feat(intelligence): Phase 2 学习循环基础 — 触发信号 + 经验行业维度
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

- 新增 triggers.rs: 5 种触发信号(痛点确认/正反馈/复杂工具链/用户纠正/行业模式)
- ExperienceStore 增加 industry_context + source_trigger 字段
- experience.rs format_for_injection 支持行业标签
- intelligence_hooks.rs 集成触发信号评估
- 17 个测试全通过 (7 trigger + 10 experience)
This commit is contained in:
iven
2026-04-12 15:52:29 +08:00
parent 5d1050bf6f
commit 29fbfbec59
5 changed files with 271 additions and 1 deletions

View File

@@ -42,6 +42,12 @@ pub struct Experience {
pub created_at: DateTime<Utc>,
/// Timestamp of most recent reuse or update.
pub updated_at: DateTime<Utc>,
/// Associated industry ID (e.g. "ecommerce", "healthcare").
#[serde(default)]
pub industry_context: Option<String>,
/// Which trigger signal produced this experience.
#[serde(default)]
pub source_trigger: Option<String>,
}
impl Experience {
@@ -64,6 +70,8 @@ impl Experience {
reuse_count: 0,
created_at: now,
updated_at: now,
industry_context: None,
source_trigger: None,
}
}
@@ -108,6 +116,9 @@ impl ExperienceStore {
let content = serde_json::to_string(exp)?;
let mut keywords = vec![exp.pain_pattern.clone()];
keywords.extend(exp.solution_steps.iter().take(3).cloned());
if let Some(ref industry) = exp.industry_context {
keywords.push(industry.clone());
}
let entry = MemoryEntry {
uri,