diff --git a/src/lib/sidebar.ts b/src/lib/sidebar.ts index a8f6536..1475c5b 100644 --- a/src/lib/sidebar.ts +++ b/src/lib/sidebar.ts @@ -15,9 +15,23 @@ export interface ResearchListItem extends ResearchSummary { const HISTORY_LIMIT = 50; +interface ResearchListResponse { + items: Array<{ + research_id: string; + query: string; + state: string; + created_at: string; + }>; +} + export async function loadResearchHistory(apiKey: string): Promise { - const response = await apiGet<{ items: ResearchSummary[] }>('/v1/research', { apiKey }); - const list = response.items; + const response = await apiGet('/v1/research', { apiKey }); + const list = response.items.map(item => ({ + id: item.research_id, + query: item.query, + status: item.state, + created_at: item.created_at, + })); // Sort descending by created_at (newest first), limit to HISTORY_LIMIT const sorted = list .slice()