From 10777b62b1a259307fdc586f8a45467197b043b0 Mon Sep 17 00:00:00 2001 From: Antigravity Date: Sat, 23 May 2026 10:15:45 +0000 Subject: [PATCH] debug(chart): add cache logging to debug cache misses --- memento-note/lib/ai/services/chart-suggestion.service.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/memento-note/lib/ai/services/chart-suggestion.service.ts b/memento-note/lib/ai/services/chart-suggestion.service.ts index b9556bc..c778666 100644 --- a/memento-note/lib/ai/services/chart-suggestion.service.ts +++ b/memento-note/lib/ai/services/chart-suggestion.service.ts @@ -70,11 +70,16 @@ function setCached(key: string, data: SuggestChartsResponse): void { export async function suggestCharts(request: SuggestChartsRequest): Promise { // Check cache first const cacheKey = getCacheKey(request.content || '', request.selection) + console.log('[suggestCharts] Cache key:', cacheKey, 'contentLen:', request.content?.length, 'selectionLen:', request.selection?.length) + const cached = getCached(cacheKey) if (cached) { + console.log('[suggestCharts] CACHE HIT - returning cached data') return cached } + console.log('[suggestCharts] CACHE MISS - calling API') + try { const response = await fetch('/api/ai/suggest-charts', { method: 'POST', @@ -104,6 +109,9 @@ export async function suggestCharts(request: SuggestChartsRequest): Promise