feat(account): 账号测试支持选择模型

- 新增 GET /api/v1/admin/accounts/:id/models 接口获取账号可用模型
- 账号测试弹窗新增模型选择下拉框
- 测试时支持传入 model_id 参数,不传则默认使用 Sonnet
- API Key 账号支持根据 model_mapping 映射测试模型
- 将模型常量提取到 claude 包统一管理
This commit is contained in:
shaw
2025-12-19 15:59:39 +08:00
parent 733d4c2b85
commit ee86dbca9d
10 changed files with 212 additions and 40 deletions

View File

@@ -11,6 +11,7 @@ import type {
PaginatedResponse,
AccountUsageInfo,
WindowStats,
ClaudeModel,
} from '@/types';
/**
@@ -247,6 +248,16 @@ export async function setSchedulable(id: number, schedulable: boolean): Promise<
return data;
}
/**
* Get available models for an account
* @param id - Account ID
* @returns List of available models for this account
*/
export async function getAvailableModels(id: number): Promise<ClaudeModel[]> {
const { data } = await apiClient.get<ClaudeModel[]>(`/admin/accounts/${id}/models`);
return data;
}
export const accountsAPI = {
list,
getById,
@@ -262,6 +273,7 @@ export const accountsAPI = {
getTodayStats,
clearRateLimit,
setSchedulable,
getAvailableModels,
generateAuthUrl,
exchangeCode,
batchCreate,