fix: chat memory lost between messages + per-note history
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 1m11s

Chat (AIChat floating widget): conversationId was never captured from
the API response, so every message created a new conversation with no
context. Now creates the conversation upfront before streaming (same
pattern as ChatContainer) so the ID persists across messages.

Note history: was stored globally in UserAISettings, so enabling
history on one note enabled it for ALL notes. Now each Note has its
own historyEnabled boolean field. The "Enable history" action only
affects the specific note. A migration adds the column with default
false.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-28 22:18:46 +02:00
parent 0bccc41ccc
commit b92f6384a4
11 changed files with 80 additions and 54 deletions

View File

@@ -142,7 +142,7 @@ export async function PUT(
})
try {
const historyEnabled = await isNoteHistoryEnabledForUser(session.user.id)
const historyEnabled = existingNote.historyEnabled === true
if (historyEnabled && shouldCaptureHistorySnapshot(updateData)) {
const mode = await getNoteHistoryMode(session.user.id)
if (mode === 'auto') {