mirror of
https://github.com/patriceckhart/zot.git
synced 2026-06-27 22:06:31 +02:00
The bridge already mirrored the assistant's text reply into the
paired Telegram chat but had no way to push real attachments. A
turn that came in over Telegram could only ever produce a textual
description of an image, never the image itself.
Add two model-facing tools, registered on the running agent only
while the bridge is connected:
- telegram_send_image(path, caption?) uploads a local image
(png/jpg/gif/webp) as an inline Telegram photo. Telegram
compresses for preview, which is what you usually want for a
screenshot or chart.
- telegram_send_file(path, caption?) uploads any local file as a
document attachment with no compression. Use for non-images or
when the recipient needs the original bytes.
Plumbing:
- Client.SendPhoto multipart upload mirrors SendDocument, hitting
sendPhoto so Telegram renders the image inline.
- Bridge.SendImage / SendDocument resolve the paired chat id and
return a clear error when the bridge is not running or no user
has paired yet.
- A small TelegramSender interface in package tools keeps the
tools package free of any telegram dependency; an adapter in
interactive.go forwards to the live *telegram.Bridge.
- applyTelegramTools mutates the running agent's tool registry on
/telegram connect / disconnect, on /model swaps, and on login
rebuilds. Walks the live registry rather than restoring from a
snapshot so extension or /reload-ext additions survive a later
disconnect; we only add or strip the two telegram entries.
Both tools respect the sandbox, refuse non-image inputs in
send_image, and reject directories. They return a one-line text
result the model can use to confirm the upload ("sent /path/foo.png
to telegram (1.2 MB)").
|
||
|---|---|---|
| .. | ||
| telegram | ||
| btw_dialog.go | ||
| changelog_dialog.go | ||
| confirm_dialog.go | ||
| dialog_frame.go | ||
| ext_panel_dialog.go | ||
| file_suggest.go | ||
| help.go | ||
| image_scroll_test.go | ||
| interactive.go | ||
| json.go | ||
| jump_dialog.go | ||
| login_dialog.go | ||
| logout_dialog.go | ||
| model_dialog.go | ||
| print.go | ||
| session_dialog.go | ||
| session_ops_dialog.go | ||
| session_tree_dialog.go | ||
| skills_dialog.go | ||
| slash_suggest.go | ||
| spinner.go | ||
| telegram_dialog.go | ||
| update_banner.go | ||
| welcome.go | ||