@@ -118,8 +118,8 @@
provider icon
@@ -443,6 +443,37 @@ const filteredModels = computed(() => { return filtered }) +// 新增:按照getProviderIcon顺序排列的提供商统计 +const sortedProviderStats = computed(() => { + if (!modelsData.value?.groupedByProvider) { + return [] + } + + // 定义提供商顺序(与getProviderIcon中的顺序一致) + const providerOrder = ['openai', 'anthropic', 'google', 'deepseek', 'doubao', 'qianwen', 'other'] + + const stats = [] + + // 按照预定义顺序添加存在的提供商 + for (const provider of providerOrder) { + if (modelsData.value.groupedByProvider[provider]) { + stats.push({ + provider, + models: modelsData.value.groupedByProvider[provider] + }) + } + } + + // 添加不在预定义列表中的其他提供商 + for (const [provider, models] of Object.entries(modelsData.value.groupedByProvider)) { + if (!providerOrder.includes(provider)) { + stats.push({ provider, models }) + } + } + + return stats +}) + // 辅助函数 const getProviderName = (provider: string) => { const names: Record = { @@ -1612,3 +1643,4 @@ onMounted(() => { } } + diff --git a/prompto-lab-ui/src/components/JsonViewer.vue b/prompto-lab-ui/src/components/JsonViewer.vue new file mode 100644 index 0000000..e6092ca --- /dev/null +++ b/prompto-lab-ui/src/components/JsonViewer.vue @@ -0,0 +1,569 @@ + + + + + diff --git a/prompto-lab-ui/src/components/LogDetailModal.vue b/prompto-lab-ui/src/components/LogDetailModal.vue new file mode 100644 index 0000000..8af13e1 --- /dev/null +++ b/prompto-lab-ui/src/components/LogDetailModal.vue @@ -0,0 +1,1408 @@ + + + + + diff --git a/prompto-lab-ui/src/services/aiCallLogApi.ts b/prompto-lab-ui/src/services/aiCallLogApi.ts new file mode 100644 index 0000000..d15085a --- /dev/null +++ b/prompto-lab-ui/src/services/aiCallLogApi.ts @@ -0,0 +1,53 @@ +import { API_CONFIG } from './apiConfig' +import { apiJsonRequest } from './apiUtils' +import type { AICallLogSummary, AICallLog, LogStatistics, ApiResponse } from '@/types/system' + +export const aiCallLogApi = { + // 获取所有日志摘要(轻量级) + async getAllLogSummaries(): Promise { + return apiJsonRequest(`${API_CONFIG.BASE_URL}/sf/api/ai-logs`, { + method: 'GET', + requireAuth: true + }) + }, + + // 根据调用ID获取完整日志详情 + async getFullLog(callId: string): Promise { + return apiJsonRequest(`${API_CONFIG.BASE_URL}/sf/api/ai-logs/${encodeURIComponent(callId)}`, { + method: 'GET', + requireAuth: true + }) + }, + + // 根据操作类型获取日志摘要 + async getLogSummariesByOperation(operationType: string): Promise { + return apiJsonRequest(`${API_CONFIG.BASE_URL}/sf/api/ai-logs/operation/${encodeURIComponent(operationType)}`, { + method: 'GET', + requireAuth: true + }) + }, + + // 根据模型名称获取日志摘要 + async getLogSummariesByModel(modelName: string): Promise { + return apiJsonRequest(`${API_CONFIG.BASE_URL}/sf/api/ai-logs/model/${encodeURIComponent(modelName)}`, { + method: 'GET', + requireAuth: true + }) + }, + + // 获取统计信息 + async getStatistics(): Promise { + return apiJsonRequest(`${API_CONFIG.BASE_URL}/sf/api/ai-logs/statistics`, { + method: 'GET', + requireAuth: true + }) + }, + + // 清空所有日志 + async clearLogs(): Promise { + return apiJsonRequest(`${API_CONFIG.BASE_URL}/sf/api/ai-logs`, { + method: 'DELETE', + requireAuth: true + }) + } +} diff --git a/prompto-lab-ui/src/services/aiModelApi.ts b/prompto-lab-ui/src/services/aiModelApi.ts index 72f81e3..05e5e6b 100644 --- a/prompto-lab-ui/src/services/aiModelApi.ts +++ b/prompto-lab-ui/src/services/aiModelApi.ts @@ -39,10 +39,10 @@ export const aiModelApi = { }, // 测试模型连接 - 改为POST请求 - // 测试模型连接 - 修改为路径参数方式 async testModel(modelName: string): Promise { - return apiJsonRequest(`${API_CONFIG.BASE_URL}/sf/api/models/${encodeURIComponent(modelName)}/test`, { + return apiJsonRequest(`${API_CONFIG.BASE_URL}/sf/api/models/test`, { method: 'POST', + body: JSON.stringify({ modelName }), requireAuth: true }) } diff --git a/prompto-lab-ui/src/services/systemApi.ts b/prompto-lab-ui/src/services/systemApi.ts new file mode 100644 index 0000000..c5eea45 --- /dev/null +++ b/prompto-lab-ui/src/services/systemApi.ts @@ -0,0 +1,37 @@ +import { API_CONFIG } from './apiConfig' +import { apiJsonRequest } from './apiUtils' +import type { SystemOverview, ApiResponse } from '@/types/system' + +export const systemApi = { + // 获取系统概览信息 + async getSystemOverview(): Promise { + return apiJsonRequest(`${API_CONFIG.BASE_URL}/sf/api/system/overview`, { + method: 'GET', + requireAuth: true + }) + }, + + // 创建系统配置备份 + async createBackup(): Promise { + return apiJsonRequest(`${API_CONFIG.BASE_URL}/sf/api/system/backup`, { + method: 'POST', + requireAuth: true + }) + }, + + // 刷新系统配置 + async refreshSystem(): Promise { + return apiJsonRequest(`${API_CONFIG.BASE_URL}/sf/api/system/refresh`, { + method: 'POST', + requireAuth: true + }) + }, + + // 重置系统配置 + async resetSystem(): Promise { + return apiJsonRequest(`${API_CONFIG.BASE_URL}/sf/api/system/reset`, { + method: 'POST', + requireAuth: true + }) + } +} \ No newline at end of file diff --git a/prompto-lab-ui/src/views/ApiConfigView.vue b/prompto-lab-ui/src/views/ApiConfigView.vue index 51c9ba4..04932c9 100644 --- a/prompto-lab-ui/src/views/ApiConfigView.vue +++ b/prompto-lab-ui/src/views/ApiConfigView.vue @@ -1,20 +1,9 @@