[color=rgba(0, 0, 0, 0.9)]问题二:接入 OpenCode(opencode.ai)接口,测试连接成功,发送消息报 MissingSessionID
[color=rgba(0, 0, 0, 0.9)]问题现象:添加 opencode.ai 的接口后,"测试连接"显示成功,但实际发送任意消息立即报错:{"msg": "API返回错误: Error code: 400 - {'type': 'error', 'error': {'type': 'MissingSessionID', 'message': 'Request is missing x-opencode-session and cannot be routed efficiently. Please see https://opencode.ai/docs/go/#where-can-i-use-it'}}"}
[color=rgba(0, 0, 0, 0.9)]原因分析:opencode.ai 的网关要求每个对话请求在 HTTP 头中携带 x-opencode-session(会话路由标识)。"测试连接"走的接口不校验该请求头所以能通过;发送消息时面板未携带该头,被网关拒绝。
建议修复方向:
- 自定义模型/接口配置中支持用户自定义 HTTP 请求头(如手动填写 x-opencode-session);
- 或面板侧针对该接口自动为每个对话生成并携带会话标识。
期望行为:OpenCode 接口可正常对话;自定义接口配置支持附加请求头。
|
|