fix: chat memory lost between messages + per-note history
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 1m11s
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:
@@ -83,10 +83,9 @@ interface NotesTabsViewProps {
|
||||
notes: Note[]
|
||||
onEdit?: (note: Note, readOnly?: boolean) => void
|
||||
currentNotebookId?: string | null
|
||||
noteHistoryEnabled?: boolean
|
||||
noteHistoryMode?: 'manual' | 'auto'
|
||||
onOpenHistory?: (note: Note) => void
|
||||
onEnableHistory?: () => Promise<void>
|
||||
onEnableHistory?: (noteId: string) => Promise<void>
|
||||
}
|
||||
|
||||
type SortOrder = 'date-desc' | 'date-asc' | 'title-asc' | 'title-desc'
|
||||
@@ -382,16 +381,14 @@ function NoteMetaSidebar({
|
||||
note,
|
||||
onPinToggle,
|
||||
onArchive,
|
||||
noteHistoryEnabled = false,
|
||||
onOpenHistory,
|
||||
onEnableHistory,
|
||||
}: {
|
||||
note: Note
|
||||
onPinToggle: (note: Note) => void
|
||||
onArchive: (note: Note) => void
|
||||
noteHistoryEnabled?: boolean
|
||||
onOpenHistory?: (note: Note) => void
|
||||
onEnableHistory?: () => Promise<void>
|
||||
onEnableHistory?: (noteId: string) => Promise<void>
|
||||
}) {
|
||||
const { t } = useLanguage()
|
||||
const { notebooks, moveNoteToNotebookOptimistic } = useNotebooks()
|
||||
@@ -427,13 +424,13 @@ function NoteMetaSidebar({
|
||||
}
|
||||
|
||||
const handleHistory = async () => {
|
||||
if (!noteHistoryEnabled) {
|
||||
if (!note.historyEnabled) {
|
||||
if (!onEnableHistory) {
|
||||
toast.info(ts('notes.historyDisabledDesc', "L'historique est désactivé pour votre compte."))
|
||||
toast.info(ts('notes.historyDisabledDesc', "L'historique est désactivé pour cette note."))
|
||||
return
|
||||
}
|
||||
try {
|
||||
await onEnableHistory()
|
||||
await onEnableHistory(note.id)
|
||||
toast.success(ts('notes.historyEnabled', 'Historique activé'))
|
||||
onOpenHistory?.(note)
|
||||
} catch {
|
||||
@@ -577,7 +574,7 @@ function NoteMetaSidebar({
|
||||
<SidebarActionBtn
|
||||
icon={<History className="h-3.5 w-3.5" />}
|
||||
label={
|
||||
noteHistoryEnabled
|
||||
note.historyEnabled
|
||||
? ts('notes.history', 'Historique')
|
||||
: ts('notes.enableHistory', "Activer l'historique")
|
||||
}
|
||||
@@ -596,7 +593,7 @@ export function NotesTabsView({
|
||||
notes,
|
||||
onEdit,
|
||||
currentNotebookId,
|
||||
noteHistoryEnabled = false,
|
||||
|
||||
noteHistoryMode = 'manual',
|
||||
onOpenHistory,
|
||||
onEnableHistory,
|
||||
@@ -893,9 +890,9 @@ export function NotesTabsView({
|
||||
<NoteInlineEditor
|
||||
key={selected.id}
|
||||
note={selected}
|
||||
noteHistoryEnabled={noteHistoryEnabled}
|
||||
noteHistoryMode={noteHistoryMode}
|
||||
onOpenHistory={onOpenHistory}
|
||||
onEnableHistory={onEnableHistory}
|
||||
colorKey={colorKey}
|
||||
defaultPreviewMode={true}
|
||||
onChange={(noteId, fields) => {
|
||||
@@ -932,7 +929,6 @@ export function NotesTabsView({
|
||||
note={selected}
|
||||
onPinToggle={handlePinToggle}
|
||||
onArchive={handleArchive}
|
||||
noteHistoryEnabled={noteHistoryEnabled}
|
||||
onOpenHistory={onOpenHistory}
|
||||
onEnableHistory={onEnableHistory}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user