fix(telegram): pass images from bridge to agent
SubmitOrQueue was discarding the images parameter. Now passes them through to startTurnWithImages so photos sent via Telegram are included in the prompt.
- commit
- 9cc50ecf7145b7be94260b7110f96f77f9b07152
- author
- patriceckhart · · 2026-04-26 12:25 UTC
- parent
- b2fa0e3
- signature
- unsigned
- refs
- tag: v0.1.22
1 file · +7 -3
M internal/agent/modes/interactive.go +7 -3
| @@ -1671,7 +1671,6 @@ func (i *Interactive) Submit(text string) { | |||
| 1671 | 1671 | // forwarded — because the queued-prompt path is text-only; a | |
| 1672 | 1672 | // follow-up can expand the queue entry to carry images. | |
| 1673 | 1673 | func (i *Interactive) SubmitOrQueue(text string, images []provider.ImageBlock) { | |
| 1674 | - | _ = images // reserved for future queued-with-images support | |
| 1675 | 1674 | i.mu.Lock() | |
| 1676 | 1675 | if i.agent == nil { | |
| 1677 | 1676 | i.statusErr = "not logged in. type /login first." | |
| @@ -1680,13 +1679,14 @@ func (i *Interactive) SubmitOrQueue(text string, images []provider.ImageBlock) { | |||
| 1680 | 1679 | return | |
| 1681 | 1680 | } | |
| 1682 | 1681 | if i.busy { | |
| 1682 | + | // Queue text only; images are dropped for queued prompts. | |
| 1683 | 1683 | i.queued = append(i.queued, text) | |
| 1684 | 1684 | i.mu.Unlock() | |
| 1685 | 1685 | i.invalidate() | |
| 1686 | 1686 | return | |
| 1687 | 1687 | } | |
| 1688 | 1688 | i.mu.Unlock() | |
| 1689 | - | i.startTurn(i.runCtx, text) | |
| 1689 | + | i.startTurnWithImages(i.runCtx, text, images) | |
| 1690 | 1690 | } | |
| 1691 | 1691 | ||
| 1692 | 1692 | // CancelTurn aborts the active turn if one is running. Used by the | |
| @@ -2548,6 +2548,10 @@ func (i *Interactive) runCompact(parent context.Context, auto bool) { | |||
| 2548 | 2548 | } | |
| 2549 | 2549 | ||
| 2550 | 2550 | func (i *Interactive) startTurn(parent context.Context, prompt string) { | |
| 2551 | + | i.startTurnWithImages(parent, prompt, nil) | |
| 2552 | + | } | |
| 2553 | + | ||
| 2554 | + | func (i *Interactive) startTurnWithImages(parent context.Context, prompt string, images []provider.ImageBlock) { | |
| 2551 | 2555 | if i.agent == nil { | |
| 2552 | 2556 | return | |
| 2553 | 2557 | } | |
| @@ -2575,7 +2579,7 @@ func (i *Interactive) startTurn(parent context.Context, prompt string) { | |||
| 2575 | 2579 | } | |
| 2576 | 2580 | ||
| 2577 | 2581 | go func() { | |
| 2578 | - | err := i.agent.Prompt(ctx, prompt, nil, sink) | |
| 2582 | + | err := i.agent.Prompt(ctx, prompt, images, sink) | |
| 2579 | 2583 | i.mu.Lock() | |
| 2580 | 2584 | i.busy = false | |
| 2581 | 2585 | // Don't touch streamPending / streamFlushPending here — the | |
| @@ -1671,7 +1671,6 @@ func (i *Interactive) Submit(text string) { | |||||
| 1671 | // forwarded — because the queued-prompt path is text-only; a | 1671 | // forwarded — because the queued-prompt path is text-only; a | ||
| 1672 | // follow-up can expand the queue entry to carry images. | 1672 | // follow-up can expand the queue entry to carry images. | ||
| 1673 | func (i *Interactive) SubmitOrQueue(text string, images []provider.ImageBlock) { | 1673 | func (i *Interactive) SubmitOrQueue(text string, images []provider.ImageBlock) { | ||
| 1674 | - | _ = images // reserved for future queued-with-images support | |||
| 1675 | i.mu.Lock() | 1674 | i.mu.Lock() | ||
| 1676 | if i.agent == nil { | 1675 | if i.agent == nil { | ||
| 1677 | i.statusErr = "not logged in. type /login first." | 1676 | i.statusErr = "not logged in. type /login first." | ||
| @@ -1680,13 +1679,14 @@ func (i *Interactive) SubmitOrQueue(text string, images []provider.ImageBlock) { | |||||
| 1680 | return | 1679 | return | ||
| 1681 | } | 1680 | } | ||
| 1682 | if i.busy { | 1681 | if i.busy { | ||
| 1682 | + | // Queue text only; images are dropped for queued prompts. | |||
| 1683 | i.queued = append(i.queued, text) | 1683 | i.queued = append(i.queued, text) | ||
| 1684 | i.mu.Unlock() | 1684 | i.mu.Unlock() | ||
| 1685 | i.invalidate() | 1685 | i.invalidate() | ||
| 1686 | return | 1686 | return | ||
| 1687 | } | 1687 | } | ||
| 1688 | i.mu.Unlock() | 1688 | i.mu.Unlock() | ||
| 1689 | - | i.startTurn(i.runCtx, text) | 1689 | + | i.startTurnWithImages(i.runCtx, text, images) |
| 1690 | } | 1690 | } | ||
| 1691 | 1691 | ||||
| 1692 | // CancelTurn aborts the active turn if one is running. Used by the | 1692 | // CancelTurn aborts the active turn if one is running. Used by the | ||
| @@ -2548,6 +2548,10 @@ func (i *Interactive) runCompact(parent context.Context, auto bool) { | |||||
| 2548 | } | 2548 | } | ||
| 2549 | 2549 | ||||
| 2550 | func (i *Interactive) startTurn(parent context.Context, prompt string) { | 2550 | func (i *Interactive) startTurn(parent context.Context, prompt string) { | ||
| 2551 | + | i.startTurnWithImages(parent, prompt, nil) | |||
| 2552 | + | } | |||
| 2553 | + | ||||
| 2554 | + | func (i *Interactive) startTurnWithImages(parent context.Context, prompt string, images []provider.ImageBlock) { | |||
| 2551 | if i.agent == nil { | 2555 | if i.agent == nil { | ||
| 2552 | return | 2556 | return | ||
| 2553 | } | 2557 | } | ||
| @@ -2575,7 +2579,7 @@ func (i *Interactive) startTurn(parent context.Context, prompt string) { | |||||
| 2575 | } | 2579 | } | ||
| 2576 | 2580 | ||||
| 2577 | go func() { | 2581 | go func() { | ||
| 2578 | - | err := i.agent.Prompt(ctx, prompt, nil, sink) | 2582 | + | err := i.agent.Prompt(ctx, prompt, images, sink) |
| 2579 | i.mu.Lock() | 2583 | i.mu.Lock() | ||
| 2580 | i.busy = false | 2584 | i.busy = false | ||
| 2581 | // Don't touch streamPending / streamFlushPending here — the | 2585 | // Don't touch streamPending / streamFlushPending here — the | ||