fix(provenance): 落库 embedding_model/script_version 血缘字段 (t_7e3577c5)
根因: commit→distill→memory 管线从不在服务端持久化请求 metadata 里的 embedding_model/script_version, MemoryRecord 结构缺这两字段, 导致 zhiyi-vault-ingest.py 已发送的血缘被丢弃, 新写入恒 NULL。 修复: - Go MemoryRecord + DistillInput 加两字段; core.go commit handler 解析 metadata→AutoDistillTrigger 透传; server.go 落库时 orDefault(embedding_model→bge-m3, script_version→unknown); lancedb_ipc.go 记录 map 带上两字段。 - Rust MemoryRecord + arrow_schema() + insert_batch + 4 处 col_str 读取。 验证: commit 带 metadata → 蒸馏落地 19 行 bge-m3/vault-ingest-2.0.0 (原为 NULL)。
This commit is contained in:
@@ -28,6 +28,8 @@ pub struct MemoryRecord {
|
||||
pub recall_count: i64, pub useful_count: i64, pub not_useful_count: i64,
|
||||
pub freshness: String, pub version: i64,
|
||||
pub version_history: String, pub source: String,
|
||||
// 2026-10-08 (t_7e3577c5):血缘字段
|
||||
pub embedding_model: String, pub script_version: String,
|
||||
pub volatile_flag: bool, pub is_deleted: bool,
|
||||
pub depends_on: String, pub derived_from: String,
|
||||
pub last_recalled_at: String, pub created_at: String, pub updated_at: String,
|
||||
@@ -56,6 +58,8 @@ fn arrow_schema() -> Schema {
|
||||
Field::new("version", DataType::Int64, false),
|
||||
Field::new("version_history", DataType::Utf8, true),
|
||||
Field::new("source", DataType::Utf8, true),
|
||||
Field::new("embedding_model", DataType::Utf8, true),
|
||||
Field::new("script_version", DataType::Utf8, true),
|
||||
Field::new("volatile_flag", DataType::Boolean, false),
|
||||
Field::new("is_deleted", DataType::Boolean, false),
|
||||
Field::new("depends_on", DataType::Utf8, true),
|
||||
@@ -117,6 +121,8 @@ impl LanceDBOps {
|
||||
version: col_i64(&batch, i, "version"),
|
||||
version_history: String::new(),
|
||||
source: col_str(&batch, i, "source"),
|
||||
embedding_model: col_str(&batch, i, "embedding_model"),
|
||||
script_version: col_str(&batch, i, "script_version"),
|
||||
volatile_flag: col_bool(&batch, i, "volatile_flag"),
|
||||
is_deleted: col_bool(&batch, i, "is_deleted"),
|
||||
depends_on: String::new(),
|
||||
@@ -164,6 +170,8 @@ impl LanceDBOps {
|
||||
version: col_i64(&batch, i, "version"),
|
||||
version_history: String::new(),
|
||||
source: col_str(&batch, i, "source"),
|
||||
embedding_model: col_str(&batch, i, "embedding_model"),
|
||||
script_version: col_str(&batch, i, "script_version"),
|
||||
volatile_flag: col_bool(&batch, i, "volatile_flag"),
|
||||
is_deleted: col_bool(&batch, i, "is_deleted"),
|
||||
depends_on: String::new(),
|
||||
@@ -193,6 +201,7 @@ impl LanceDBOps {
|
||||
let mut recall_counts = Vec::new(); let mut useful_counts = Vec::new(); let mut not_useful_counts = Vec::new();
|
||||
let mut freshnesses = Vec::new(); let mut versions = Vec::new();
|
||||
let mut version_histories = Vec::new(); let mut sources = Vec::new();
|
||||
let mut embedding_models = Vec::new(); let mut script_versions = Vec::new();
|
||||
let mut volatile_flags = Vec::new(); let mut is_deleteds = Vec::new();
|
||||
let mut depends_ons = Vec::new(); let mut derived_froms = Vec::new();
|
||||
let mut last_recalled_ats = Vec::new(); let mut created_ats = Vec::new(); let mut updated_ats = Vec::new();
|
||||
@@ -217,6 +226,8 @@ impl LanceDBOps {
|
||||
versions.push(r["version"].as_i64().unwrap_or(1));
|
||||
version_histories.push(r["version_history"].as_str().unwrap_or("[]"));
|
||||
sources.push(r["source"].as_str().unwrap_or(""));
|
||||
embedding_models.push(r["embedding_model"].as_str().unwrap_or(""));
|
||||
script_versions.push(r["script_version"].as_str().unwrap_or(""));
|
||||
volatile_flags.push(r["volatile_flag"].as_bool().unwrap_or(false));
|
||||
is_deleteds.push(r["is_deleted"].as_bool().unwrap_or(false));
|
||||
depends_ons.push(r["depends_on"].as_str().unwrap_or("[]"));
|
||||
@@ -253,6 +264,8 @@ impl LanceDBOps {
|
||||
Arc::new(Int64Array::from(versions)),
|
||||
Arc::new(StringArray::from(version_histories)),
|
||||
Arc::new(StringArray::from(sources)),
|
||||
Arc::new(StringArray::from(embedding_models)),
|
||||
Arc::new(StringArray::from(script_versions)),
|
||||
Arc::new(BooleanArray::from(volatile_flags)),
|
||||
Arc::new(BooleanArray::from(is_deleteds)),
|
||||
Arc::new(StringArray::from(depends_ons)),
|
||||
@@ -566,6 +579,8 @@ impl LanceDBOps {
|
||||
version: col_i64(&batch, i, "version"),
|
||||
version_history: String::new(),
|
||||
source: col_str(&batch, i, "source"),
|
||||
embedding_model: col_str(&batch, i, "embedding_model"),
|
||||
script_version: col_str(&batch, i, "script_version"),
|
||||
volatile_flag: col_bool(&batch, i, "volatile_flag"),
|
||||
is_deleted: col_bool(&batch, i, "is_deleted"),
|
||||
depends_on: String::new(),
|
||||
@@ -623,6 +638,8 @@ impl LanceDBOps {
|
||||
version: col_i64(&batch, i, "version"),
|
||||
version_history: String::new(),
|
||||
source: col_str(&batch, i, "source"),
|
||||
embedding_model: col_str(&batch, i, "embedding_model"),
|
||||
script_version: col_str(&batch, i, "script_version"),
|
||||
volatile_flag: col_bool(&batch, i, "volatile_flag"),
|
||||
is_deleted: col_bool(&batch, i, "is_deleted"),
|
||||
depends_on: String::new(),
|
||||
|
||||
Reference in New Issue
Block a user