test: cover media formats + doc resize cap

This commit is contained in:
Peter Steinberger
2025-11-25 22:23:06 +01:00
parent 7166efef08
commit f945e284e1
3 changed files with 154 additions and 2 deletions

View File

@@ -58,7 +58,7 @@ Notes on this configuration:
- To send an image from Claude, include a line like `MEDIA:https://example.com/pic.jpg` in the output. warelay will:
- Host local paths for Twilio using the media server/Tailscale Funnel.
- Send buffers directly for the Web provider.
- Inbound media is downloaded (≤5MB) and exposed to your templates as `{{MediaPath}}`, `{{MediaUrl}}`, and `{{MediaType}}`. You can mention this in your prompt if you want Claude to reason about the attachment.
- Inbound media is downloaded (≤5MB) and exposed to your templates as `{{MediaPath}}`, `{{MediaUrl}}`, and `{{MediaType}}`. You can mention this in your prompt if you want Claude to reason about the attachment. Outbound media from Claude (via `MEDIA:`) is resized/recompressed on the Web provider path; control the cap with `inbound.reply.mediaMaxMb` (default 5).
## Testing the setup
1. Start a relay (auto-selects Web when logged in, otherwise Twilio polling):

View File

@@ -21,7 +21,8 @@ This document defines how `warelay` should handle sending and replying with imag
## Provider Behavior
### Web (Baileys)
- Input: local file path **or** HTTP(S) URL.
- Flow: load into Buffer (max 5MB), send via `sock.sendMessage(jid, { image: buffer, caption })`.
- Flow: load into Buffer, **resize + recompress to JPEG** (max side 2048px, quality step-down) to fit under a configurable cap, then send via `sock.sendMessage(jid, { image: buffer, caption })`.
- Size cap: default 5MB; override with `inbound.reply.mediaMaxMb` in `~/.warelay/warelay.json`.
- Caption uses `--message` or `reply.text`; if caption is empty, send media-only.
- Logging: non-verbose shows `↩️`/`✅` with caption; verbose includes `(media, <bytes>B, <ms>ms fetch)`.