fix(provider): 模型测试按 Key 模型权限过滤

测试模型前检查 provider key 的 allowed_models:
- 空权限视为允许所有模型
- 非空权限需匹配请求模型或映射后的实际模型
- 不匹配的 key 标记为跳过,避免发起测试请求

同时补充相关单测和前端跳过原因文案。
This commit is contained in:
AAEE86
2026-05-26 16:46:21 +08:00
parent 7e76c9763d
commit 949e251b2e
4 changed files with 130 additions and 4 deletions
@@ -372,6 +372,11 @@ describe('isModelTestableEndpoint', () => {
})
describe('formatModelTestDiagnostic', () => {
it('maps model permission skips to an actionable label', () => {
expect(formatModelTestDiagnostic('key_model_not_allowed'))
.toBe('Key 未允许当前模型,已跳过')
})
it('maps pool account blocked scheduler code to an actionable label', () => {
expect(formatModelTestDiagnostic('pool_account_blocked')).toBe('账号已失效,需重新授权')
})
@@ -41,6 +41,7 @@ const MODEL_TEST_BEARER_INHERITS_PROVIDER_FORMATS = new Set([
])
const MODEL_TEST_DIAGNOSTIC_LABELS: Record<string, string> = {
key_model_not_allowed: 'Key 未允许当前模型,已跳过',
pool_account_blocked: '账号已失效,需重新授权',
}