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