fix(growth): MEDIUM-12 ProfileUpdater 补齐 5 维度画像更新
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
根因: ProfileUpdater 只处理 industry 和 communication_style 2/5 维度, 跳过 recent_topic、pain_point、preferred_tool。 修复: - ProfileFieldUpdate 添加 kind 字段 (SetField | AppendArray) - collect_updates() 现在处理全部 5 个维度: - industry, communication_style → SetField (直接覆盖) - recent_topic, pain_point, preferred_tool → AppendArray (追加去重) - growth.rs 根据 ProfileUpdateKind 分派到不同的 UserProfileStore 方法: - SetField → update_field() - AppendArray → add_recent_topic() / add_pain_point() / add_preferred_tool() - ProfileUpdateKind re-exported from lib.rs 测试: test_collect_updates_all_five_dimensions 验证 5 个维度 + 2 种更新类型
This commit is contained in:
@@ -325,10 +325,40 @@ impl GrowthIntegration {
|
||||
let updates = self.profile_updater.collect_updates(&combined);
|
||||
let user_id = agent_id.to_string();
|
||||
for update in updates {
|
||||
if let Err(e) = profile_store
|
||||
.update_field(&user_id, &update.field, &update.value)
|
||||
.await
|
||||
{
|
||||
let result = match update.kind {
|
||||
zclaw_growth::ProfileUpdateKind::SetField => {
|
||||
profile_store
|
||||
.update_field(&user_id, &update.field, &update.value)
|
||||
.await
|
||||
}
|
||||
zclaw_growth::ProfileUpdateKind::AppendArray => {
|
||||
match update.field.as_str() {
|
||||
"recent_topic" => {
|
||||
profile_store
|
||||
.add_recent_topic(&user_id, &update.value, 10)
|
||||
.await
|
||||
}
|
||||
"pain_point" => {
|
||||
profile_store
|
||||
.add_pain_point(&user_id, &update.value, 10)
|
||||
.await
|
||||
}
|
||||
"preferred_tool" => {
|
||||
profile_store
|
||||
.add_preferred_tool(&user_id, &update.value, 10)
|
||||
.await
|
||||
}
|
||||
_ => {
|
||||
tracing::warn!(
|
||||
"[GrowthIntegration] Unknown array field: {}",
|
||||
update.field
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
if let Err(e) = result {
|
||||
tracing::warn!(
|
||||
"[GrowthIntegration] Profile update failed for {}: {}",
|
||||
update.field,
|
||||
|
||||
Reference in New Issue
Block a user