feat(chat): image specialist session image fallback and WS UX

- Resolve legacy multimodal inputs from session history when the user sends
  text-only (assistant images first, then user uploads); optional env toggles.
- Support relay_pointer image resolution in legacy lane collector.
- Align uvicorn WebSocket frame limit with MAX_PAYLOAD_BYTES; document
  OCLAW_UVICORN_WS_MAX_SIZE and compatible-mode env knobs.
- Admin chat: encode attachments after bubble preview; FileReader-based
  base64 for large files.
- Tests and docs for new behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-05-10 11:25:21 +08:00
parent faeb067856
commit 396dba76ea
8 changed files with 368 additions and 28 deletions

View file

@ -29,6 +29,11 @@
AIA_ASSISTANT_GATEWAY_HOST=0.0.0.0
AIA_ASSISTANT_GATEWAY_PORT=8787
# OCLAW_UVICORN_WS_MAX_SIZE uvicorn WebSocket 单帧最大字节;默认与 hello 里 maxPayload 一致(约 25MB)。
# 不设时 python -m oclaw... 仍用旧 uvicorn 默认 16MB,多图 base64 一条 chat.send 易超限被断连,前端报 ws_closed。
# 若用命令行启动 uvicorn,请自行加:--ws-max-size 26214400(或与 MAX_PAYLOAD_BYTES 一致)。
# OCLAW_UVICORN_WS_MAX_SIZE=
# AIA_PREWARM_INTERVAL_SECONDS 后台预热任务周期(秒),默认 600,合法范围代码内 clamp。
# 【前端】无。
AIA_PREWARM_INTERVAL_SECONDS=600
@ -287,6 +292,14 @@ AIA_IMAGE_EXPERT_MODEL=
AIA_IMAGE_EXPERT_BASE_URL=
AIA_IMAGE_EXPERT_API_KEY=
AIA_IMAGE_EXPERT_CHAT_ENDPOINT=
# compatible-mode defaults to OpenAI vision blocks (type + image_url/text). Set to 1 only if your gateway
# requires DashScope doc shape without "type" on each content part (may break OpenAI-compatible gateways).
# AIA_IMAGE_EXPERT_COMPAT_USE_DASHSCOPE_NATIVE_BLOCKS=
# Max input images per turn (1–12; default 8).
# AIA_IMAGE_EXPERT_MAX_INPUT_IMAGES=
# Multi-turn image specialist: inherit images from assistant/user history when this turn has no attachment (0=off).
# AIA_IMAGE_SPECIALIST_SESSION_IMAGE_FALLBACK=
# AIA_IMAGE_SPECIALIST_FALLBACK_SCAN_MESSAGES=
# Optional; image expert top-level kwargs (parity with DashScope multimodal-gen samples)
DASHSCOPE_IMAGE_STREAM=