mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-03 01:40:21 +08:00
feat(ui): 新增模型请求链路预览功能
- 添加后端 API 获取 GlobalModel 的请求链路信息 (/api/admin/models/global/{id}/routing)
- 新增 RoutingTab 组件展示模型的请求链路树状结构
- 支持全局 Key 优先和提供商优先两种模式的可视化
- 重构批量模型管理对话框为单列勾选模式
- 修复 errorParser.ts 字符串拼接格式问题
- 若干 Vue 模板格式优化
This commit is contained in:
@@ -6,6 +6,16 @@ import type {
|
||||
GlobalModelWithStats,
|
||||
GlobalModelListResponse,
|
||||
ModelCatalogProviderDetail,
|
||||
ModelRoutingPreviewResponse,
|
||||
} from './types'
|
||||
|
||||
// 重新导出路由相关类型供外部使用
|
||||
export type {
|
||||
RoutingKeyInfo,
|
||||
RoutingEndpointInfo,
|
||||
RoutingModelMapping,
|
||||
RoutingProviderInfo,
|
||||
ModelRoutingPreviewResponse,
|
||||
} from './types'
|
||||
|
||||
/**
|
||||
@@ -97,3 +107,15 @@ export async function getGlobalModelProviders(globalModelId: string): Promise<{
|
||||
)
|
||||
return response.data
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 GlobalModel 的请求链路预览
|
||||
*/
|
||||
export async function getGlobalModelRoutingPreview(
|
||||
globalModelId: string
|
||||
): Promise<ModelRoutingPreviewResponse> {
|
||||
const response = await client.get(
|
||||
`/api/admin/models/global/${globalModelId}/routing`
|
||||
)
|
||||
return response.data
|
||||
}
|
||||
|
||||
@@ -622,3 +622,83 @@ export interface ImportFromUpstreamResponse {
|
||||
success: ImportFromUpstreamSuccessItem[]
|
||||
errors: ImportFromUpstreamErrorItem[]
|
||||
}
|
||||
|
||||
// ========== 路由预览相关类型 ==========
|
||||
|
||||
/**
|
||||
* Key 路由信息
|
||||
*/
|
||||
export interface RoutingKeyInfo {
|
||||
id: string
|
||||
name: string
|
||||
masked_key: string
|
||||
internal_priority: number
|
||||
global_priority?: number | null
|
||||
rpm_limit?: number | null
|
||||
is_adaptive: boolean
|
||||
effective_rpm?: number | null
|
||||
cache_ttl_minutes: number
|
||||
health_score: number
|
||||
is_active: boolean
|
||||
api_formats: string[]
|
||||
circuit_breaker_open: boolean
|
||||
circuit_breaker_formats: string[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Endpoint 路由信息
|
||||
*/
|
||||
export interface RoutingEndpointInfo {
|
||||
id: string
|
||||
api_format: string
|
||||
base_url: string
|
||||
custom_path?: string | null
|
||||
is_active: boolean
|
||||
keys: RoutingKeyInfo[]
|
||||
total_keys: number
|
||||
active_keys: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 模型名称映射信息
|
||||
*/
|
||||
export interface RoutingModelMapping {
|
||||
name: string
|
||||
priority: number
|
||||
api_formats?: string[] | null
|
||||
}
|
||||
|
||||
/**
|
||||
* Provider 路由信息
|
||||
*/
|
||||
export interface RoutingProviderInfo {
|
||||
id: string
|
||||
name: string
|
||||
model_id: string
|
||||
provider_priority: number
|
||||
billing_type?: string | null
|
||||
monthly_quota_usd?: number | null
|
||||
monthly_used_usd?: number | null
|
||||
is_active: boolean
|
||||
provider_model_name: string
|
||||
model_mappings: RoutingModelMapping[]
|
||||
model_is_active: boolean
|
||||
endpoints: RoutingEndpointInfo[]
|
||||
total_endpoints: number
|
||||
active_endpoints: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 模型请求链路预览响应
|
||||
*/
|
||||
export interface ModelRoutingPreviewResponse {
|
||||
global_model_id: string
|
||||
global_model_name: string
|
||||
display_name: string
|
||||
is_active: boolean
|
||||
providers: RoutingProviderInfo[]
|
||||
total_providers: number
|
||||
active_providers: number
|
||||
scheduling_mode: string
|
||||
priority_mode: string
|
||||
}
|
||||
|
||||
@@ -21,4 +21,5 @@ export {
|
||||
deleteGlobalModel,
|
||||
batchAssignToProviders,
|
||||
getGlobalModelProviders,
|
||||
getGlobalModelRoutingPreview,
|
||||
} from './endpoints/global-models'
|
||||
|
||||
Reference in New Issue
Block a user