蒸馏嵌入接线:Distiller/Agent 注入共享 embedder,修复配置缺失时蒸馏零产出

This commit is contained in:
root
2026-08-05 09:59:33 +08:00
parent c6ebbfca34
commit 19410b0e26
7 changed files with 42 additions and 14 deletions

View File

@ -10,6 +10,7 @@ import (
"os/exec"
"os/signal"
"path/filepath"
"strings"
"syscall"
"time"
@ -138,6 +139,11 @@ func main() {
cfgReg.SeedDefaults(*dataDir)
cfg := cfgReg.ToConfig()
// 共享词嵌入蒸馏提取Phase 3 TransE 验证)与 Agent 上下文复用同一实例,
// 避免同一模型被二次加载(约 200k×300 维 ≈ 数百 MB 内存)。
embedder := memory.NewStaticEmbedder(strings.Split(cfgReg.GetString("core.agent.embedding_model_path", ""), ",")...)
distiller.SetEmbedder(embedder)
// ========================================================================
// Lua VMLLM 协议适配)
// ========================================================================
@ -398,6 +404,7 @@ func main() {
MergeInterval: cfgReg.GetDuration("core.agent.merge_interval", 120*time.Minute),
ContextSavePath: filepath.Join(cfg.Daemon.DataDir, "memory", "context.json"),
EmbeddingModelPath: cfgReg.GetString("core.agent.embedding_model_path", ""),
Embedder: embedder,
StageHost: stageHost,
EventBus: evBus,
ThinkingEnabled: cfg.LLM.ThinkingEnabled,