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([]); } };