Repository navigation
Conversation
"" means "never configured" for new and preset providers, so it could not also mean "no suffix": the runtime fell back to the default suffix and the settings page showed the default again on reopen. Store an explicit "none" marker for "no suffix" and keep "" as "use the default", so existing providers request the same URLs as before. The meaning of the stored value now lives in src/shared/providerSuffix.ts, used by both ModelService and the settings page, so the preview matches the real URL. Gemini appends the model path itself, so the factory passes exactEndpoint to keep the request on the base URL. "No suffix" without a base URL now fails instead of falling back to the official endpoint with a gateway's key.
The model list sent the API key but completions did not, so an Ollama behind an authenticating proxy listed models and then failed with HTTP 401 on connection test and conversion. Send the header only when a key is set. A custom-named Ollama provider matched no preset, so its model list went to /models, which Ollama does not serve. Fall back to the Ollama preset (/tags and the default base URL).
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.
Fixes #89
改动
src/shared/providerSuffix.ts,主进程和渲染进程共用:""/null表示用默认后缀,"none"表示无后缀,其他值作为路径追加。旧数据的""含义不变,不需要数据库迁移ModelService改用共享函数;选了无后缀时,Gemini 不再追加/{model}:generateContent,请求地址等于 Base URL;无后缀且 Base URL 为空时报错,避免把 Key 发到官方端点Provider.tsx选择、保存、重新打开都正确显示无后缀,地址预览与实际请求一致OllamaClient在有 Key 时发送Authorization: Bearer,没有 Key 时不带这个请求头/tags测试
providerSuffix.test.ts、ProviderEndpoint.test.ts,并补充了 Ollama、Gemini、工厂、provider handler、Provider.tsx组件的测试npm run test:unit:51 个文件,1075 个用例全部通过npm run test:renderer:18 个文件,300 个用例全部通过npm run typecheck、lint、electron-vite build:通过需要注意
"",和“未设置”区分不开,升级后需要重新选一次Base URL + /models未验证项