fix: clarify streaming message handling logic with comments
All checks were successful
BotUI CI/CD / build (push) Successful in 40s
All checks were successful
BotUI CI/CD / build (push) Successful in 40s
This commit is contained in:
parent
cf7462f1cb
commit
5fa187fd97
1 changed files with 19 additions and 16 deletions
|
|
@ -857,22 +857,25 @@ function processMessage(data) {
|
|||
) {
|
||||
renderSuggestions(data.suggestions);
|
||||
}
|
||||
} else {
|
||||
if (!isStreaming) {
|
||||
isStreaming = true;
|
||||
streamingMessageId = "streaming-" + Date.now();
|
||||
currentStreamingContent = data.content || "";
|
||||
addMessage(
|
||||
"bot",
|
||||
currentStreamingContent,
|
||||
streamingMessageId,
|
||||
);
|
||||
} else {
|
||||
currentStreamingContent += data.content || "";
|
||||
updateStreaming(currentStreamingContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Streaming chunk received
|
||||
if (!isStreaming) {
|
||||
// New streaming response - create a new message element
|
||||
isStreaming = true;
|
||||
streamingMessageId = "streaming-" + Date.now();
|
||||
currentStreamingContent = data.content || "";
|
||||
addMessage(
|
||||
"bot",
|
||||
currentStreamingContent,
|
||||
streamingMessageId,
|
||||
);
|
||||
} else {
|
||||
// Continue streaming to existing message element
|
||||
currentStreamingContent += data.content || "";
|
||||
updateStreaming(currentStreamingContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Thinking indicator (shown while LLM is in reasoning mode)
|
||||
var thinkingIndicator = null;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue