feat: wire Media through agent pipeline to enable vision model support

- Add Media field to processOptions struct
- Pass msg.Media from InboundMessage to processOptions in processMessage
- Update BuildMessages to attach media to user message
- Pass opts.Media to BuildMessages instead of nil in runAgentLoop
- Enables vision-capable models (Gemini 2.0 Flash, etc.) to receive image_url content parts
This commit is contained in:
Zachary Guerrero 2026-02-20 14:33:02 -08:00
parent 42725e0fe0
commit 4b589125ce
2 changed files with 13 additions and 10 deletions

View file

@ -198,10 +198,11 @@ func (cb *ContextBuilder) BuildMessages(history []providers.Message, summary str
messages = append(messages, history...)
if strings.TrimSpace(currentMessage) != "" {
if strings.TrimSpace(currentMessage) != "" || len(media) > 0 {
messages = append(messages, providers.Message{
Role: "user",
Content: currentMessage,
Media: media,
})
}

View file

@ -46,6 +46,7 @@ type processOptions struct {
Channel string // Target channel for tool execution
ChatID string // Target chat ID for tool execution
UserMessage string // User message content (may include prefix)
Media []string // Media URLs attached to the user message
DefaultResponse string // Response when LLM returns empty
EnableSummary bool // Whether to trigger summarization
SendResponse bool // Whether to send response via bus
@ -313,6 +314,7 @@ func (al *AgentLoop) processMessage(ctx context.Context, msg bus.InboundMessage)
Channel: msg.Channel,
ChatID: msg.ChatID,
UserMessage: msg.Content,
Media: msg.Media,
DefaultResponse: "I've completed processing but have no response to give.",
EnableSummary: true,
SendResponse: false,
@ -402,7 +404,7 @@ func (al *AgentLoop) runAgentLoop(ctx context.Context, agent *AgentInstance, opt
history,
summary,
opts.UserMessage,
nil,
opts.Media,
opts.Channel,
opts.ChatID,
)