Files
Aether/frontend/src/api/public-models.ts
fawney19 33265b4b13 refactor(global-model): migrate model metadata to flexible config structure
将模型配置从多个固定字段(description, official_url, icon_url, default_supports_* 等)
统一为灵活的 config JSON 字段,提高扩展性。同时优化前端模型创建表单,支持从 models-dev
列表直接选择模型快速填充。

主要变更:
- 后端:模型表迁移,支持 config JSON 存储模型能力和元信息
- 前端:GlobalModelFormDialog 支持两种创建方式(列表选择/手动填写)
- API 类型更新,对齐新的数据结构
2025-12-16 12:21:21 +08:00

39 lines
991 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* Public Models API - 普通用户可访问的模型列表
*/
import client from './client'
import type { TieredPricingConfig } from './endpoints/types'
export interface PublicGlobalModel {
id: string
name: string
display_name: string | null
is_active: boolean
// 阶梯计费配置
default_tiered_pricing: TieredPricingConfig
default_price_per_request: number | null // 按次计费价格
// Key 能力支持
supported_capabilities: string[] | null
// 模型配置JSON
config: Record<string, any> | null
}
export interface PublicGlobalModelListResponse {
models: PublicGlobalModel[]
total: number
}
/**
* 获取公开的 GlobalModel 列表(普通用户可访问)
*/
export async function getPublicGlobalModels(params?: {
skip?: number
limit?: number
is_active?: boolean
search?: string
}): Promise<PublicGlobalModelListResponse> {
const response = await client.get('/api/public/global-models', { params })
return response.data
}