From fb7b3cbe1ac7cd6f656799ab4bea1dc84497ba8e Mon Sep 17 00:00:00 2001 From: a7m-1st Date: Thu, 13 Nov 2025 02:23:15 +0300 Subject: [PATCH] fix: backwards compat --- src/service/historyApi.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/service/historyApi.ts b/src/service/historyApi.ts index 7f0a39210..741339ffb 100644 --- a/src/service/historyApi.ts +++ b/src/service/historyApi.ts @@ -77,10 +77,12 @@ export const fetchHistoryTasks = async (setTasks: React.Dispatch>) => { try { const res = await proxyFetchGet(`/api/chat/histories/grouped?include_tasks=true`); - setProjects(res.projects); + if(res.status !== 200) { + fetchGroupedHistoryTasksLegacy(setProjects); + } else setProjects(res.projects); } catch (error) { - console.error("Failed to fetch grouped history tasks, using fallback:", error); - fetchGroupedHistoryTasksLegacy(setProjects); + console.error("Failed to fetch grouped history summaries:", error); + setProjects([]); } }; @@ -88,10 +90,12 @@ export const fetchGroupedHistoryTasks = async (setProjects: React.Dispatch>) => { try { const res = await proxyFetchGet(`/api/chat/histories/grouped?include_tasks=false`); - setProjects(res.projects); + if(res.status !== 200) { + fetchGroupedHistoryTasksLegacy(setProjects); + } else setProjects(res.projects); } catch (error) { - console.error("Failed to fetch grouped history summaries, using fallback:", error); - fetchGroupedHistoryTasksLegacy(setProjects); + console.error("Failed to fetch grouped history summaries:", error); + setProjects([]); } };