Files
Goulingyun 63dbb7d27d feat(qq): implement file send & receive via OneBot HTTP API (#323)
* feat(qq): implement FileSender via OneBot HTTP API

Add file sending support (core.FileSender) to the QQ platform.
Files are base64-encoded to avoid local-path issues across
Windows/WSL/Docker boundaries.

- SendFile: group via upload_group_file, private via send_private_msg
  with file message segment
- callHTTPAPI: new method that calls OneBot v11 HTTP endpoints,
  preferred over WebSocket for large file payloads
- New config option `http_url`: points to the OneBot HTTP API
  (e.g. NapCat/Lagrange HTTP server). When set, file operations
  route through HTTP; otherwise falls back to WebSocket.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(qq): implement file receiving with NapCat best-practice fallback chain

Add file attachment receiving support to the QQ platform. When a user
sends a file (PDF, docx, etc.), parseMessage now extracts it as a
core.FileAttachment so the agent can read it.

Download strategy follows NapCat recommended best practices:
1. Direct download from segment URL (120s timeout for large files)
2. get_group_file_url / get_private_file_url for fresh CDN links
   (original URLs expire quickly and have download count limits)
3. get_file as last resort (NapCat local download or base64)

Key details:
- get_group_file_url requires param "group" (string), not "group_id"
- downloadLargeFile with 120s timeout (vs 30s for images)
- HTTP status code validation to fail fast on 404 expired URLs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Gou Lingyun <62201655+ganansuan647@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-06-09 23:34:22 +08:00
..