From 3fb9c34f07b82a7ec550a1b419eb8afa1b77af04 Mon Sep 17 00:00:00 2001 From: cfdaily Date: Thu, 21 May 2026 20:07:15 +0800 Subject: [PATCH] auto-sync: 2026-05-21 20:07:15 --- src/frontend/src/components/TaskModal.tsx | 89 ++++++++++------------- 1 file changed, 40 insertions(+), 49 deletions(-) diff --git a/src/frontend/src/components/TaskModal.tsx b/src/frontend/src/components/TaskModal.tsx index 414e261..cb8063f 100644 --- a/src/frontend/src/components/TaskModal.tsx +++ b/src/frontend/src/components/TaskModal.tsx @@ -102,66 +102,57 @@ function StatusButtons({ status, taskId, onAction }: { status: string; taskId: s const [showAdvanced, setShowAdvanced] = useState(false); // AI Native:只显示人需要做的动作 - const PRIMARY_ACTIONS: Record> = { - pending: [{ target: 'cancelled', label: '取消任务', icon: '🚫', bg: '#6b728022', color: '#6b7280', border: '#6b728044' }], - working: [{ target: 'paused', label: '暂停任务', icon: '⏸', bg: '#818cf822', color: '#818cf8', border: '#818cf844' }], - waiting_human: [ - { target: 'done', label: '确认完成', icon: '✅', bg: '#2ecc8a22', color: '#2ecc8a', border: '#2ecc8a44' }, - { target: 'working', label: '拒绝,继续做', icon: '🔄', bg: '#7a9aff22', color: '#7a9aff', border: '#7a9aff44' }, + // v3.1: 取消 ADVANCED 折叠区,所有操作直接展示 + // 设计原则:暂停和取消是用户通用权利 + const ACTION_BUTTONS: Record> = { + pending: [ + { target: 'paused', label: '暂停', icon: '⏸', bg: '#818cf822', color: '#818cf8', border: '#818cf844' }, + { target: 'cancelled', label: '取消', icon: '🚫', bg: '#6b728022', color: '#6b7280', border: '#6b728044' }, + ], + claimed: [ + { target: 'paused', label: '暂停', icon: '⏸', bg: '#818cf822', color: '#818cf8', border: '#818cf844' }, + { target: 'cancelled', label: '取消', icon: '🚫', bg: '#6b728022', color: '#6b7280', border: '#6b728044' }, + ], + working: [ + { target: 'paused', label: '暂停', icon: '⏸', bg: '#818cf822', color: '#818cf8', border: '#818cf844' }, + { target: 'cancelled', label: '取消', icon: '🚫', bg: '#6b728022', color: '#6b7280', border: '#6b728044' }, + ], + paused: [ + { target: 'pending', label: '恢复', icon: '▶', bg: '#2ecc8a22', color: '#2ecc8a', border: '#2ecc8a44' }, + { target: 'cancelled', label: '取消', icon: '🚫', bg: '#6b728022', color: '#6b7280', border: '#6b728044' }, + ], + review: [ + { target: 'paused', label: '暂停', icon: '⏸', bg: '#818cf822', color: '#818cf8', border: '#818cf844' }, + { target: 'cancelled', label: '取消', icon: '🚫', bg: '#6b728022', color: '#6b7280', border: '#6b728044' }, + ], + failed: [ + { target: 'pending', label: '重试', icon: '🔄', bg: '#7a9aff22', color: '#7a9aff', border: '#7a9aff44' }, + { target: 'cancelled', label: '取消', icon: '🚫', bg: '#6b728022', color: '#6b7280', border: '#6b728044' }, + ], + blocked: [ + { target: 'pending', label: '解除阻塞', icon: '🔓', bg: '#2ecc8a22', color: '#2ecc8a', border: '#2ecc8a44' }, + { target: 'cancelled', label: '取消', icon: '🚫', bg: '#6b728022', color: '#6b7280', border: '#6b728044' }, ], escalated: [ { target: 'working', label: '继续执行', icon: '▶', bg: '#2ecc8a22', color: '#2ecc8a', border: '#2ecc8a44' }, { target: 'pending', label: '重新分配', icon: '🔄', bg: '#7a9aff22', color: '#7a9aff', border: '#7a9aff44' }, - ], - failed: [{ target: 'pending', label: '重试', icon: '🔄', bg: '#7a9aff22', color: '#7a9aff', border: '#7a9aff44' }], - blocked: [{ target: 'pending', label: '解除阻塞', icon: '🔓', bg: '#2ecc8a22', color: '#2ecc8a', border: '#2ecc8a44' }], - paused: [ - { target: 'working', label: '继续执行', icon: '▶', bg: '#2ecc8a22', color: '#2ecc8a', border: '#2ecc8a44' }, - { target: 'cancelled', label: '取消任务', icon: '🚫', bg: '#6b728022', color: '#6b7280', border: '#6b728044' }, - ], - done: [{ target: '__archive', label: '归档', icon: '📦', bg: '#6b728022', color: '#6b7280', border: '#6b728044' }], - cancelled: [{ target: '__archive', label: '归档', icon: '📦', bg: '#6b728022', color: '#6b7280', border: '#6b728044' }], - }; - - // 高级操作(手动干预用) - const ADVANCED_ACTIONS: Record> = { - working: [ - { target: 'review', label: '手动提交审查', icon: '🔍', bg: '#818cf822', color: '#818cf8', border: '#818cf844' }, - { target: 'cancelled', label: '取消', icon: '🚫', bg: '#6b728022', color: '#6b7280', border: '#6b728044' }, - ], - review: [ - { target: 'done', label: '手动通过', icon: '✅', bg: '#2ecc8a22', color: '#2ecc8a', border: '#2ecc8a44' }, - { target: 'pending', label: '打回重做', icon: '🔄', bg: '#7a9aff22', color: '#7a9aff', border: '#7a9aff44' }, - { target: 'cancelled', label: '取消', icon: '🚫', bg: '#6b728022', color: '#6b7280', border: '#6b728044' }, - ], - escalated: [ - { target: 'cancelled', label: '取消', icon: '🚫', bg: '#6b728022', color: '#6b7280', border: '#6b728044' }, - ], - failed: [ - { target: 'escalated', label: '升级求助', icon: '⚠️', bg: '#ff527022', color: '#ff5270', border: '#ff527044' }, - { target: 'cancelled', label: '取消', icon: '🚫', bg: '#6b728022', color: '#6b7280', border: '#6b728044' }, - ], - blocked: [ - { target: 'escalated', label: '升级求助', icon: '⚠️', bg: '#ff527022', color: '#ff5270', border: '#ff527044' }, { target: 'cancelled', label: '取消', icon: '🚫', bg: '#6b728022', color: '#6b7280', border: '#6b728044' }, ], waiting_human: [ + { target: 'done', label: '确认', icon: '✅', bg: '#2ecc8a22', color: '#2ecc8a', border: '#2ecc8a44' }, + { target: 'working', label: '拒绝', icon: '🔄', bg: '#7a9aff22', color: '#7a9aff', border: '#7a9aff44' }, { target: 'cancelled', label: '取消', icon: '🚫', bg: '#6b728022', color: '#6b7280', border: '#6b728044' }, ], + done: [ + { target: '__archive', label: '归档', icon: '📦', bg: '#6b728022', color: '#6b7280', border: '#6b728044' }, + ], + cancelled: [ + { target: 'pending', label: '重新启动', icon: '🔄', bg: '#2ecc8a22', color: '#2ecc8a', border: '#2ecc8a44' }, + { target: '__archive', label: '归档', icon: '📦', bg: '#6b728022', color: '#6b7280', border: '#6b728044' }, + ], }; - const primary = PRIMARY_ACTIONS[status] || []; - const advanced = ADVANCED_ACTIONS[status] || []; - - if (primary.length === 0 && advanced.length === 0) { - // Agent 自动流转的状态,提示用户 - const autoMsg: Record = { - pending: '⏳ 等待 Agent 自动认领...', - claimed: '⏳ Agent 已认领,即将开始...', - review: '🔍 Agent 审查中,请等待审查结果...', - }; - return
{autoMsg[status] || ''}
; - } + const buttons = ACTION_BUTTONS[status] || []; const handleClick = async (targetStatus: string) => { setLoading(targetStatus);