mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-14 12:02:27 +08:00
refactor(platform): 多协议供应商的转发与探测判断改查 profile
平台清单之外,后端还有几处用"国产厂商"或"国产厂商 ∪ OpenCode"表示 多协议供应商,新登记的供应商会被漏掉(例如上游模型同步直接报不支持)。 - 适用于全部多协议供应商的判断改用 IsMultiProtocolAPIKey:上游模型同步与 模型目录基址、Anthropic count_tokens 本地估算、HTML 403 豁免与累计计数、Claude 型号 计费候选过滤; - 新增 RoutesProtocolByInbound(profile 分流方式为按入站协议),替换原来 只针对国产厂商、实际描述"按入站协议分流"的判断:Responses 直转回退、 Responses 能力标记(含创建 / 更新后的异步探测调度)、上游计费探测的 adaptive 基址、Anthropic API Key 鉴权方式、OpenAI 输入 token 本地估算。 按模型分流的供应商(OpenCode)仍走 routesByModel 分支。 依赖各家额度 / 余额接口的逻辑(Coding Plan 窗口、余额不足冷却等)仍按平台 显式判断。现有平台上两组判断与改动前逐一相同(测试覆盖全部平台与非法值); 另测试临时登记的新供应商按分流方式分别获得国产厂商与 OpenCode 的行为。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
eefa7dd9dc
commit
c556aee8fd
@@ -1226,7 +1226,7 @@ func (h *AccountHandler) Update(c *gin.Context) {
|
||||
// 网关会按"现状即证据"默认走 Responses。
|
||||
func (h *AccountHandler) scheduleOpenAIResponsesProbe(account *service.Account) {
|
||||
if account == nil || account.Type != service.AccountTypeAPIKey ||
|
||||
(account.Platform != service.PlatformOpenAI && !service.IsCNProvider(account.Platform)) {
|
||||
(account.Platform != service.PlatformOpenAI && !account.RoutesProtocolByInbound()) {
|
||||
return
|
||||
}
|
||||
if h.accountTestService == nil {
|
||||
|
||||
Reference in New Issue
Block a user