From 1baf26237e398f09c6f04129a9fb13cc7fa3c5c6 Mon Sep 17 00:00:00 2001 From: cfdaily Date: Tue, 19 May 2026 14:00:04 +0800 Subject: [PATCH] auto-sync: 2026-05-19 14:00:04 --- .../src/components/CheckpointPanel.tsx | 52 ++++++++++++------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/src/frontend/src/components/CheckpointPanel.tsx b/src/frontend/src/components/CheckpointPanel.tsx index a54eb65..e756312 100644 --- a/src/frontend/src/components/CheckpointPanel.tsx +++ b/src/frontend/src/components/CheckpointPanel.tsx @@ -282,33 +282,46 @@ function ActionCheckpoint({ export default function CheckpointPanel({ taskId, - checkpoints, onDone, }: { taskId: string; - checkpoints: CheckpointInfo[]; onDone: () => void; }) { + const [checkpoints, setCheckpoints] = useState([]); const [activeIdx, setActiveIdx] = useState(0); - const info = checkpoints[activeIdx]; - if (!info) return null; - const cp = info.checkpoint; - const typeIcon = cp.type === 'verify' ? '🔍' : cp.type === 'decision' ? '🎯' : '🔧'; - const typeColor = cp.type === 'verify' ? '#6a9eff' : cp.type === 'decision' ? '#818cf8' : '#f59e0b'; - const typeLabel = cp.type === 'verify' ? '验证 Checkpoint' : cp.type === 'decision' ? '决策 Checkpoint' : '执行 Checkpoint'; + useEffect(() => { + const pid = api._getProjectId(); + if (!pid) return; + fetch(`/api/projects/${pid}/tasks/${taskId}/checkpoints`) + .then(r => r.json()) + .then(d => setCheckpoints(d.checkpoints || [])) + .catch(() => {}); + }, [taskId]); + + const cp = checkpoints[activeIdx]; + if (!cp) return null; + + // 只显示 pending 的 + const pendingCps = checkpoints.filter(c => c.status === 'pending'); + const activeCp = pendingCps[activeIdx] || pendingCps[0]; + if (!activeCp) return
所有 Checkpoint 已处理
; + + const typeIcon = activeCp.type === 'verify' ? '🔍' : activeCp.type === 'decision' ? '🎯' : '🔧'; + const typeColor = activeCp.type === 'verify' ? '#6a9eff' : activeCp.type === 'decision' ? '#818cf8' : '#f59e0b'; + const typeLabel = activeCp.type === 'verify' ? '验证 Checkpoint' : activeCp.type === 'decision' ? '决策 Checkpoint' : '执行 Checkpoint'; return (
- {/* 多节点 Tab */} - {checkpoints.length > 1 && ( + {/* 多 checkpoint Tab */} + {pendingCps.length > 1 && (
- {checkpoints.map((c, i) => ( - + style={{ fontSize: 12, padding: '6px 12px', border: 'none', background: 'transparent', cursor: 'pointer', + color: i === activeIdx ? typeColor : 'var(--muted)', borderBottom: `2px solid ${i === activeIdx ? typeColor : 'transparent'}` }} + >{typeIcon} {c.title} ))}
)} @@ -318,17 +331,16 @@ export default function CheckpointPanel({
{typeIcon}
{typeLabel}
-
节点 {info.node_name}({AGENT_EMOJI[info.agent_id] || ''} {info.agent_id})
{/* 标题 */} -
{cp.title}
+
{activeCp.title}
{/* 按类型渲染 */} - {cp.type === 'verify' && } - {cp.type === 'decision' && } - {cp.type === 'action' && } + {activeCp.type === 'verify' && } + {activeCp.type === 'decision' && } + {activeCp.type === 'action' && } ); }