Repository navigation
Conversation
Contributor
|
All contributors have signed the CLA. ✅ |
Embeddings 入口调用 SelectAccountWithSchedulerForCapability 时未传平台, 调度器默认按 openai 平台选号;分组平台为 zhipu 等国产平台时选不到账号, 无可用账号的错误分类也按 openai 判断。改为与 chat completions 一致, 使用 openAICompatibleRequestPlatform 解析的请求平台。
ychy7001
force-pushed
the
fix/embeddings-group-platform
branch
from
October 26, 2026 09:19
9ac5cde to
3ae3085
Compare
hjkl950217
added a commit
to hjkl950217/sub2api
that referenced
this pull request
Nov 6, 2026
Co-Authored-By: Claude Code <noreply@anthropic.com>
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.
问题
/v1/embeddings入口(handler/openai_embeddings.go)调用SelectAccountWithSchedulerForCapability时没有传平台,调度器默认按openai平台选号。分组平台为 zhipu、deepseek 等国产平台时,组内账号都选不到,请求返回无可用账号;无可用账号的错误分类也写死成PlatformOpenAI。chat completions、responses 等入口已经用openAICompatibleRequestPlatform解析请求平台,只有 embeddings 漏掉了。复现
POST /v1/embeddings,例如{"model":"embedding-3","input":"hi"}。修改内容
openAICompatibleRequestPlatform(ctx, apiKey)解析请求平台,通过platformOverride传给调度器。classifyNoAccountErrorFromGin改用同一个请求平台。测试
TestEmbeddingsDomesticGroupSelectsGroupPlatformAccount:zhipu 分组里同时有 openai 和 zhipu 账号时,请求只会打到 zhipu 账号,URL 为<base_url>/embeddings。不加修复时这个用例失败。go test -tags unit ./internal/handler/...通过。