diff --git a/src/lib/sidebar.ts b/src/lib/sidebar.ts index 3e1bc8f..a8f6536 100644 --- a/src/lib/sidebar.ts +++ b/src/lib/sidebar.ts @@ -16,7 +16,8 @@ export interface ResearchListItem extends ResearchSummary { const HISTORY_LIMIT = 50; export async function loadResearchHistory(apiKey: string): Promise { - const list = await apiGet('/v1/research', { apiKey }); + const response = await apiGet<{ items: ResearchSummary[] }>('/v1/research', { apiKey }); + const list = response.items; // Sort descending by created_at (newest first), limit to HISTORY_LIMIT const sorted = list .slice() @@ -34,10 +35,10 @@ export async function createResearch( query: string, language: string, depth: string -): Promise<{ id: string }> { - return await apiPost<{ id: string }>( +): Promise<{ research_id: string }> { + return await apiPost<{ research_id: string }>( '/v1/research', { query, language, depth }, { apiKey } ); -} \ No newline at end of file +} diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 3056bba..fe44e98 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,5 +1,5 @@