fix: AI assistant in note-input still searches other notes when scoped to "this note"

When chatScope is "this note", the AI had access to note_search and note_read
tools which let it pull content from any note. Now these tools are excluded via
a webOnly flag in buildToolsForChat — only web_search/web_scrape remain if
the user toggled web search.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-30 19:10:20 +02:00
parent cd6819b905
commit a482aaaad6
2 changed files with 8 additions and 3 deletions

View File

@@ -419,7 +419,11 @@ Never switch to another language. Even if the user writes in a different languag
webSearch: !!webSearch,
config,
}
const chatTools = toolRegistry.buildToolsForChat(chatToolContext)
// When scoped to "this note", only provide web tools — no note_search/note_read
// to prevent the AI from pulling information from other notes
const chatTools = noteContext
? toolRegistry.buildToolsForChat({ ...chatToolContext, webOnly: true })
: toolRegistry.buildToolsForChat(chatToolContext)
// 8. Save user message to DB before streaming
if (isNewMessage && lastIncoming) {