Fix: Reset streaming state on new user message to prevent bot messages from accumulating
All checks were successful
BotUI CI/CD / build (push) Successful in 45s
All checks were successful
BotUI CI/CD / build (push) Successful in 45s
This commit is contained in:
parent
d8984b8112
commit
4a0bc0cb27
1 changed files with 21 additions and 12 deletions
|
|
@ -1048,20 +1048,29 @@ function finalizeStreaming() {
|
|||
});
|
||||
}
|
||||
|
||||
function sendMessage(messageContent) {
|
||||
var input = document.getElementById("messageInput");
|
||||
if (!input) {
|
||||
console.error("Chat input not found");
|
||||
return;
|
||||
}
|
||||
function sendMessage(messageContent) {
|
||||
var input = document.getElementById("messageInput");
|
||||
if (!input) {
|
||||
console.error("Chat input not found");
|
||||
return;
|
||||
}
|
||||
|
||||
// If no messageContent provided, read from input
|
||||
var content = messageContent || input.value.trim();
|
||||
if (!content) {
|
||||
return;
|
||||
}
|
||||
// If no messageContent provided, read from input
|
||||
var content = messageContent || input.value.trim();
|
||||
if (!content) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Inject active switchers into content
|
||||
// Reset streaming state for new user message
|
||||
// This ensures bot responses create new message elements
|
||||
if (isStreaming) {
|
||||
finalizeStreaming();
|
||||
}
|
||||
isStreaming = false;
|
||||
streamingMessageId = null;
|
||||
currentStreamingContent = "";
|
||||
|
||||
// Inject active switchers into content
|
||||
var activeKeys = Object.keys(activeSwitchers).filter(function(k) { return activeSwitchers[k]; });
|
||||
|
||||
var enhancedContent = content;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue