fix(pico): stream assistant text between tool calls

This commit is contained in:
lc6464
2026-04-09 22:32:35 +08:00
parent 5b596ed2f0
commit 2aeed8fb3a
2 changed files with 113 additions and 1 deletions
+15 -1
View File
@@ -1409,7 +1409,7 @@ func (al *AgentLoop) processMessage(ctx context.Context, msg bus.InboundMessage)
Media: msg.Media,
DefaultResponse: defaultResponse,
EnableSummary: true,
SendResponse: msg.Channel == "pico",
SendResponse: false,
}
// context-dependent commands check their own Runtime fields and report
@@ -2253,6 +2253,20 @@ turnLoop:
}
logger.DebugCF("agent", "LLM response", llmResponseFields)
if al.bus != nil && ts.channel == "pico" {
liveContent := response.Content
if liveContent == "" && len(response.ToolCalls) == 0 && response.ReasoningContent != "" {
liveContent = response.ReasoningContent
}
if strings.TrimSpace(liveContent) != "" {
al.bus.PublishOutbound(turnCtx, bus.OutboundMessage{
Channel: ts.channel,
ChatID: ts.chatID,
Content: liveContent,
})
}
}
if len(response.ToolCalls) == 0 || gracefulTerminal {
responseContent := response.Content
if responseContent == "" && response.ReasoningContent != "" {