From 19361a5c27774e0d864b0e230e7f667aeb3ab744 Mon Sep 17 00:00:00 2001 From: cfdaily Date: Mon, 18 May 2026 11:52:39 +0800 Subject: [PATCH] auto-sync: 2026-05-18 11:52:39 --- src/frontend/src/api.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/frontend/src/api.ts b/src/frontend/src/api.ts index 4ded441..d40b62e 100644 --- a/src/frontend/src/api.ts +++ b/src/frontend/src/api.ts @@ -253,6 +253,25 @@ export const api = { artifacts: async (taskId: string): Promise => ({ ok: true, deliverable: null, nodes: [], }), + + // ── v2.7: Task 进度 + 子 Task ── + + taskProgress: async (taskId: string): Promise => { + try { + const pid = _currentProjectId || Object.keys((await api.projects()).projects)[0]; + if (!pid) return null; + return fetchJ(`${API_BASE}/api/projects/${pid}/tasks/${taskId}/progress`); + } catch { return null; } + }, + + listSubtasks: async (parentId: string): Promise => { + try { + const pid = _currentProjectId || Object.keys((await api.projects()).projects)[0]; + if (!pid) return []; + const data = await fetchJ<{ tasks: any[] }>(`${API_BASE}/api/projects/${pid}/tasks?parent_task=${parentId}`); + return (data.tasks || []).map(adaptTask); + } catch { return []; } + }, artifactPreview: async (taskId: string, path: string): Promise => ({ ok: false, previewable: false, name: '', type: '', render_as: '', size: 0, content: null, }),