diff --git a/src/components/UnifiedDataBar/ChatsTab.tsx b/src/components/UnifiedDataBar/ChatsTab.tsx index cfb961e..3260b61 100644 --- a/src/components/UnifiedDataBar/ChatsTab.tsx +++ b/src/components/UnifiedDataBar/ChatsTab.tsx @@ -75,7 +75,15 @@ const ChatsTab: React.FC = ({ `/api/workspace/${context.instanceId}/workflows`, { params: { includeArchived: true } }, ); - const workflows = response.data?.workflows || response.data?.data || []; + const body = response.data ?? {}; + const nested = body.data && typeof body.data === 'object' && !Array.isArray(body.data) + ? (body.data as { workflows?: unknown }) + : null; + const workflowsRaw = + body.workflows ?? + nested?.workflows ?? + (Array.isArray(body.data) ? body.data : null); + const workflows = Array.isArray(workflowsRaw) ? workflowsRaw : []; const groupMap = new Map(); for (const wf of workflows) { diff --git a/src/components/UnifiedDataBar/FilesTab.tsx b/src/components/UnifiedDataBar/FilesTab.tsx index c96ebdd..a801560 100644 --- a/src/components/UnifiedDataBar/FilesTab.tsx +++ b/src/components/UnifiedDataBar/FilesTab.tsx @@ -51,9 +51,13 @@ const FilesTab: React.FC = ({ context, onFileSelect }) => { setLoading(true); try { const response = await api.get(`/api/workspace/${context.instanceId}/files`); - const data = response.data?.data || response.data || []; + const body = response.data; + const rawList = + (Array.isArray(body?.files) && body.files) || + (Array.isArray(body?.data) && body.data) || + (Array.isArray(body) ? body : []); setFiles( - data.map((f: any) => ({ + rawList.map((f: any) => ({ id: f.id, fileName: f.fileName || f.name || 'unknown', mimeType: f.mimeType,