maybeEnableImageReplies wires the runner to attach a generated/edited image to the final reply per CHATCLI_GATEWAY_IMAGE_REPLY (auto default, never off).
(runner *gateway.Runner, outbox *gatewayImageOutbox)
| 439 | // maybeEnableImageReplies wires the runner to attach a generated/edited image |
| 440 | // to the final reply per CHATCLI_GATEWAY_IMAGE_REPLY (auto default, never off). |
| 441 | func (cli *ChatCLI) maybeEnableImageReplies(runner *gateway.Runner, outbox *gatewayImageOutbox) { |
| 442 | if imageReplyMode(os.Getenv("CHATCLI_GATEWAY_IMAGE_REPLY")) == imageReplyNever { |
| 443 | return |
| 444 | } |
| 445 | cli.logger.Info("gateway: image replies enabled") |
| 446 | runner.SetImageProvider(func(_ context.Context, session string) *gateway.OutboundImage { |
| 447 | return outbox.take(session) |
| 448 | }) |
| 449 | } |
| 450 | |
| 451 | // loadFirstGeneratedImage reads the first existing image path into an |
| 452 | // OutboundImage. Returns nil when there is nothing to send or it is unreadable. |
no test coverage detected