fix: preserve provider auth metadata

This commit is contained in:
elky
2026-06-20 22:11:42 +08:00
parent 1123095bb7
commit f1c30439ff
51 changed files with 2098 additions and 420 deletions
@@ -3,14 +3,11 @@ import { describe, expect, it } from 'vitest'
import {
buildPoolCooldownFieldLayout,
buildPoolHealthToggleCards,
buildPoolCostFieldLayout,
buildPoolSecondarySectionLayout,
} from '@/features/pool/utils/poolAdvancedDialog'
describe('poolAdvancedDialog', () => {
it('returns health toggle cards in the desktop display order', () => {
expect(buildPoolHealthToggleCards().map(item => item.key)).toEqual([
'health_policy_enabled',
'probing_enabled',
'account_self_check_enabled',
'auto_remove_banned_keys',
@@ -20,11 +17,6 @@ describe('poolAdvancedDialog', () => {
it('provides tooltip copy for every desktop health toggle card', () => {
expect(buildPoolHealthToggleCards()).toEqual([
{
key: 'health_policy_enabled',
label: '健康策略',
description: '按上游错误自动冷却并跳过异常账号。',
},
{
key: 'probing_enabled',
label: '自适应热池',
@@ -48,32 +40,13 @@ describe('poolAdvancedDialog', () => {
])
})
it('returns the four cooldown-related fields in one desktop row order', () => {
it('returns only cooldown-related fields in one desktop row order', () => {
expect(buildPoolCooldownFieldLayout()).toEqual({
fields: [
'rate_limit_cooldown_seconds',
'overload_cooldown_seconds',
'sticky_session_ttl_seconds',
'global_priority',
],
desktopColumnsClass: 'xl:grid-cols-4',
})
})
it('stacks batch and cost sections as full-width rows on desktop', () => {
expect(buildPoolSecondarySectionLayout()).toEqual({
wrapperClass: 'space-y-4',
})
})
it('returns the three cost fields in one desktop row order', () => {
expect(buildPoolCostFieldLayout()).toEqual({
fields: [
'cost_window_seconds',
'cost_limit_per_key_tokens',
'cost_soft_threshold_percent',
],
desktopColumnsClass: 'xl:grid-cols-3',
desktopColumnsClass: 'xl:grid-cols-2',
})
})
})
@@ -1,5 +1,4 @@
export type PoolHealthToggleKey =
| 'health_policy_enabled'
| 'probing_enabled'
| 'account_self_check_enabled'
| 'auto_remove_banned_keys'
@@ -16,22 +15,8 @@ export interface PoolCooldownFieldLayout {
desktopColumnsClass: string
}
export interface PoolSecondarySectionLayout {
wrapperClass: string
}
export interface PoolCostFieldLayout {
fields: string[]
desktopColumnsClass: string
}
export function buildPoolHealthToggleCards(): PoolHealthToggleCard[] {
return [
{
key: 'health_policy_enabled',
label: '健康策略',
description: '按上游错误自动冷却并跳过异常账号。',
},
{
key: 'probing_enabled',
label: '自适应热池',
@@ -60,26 +45,7 @@ export function buildPoolCooldownFieldLayout(): PoolCooldownFieldLayout {
fields: [
'rate_limit_cooldown_seconds',
'overload_cooldown_seconds',
'sticky_session_ttl_seconds',
'global_priority',
],
desktopColumnsClass: 'xl:grid-cols-4',
}
}
export function buildPoolSecondarySectionLayout(): PoolSecondarySectionLayout {
return {
wrapperClass: 'space-y-4',
}
}
export function buildPoolCostFieldLayout(): PoolCostFieldLayout {
return {
fields: [
'cost_window_seconds',
'cost_limit_per_key_tokens',
'cost_soft_threshold_percent',
],
desktopColumnsClass: 'xl:grid-cols-3',
desktopColumnsClass: 'xl:grid-cols-2',
}
}