diff --git a/src/bot/index.js b/src/bot/index.js index b2802618..edde6fca 100644 --- a/src/bot/index.js +++ b/src/bot/index.js @@ -379,10 +379,11 @@ export async function initBot(config, api, tools, skills, agents) { fullResponse += content; onDelta(content); } - // Check for tool calls in streaming + // Tool calls in streaming - abort stream, fall back to non-streaming (handles tools) if (delta.tool_calls) { - // Tool calls in streaming mode — accumulate and handle after stream - // For now, fall through to non-streaming tool handling + logger.info("Tool call in stream, falling back to non-streaming"); + reader.cancel().catch(() => {}); + return await chatWithAI(body.messages, { maxTokens: body.max_tokens }); } } } catch {