agent-Specialization/static/src/app/methods/taskPolling/workflow.ts
JOJO 4d9b709a9e feat(workflow): 实现工作流运行时并统一审核智能体配置
工作流运行时:
- 状态机与编排:modules/workflow_state_manager.py + server/workflow_flow.py
  (激活快照/阶段推进/审核节点/分支决策/柔性通知/max_stage_rounds 撞限询问)
- 五个工具(activate/report_stage/choose_branch/get_status/deactivate)
  与 REST API(server/workflow_runtime_api.py)
- 前端:QuickDock 工作流窗口(三段式进度,推进/驳回/完成/退出动画)、
  slash 菜单激活与退出、轮询事件消费、进入对话状态回填
- 审核:modules/workflow_review_agent.py(pass/reject 把关节点)

审核智能体统一配置:
- 个人空间新增「审核智能体」标签页:自动审批/目标/工作流三个审核智能体
  统一选择模型+思考模式+超时/轮次参数
- modules/review_agent_config.py 统一解析(复用子智能体模型库),
  废除独立 json 配置(auto_approval/goal_review/workflow_review)
- goal 审核接入 max_rounds 上限(原常量未接线);workflow 审核硬编码 6 轮改为可配

联调修复:
- /new 空对话激活:后端自动创建对话并完整继承模式参数
  (work_mode/permission/execution/reasoning_effort,修复思考模式丢失)
- 激活/通知消息 starts_work=True,恢复智能体回复头部与工作计时
- 节点目录改为从开始节点拓扑遍历(修复按保存顺序显示错乱)
- QuickDock 乐观掩码不再掩盖工作流实时状态(修复 /new 激活窗口瞬关+延迟瞬开);
  /new 路由不套用全局内容缓存(修复空对话展开空白数秒后收回)
- 工作流完成先广播完成态快照再摘牌,窗口播完落定+退出动画再收起
- 激活提示中的工具名修正为 report_workflow_stage
2026-08-21 16:50:35 +08:00

45 lines
1.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// @ts-nocheck
import { useWorkflowStore } from '../../../stores/workflow';
/**
* 工作流运行时事件处理(任务轮询链路)。
*
* - workflow_progress进度快照推进/审核结果/激活/退出都会广播live=true 播窗口动画
* - workflow_review_progress审核智能体实时进度复用右侧自动审批面板对齐 goal_review_progress
*/
export const workflowMethods = {
handleWorkflowProgress(data: any) {
// 对话隔离:忽略不属于当前对话的工作流事件
if (data?.conversation_id && this.currentConversationId && data.conversation_id !== this.currentConversationId) {
return;
}
useWorkflowStore().setWorkflow(data, true);
},
handleWorkflowReviewProgress(data: any) {
if (data?.conversation_id && this.currentConversationId && data.conversation_id !== this.currentConversationId) {
return;
}
const progress = data?.progress || data || {};
if (!progress || typeof progress !== 'object') {
return;
}
if (!Array.isArray(this.autoApprovalFeedLines)) {
this.autoApprovalFeedLines = [];
}
this.autoApprovalTitle = '工作流审核';
if (progress.stage === 'start') {
this.autoApprovalFeedLines = ['开始审核'];
this.autoApprovalFinalMessage = '';
} else if (progress.stage === 'model_call') {
this.autoApprovalFeedLines.push(String(progress.message || `审核轮次 ${progress.round || ''}`).trim());
} else if (progress.stage === 'run_command' && progress.command) {
this.autoApprovalFeedLines.push(String(progress.command));
} else if (progress.message) {
this.autoApprovalFeedLines.push(String(progress.message));
}
this.autoApprovalFeedLines = this.autoApprovalFeedLines.slice(-20);
this.$forceUpdate();
}
};