From 9d0b045377cc43adc8138f1351fc45f9134ab99d Mon Sep 17 00:00:00 2001 From: Tony Yu Date: Tue, 13 Oct 2026 13:49:45 +0800 Subject: [PATCH] fix(chat): answer general questions normally instead of deflecting to sources The prompt forced answer-only-from-sources, so a generic question ("what is an apple?") got a 'the sources don't contain this' deflection plus an irrelevant citation. Now: ground + cite when the question relates to the sources, otherwise answer from general knowledge without mentioning the sources. --- app/src/chat.service.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/chat.service.ts b/app/src/chat.service.ts index a111921..1cf9909 100644 --- a/app/src/chat.service.ts +++ b/app/src/chat.service.ts @@ -24,7 +24,11 @@ const buildPrompt = (messages: ChatMessage[], captures: Capture[]): string => { .slice(-HISTORY_LIMIT) .map((m) => `${m.role === 'user' ? 'User' : 'Assistant'}: ${m.content}`) .join('\n') - return `You are a helpful assistant answering from the user's saved sources. Use ONLY the numbered SOURCES for facts and cite them by number like [1]. If the sources don't contain the answer, say so. Continue the conversation naturally. + return `You are a helpful assistant in the user's notes app. Their saved SOURCES (retrieved for this turn) are below. + +- If the question relates to the sources, ground your answer in them and cite the ones you use by number like [1]. +- If it's a general question the sources don't cover, just answer it normally from your own knowledge. Do NOT mention the sources or point out that they lack the info — only say a source doesn't contain something when the user is clearly asking about their saved material. +- Only cite a source you actually used. SOURCES: ${sources}