fix: quarantine unavailable upstream routes and harden upgrades
This commit is contained in:
1 parent
9acc69d4c7
commit
59907cebdf
8 files changed
+424
-3
No files matched your search
+1
-1
@@ -195,7 +195,7 @@ public class OpenAiCompatibleProvider {
|
||||
if (status == 429 || details.matches(".*(rate.?limit|too many requests|concurr|并发|频率过高|请求过于频繁|限流).*")) {
|
||||
return new ApiException("UPSTREAM_RATE_LIMITED", "上游渠道限流或并发已满,请稍后重试", 429);
|
||||
}
|
||||
if (status == 404 || details.matches(".*(no available channel|model.{0,16}(not found|does not exist|unavailable)|not_found|unsupported model|没有可用渠道|模型不存在|模型不可用).*")) {
|
||||
if (status == 404 || details.matches(".*(no available channel|available channel.{0,12}(does not exist|not found)|channel.{0,12}(not found|does not exist|unavailable)|model.{0,16}(not found|does not exist|unavailable)|not_found|unsupported model|没有可用渠道|可用渠道不存在|渠道不存在|模型不存在|模型不可用).*")) {
|
||||
return new ApiException("UPSTREAM_MODEL_UNAVAILABLE", "上游渠道没有可用的模型路由", 502);
|
||||
}
|
||||
return new ApiException("UPSTREAM_PROVIDER_ERROR", "上游模型供应商请求失败", 502);
|
||||
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
-- Keep the public catalog honest after the 2026-09-28 live acceptance run.
|
||||
-- These routes returned a deterministic "no available channel"/unsupported
|
||||
-- response from the named upstream. They remain soft-disabled and editable in
|
||||
-- the admin catalog so an operator can re-enable them after the upstream adds
|
||||
-- a channel. Routes for the same logical model on another provider are kept.
|
||||
UPDATE model_catalog AS m
|
||||
SET status = 'disabled', updated_at = now()
|
||||
FROM model_providers AS p
|
||||
WHERE m.provider_id = p.id
|
||||
AND p.code = 'apipro'
|
||||
AND m.upstream_model IN (
|
||||
'Moonshot-Kimi-K2-Instruct',
|
||||
'claude-fable-5',
|
||||
'claude-haiku-4-5-20251001-thinking',
|
||||
'claude-opus-4-1-20250805',
|
||||
'claude-opus-4-1-20250805-thinking',
|
||||
'claude-opus-4-20250514',
|
||||
'claude-opus-4-20250514-thinking',
|
||||
'claude-opus-4-5-20251101-thinking',
|
||||
'claude-sonnet-4-20250514-thinking',
|
||||
'doubao-seed-1-6-lite-251015',
|
||||
'gemini-3-flash',
|
||||
'glm-4.7',
|
||||
'gpt-4.1-nano-2025-04-14',
|
||||
'gpt-5-chat',
|
||||
'gpt-5-chat-latest',
|
||||
'gpt-5-nano-2025-08-07',
|
||||
'gpt-5.1-codex',
|
||||
'gpt-5.2-pro',
|
||||
'gpt-5.4-pro',
|
||||
'gpt-5.5-pro',
|
||||
'kimi-k2-thinking',
|
||||
'kimi-k2.5',
|
||||
'kimi-k2.7-code',
|
||||
'minimax-m2.7'
|
||||
)
|
||||
AND m.status = 'active'
|
||||
AND m.deleted_at IS NULL;
|
||||
|
||||
-- TokenFoundryX's own playground currently reports these default-group routes
|
||||
-- as "可用渠道不存在". Keep the successful TokenFoundryX routes visible and
|
||||
-- quarantine only the models that failed the live probe.
|
||||
UPDATE model_catalog AS m
|
||||
SET status = 'disabled', updated_at = now()
|
||||
FROM model_providers AS p
|
||||
WHERE m.provider_id = p.id
|
||||
AND p.code = 'tokenfoundryx'
|
||||
AND m.source_label = 'TokenFoundryX 海外'
|
||||
AND m.upstream_model IN (
|
||||
'claude-fable-5'
|
||||
)
|
||||
AND m.status = 'active'
|
||||
AND m.deleted_at IS NULL;
|
||||
|
||||
-- These aliases/wildcards are catalog placeholders rather than stable
|
||||
-- OpenAI-compatible model IDs. A timeout or generic provider error is not
|
||||
-- enough evidence to disable a real route, so only wildcard aliases and
|
||||
-- deterministic "no available channel" results are quarantined here.
|
||||
UPDATE model_catalog AS m
|
||||
SET status = 'disabled', updated_at = now()
|
||||
FROM model_providers AS p
|
||||
WHERE m.provider_id = p.id
|
||||
AND p.code = 'apipro'
|
||||
AND (
|
||||
m.upstream_model LIKE '%*'
|
||||
)
|
||||
AND m.status = 'active'
|
||||
AND m.deleted_at IS NULL;
|
||||
|
||||
-- OCR requires an image payload, but the current chat gateway intentionally
|
||||
-- accepts text-only messages and the async executor has no OCR adapter. Keep
|
||||
-- it editable in the admin catalog, but do not publish a route that cannot be
|
||||
-- called successfully through the public API.
|
||||
UPDATE model_catalog
|
||||
SET status = 'disabled',
|
||||
updated_at = now()
|
||||
WHERE upstream_model = 'deepseek-ocr'
|
||||
AND provider_id IN (SELECT id FROM model_providers WHERE code = 'apipro')
|
||||
AND deleted_at IS NULL;
|
||||
Reference in new issue
Block a user