mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-09-09 22:31:10 +00:00
fix(nova): keep user message when stopping generation early (#1055)
Clicking stop before the first assistant token streamed in deleted the triggering user message: handleStop unconditionally sliced off a trailing user message, which during the submitted/thinking window is the user's own message. Drop the slice so the message is preserved on stop. ENG-732
This commit is contained in:
parent
2b60568a21
commit
5b129d7d32
1 changed files with 3 additions and 8 deletions
|
|
@ -563,16 +563,11 @@ export function ChatSidebar({
|
|||
}
|
||||
}
|
||||
|
||||
// When the user stops generation before any assistant response arrives,
|
||||
// remove the dangling user message so it isn't duplicated on the next send.
|
||||
// Keep the user message on stop so it isn't lost when generation is halted
|
||||
// before any assistant response arrives (ENG-732).
|
||||
const handleStop = useCallback(() => {
|
||||
stop()
|
||||
setMessages((prev) => {
|
||||
const last = prev[prev.length - 1]
|
||||
if (last?.role === "user") return prev.slice(0, -1)
|
||||
return prev
|
||||
})
|
||||
}, [stop, setMessages])
|
||||
}, [stop])
|
||||
|
||||
const handleCopyMessage = useCallback((messageId: string, text: string) => {
|
||||
analytics.chatMessageCopied({ message_id: messageId })
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue