feat(settings): 添加 OpenAI 兼容性文档与设置页连接诊断#80
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7bcd812287
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| 'Authorization': `Bearer ${openAiApiKey}`, | ||
| 'Content-Type': 'application/json', | ||
| }; | ||
| const model = openAiModel || 'gpt-4o-mini'; |
There was a problem hiding this comment.
Align diagnostic fallback model with app runtime default
Use the same fallback model as the chat runtime to avoid false negatives in the new connection test. The runtime path defaults to gpt-4o when no model is set (src/shared/services/providers/OpenAIChatService.ts, line 91), but this diagnostic defaults to gpt-4o-mini, so users who leave the model blank can see /chat/completions//responses failures in diagnostics even though normal chat would use a different model and succeed.
Useful? React with 👍 / 👎.
| const contentType = response.headers.get('content-type') || ''; | ||
| return response.ok && (contentType.includes('text/event-stream') || contentType.includes('application/x-ndjson')); |
There was a problem hiding this comment.
Relax stream probe to match actual streaming parser behavior
The stream probe currently requires content-type to include text/event-stream or application/x-ndjson, but the production OpenAI streaming path parses data: lines from the body and does not gate on that header (src/shared/services/providers/OpenAIChatService.ts, lines 114-138). OpenAI-compatible gateways that stream correctly with a non-matching header will be marked as unsupported here, causing misleading "disable stream" recommendations.
Useful? React with 👍 / 👎.
Motivation
/models、/chat/completions、/responses、tools、stream等能力的经验性支持情况,便于快速判断兼容性。Description
public/dev_doc/OPENAI_COMPAT_MATRIX.md,整理能力维度、只读探测策略、建议配置映射与典型故障提示。src/pages/SettingsPage.tsx中新增诊断类型ProbeResult与handleConnectionTest,实现对GET /models、POST /chat/completions、POST /responses、tools 探测以及 stream 输出头探测的只读探针,并将结果映射为可读建议在 UI 中展示。public/locales/{zh-CN,en,ja}.json)以支持诊断提示与建议的本地化显示。Testing
npm run build,构建成功(vite build完成且产物生成)。Codex Task