Share image input across agent vendors
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"g.fc.run/ai/byre/internal/agentinput"
|
||||
"g.fc.run/ai/byre/internal/antigravity"
|
||||
"g.fc.run/ai/byre/internal/api"
|
||||
"g.fc.run/ai/byre/internal/claude"
|
||||
@@ -17,13 +18,8 @@ import (
|
||||
"g.fc.run/ai/byre/internal/mcp"
|
||||
)
|
||||
|
||||
type image struct {
|
||||
mediaType string
|
||||
data []byte
|
||||
}
|
||||
|
||||
type agentProcess interface {
|
||||
send(ctx context.Context, text string, images []image) error
|
||||
send(ctx context.Context, text string, images []agentinput.Image) error
|
||||
interrupt(ctx context.Context) error
|
||||
setModel(ctx context.Context, model string) error
|
||||
kill()
|
||||
@@ -118,12 +114,8 @@ func (m *Manager) startClaude(ctx context.Context, sess api.AgentSession, l *liv
|
||||
return claudeProcess{s: s}, nil
|
||||
}
|
||||
|
||||
func (p claudeProcess) send(ctx context.Context, text string, images []image) error {
|
||||
imgs := []claude.Image{}
|
||||
for _, img := range images {
|
||||
imgs = append(imgs, claude.Image{MediaType: img.mediaType, Data: img.data})
|
||||
}
|
||||
return p.s.Send(text, imgs...)
|
||||
func (p claudeProcess) send(ctx context.Context, text string, images []agentinput.Image) error {
|
||||
return p.s.Send(text, images...)
|
||||
}
|
||||
|
||||
func (p claudeProcess) interrupt(ctx context.Context) error {
|
||||
@@ -196,12 +188,8 @@ func (m *Manager) startCodex(ctx context.Context, sess api.AgentSession, l *live
|
||||
return codexProcess{s: s}, nil
|
||||
}
|
||||
|
||||
func (p codexProcess) send(ctx context.Context, text string, images []image) error {
|
||||
imgs := []codex.Image{}
|
||||
for _, img := range images {
|
||||
imgs = append(imgs, codex.Image{MediaType: img.mediaType, Data: img.data})
|
||||
}
|
||||
_, err := p.s.Send(ctx, text, imgs...)
|
||||
func (p codexProcess) send(ctx context.Context, text string, images []agentinput.Image) error {
|
||||
_, err := p.s.Send(ctx, text, images...)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -267,12 +255,8 @@ func (m *Manager) startAntigravity(ctx context.Context, sess api.AgentSession, l
|
||||
return antigravityProcess{s: s}, nil
|
||||
}
|
||||
|
||||
func (p antigravityProcess) send(ctx context.Context, text string, images []image) error {
|
||||
imgs := []antigravity.Image{}
|
||||
for _, img := range images {
|
||||
imgs = append(imgs, antigravity.Image{MediaType: img.mediaType, Data: img.data})
|
||||
}
|
||||
return p.s.Send(text, imgs...)
|
||||
func (p antigravityProcess) send(ctx context.Context, text string, images []agentinput.Image) error {
|
||||
return p.s.Send(text, images...)
|
||||
}
|
||||
|
||||
func (p antigravityProcess) interrupt(ctx context.Context) error {
|
||||
|
||||
Reference in New Issue
Block a user