diff --git a/web/helpers/atoms/ChatMessage.atom.ts b/web/helpers/atoms/ChatMessage.atom.ts index 5df44e0312..7034396652 100644 --- a/web/helpers/atoms/ChatMessage.atom.ts +++ b/web/helpers/atoms/ChatMessage.atom.ts @@ -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', + }) } } )