fix:修复从 cherry-studio 导入备份数据时,请求自定义模型报错#351
Open
Little-LittleProgrammer wants to merge 1 commit intoCherryHQ:mainfrom
Open
fix:修复从 cherry-studio 导入备份数据时,请求自定义模型报错#351Little-LittleProgrammer wants to merge 1 commit intoCherryHQ:mainfrom
Little-LittleProgrammer wants to merge 1 commit intoCherryHQ:mainfrom
Conversation
- Add hasAPIVersion function to detect if host already contains API version - Add withoutTrailingSlash and withoutTrailingSharp helper functions - Improve formatApiHost to handle edge cases like trailing #, whitespace, etc. - Update providerConfig to pass supportApiVersion parameter for Gemini - Add comprehensive unit tests for API formatting utilities Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
|
那直接修改app的formatApiHost逻辑匹配pc端是否可以解决? |
Author
现在就是将 pc 端的 formatApiHost 的方法迁移过来,毕竟 pc 端经历了长期的线上验证,已经很稳定了,而且有多种特殊情况的处理机制,如果直接增加匹配 pc逻辑后续可能还要更改 |
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.
历史逻辑
cherry-studiopc应用里,会经过formatApiHost将所有的apiHost格式化,去掉了末尾的/a. 例如:百炼平台: https://dashscope.aliyuncs.com/compatible-mode/v1
cherry-studioapp 应用里formatApiHost会根据apiHost是否以/结尾判断是否加/v1/,cherry-studio-app, 发起请求的最终 url 会处理成https://dashscope.aliyuncs.com/compatible-mode/v1/v1/chat/completions, 最终导致请求 404现在逻辑
cherry-studioformatApiHost的方法迁移过来,增加了多种 api 格式化的分支,具体可参考测试用例