fix(growth): MEDIUM-10 Experience 添加 tool_used 字段
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
根因: Experience 结构体没有 tool_used 字段,PatternAggregator 从 context 字段提取工具名(语义混淆),导致工具信息不准确。 修复: - experience_store.rs: Experience 添加 tool_used: Option<String> 字段 (#[serde(default)] 兼容旧数据),Experience::new() 初始化为 None - experience_extractor.rs: persist_experiences() 从 ExperienceCandidate 的 tools_used[0] 填充 tool_used,同时填充 industry_context - pattern_aggregator.rs: 改用 tool_used 字段提取工具名,不再误用 context - store_experience() 将 tool_used 加入 keywords 提升搜索命中率
This commit is contained in:
@@ -45,13 +45,16 @@ impl ExperienceExtractor {
|
||||
Outcome::Partial => "partial",
|
||||
Outcome::Failed => "failed",
|
||||
};
|
||||
let exp = crate::experience_store::Experience::new(
|
||||
let mut exp = crate::experience_store::Experience::new(
|
||||
agent_id,
|
||||
&candidate.pain_pattern,
|
||||
&candidate.context,
|
||||
candidate.solution_steps.clone(),
|
||||
outcome_str,
|
||||
);
|
||||
// 填充 tool_used:取 tools_used 中的第一个作为主要工具
|
||||
exp.tool_used = candidate.tools_used.first().cloned();
|
||||
exp.industry_context = candidate.industry_context.clone();
|
||||
store.store_experience(&exp).await?;
|
||||
count += 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user