feat(service): add OpenAI completions models output probe#97
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds a new probe to test the OpenAI-compatible /models endpoint for LLM providers. The feature addresses an issue where some domestic Chinese LLM providers that support OpenAI-compatible APIs would show as "Unsupported" during connection testing. By adding a probe that checks the /models endpoint, the system can now better identify providers that support OpenAI-compatible APIs even if they don't support all other endpoints.
Changes:
- Added backend probe function
probeOpenAICompletionsModelsOutputto test the/modelsendpoint with OpenAI-style authentication - Updated the provider test response to include 6 checks instead of 5
- Added UI display for the new "OpenAI Completions Models" check result in the provider form
- Added translations for the new check in both English and Chinese locales
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/providers/service.go | Added new probe function and integrated it into the concurrent probe execution flow |
| packages/web/src/pages/models/components/provider-form.vue | Added UI display for the new "openai-completions-models-output" check result |
| packages/web/src/i18n/locales/zh.json | Added Chinese translation for "OpenAI Completions Models" |
| packages/web/src/i18n/locales/en.json | Added English translation for "OpenAI Completions Models" |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return probeEndpoint(ctx, http.MethodGet, baseURL+"/models", | ||
| map[string]string{ | ||
| "Authorization": "Bearer " + apiKey, | ||
| "Content-Type": "application/json", |
There was a problem hiding this comment.
The Content-Type header is unnecessary for a GET request with no body. Other probe functions that make GET requests (like probeGoogleGenerativeAI on line 288) don't include this header. For consistency with the existing codebase pattern, consider removing the Content-Type header from the headers map.
| "Content-Type": "application/json", |
|
也许有更优雅的方式来兼容检测这些api? |
我目前看到的文档和测试结果表明,模型错误和没带apikey是一样的401报错,文档里面也没有相关probe的资料 这些服务商大多都是openai类型兼容的,可以用输出model变相测试是否正确,算是一种参考手段。 |
可以改一下现有的openai completion检测方法,使用获取model检测 |
已修改/ |
一些国内的大模型可以使用,但是测试链接的时候会显示Unsupported
添加一个 Models 列表检查以用于判断