mirror of
https://github.com/fawney19/Aether.git
synced 2026-01-13 04:58:28 +08:00
- 将 adaptive_concurrency 重命名为 adaptive_rpm,从并发控制改为 RPM 控制 - 健康监控器支持按 API 格式独立管理健康度和熔断器状态 - 新增 model_permissions 模块,支持按格式配置允许的模型 - 重构前端提供商相关表单组件,新增 Collapsible UI 组件 - 新增数据库迁移脚本支持新的数据结构
69 lines
1.8 KiB
TypeScript
69 lines
1.8 KiB
TypeScript
import client from '../client'
|
|
import type { ProviderEndpoint, ProxyConfig } from './types'
|
|
|
|
/**
|
|
* 获取指定 Provider 的所有 Endpoints
|
|
*/
|
|
export async function getProviderEndpoints(providerId: string): Promise<ProviderEndpoint[]> {
|
|
const response = await client.get(`/api/admin/endpoints/providers/${providerId}/endpoints`)
|
|
return response.data
|
|
}
|
|
|
|
/**
|
|
* 获取 Endpoint 详情
|
|
*/
|
|
export async function getEndpoint(endpointId: string): Promise<ProviderEndpoint> {
|
|
const response = await client.get(`/api/admin/endpoints/${endpointId}`)
|
|
return response.data
|
|
}
|
|
|
|
/**
|
|
* 为 Provider 创建新的 Endpoint
|
|
*/
|
|
export async function createEndpoint(
|
|
providerId: string,
|
|
data: {
|
|
provider_id: string
|
|
api_format: string
|
|
base_url: string
|
|
custom_path?: string
|
|
headers?: Record<string, string>
|
|
timeout?: number
|
|
max_retries?: number
|
|
is_active?: boolean
|
|
config?: Record<string, any>
|
|
proxy?: ProxyConfig | null
|
|
}
|
|
): Promise<ProviderEndpoint> {
|
|
const response = await client.post(`/api/admin/endpoints/providers/${providerId}/endpoints`, data)
|
|
return response.data
|
|
}
|
|
|
|
/**
|
|
* 更新 Endpoint
|
|
*/
|
|
export async function updateEndpoint(
|
|
endpointId: string,
|
|
data: Partial<{
|
|
base_url: string
|
|
custom_path: string | null
|
|
headers: Record<string, string>
|
|
timeout: number
|
|
max_retries: number
|
|
is_active: boolean
|
|
config: Record<string, any>
|
|
proxy: ProxyConfig | null
|
|
}>
|
|
): Promise<ProviderEndpoint> {
|
|
const response = await client.put(`/api/admin/endpoints/${endpointId}`, data)
|
|
return response.data
|
|
}
|
|
|
|
/**
|
|
* 删除 Endpoint
|
|
*/
|
|
export async function deleteEndpoint(endpointId: string): Promise<{ message: string; affected_keys_count: number }> {
|
|
const response = await client.delete(`/api/admin/endpoints/${endpointId}`)
|
|
return response.data
|
|
}
|