Skip to content

feat(settings): 添加 OpenAI 兼容性文档与设置页连接诊断#80

Open
CJackHwang wants to merge 1 commit into
mainfrom
codex/add-development-documentation-and-diagnostics
Open

feat(settings): 添加 OpenAI 兼容性文档与设置页连接诊断#80
CJackHwang wants to merge 1 commit into
mainfrom
codex/add-development-documentation-and-diagnostics

Conversation

@CJackHwang

Copy link
Copy Markdown
Owner

Motivation

  • 降低用户和开发者在对接 OpenAI 兼容上游时的盲调成本,提供可读化的诊断建议与故障映射。
  • 记录常见上游对 /models/chat/completions/responsestoolsstream 等能力的经验性支持情况,便于快速判断兼容性。
  • 在设置页增加轻量化、只读的连接测试,以便在客户端直接获得建议配置(协议模式、是否建议 proxy 等)。

Description

  • 新增兼容性文档 public/dev_doc/OPENAI_COMPAT_MATRIX.md,整理能力维度、只读探测策略、建议配置映射与典型故障提示。
  • src/pages/SettingsPage.tsx 中新增诊断类型 ProbeResulthandleConnectionTest,实现对 GET /modelsPOST /chat/completionsPOST /responses、tools 探测以及 stream 输出头探测的只读探针,并将结果映射为可读建议在 UI 中展示。
  • 在设置页 UI 中添加轻量“连接测试”按钮与诊断结果面板(显示每项能力的 ✅/❌ 和建议文案),并尽量使用最小化 payload 以避免副作用。
  • 新增中/英/日三套文案键(位于 public/locales/{zh-CN,en,ja}.json)以支持诊断提示与建议的本地化显示。

Testing

  • 在本地运行了构建命令 npm run build,构建成功(vite build 完成且产物生成)。

Codex Task

@vercel

vercel Bot commented May 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hey-mean Ready Ready Preview, Comment May 19, 2026 7:33pm

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +129 to +130
const contentType = response.headers.get('content-type') || '';
return response.ok && (contentType.includes('text/event-stream') || contentType.includes('application/x-ndjson'));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant