Save chat before emitting event for user message (#5389)

Fixes #5388
This commit is contained in:
Cohee
2026-04-01 23:19:56 +03:00
committed by GitHub
parent d2b2b1b4a6
commit 04ef0632ee
+1 -1
View File
@@ -5831,11 +5831,11 @@ export async function sendMessageAsUser(messageText, messageBias, insertAt = nul
await eventSource.emit(event_types.USER_MESSAGE_RENDERED, insertAt);
} else {
chat.push(message);
await saveChatConditional();
const chat_id = (chat.length - 1);
await eventSource.emit(event_types.MESSAGE_SENT, chat_id);
addOneMessage(message);
await eventSource.emit(event_types.USER_MESSAGE_RENDERED, chat_id);
await saveChatConditional();
}
return message;