优化: workflow记录补project_id+前端审批/交互打磨

This commit is contained in:
lxy
2026-08-12 00:40:40 +08:00
parent d31a27512c
commit 7a1e80eac2
9 changed files with 83 additions and 32 deletions
+13 -2
View File
@@ -148,7 +148,18 @@ pub async fn run_workflow_inner(
// 1. 先构建运行时 DAG,校验失败直接返回,不落库
let runtime_dag = state.registry.build_dag(&dag).map_err(err_str)?;
// 2. 写入执行记录(status=running
// 2. P2-I: 反查 project_idtask_id 有值时),不阻塞工作流
let project_id = match &task_id {
Some(tid) => TaskRepo::new(&state.db)
.get_by_id(tid)
.await
.ok()
.flatten()
.map(|t| t.project_id),
None => None,
};
// 3. 写入执行记录(status=running
let execution_id: ExecutionId = new_id().into();
let dag_json = serde_json::to_string(&dag).map_err(err_str)?;
let record = WorkflowRecord {
@@ -159,7 +170,7 @@ pub async fn run_workflow_inner(
// CR-52: triggered_by 由调用方透传(命令层 run_workflow="manual",
// execute_run_workflow_for_tool="ai"),不再硬编码 "manual" 致 AI 路径误标。
triggered_by: Some(triggered_by.to_string()),
project_id: None,
project_id,
task_id: task_id.clone(),
created_at: now_millis(),
completed_at: None,