Files
Aether/frontend/src/api/endpoints/adaptive.ts

58 lines
1.3 KiB
TypeScript
Raw Normal View History

2025-12-10 20:52:44 +08:00
import client from '../client'
import type { AdaptiveStatsResponse } from './types'
/**
* / Key
*/
export async function toggleAdaptiveMode(
keyId: string,
data: {
enabled: boolean
fixed_limit?: number
}
): Promise<{
message: string
key_id: string
is_adaptive: boolean
max_concurrent: number | null
effective_limit: number | null
}> {
const response = await client.patch(`/api/admin/adaptive/keys/${keyId}/mode`, data)
return response.data
}
/**
* Key
*/
export async function setConcurrentLimit(
keyId: string,
limit: number
): Promise<{
message: string
key_id: string
is_adaptive: boolean
max_concurrent: number
previous_mode: string
}> {
const response = await client.patch(`/api/admin/adaptive/keys/${keyId}/limit`, null, {
params: { limit }
})
return response.data
}
/**
* Key
*/
export async function getAdaptiveStats(keyId: string): Promise<AdaptiveStatsResponse> {
const response = await client.get(`/api/admin/adaptive/keys/${keyId}/stats`)
return response.data
}
/**
* Key
*/
export async function resetAdaptiveLearning(keyId: string): Promise<{ message: string; key_id: string }> {
const response = await client.delete(`/api/admin/adaptive/keys/${keyId}/learning`)
return response.data
}