diff --git a/web/src/components/ChatSessionList.tsx b/web/src/components/ChatSessionList.tsx index c1988681f35..a926440aa79 100644 --- a/web/src/components/ChatSessionList.tsx +++ b/web/src/components/ChatSessionList.tsx @@ -85,7 +85,7 @@ export function ChatSessionList({ setLoading(true); setError(null); api - .getSessions(SESSION_LIMIT, 0, scopeKey) + .getSessions(SESSION_LIMIT, 0, scopeKey, "recent") .then((res) => { if (reqRef.current !== myReq) return; setSessions(res.sessions); diff --git a/web/src/lib/api.ts b/web/src/lib/api.ts index 3955d3324c9..ba898924196 100644 --- a/web/src/lib/api.ts +++ b/web/src/lib/api.ts @@ -344,9 +344,17 @@ export const api = { window.location.assign("/login"); return r; }), - getSessions: (limit = 20, offset = 0, profile = getManagementProfile()) => + getSessions: ( + limit = 20, + offset = 0, + profile = getManagementProfile(), + order: "created" | "recent" = "created", + ) => fetchJSON( - appendProfileParam(`/api/sessions?limit=${limit}&offset=${offset}`, profile), + appendProfileParam( + `/api/sessions?limit=${limit}&offset=${offset}&order=${order}`, + profile, + ), ), getSessionMessages: (id: string, profile = getManagementProfile()) => fetchJSON(