fix(proxy): 修复厂商Base URL中path部分不生效,仅host生效的问题#2
Open
jones-187 wants to merge 1 commit intomtfly:mainfrom
Open
Conversation
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.
问题描述
当前代码只提取
base_url的 host 部分,丢弃了 path。导致包含自定义路径的 Base URL(如cloud.infini-ai.com/maas/coding)无法正常工作。修复内容
完整保留 Base URL 的 path 部分,正确拼接到请求 endpoint。
这个修改会改变 Base URL 的解析方式,现有用户可能需要调整配置。
变更对比
https://api.xxxx.com/v1/v1/completion✅/v1/v1/completion❌https://api.openai.comhttps://api.xxxx.com/v1/completion✅/v1/completion✅https://api.xxxx.com/maas/coding/v1/completion❌/maas/coding/v1/completion✅用户迁移指南
如果用户之前配置的是:
https://api.openai.com/v1→ 需要改为https://api.openai.comhttps://任意地址/v1→ 需要去掉末尾的/v1如果用户之前配置的是:
https://api.openai.com(不带/v1)→ 之前可能不工作,修复后正常工作,无需修改测试情况
我已测试:
cloud.infini-ai.com/maas/coding)→ 正常工作我无法测试(缺少账号):
逻辑分析 未实测:
/v1的情况会变成/v1/v1,需要用户修改配置请求协助
麻烦作者帮忙:
阿里云coding plan账号测试https://coding.dashscope.aliyuncs.com(去掉/v1)能否正常工作如果这个 breaking change 不可接受,我可以换一种方案(例如只保留非
/v1的 path,自动去除末尾/v1),请告知。