fix(api): retry transient session reads safely
This commit is contained in:
+9
-3
@@ -1443,7 +1443,9 @@ export async function listSessions(options?: {
|
||||
if (options?.offset != null) params.set('offset', String(options.offset));
|
||||
if (options?.query?.trim()) params.set('query', options.query.trim());
|
||||
const qs = params.size ? `?${params.toString()}` : '';
|
||||
const result = await apiFetch<SessionListResponse>(`/sessions${qs}`);
|
||||
const result = await apiFetch<SessionListResponse>(`/sessions${qs}`, undefined, {
|
||||
retryOnTransientFailure: true,
|
||||
});
|
||||
return { items: result.sessions ?? [], page: result.page ?? {} };
|
||||
}
|
||||
|
||||
@@ -1452,7 +1454,9 @@ function sessionPath(sessionId: string, suffix = '') {
|
||||
}
|
||||
|
||||
export async function getSession(sessionId: string): Promise<Session> {
|
||||
return apiFetch<Session>(sessionPath(sessionId));
|
||||
return apiFetch<Session>(sessionPath(sessionId), undefined, {
|
||||
retryOnTransientFailure: true,
|
||||
});
|
||||
}
|
||||
|
||||
export async function deleteChatSession(sessionId: string): Promise<void> {
|
||||
@@ -1474,7 +1478,9 @@ export async function loadSessionDetail(
|
||||
if (history?.before != null) params.set('history_before', String(history.before));
|
||||
if (history?.limit != null) params.set('history_limit', String(history.limit));
|
||||
const qs = params.size ? `?${params.toString()}` : '';
|
||||
const detail = await apiFetch<Session>(`${sessionPath(sessionId)}${qs}`);
|
||||
const detail = await apiFetch<Session>(`${sessionPath(sessionId)}${qs}`, undefined, {
|
||||
retryOnTransientFailure: true,
|
||||
});
|
||||
const messages = normalizeConversationMessages(
|
||||
(detail.conversation ?? []).filter((m) => m.metadata?.userVisible),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user