fix: robust internal signal detection in orchestrator
Some checks failed
BotServer CI/CD / build (push) Failing after 4m16s
Some checks failed
BotServer CI/CD / build (push) Failing after 4m16s
This commit is contained in:
parent
3d6db4b46f
commit
c7f5f95a37
1 changed files with 8 additions and 1 deletions
|
|
@ -882,7 +882,14 @@ impl BotOrchestrator {
|
||||||
// Tool calls arrive as JSON that can span multiple chunks
|
// Tool calls arrive as JSON that can span multiple chunks
|
||||||
|
|
||||||
// Check if this chunk is an internal event (thinking/thinking_clear)
|
// 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 {
|
let response = BotResponse {
|
||||||
bot_id: message.bot_id.clone(),
|
bot_id: message.bot_id.clone(),
|
||||||
user_id: message.user_id.clone(),
|
user_id: message.user_id.clone(),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue