diff --git a/docs/01-技术文档/SQLite-CRUD模式.md b/docs/01-技术文档/SQLite-CRUD模式-2026-06-12.md similarity index 100% rename from docs/01-技术文档/SQLite-CRUD模式.md rename to docs/01-技术文档/SQLite-CRUD模式-2026-06-12.md diff --git a/docs/01-技术文档/Tauri-IPC模式.md b/docs/01-技术文档/Tauri-IPC模式-2026-06-12.md similarity index 100% rename from docs/01-技术文档/Tauri-IPC模式.md rename to docs/01-技术文档/Tauri-IPC模式-2026-06-12.md diff --git a/docs/02-架构设计/B-03-人工审批响应机制.md b/docs/02-架构设计/B-03-人工审批响应机制-2026-06-14.md similarity index 100% rename from docs/02-架构设计/B-03-人工审批响应机制.md rename to docs/02-架构设计/B-03-人工审批响应机制-2026-06-14.md diff --git a/docs/02-架构设计/Phase1架构决策.md b/docs/02-架构设计/Phase1架构决策-2026-06-12.md similarity index 100% rename from docs/02-架构设计/Phase1架构决策.md rename to docs/02-架构设计/Phase1架构决策-2026-06-12.md diff --git a/docs/02-架构设计/aichat-info-density-concept.md b/docs/02-架构设计/aichat信息密度构想-2026-06-14.md similarity index 100% rename from docs/02-架构设计/aichat-info-density-concept.md rename to docs/02-架构设计/aichat信息密度构想-2026-06-14.md diff --git a/docs/02-架构设计/aichat-review-2026-06-14.md b/docs/02-架构设计/aichat审查报告-2026-06-14.md similarity index 100% rename from docs/02-架构设计/aichat-review-2026-06-14.md rename to docs/02-架构设计/aichat审查报告-2026-06-14.md diff --git a/docs/02-架构设计/aichat-async-approval-concept.md b/docs/02-架构设计/aichat异步审批构想-2026-06-14.md similarity index 100% rename from docs/02-架构设计/aichat-async-approval-concept.md rename to docs/02-架构设计/aichat异步审批构想-2026-06-14.md diff --git a/docs/02-架构设计/业务系统设计.md b/docs/02-架构设计/业务系统设计-2026-06-12.md similarity index 100% rename from docs/02-架构设计/业务系统设计.md rename to docs/02-架构设计/业务系统设计-2026-06-12.md diff --git a/docs/02-架构设计/产品定位调整.md b/docs/02-架构设计/产品定位调整-2026-06-12.md similarity index 100% rename from docs/02-架构设计/产品定位调整.md rename to docs/02-架构设计/产品定位调整-2026-06-12.md diff --git a/docs/02-架构设计/前后端类型对齐.md b/docs/02-架构设计/前后端类型对齐-2026-06-12.md similarity index 100% rename from docs/02-架构设计/前后端类型对齐.md rename to docs/02-架构设计/前后端类型对齐-2026-06-12.md diff --git a/docs/02-架构设计/功能决策记录.md b/docs/02-架构设计/功能决策记录-2026-06-14.md similarity index 100% rename from docs/02-架构设计/功能决策记录.md rename to docs/02-架构设计/功能决策记录-2026-06-14.md diff --git a/docs/02-架构设计/功能决策记录-归档.md b/docs/02-架构设计/功能决策记录-归档-2026-06-14.md similarity index 100% rename from docs/02-架构设计/功能决策记录-归档.md rename to docs/02-架构设计/功能决策记录-归档-2026-06-14.md diff --git a/docs/02-架构设计/对抗论证裁决报告.md b/docs/02-架构设计/对抗论证裁决报告-2026-06-12.md similarity index 100% rename from docs/02-架构设计/对抗论证裁决报告.md rename to docs/02-架构设计/对抗论证裁决报告-2026-06-12.md diff --git a/docs/02-架构设计/文档记录规范.md b/docs/02-架构设计/文档记录规范-2026-06-14.md similarity index 100% rename from docs/02-架构设计/文档记录规范.md rename to docs/02-架构设计/文档记录规范-2026-06-14.md diff --git a/docs/02-架构设计/经验记录.md b/docs/02-架构设计/经验记录-2026-06-14.md similarity index 100% rename from docs/02-架构设计/经验记录.md rename to docs/02-架构设计/经验记录-2026-06-14.md diff --git a/docs/02-架构设计/规格契约自检机制.md b/docs/02-架构设计/规格契约自检机制-2026-06-14.md similarity index 100% rename from docs/02-架构设计/规格契约自检机制.md rename to docs/02-架构设计/规格契约自检机制-2026-06-14.md diff --git a/docs/03-模块文档/df-ai-AI集成模块.md b/docs/03-模块文档/df-ai-AI集成模块-2026-06-12.md similarity index 100% rename from docs/03-模块文档/df-ai-AI集成模块.md rename to docs/03-模块文档/df-ai-AI集成模块-2026-06-12.md diff --git a/docs/03-模块文档/df-knowledge-知识库.md b/docs/03-模块文档/df-knowledge-知识库-2026-06-14.md similarity index 100% rename from docs/03-模块文档/df-knowledge-知识库.md rename to docs/03-模块文档/df-knowledge-知识库-2026-06-14.md diff --git a/docs/03-模块文档/df-nodes-节点集合.md b/docs/03-模块文档/df-nodes-节点集合-2026-06-12.md similarity index 100% rename from docs/03-模块文档/df-nodes-节点集合.md rename to docs/03-模块文档/df-nodes-节点集合-2026-06-12.md diff --git a/docs/03-模块文档/df-storage-存储层.md b/docs/03-模块文档/df-storage-存储层-2026-06-12.md similarity index 100% rename from docs/03-模块文档/df-storage-存储层.md rename to docs/03-模块文档/df-storage-存储层-2026-06-12.md diff --git a/docs/03-模块文档/df-workflow-工作流引擎.md b/docs/03-模块文档/df-workflow-工作流引擎-2026-06-12.md similarity index 100% rename from docs/03-模块文档/df-workflow-工作流引擎.md rename to docs/03-模块文档/df-workflow-工作流引擎-2026-06-12.md diff --git a/docs/03-模块文档/想法探索-对抗式评估.md b/docs/03-模块文档/想法探索-对抗式评估-2026-06-12.md similarity index 100% rename from docs/03-模块文档/想法探索-对抗式评估.md rename to docs/03-模块文档/想法探索-对抗式评估-2026-06-12.md diff --git a/docs/04-功能迭代/DEVFLOW-1.CRUD层实施.md b/docs/04-功能迭代/DEVFLOW-1.CRUD层实施-2026-06-12.md similarity index 100% rename from docs/04-功能迭代/DEVFLOW-1.CRUD层实施.md rename to docs/04-功能迭代/DEVFLOW-1.CRUD层实施-2026-06-12.md diff --git a/docs/04-功能迭代/DEVFLOW-2.IPC桥接实施.md b/docs/04-功能迭代/DEVFLOW-2.IPC桥接实施-2026-06-12.md similarity index 100% rename from docs/04-功能迭代/DEVFLOW-2.IPC桥接实施.md rename to docs/04-功能迭代/DEVFLOW-2.IPC桥接实施-2026-06-12.md diff --git a/docs/04-功能迭代/DEVFLOW-3.Store对接实施.md b/docs/04-功能迭代/DEVFLOW-3.Store对接实施-2026-06-12.md similarity index 100% rename from docs/04-功能迭代/DEVFLOW-3.Store对接实施.md rename to docs/04-功能迭代/DEVFLOW-3.Store对接实施-2026-06-12.md diff --git a/docs/04-功能迭代/DEVFLOW-4.端到端验证.md b/docs/04-功能迭代/DEVFLOW-4.端到端验证-2026-06-12.md similarity index 100% rename from docs/04-功能迭代/DEVFLOW-4.端到端验证.md rename to docs/04-功能迭代/DEVFLOW-4.端到端验证-2026-06-12.md diff --git a/docs/06-前端开发/View改造指南.md b/docs/06-前端开发/View改造指南-2026-06-12.md similarity index 100% rename from docs/06-前端开发/View改造指南.md rename to docs/06-前端开发/View改造指南-2026-06-12.md diff --git a/docs/07-项目管理/Phase1任务清单.md b/docs/07-项目管理/Phase1任务清单-2026-06-12.md similarity index 100% rename from docs/07-项目管理/Phase1任务清单.md rename to docs/07-项目管理/Phase1任务清单-2026-06-12.md diff --git a/docs/07-项目管理/Phase2计划.md b/docs/07-项目管理/Phase2计划-2026-06-12.md similarity index 100% rename from docs/07-项目管理/Phase2计划.md rename to docs/07-项目管理/Phase2计划-2026-06-12.md diff --git a/docs/08-用户指南/使用手册.md b/docs/08-用户指南/使用手册-2026-06-12.md similarity index 100% rename from docs/08-用户指南/使用手册.md rename to docs/08-用户指南/使用手册-2026-06-12.md diff --git a/src-tauri/src/commands/ai/audit.rs b/src-tauri/src/commands/ai/audit.rs index 138ea7d..21d773c 100644 --- a/src-tauri/src/commands/ai/audit.rs +++ b/src-tauri/src/commands/ai/audit.rs @@ -7,7 +7,7 @@ use tauri::{AppHandle, Emitter}; use df_ai::ai_tools::{AiToolRegistry, RiskLevel}; use df_ai::provider::ChatMessage; -use df_storage::crud::AiToolExecutionRepo; +use df_storage::crud::{AiToolExecutionRepo, ProjectRepo}; use df_storage::db::Database; use df_storage::models::AiToolExecutionRecord; @@ -38,45 +38,79 @@ pub(crate) fn risk_from_str(s: &str) -> Option { } } +/// 查项目可读标签:id → "「项目名」(id=x)",查不到回退 "(id=x)",空 id 返回空串。 +/// +/// AR-3:审批卡片需显示对象名而非裸 id(用户反馈"只返回 ID 不知道是什么数据")。 +async fn resolve_project_label(db: &Arc, id: &str) -> String { + if id.is_empty() { + return String::new(); + } + let repo = ProjectRepo::new(db); + match repo.get_by_id(id).await { + Ok(Some(p)) => format!("「{}」(id={})", p.name, id), + _ => format!("(id={})", id), + } +} + /// 拼审批 reason:按工具名 + args 取可读字段,让用户知道"审批要做什么"。 /// /// 主要审批工具特化(带对象名/标识): -/// - delete_project/restore_project/purge_project → "删除/恢复/清除项目"+id -/// - update_project → "修改项目"+field -/// - bind_directory → "绑定目录"+path -/// - create_task → "创建任务"+title;create_project → "创建项目"+name;create_idea → "捕获灵感"+title -/// - run_workflow → "运行工作流"+name +/// - delete_project/restore_project/purge_project → 查项目名拼"删除项目「名」(id=x)" +/// - update_project → 查项目名 + field +/// - bind_directory → path + 查项目名 +/// - create_task → title + 查 project_id 项目名;create_project → name;create_idea → title +/// - run_workflow → name /// args 无可读字段或工具未特化时,fallback 原 risk 模板(含风险等级提示)。 -fn build_approval_reason(tool_name: &str, args: &serde_json::Value, risk_level: RiskLevel) -> String { +async fn build_approval_reason( + tool_name: &str, + args: &serde_json::Value, + risk_level: RiskLevel, + db: &Arc, +) -> String { let s = |key: &str| args.get(key).and_then(|v| v.as_str()).unwrap_or(""); let detail = match tool_name { "delete_project" => { let id = s("id"); - if !id.is_empty() { format!("删除项目(ID: {})", id) } else { String::new() } + if !id.is_empty() { format!("删除项目{}", resolve_project_label(db, id).await) } else { String::new() } } "restore_project" => { let id = s("id"); - if !id.is_empty() { format!("从回收站恢复项目(ID: {})", id) } else { String::new() } + if !id.is_empty() { format!("从回收站恢复项目{}", resolve_project_label(db, id).await) } else { String::new() } } "purge_project" => { let id = s("id"); - if !id.is_empty() { format!("永久删除项目及关联数据,不可恢复(ID: {})", id) } else { String::new() } + if !id.is_empty() { format!("永久删除项目及关联数据,不可恢复{}", resolve_project_label(db, id).await) } else { String::new() } } "update_project" => { + let id = s("id"); let field = s("field"); - if !field.is_empty() { format!("修改项目字段「{}」", field) } else { String::new() } + if !id.is_empty() { + format!("修改项目{}字段「{}」", resolve_project_label(db, id).await, field) + } else if !field.is_empty() { + format!("修改项目字段「{}」", field) + } else { String::new() } } "bind_directory" => { + let id = s("id"); let path = s("path"); - if !path.is_empty() { format!("绑定目录:{}", path) } else { String::new() } + if !path.is_empty() && !id.is_empty() { + format!("绑定目录:{}(项目{})", path, resolve_project_label(db, id).await) + } else if !path.is_empty() { + format!("绑定目录:{}", path) + } else { String::new() } } "create_task" => { let title = s("title"); - if !title.is_empty() { format!("创建任务:{}", title) } else { String::new() } + let pid = s("project_id"); + if !title.is_empty() && !pid.is_empty() { + format!("创建任务:{}(项目{})", title, resolve_project_label(db, pid).await) + } else if !title.is_empty() { + format!("创建任务:{}", title) + } else { String::new() } } "create_project" => { let name = s("name"); - if !name.is_empty() { format!("创建项目:{}", name) } else { String::new() } + if !name.is_empty() { format!("创建项目:「{}」", name) } else { String::new() } } "create_idea" => { let title = s("title"); @@ -241,7 +275,7 @@ pub(crate) async fn process_tool_calls( recovered: false, }); session.messages.push(ChatMessage::tool_result(&draft.id, "需要用户审批,等待确认")); - let reason = build_approval_reason(&draft.name, &args, risk_level); + let reason = build_approval_reason(&draft.name, &args, risk_level, db).await; let _ = app_handle.emit("ai-chat-event", AiChatEvent::AiApprovalRequired { id: draft.id.clone(), name: draft.name.clone(),