优化: AI Chat全栈多批审查修复与架构清理(risk_level清理/路由解耦/工具渲染/测试补测/死代码)

This commit is contained in:
2026-06-18 22:57:19 +08:00
parent 0ca5d9805f
commit a2871a66e0
87 changed files with 5720 additions and 3012 deletions

View File

@@ -107,8 +107,8 @@ pub async fn promote_idea(
.map_err(err_str)?
.ok_or_else(|| format!("灵感不存在: {id}"))?;
if record.promoted_to.is_some() {
return Err(format!("灵感已立项: {}", record.promoted_to.unwrap()));
if let Some(promoted_to) = &record.promoted_to {
return Err(format!("灵感已立项: {}", promoted_to));
}
// 复用 df-project 领域逻辑构造项目实体create_from_idea
@@ -289,11 +289,16 @@ async fn build_default_provider(
/// IdeaRecord → df_ideas::Idea评估用status/time 不影响评分)
fn record_to_idea(record: &IdeaRecord) -> Idea {
let tags: Vec<String> = record
.tags
.as_deref()
.and_then(|t| serde_json::from_str(t).ok())
.unwrap_or_default();
let tags: Vec<String> = match record.tags.as_deref() {
Some(t) => match serde_json::from_str::<Vec<String>>(t) {
Ok(v) => v,
Err(e) => {
tracing::warn!(error = %e, idea_id = %record.id, "[ideas] tags JSON 解析失败,降级空 tags 继续评估");
Vec::new()
}
},
None => Vec::new(),
};
Idea {
id: record.id.clone(),
title: record.title.clone(),