MCPcopy Create free account
hub / github.com/diillson/chatcli / maybeEnableImageReplies

Method maybeEnableImageReplies

cli/gateway_command.go:441–449  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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).
441func (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.

Callers 1

runGatewayMethod · 0.95

Calls 4

imageReplyModeFunction · 0.85
SetImageProviderMethod · 0.80
takeMethod · 0.80
InfoMethod · 0.65

Tested by

no test coverage detected