fixed sys attributes
This commit is contained in:
parent
77e7eba711
commit
4e2510c38b
2 changed files with 15 additions and 3 deletions
|
|
@ -75,7 +75,15 @@ const ChatsTab: React.FC<ChatsTabProps> = ({
|
|||
`/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<string, ChatGroup>();
|
||||
for (const wf of workflows) {
|
||||
|
|
|
|||
|
|
@ -51,9 +51,13 @@ const FilesTab: React.FC<FilesTabProps> = ({ 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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue