Update api-config.ts for dynamic API version prefix support#76
Closed
scalaview wants to merge 14 commits intosaturndec:mainfrom
Closed
Update api-config.ts for dynamic API version prefix support#76scalaview wants to merge 14 commits intosaturndec:mainfrom
scalaview wants to merge 14 commits intosaturndec:mainfrom
Conversation
### ✨ 新功能 - 增加 OpenAI 兼容图片、视频格式支持 ### 🐛 修复 - 修复默认模型配置后项目模型需要二次选择的问题 - 修复部分情况 resolution 无法读取的问题 - 修复模型链路为 LangGraph - 修复默认参数无选择问题 - 修复关闭计费依然触发计费问题 - 修复 openai-compatible 被误判为原生 OpenAI 推理问题 - 修复 JSON 解析失败问题 ### ⚙️ 优化 - 修改为默认计费 off - 增强提示词 JSON 格式限制
### ✨ 新功能 - 增加 OpenAI 兼容图片、视频格式支持 ### 🐛 修复 - 修复默认模型配置后项目模型需要二次选择的问题 - 修复部分情况 resolution 无法读取的问题 - 修复模型链路为 LangGraph - 修复默认参数无选择问题 - 修复关闭计费依然触发计费问题 - 修复 openai-compatible 被误判为原生 OpenAI 推理问题 - 修复 JSON 解析失败问题 ### ⚙️ 优化 - 修改为默认计费 off - 增强提示词 JSON 格式限制
Updated beta notice for clarity and emphasis.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
修复使用 OpenAI 兼容 API 接入智谱时,由于智谱 base_url 包含
/v4前缀而导致 API 调用报错的问题。错误现象:
问题根因:
当用户配置智谱 API 的 baseUrl 为
https://open.bigmodel.cn/api/paas/v4时,原代码仅检查路径中是否包含v1,未包含则强制追加/v1,导致最终 URL 变成错误的.../v4/v1/chat/completions。normalizeProviderBaseUrl函数的版本检测逻辑v1改为检查最后一个路径段是否为版本标识符(支持 v1, v2, v4, v1beta, v1alpha 等)/^v\d+/匹配版本前缀,而非简单的字符串包含判断/v4作为 API 版本前缀,而非标准的/v1v4为有效版本,导致错误地追加/v1v开头的数字版本前缀,兼容不同 API 提供商的版本规范Architecture Plan Sync (Required)
/Users/earth/Desktop/waoowaoo/docs/architecture-unification-master-plan.md✅/🔄/⏸/⚠️) in the same PR.Phase Status Delta (Required)
src/lib/query/task-target-overlay.tsGuardrails Checklist (Required)
Validation
Commands run:
npm run lint- 通过 ESLint 检查npm run typecheck- 通过 TypeScript 类型检查npm test- 通过相关单元测试Manual verification:
https://open.bigmodel.cn/api/paas/v4https://open.bigmodel.cn/api/paas/v4/chat/completions(正确)/v1Risks
openai-compatible类型的 providerv1beta,v2alpha),新逻辑能正确识别并保留