mirror of
https://github.com/patriceckhart/zot.git
synced 2026-06-27 05:46:34 +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)").
|
||
|---|---|---|
| .. | ||
| extensions | ||
| modes | ||
| tools | ||
| args.go | ||
| botcmd.go | ||
| botcmd_unix.go | ||
| botcmd_windows.go | ||
| build.go | ||
| changelog.go | ||
| cli.go | ||
| config.go | ||
| extcmd.go | ||
| modelsync.go | ||
| rpc.go | ||
| systemprompt.go | ||
| update.go | ||