feat(channels): add video support for Telegram and WebSocket

Telegram previously sent all video files as documents via send_document,
so users saw a file icon instead of an inline player. WebSocket only
accepted image MIME types, rejecting video uploads entirely.

Telegram:
- Recognize video extensions (mp4/mov/avi/mkv/webm/3gp) in _get_media_type
- Route videos through send_video with supports_streaming=True
- Add VIDEO/VIDEO_NOTE/ANIMATION to inbound message filters
- Add video MIME mappings to _get_extension
- Fix: local file sends now use _call_with_retry (previously no retry)

WebSocket:
- Expand upload MIME whitelist with video/mp4, video/webm, video/quicktime
- Add per-type size limits (_MAX_VIDEO_BYTES=20MB, _MAX_VIDEOS_PER_MESSAGE=1)
- Expand media serving endpoint to serve video with correct Content-Type

Agent:
- Add "video" to message tool media parameter description
- Add .mp4 example to identity.md system prompt

Made-with: Cursor
This commit is contained in:
Xubin Ren
2026-04-25 02:20:13 +08:00
committed by Xubin Ren
parent ee14e2df56
commit be05189f39
5 changed files with 67 additions and 20 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ from nanobot.bus.events import OutboundMessage
chat_id=StringSchema("Optional: target chat/user ID"),
media=ArraySchema(
StringSchema(""),
description="Optional: list of file paths to attach (images, audio, documents)",
description="Optional: list of file paths to attach (images, video, audio, documents)",
),
buttons=ArraySchema(
ArraySchema(StringSchema("Button label")),