From ce8bc27db860f25da55ab755b88f3af77d370c6e Mon Sep 17 00:00:00 2001 From: JianFeeeee Date: Sat, 12 Sep 2026 12:46:21 +0800 Subject: [PATCH] =?UTF-8?q?docs(architecture):=20=E8=AE=B0=E5=BF=86?= =?UTF-8?q?=E6=B5=81=E8=BD=AC=E5=9B=BE=E5=AF=B9=E9=BD=90=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E5=A4=9A=E6=A8=A1=E6=80=81=E7=A9=BA=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 流程图里 Context/Prune/DocStore 三行仍只写 StaticEmbedder 与 TF-IDF, 读起来像"向量化只有词嵌入一条路",与 1.2.0 实际(多模态统一空间为主, 带 fingerprint;词嵌入/TF-IDF 是降级层)不符。 - Context Append:补三层向量层级说明 - Context Prune:改为 DenseCosine(仅同指纹比较)→ StaticEmbedder 回退 - DocStore:改为稠密向量 + dense_fp 同指纹要求(不符即重算) - 中英双版同步 --- assets/docs/en/ARCHITECTURE.md | 6 +++--- assets/docs/zh/ARCHITECTURE.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/assets/docs/en/ARCHITECTURE.md b/assets/docs/en/ARCHITECTURE.md index 127c651..6bd40b2 100644 --- a/assets/docs/en/ARCHITECTURE.md +++ b/assets/docs/en/ARCHITECTURE.md @@ -90,8 +90,8 @@ Setting `ctx.Response` at any stage jumps to `after_output`. RelevanceContext — In-memory events[] + JSON persistence Append: Each input, CleanTemplateText → three-branch vector(textForVector) agent→Response, user→Input, cold_storage→Input+Response - StaticEmbedder pretrained word embedding / TF-IDF fallback - Prune: StaticEmbedder CosineSimilarity, keep topK + last 10 + Vector layers: unified multimodal space (primary, with fingerprint) → StaticEmbedder word embedding → TF-IDF (fallback) + Prune: DenseCosine (compared only within the same fingerprint) → StaticEmbedder CosineSimilarity fallback; keep topK + last 10 ├── Keep → timeline → chronologically sorted → system prompt └── Low score → Document layer archive (original timestamp) Save: 5s debounce write to disk @@ -99,7 +99,7 @@ Setting `ctx.Response` at any stage jumps to `after_output`. ↓ Prune archive ↑ LLM active recall ② Document (File Memory) - DocStore — JSON files + shared StaticEmbedder vector space with Context (fallback: TF-IDF InvertedIndex) + DocStore — JSON files + dense vectors (unified multimodal space; dense_fp must match the current space fingerprint or the doc is recomputed; fallback: StaticEmbedder / TF-IDF InvertedIndex) Write: Prune archive / doc_commit / Graph snapshot (syncGraphToDocs) Read: ├── Auto-inject: Query(input, top3) → similarity summary under same vector space → [Related Memory Docs] → system prompt (read-only) diff --git a/assets/docs/zh/ARCHITECTURE.md b/assets/docs/zh/ARCHITECTURE.md index aaa9459..8e9f771 100644 --- a/assets/docs/zh/ARCHITECTURE.md +++ b/assets/docs/zh/ARCHITECTURE.md @@ -90,8 +90,8 @@ eventLoop() → processTextInput() RelevanceContext — 内存 events[] + JSON持久化 Append: 每次输入, CleanText → 三分支向量(textForVector) agent事件→Response, 用户事件→Input, cold_storage→Input+Response - StaticEmbedder 预训练词嵌入 / TF-IDF 回退 - Prune: StaticEmbedder CosineSimilarity, 保留 topK + 最近10条 + 向量层级:统一多模态空间(主,带 fingerprint)→ StaticEmbedder 词嵌入 → TF-IDF(回退) + Prune: DenseCosine(仅同指纹才比较)→ 退化 StaticEmbedder CosineSimilarity;保留 topK + 最近10条 ├── 保留 → timeline → 按时间排序 → system prompt └── 低分 → Document 层归档 (原始时间戳) Save: 5s debounce 写盘 @@ -99,7 +99,7 @@ eventLoop() → processTextInput() ↓ Prune 归档 ↑ LLM 主动召回 ② Document (文件记忆) - DocStore — JSON文件 + 与 Context 共享的 StaticEmbedder 向量空间(兜底: TF-IDF InvertedIndex) + DocStore — JSON文件 + 稠密向量(统一多模态空间;dense_fp 须与当前空间同指纹,不符即重算;兜底: StaticEmbedder / TF-IDF InvertedIndex) 写入: Prune归档 / doc_commit / Graph快照(syncGraphToDocs) 读取: ├── 自动注入: Query(input, top3) → 同一向量空间下相似度摘要 → 【相关记忆文档】→ system prompt (只读)