fix: generating message is gone after switching to another thread (#4321)

This commit is contained in:
Louis 2024-12-23 15:27:02 +07:00 committed by GitHub
parent 9c4dcd38a8
commit 171dad1eca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -175,6 +175,17 @@ export const updateMessageAtom = atom(
// Update thread last message
if (text.length)
set(updateThreadStateLastMessageAtom, conversationId, text)
} else {
set(addNewMessageAtom, {
id,
thread_id: conversationId,
content: text,
status,
role: ChatCompletionRole.Assistant,
created_at: Date.now() / 1000,
completed_at: Date.now() / 1000,
object: 'thread.message',
})
}
}
)