bug: openai-chat bridge hard-rejects web_search for custom providers
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 395
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
### 问题描述 / What happened
自定义 OpenAI 兼容提供者(协议走 openai-chat 即 Responses→Chat Completions 桥)无法用于对话:客户端自动注入 `web_search` 内置工具,openai-chat 桥对该工具单独抛错,接口返回 400,任何模型(包括纯文本对话)都不可用。用户侧没有关闭 web_search 的配置入口。
实际行为:`{"error":{"type":"invalid_request_error","code":"unsupported_feature","message":"Responses feature is not supported by the Chat Completions bridge: tools[26].web_search"}}`
期望行为:桥接层应像丢弃其他不支持的 tools 一样丢弃 web_search(或提供开关),而不是让整个请求失败。
### 环境 / Environment
- Cindy 版本或 commit / version or commit: 0.1.43(app.asar 反编译确认)
- 平台与版本 / platform & OS version: Windows 10/11 x64
- 安装方式 / install method: 桌面客户端安装包
### 复现步骤 / Steps to reproduce
1. 添加自定义模型提供者「基元律动」,Base URL `https://tokenrhythm.studio/v1`,Chat 接口 `/chat/completions`,wire protocol 选 openai-chat。
2. 对话中选择该提供者模型,正常提问。
3. 客户端自动在 Responses 请求中附加 `tools`(含第 26 项 `web_search`)。
4. 接口返回 400,对话完全不可用。
### 日志与截图 / Logs & screenshots
复现报错:
```
{"error":{"type":"invalid_request_error","code":"unsupported_feature","message":"Responses feature is not supported by the Chat Completions bridge: tools[26].web_search"}}
```
根因(app.asar 内 `bootstrap-electron-SDtU5ylA.js`,Cindy 0.1.43):
`createResponsesChatHandler` 的 `onDroppedTool` 回调:
```js
onDroppedTool: (type, index) => {
if (type === "web_search") throw new UnsupportedResponsesFeatureError(`tools[${index}].web_search`);
// 其他类型仅 warn 后丢弃
}
```
`reportDroppedTools` 会把所有非 `function/custom/namespace/tool_search` 工具交给 `onDroppedTool`。对比同文件 `sanitizeXaiTools`(xAI)与 `sanitizeByteDanceSeedTools`(字节)都是清洗丢弃,不抛错。
建议:openai-chat 桥对 web_search 与其它 dropped tool 一致处理(丢弃 + warn),或提供配置开关禁用自动注入。
Contributor guide
Research direction
Start with bootstrap-electron-SDtU5ylA.js and the createResponsesChatHandler onDroppedTool callback described in the report. Compare its handling with reportDroppedTools, sanitizeXaiTools, and sanitizeByteDanceSeedTools. Done means web_search no longer causes a 400 for openai-chat providers and is instead dropped with a warning, while other unsupported-tool behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100