fix: robust internal signal detection in orchestrator
Some checks failed
BotServer CI/CD / build (push) Failing after 4m16s

This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-14 17:24:17 -03:00
parent 3d6db4b46f
commit c7f5f95a37

View file

@ -882,7 +882,14 @@ impl BotOrchestrator {
// Tool calls arrive as JSON that can span multiple chunks
// Check if this chunk is an internal event (thinking/thinking_clear)
if chunk.trim().starts_with("{\"type\":\"thinking\"") || chunk.trim().starts_with("{\"type\":\"thinking_clear\"") {
let is_internal_signal = if chunk.trim().starts_with("{\"type\"") {
if let Ok(v) = serde_json::from_str::<Value>(&chunk) {
let t = v.get("type").and_then(|t| t.as_str()).unwrap_or_default();
t == "thinking" || t == "thinking_clear"
} else { false }
} else { false };
if is_internal_signal {
let response = BotResponse {
bot_id: message.bot_id.clone(),
user_id: message.user_id.clone(),