diff --git a/src/frontend/src/components/CheckpointPanel.tsx b/src/frontend/src/components/CheckpointPanel.tsx index 1264255..637526f 100644 --- a/src/frontend/src/components/CheckpointPanel.tsx +++ b/src/frontend/src/components/CheckpointPanel.tsx @@ -45,15 +45,9 @@ const AGENT_EMOJI: Record = { // ── Decision Checkpoint ── function DecisionCheckpoint({ - taskId, - info, - onDone, -}: { - taskId: string; - info: CheckpointInfo; - onDone: () => void; -}) { - const cp = info.checkpoint; + taskId, cp, onDone, +}: { taskId: string; cp: Checkpoint; onDone: () => void }) { + const payload: DecisionPayload = JSON.parse(cp.payload || '{}'); const [selected, setSelected] = useState(null); const [note, setNote] = useState(''); const [loading, setLoading] = useState(false); @@ -63,12 +57,11 @@ function DecisionCheckpoint({ if (!selected) return; setLoading(true); try { - const r = await api.humanInputRespond(taskId, { - node_id: info.node_id, - action: 'decide', - selected_option: selected, - reason: note, + const res = await fetch(`/api/projects/${api._getProjectId()}/tasks/${taskId}/checkpoints/${cp.id}/approve`, { + method: 'POST', headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ resolved_by: 'user', note: `选择: ${selected}${note ? '\n' + note : ''}` }), }); + const r = await res.json(); if (r.ok) { toast('✅ 已御批', 'ok'); onDone(); } else toast(r.error || '操作失败', 'err'); } catch { toast('服务器连接失败', 'err'); } @@ -77,27 +70,14 @@ function DecisionCheckpoint({ return (
-
- {cp.description} -
- {/* 关联产出物 */} - {cp.artifacts?.length ? ( -
-
📦 关联产出物
-
- {cp.artifacts.map((a, i) => ( - - 📄 {a.name} ↗ - - ))} -
+ {cp.description && ( +
+ {cp.description}
- ) : null} - {/* 方案 */} + )}
📋 备选方案
- {cp.options?.map((opt) => ( + {(payload.options || []).map((opt) => (
setSelected(opt.id)} style={{ @@ -110,28 +90,19 @@ function DecisionCheckpoint({
)}
{opt.label}
- {opt.description &&
{opt.description}
} + {opt.desc &&
{opt.desc}
} {opt.pros?.map((p, i) =>
👍 {p}
)} {opt.cons?.map((c, i) =>
👎 {c}
)}
))}
- {/* 兜底自由输入 */} - {(!cp.options || cp.options.length === 0) && ( -
-
无预定义方案,请直接输入决策:
-