新增: 知识库图召回激活扩散与治理续批

- 阶段2 图召回: list_neighbors_for_seeds(多种子 1-hop 展开,排除种子与 archived)+knowledge_search 结果附 related 段(权重降序限 5)
- 蒸馏合并: knowledge_distill.rs(archived 按 kind 分组 LLM 合订本+merges 边连组)
- V54 knowledge_edges 边表与渐进披露批配套迁移/模型字段
- 提炼链 related_ids 协议+检索补 id 字段
This commit is contained in:
lxy
2026-10-26 01:36:19 +08:00
parent a30f599fe2
commit 0dd95e0e6e
15 changed files with 953 additions and 135 deletions
+25
View File
@@ -559,6 +559,31 @@ pub struct KnowledgeEventRecord {
pub timestamp: String,
}
/// 知识关联边(知识中枢阶段1:节点连边,V54)
///
/// 有向 src→dst,查询侧双向读(关联语义无方向)。kind/origin 枚举见 migrations V54 注释;
/// 首两版只产 similar(提炼 related_ids)与 manual(人工),embed-sim/co-cite 归阶段 3 自动建边。
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct KnowledgeEdgeRecord {
pub id: String,
pub src_id: String,
pub dst_id: String,
pub kind: String,
pub weight: f64,
pub origin: String,
pub created_at: String,
pub last_verified_at: String,
}
/// 关联知识条目(边 + 对端知识展开,详情页「关联知识」区块直接消费)
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RelatedKnowledge {
pub edge: KnowledgeEdgeRecord,
pub knowledge: KnowledgeRecord,
/// 对端相对当前条目的方向:out=当前是 src(边指向对方),in=当前是 dst(对方指进来)
pub direction: String,
}
/// 工程记录(project_modules 表,项目多工程,每个工程独立代码仓库)
///
/// 一个项目可含多个工程(Monorepo 多仓库 / 微服务 / 前后端分离)。