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
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:
@@ -79,6 +79,7 @@ pub async fn post_conversation_hook(
|
||||
}
|
||||
|
||||
// Step 1.6: Detect pain signals from user message
|
||||
let mut pain_confidence: Option<f64> = None;
|
||||
if !_user_message.is_empty() {
|
||||
let messages = vec![zclaw_types::Message::user(_user_message)];
|
||||
if let Some(analysis) = crate::intelligence::pain_aggregator::analyze_for_pain_signals(&messages) {
|
||||
@@ -101,6 +102,7 @@ pub async fn post_conversation_hook(
|
||||
"[intelligence_hooks] Pain point recorded: {} (confidence: {:.2}, count: {})",
|
||||
pain.summary, pain.confidence, pain.occurrence_count
|
||||
);
|
||||
pain_confidence = Some(pain.confidence);
|
||||
}
|
||||
Err(e) => {
|
||||
warn!("[intelligence_hooks] Failed to record pain point: {}", e);
|
||||
@@ -109,6 +111,28 @@ pub async fn post_conversation_hook(
|
||||
}
|
||||
}
|
||||
|
||||
// Step 1.7: Evaluate learning triggers (rule-based, zero LLM cost)
|
||||
if !_user_message.is_empty() {
|
||||
let trigger_ctx = crate::intelligence::triggers::TriggerContext {
|
||||
user_message: _user_message.to_string(),
|
||||
tool_call_count: 0, // Will be populated from trajectory recorder in future
|
||||
conversation_messages: vec![_user_message.to_string()],
|
||||
pain_confidence,
|
||||
industry_keywords: vec![], // Will be populated from industry config in Phase 3
|
||||
};
|
||||
let signals = crate::intelligence::triggers::evaluate_triggers(&trigger_ctx);
|
||||
if !signals.is_empty() {
|
||||
let signal_names: Vec<&str> = signals.iter()
|
||||
.map(crate::intelligence::triggers::signal_description)
|
||||
.collect();
|
||||
debug!(
|
||||
"[intelligence_hooks] Learning triggers activated: {:?}",
|
||||
signal_names
|
||||
);
|
||||
// Future: Pass signals to LLM experience extraction (Phase 5)
|
||||
}
|
||||
}
|
||||
|
||||
// Step 2: Record conversation for reflection
|
||||
let mut engine = reflection_state.lock().await;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user