Refactor vision model configuration handling in voice_webrtc.py

- Update vision model authorization logic to rely solely on server-side configuration, removing client offer dependency for vision capabilities.
- Enhance clarity in comments regarding the role of server configurations in enabling vision understanding.
This commit is contained in:
Xin Wang
2026-07-08 12:40:14 +08:00
parent 5bc4e24adb
commit 6a17855e17

View File

@@ -87,7 +87,8 @@ async def _handle_offer(websocket, payload, peers):
await pc.renegotiate(sdp=offer.sdp, type=offer.type, restart_pc=False)
else:
cfg = await _resolve_config(offer) # 解析放在建连前,配置错就别建连
vision_enabled = offer.vision_enabled or cfg.vision_enabled
# 服务端助手配置是视觉理解的唯一授权来源;客户端 offer 只负责携带媒体轨。
vision_enabled = cfg.vision_enabled
if vision_enabled:
has_native_vision = (
not cfg.vision_model_resource_id and cfg.llm_support_image_input