mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
fix(pico): stream assistant text between tool calls
This commit is contained in:
+15
-1
@@ -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 != "" {
|
||||
|
||||
Reference in New Issue
Block a user