fix: clear thinking indicator on stream complete
All checks were successful
BotServer CI/CD / build (push) Successful in 3m21s

This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-13 22:19:10 -03:00
parent 200b026efe
commit 318d199d6c

View file

@ -1185,6 +1185,28 @@ impl BotOrchestrator {
trace!("LLM stream complete. Full response: {}", full_response);
// CRITICAL: Clear thinking indicator when stream ends (in case closing tags weren't detected)
// This ensures the "Pensando..." message gets cleared
if in_analysis {
warn!("Stream ended while in_analysis=true, clearing thinking indicator");
in_analysis = false;
let clear_thinking = BotResponse {
bot_id: message.bot_id.clone(),
user_id: message.user_id.clone(),
session_id: message.session_id.clone(),
channel: message.channel.clone(),
content: String::new(),
message_type: MessageType::BOT_RESPONSE,
stream_token: None,
is_complete: false,
suggestions: Vec::new(),
context_name: None,
context_length: 0,
context_max_length: 0,
};
let _ = response_tx.send(clear_thinking).await;
}
let state_for_save = self.state.clone();
let full_response_clone = full_response.clone();
tokio::task::spawn_blocking(