feat(test,export,headers): 模型测试复用统一运行时、实时进度展示、导出增强与请求头大小写保留

- 模型测试 failover 从手动 FailoverEngine 改为 TaskService.execute_sync_candidates 统一运行时
- 前端新增实时 trace 轮询进度展示(候选状态、测试账号、进度条)
- 用户导出/导入支持明文 Key 优先(版本升至 1.2),新增 email_verified 字段
- SENSITIVE_CREDENTIAL_FIELDS 统一到 provider_ops/types.py,补充 refresh_token
- 请求头大小写保留机制(resolve_header_name_case + HeaderBuilder.add 语义修改)
- Codex envelope 移除合成头部,保留客户端原始请求头
- endpoint_checker 支持自定义超时透传
- 新增 x-forwarded-scheme 到上游丢弃头部列表
This commit is contained in:
fawney19
2026-03-06 21:06:45 +08:00
parent 7950ba7dc5
commit 90760da499
28 changed files with 1485 additions and 429 deletions

View File

@@ -34,6 +34,12 @@ export interface OAuthProviderExport {
is_enabled?: boolean
}
export interface SystemConfigExport {
key: string
value: unknown
description?: string | null
}
// 配置导出数据结构
export interface ConfigExportData {
version: string
@@ -42,6 +48,7 @@ export interface ConfigExportData {
providers: ProviderExport[]
ldap_config?: LDAPConfigExport | null
oauth_providers?: OAuthProviderExport[]
system_configs?: SystemConfigExport[]
}
// 用户导出数据结构
@@ -54,6 +61,7 @@ export interface UsersExportData {
export interface UserExport {
email: string
email_verified?: boolean
username: string
password_hash: string
role: string
@@ -69,6 +77,7 @@ export interface UserExport {
}
export interface UserApiKeyExport {
key?: string | null
key_hash: string
key_encrypted?: string | null
name?: string | null
@@ -105,14 +114,18 @@ export interface ProviderExport {
name: string
description?: string | null
website?: string | null
provider_type?: string
billing_type?: string | null
monthly_quota_usd?: number | null
quota_reset_day?: number
rpm_limit?: number | null
provider_priority?: number
keep_priority_on_conversion?: boolean
enable_format_conversion?: boolean
is_active: boolean
concurrent_limit?: number | null
max_retries?: number | null
stream_first_byte_timeout?: number | null
request_timeout?: number | null
proxy?: Record<string, unknown>
config?: Record<string, unknown>
endpoints: EndpointExport[]
@@ -123,19 +136,24 @@ export interface ProviderExport {
export interface EndpointExport {
api_format: string
base_url: string
headers?: Record<string, unknown>
header_rules?: Record<string, unknown>[] | null
body_rules?: Record<string, unknown>[] | null
max_retries?: number
is_active: boolean
custom_path?: string | null
config?: Record<string, unknown>
format_acceptance_config?: Record<string, unknown> | null
proxy?: Record<string, unknown>
}
export interface ProviderKeyExport {
api_key: string
auth_type?: string
auth_config?: string | Record<string, unknown> | null
name?: string | null
note?: string | null
api_formats: string[]
supported_endpoints?: string[]
rate_multipliers?: Record<string, number> | null
internal_priority?: number
global_priority_by_format?: Record<string, number> | null
@@ -144,7 +162,13 @@ export interface ProviderKeyExport {
capabilities?: Record<string, boolean>
cache_ttl_minutes?: number
max_probe_interval_minutes?: number
auto_fetch_models?: boolean
locked_models?: string[] | null
model_include_patterns?: string[] | null
model_exclude_patterns?: string[] | null
is_active: boolean
proxy?: Record<string, unknown> | null
fingerprint?: Record<string, unknown> | null
}
export interface ModelExport {

View File

@@ -131,7 +131,9 @@ export interface TestModelResponse {
}
export async function testModel(data: TestModelRequest): Promise<TestModelResponse> {
const response = await client.post('/api/admin/provider-query/test-model', data)
const response = await client.post('/api/admin/provider-query/test-model', data, {
timeout: 10 * 60 * 1000,
})
return response.data
}
@@ -145,10 +147,12 @@ export interface TestModelFailoverRequest {
api_format?: string
endpoint_id?: string
message?: string
request_id?: string
}
export interface TestAttemptDetail {
candidate_index: number
retry_index?: number
endpoint_api_format: string
endpoint_base_url: string
key_name: string | null
@@ -174,7 +178,9 @@ export interface TestModelFailoverResponse {
}
export async function testModelFailover(data: TestModelFailoverRequest): Promise<TestModelFailoverResponse> {
const response = await client.post('/api/admin/provider-query/test-model-failover', data)
const response = await client.post('/api/admin/provider-query/test-model-failover', data, {
timeout: 10 * 60 * 1000,
})
return response.data
}

View File

@@ -12,6 +12,7 @@ export interface CandidateRecord {
endpoint_name?: string // 端点显示名称api_format
key_id?: string
key_name?: string // 密钥名称
key_account_label?: string // 更适合展示的测试账号标签(优先 OAuth 邮箱)
key_preview?: string // 密钥脱敏预览(如 sk-***abcOAuth 类型不返回
key_auth_type?: string // 密钥认证类型api_key, service_account, oauth 等)
key_oauth_plan_type?: string // OAuth 账号套餐类型free/plus/team/enterprise