diff --git a/frontend/src/components/TaskTree/TaskFlowView.tsx b/frontend/src/components/TaskTree/TaskFlowView.tsx index 3813d18..65e11c3 100644 --- a/frontend/src/components/TaskTree/TaskFlowView.tsx +++ b/frontend/src/components/TaskTree/TaskFlowView.tsx @@ -22,7 +22,12 @@ function ArrowRight({ color = "#9ca3af" }: { color?: string }) { function ArrowLeft({ color = "#9ca3af" }: { color?: string }) { return ; } -function parseImages(s: string | null | undefined): string[] { if (!s) return []; try { return JSON.parse(s); } catch { return []; } } +function parseImages(s: any): string[] { + if (!s) return []; + if (Array.isArray(s)) return s; // Pydantic 序列化后的数组 + if (typeof s === "string") { try { return JSON.parse(s); } catch { return []; } } + return []; +} function imageUrl(u: string) { if (!u) return ""; return u.startsWith("http") ? u : import.meta.env.VITE_API_BASE_URL + (u.startsWith("/") ? u : "/" + u); } const ALL_TASKS = new Set(); @@ -218,7 +223,7 @@ export const TaskFlowView = memo(function TaskFlowView({ tasks, onAction, curren

{fmtTime(r.created_at)}

{(r.note || r.remark) &&

{r.note || r.remark}

} - {(() => { const imgs = parseImages((r as any).images); if (!imgs.length) return null; return
{imgs.map((img, j) => window.open(imageUrl(img))} />)}
; })()} + {(() => { const imgs = parseImages(r.images); if (!imgs.length) return null; return
{imgs.map((img, j) => window.open(imageUrl(img))} />)}
; })()}
))}}