feat(agent): add Final field to outbound messages

This commit is contained in:
Zhang Rui 2026-03-19 22:45:02 +08:00
parent 9a25fad20a
commit bdb1b238a1
3 changed files with 4 additions and 1 deletions

View file

@ -193,6 +193,7 @@ func registerSharedTools(
Channel: channel, Channel: channel,
ChatID: chatID, ChatID: chatID,
Content: content, Content: content,
Final: true,
}) })
}) })
agent.Tools.Register(messageTool) agent.Tools.Register(messageTool)
@ -315,6 +316,7 @@ func (al *AgentLoop) Run(ctx context.Context) error {
Channel: msg.Channel, Channel: msg.Channel,
ChatID: msg.ChatID, ChatID: msg.ChatID,
Content: response, Content: response,
Final: true,
}) })
logger.InfoCF("agent", "Published outbound response", logger.InfoCF("agent", "Published outbound response",
map[string]any{ map[string]any{

View file

@ -64,7 +64,7 @@ func (al *AgentLoop) ensureMCPInitialized(ctx context.Context) error {
return nil return nil
} }
if al.cfg.Tools.MCP.Servers == nil || len(al.cfg.Tools.MCP.Servers) == 0 { if len(al.cfg.Tools.MCP.Servers) == 0 {
logger.WarnCF("agent", "MCP is enabled but no servers are configured, skipping MCP initialization", nil) logger.WarnCF("agent", "MCP is enabled but no servers are configured, skipping MCP initialization", nil)
return nil return nil
} }

View file

@ -34,6 +34,7 @@ type OutboundMessage struct {
ChatID string `json:"chat_id"` ChatID string `json:"chat_id"`
Content string `json:"content"` Content string `json:"content"`
ReplyToMessageID string `json:"reply_to_message_id,omitempty"` ReplyToMessageID string `json:"reply_to_message_id,omitempty"`
Final bool `json:"final,omitempty"`
} }
// MediaPart describes a single media attachment to send. // MediaPart describes a single media attachment to send.