From fb76f765cc6995bf078b59c04d41a0de3c85a1f8 Mon Sep 17 00:00:00 2001 From: zhaoying Date: Tue, 3 Feb 2026 14:01:28 +0800 Subject: [PATCH] style(web): translate the comments in the web/src/api directory into English --- web/src/api/apiKey.ts | 18 +++++++++----- web/src/api/application.ts | 51 ++++++++++++++++++++++---------------- web/src/api/common.ts | 8 +++--- web/src/api/fileStorage.ts | 6 +++++ web/src/api/member.ts | 16 ++++++++---- web/src/api/memory.ts | 6 +++++ web/src/api/models.ts | 6 +++++ web/src/api/order.ts | 11 ++++++-- web/src/api/prompt.ts | 6 +++++ web/src/api/user.ts | 24 +++++++++++------- web/src/api/workspaces.ts | 22 ++++++++++------ 11 files changed, 118 insertions(+), 56 deletions(-) diff --git a/web/src/api/apiKey.ts b/web/src/api/apiKey.ts index 56ad79c4..92df70c9 100644 --- a/web/src/api/apiKey.ts +++ b/web/src/api/apiKey.ts @@ -1,33 +1,39 @@ +/* + * @Author: ZhaoYing + * @Date: 2026-02-03 13:59:41 + * @Last Modified by: ZhaoYing + * @Last Modified time: 2026-02-03 13:59:41 + */ import { request } from '@/utils/request' import type { ApiKey } from '@/views/ApiKeyManagement/types' -// API Key列表 +// API Key list export const getApiKeyListUrl = '/apikeys' export const getApiKeyList = (data: Record) => { return request.get(getApiKeyListUrl, data) } -// API Key详情 +// API Key details export const getApiKey = (id: string) => { return request.get(`/apikeys/${id}`) } -// 创建API Key +// Create API Key export const createApiKey = (values: ApiKey) => { return request.post('/apikeys', values) } -// 更新API Key +// Update API Key export const updateApiKey = (id: string, values: ApiKey) => { return request.put(`/apikeys/${id}`, values) } -// 删除 API Key +// Delete API Key export const deleteApiKey = (id: string) => { return request.delete(`/apikeys/${id}`) } -// 使用统计 +// Usage statistics export const getApiKeyStats = (app_key_id: string) => { return request.get(`/apikeys/${app_key_id}/stats`) } \ No newline at end of file diff --git a/web/src/api/application.ts b/web/src/api/application.ts index 1f20282e..244f3503 100644 --- a/web/src/api/application.ts +++ b/web/src/api/application.ts @@ -1,3 +1,9 @@ +/* + * @Author: ZhaoYing + * @Date: 2026-02-03 13:59:45 + * @Last Modified by: ZhaoYing + * @Last Modified time: 2026-02-03 13:59:45 + */ import { request } from '@/utils/request' import type { ApplicationModalData } from '@/views/ApplicationManagement/types' import type { Config } from '@/views/ApplicationConfig/types' @@ -5,71 +11,72 @@ import { handleSSE, type SSEMessage } from '@/utils/stream' import type { QueryParams } from '@/views/Conversation/types' import type { WorkflowConfig } from '@/views/Workflow/types' -// 应用列表 +// Application list export const getApplicationListUrl = '/apps' export const getApplicationList = (data: Record) => { return request.get(getApplicationListUrl, data) } -// 获取应用配置 +// Get application config export const getApplicationConfig = (id: string) => { return request.get(`/apps/${id}/config`) } -// 获取集群应用配置 +// Get multi-agent config export const getMultiAgentConfig = (id: string) => { return request.get(`/apps/${id}/multi-agent`) } -// 获取 workflow应用配置 +// Get workflow config export const getWorkflowConfig = (id: string) => { return request.get(`/apps/${id}/workflow`) } -// 应用详情 +// Application details export const getApplication = (id: string) => { return request.get(`/apps/${id}`) } -// 更新应用 +// Update application export const updateApplication = (id: string, values: ApplicationModalData) => { return request.put(`/apps/${id}`, values) } -// 创建应用 +// Create application export const addApplication = (values: ApplicationModalData) => { return request.post('/apps', values) } -// 保存Agent配置 +// Save agent config export const saveAgentConfig = (app_id: string, values: Config) => { return request.put(`/apps/${app_id}/config`, values) } -// 保存集群配置 +// Save multi-agent config export const saveMultiAgentConfig = (app_id: string, values: Config) => { return request.put(`/apps/${app_id}/multi-agent`, values) } -// 保存workflow配置 +// Save workflow config export const saveWorkflowConfig = (app_id: string, values: WorkflowConfig) => { return request.put(`/apps/${app_id}/workflow`, values) } -// 模型比对试运行 +// Model comparison test run export const runCompare = (app_id: string, values: Record, onMessage?: (data: SSEMessage[]) => void) => { return handleSSE(`/apps/${app_id}/draft/run/compare`, values, onMessage) } +// Test run export const draftRun = (app_id: string, values: Record, onMessage?: (data: SSEMessage[]) => void) => { return handleSSE(`/apps/${app_id}/draft/run`, values, onMessage) } -// 删除应用 +// Delete application export const deleteApplication = (app_id: string) => { return request.delete(`/apps/${app_id}`) } -// 发布版本列表 +// Release version list export const getReleaseList = (app_id: string) => { return request.get(`/apps/${app_id}/releases`) } -// 发布版本 +// Publish release export const publishRelease = (app_id: string, values: Record) => { return request.post(`/apps/${app_id}/publish`, values) } -// 回滚版本 +// Rollback release export const rollbackRelease = (app_id: string, version: string) => { return request.post(`/apps/${app_id}/rollback/${version}`) } -// 发布版本分享 +// Share release export const shareRelease = (app_id: string, release_id: string) => { return request.post(`/apps/${app_id}/releases/${release_id}/share`, { "is_enabled": true, @@ -77,7 +84,7 @@ export const shareRelease = (app_id: string, release_id: string) => { "allow_embed": true }) } -// 获取体验对话历史 +// Get conversation history export const getConversationHistory = (share_token: string, data: { page: number; pagesize: number }) => { return request.get(`/public/share/conversations`, data, { headers: { @@ -85,7 +92,7 @@ export const getConversationHistory = (share_token: string, data: { page: number } }) } -// 发送体验对话 +// Send conversation export const sendConversation = (values: QueryParams, onMessage: (data: SSEMessage[]) => void, shareToken: string) => { return handleSSE(`/public/share/chat`, values, onMessage, { headers: { @@ -93,7 +100,7 @@ export const sendConversation = (values: QueryParams, onMessage: (data: SSEMessa } }) } -// 获取体验会话详情 +// Get conversation details export const getConversationDetail = (share_token: string, conversation_id: string) => { return request.get(`/public/share/conversations/${conversation_id}`, {}, { headers: { @@ -101,15 +108,15 @@ export const getConversationDetail = (share_token: string, conversation_id: stri } }) } -// 获取体验对话token +// Get share token export const getShareToken = (share_token: string, user_id: string) => { return request.post(`/public/share/${share_token}/token`, { user_id }) } -// 复制应用 +// Copy application export const copyApplication = (app_id: string, new_name: string) => { return request.post(`/apps/${app_id}/copy?new_name=${new_name}`) } -// 数据统计 +// Data statistics export const getAppStatistics = (app_id: string, data: { start_date: number; end_date: number; }) => { return request.get(`/apps/${app_id}/statistics`, data) } diff --git a/web/src/api/common.ts b/web/src/api/common.ts index 2f6033d1..b53e4d5f 100644 --- a/web/src/api/common.ts +++ b/web/src/api/common.ts @@ -1,5 +1,5 @@ import { request } from "@/utils/request"; -// 列表查询参数 +// List query parameters export interface Query { page?: number; pagesize?: number; @@ -38,15 +38,15 @@ export interface versionResponse{ codeName: string; }; } -// 首页数据统计 +// Dashboard data statistics export const getDashboardData = `/home-page/workspaces` -// 首页数据看板统计 +// Dashboard statistics export const getDashboardStatistics = async () => { const response = await request.get(`/home-page/statistics`); return response as DataResponse; }; -// 获取版本号 +// Get version export const getVersion = async () => { const response = await request.get(`/home-page/version`); return response as versionResponse; diff --git a/web/src/api/fileStorage.ts b/web/src/api/fileStorage.ts index e7b476a3..86da129c 100644 --- a/web/src/api/fileStorage.ts +++ b/web/src/api/fileStorage.ts @@ -1,3 +1,9 @@ +/* + * @Author: ZhaoYing + * @Date: 2026-02-03 13:59:56 + * @Last Modified by: ZhaoYing + * @Last Modified time: 2026-02-03 13:59:56 + */ import { request, API_PREFIX } from '@/utils/request' // Upload file,file storage has expiration period diff --git a/web/src/api/member.ts b/web/src/api/member.ts index 8e456e24..f186fdc4 100644 --- a/web/src/api/member.ts +++ b/web/src/api/member.ts @@ -1,20 +1,26 @@ +/* + * @Author: ZhaoYing + * @Date: 2026-02-03 14:00:01 + * @Last Modified by: ZhaoYing + * @Last Modified time: 2026-02-03 14:00:01 + */ import { request } from '@/utils/request' -// 成员列表 +// Member list export const memberListUrl = '/workspaces/members' -// 邀请成员 +// Invite member export const inviteMember = (values: { email: string }) => { return request.post(`/workspaces/invites`, values) } -// 删除成员 +// Delete member export const deleteMember = (id: string) => { return request.delete(`/workspaces/members/${id}`) } -// 更新成员 +// Update member export const updateMember = (values: { id: string, role: string }) => { return request.put(`/workspaces/members`, [values]) } -// 验证邀请token +// Validate invite token export const validateInviteToken = (token: string) => { return request.get(`/workspaces/invites/validate/${token}`) } diff --git a/web/src/api/memory.ts b/web/src/api/memory.ts index ff8e0435..6f4e7f0e 100644 --- a/web/src/api/memory.ts +++ b/web/src/api/memory.ts @@ -1,3 +1,9 @@ +/* + * @Author: ZhaoYing + * @Date: 2026-02-03 14:00:06 + * @Last Modified by: ZhaoYing + * @Last Modified time: 2026-02-03 14:00:06 + */ import { request } from '@/utils/request' import type { MemoryFormData, diff --git a/web/src/api/models.ts b/web/src/api/models.ts index e5d0f339..eb18ce91 100644 --- a/web/src/api/models.ts +++ b/web/src/api/models.ts @@ -1,3 +1,9 @@ +/* + * @Author: ZhaoYing + * @Date: 2026-02-03 14:00:09 + * @Last Modified by: ZhaoYing + * @Last Modified time: 2026-02-03 14:00:09 + */ import { request } from '@/utils/request' import type { MultiKeyForm, Query, KeyConfigModalForm, CompositeModelForm, CustomModelForm } from '@/views/ModelManagement/types' diff --git a/web/src/api/order.ts b/web/src/api/order.ts index e5d9d916..9d83538f 100644 --- a/web/src/api/order.ts +++ b/web/src/api/order.ts @@ -1,16 +1,23 @@ +/* + * @Author: ZhaoYing + * @Date: 2026-02-03 14:00:14 + * @Last Modified by: ZhaoYing + * @Last Modified time: 2026-02-03 14:00:14 + */ import { request } from '@/utils/request' import type { VoucherForm } from '@/views/OrderPayment/types' export const getOrderListUrl = '/v1/orders/customer' -// 提交支付凭证API +// Submit payment voucher API export const submitPaymentVoucherAPI = (voucherData: VoucherForm) => { return request.post('/v1/orders/', voucherData) } -// 订单详情 +// Order details export const getOrderDetail = (order_no: string) => { return request.get(`/v1/orders/customer/${order_no}`) } +// Order status enum export const orderStatusUrl = '/v1/order-status/' export const getOrderStatus = () => { return request.get(orderStatusUrl) diff --git a/web/src/api/prompt.ts b/web/src/api/prompt.ts index 79ea374c..55398ca5 100644 --- a/web/src/api/prompt.ts +++ b/web/src/api/prompt.ts @@ -1,3 +1,9 @@ +/* + * @Author: ZhaoYing + * @Date: 2026-02-03 14:00:17 + * @Last Modified by: ZhaoYing + * @Last Modified time: 2026-02-03 14:00:17 + */ import { request } from '@/utils/request' import type { AiPromptForm } from '@/views/ApplicationConfig/types' import type { PromptReleaseData } from '@/views/Prompt/types' diff --git a/web/src/api/user.ts b/web/src/api/user.ts index 3ff03386..f37e685b 100644 --- a/web/src/api/user.ts +++ b/web/src/api/user.ts @@ -1,40 +1,46 @@ +/* + * @Author: ZhaoYing + * @Date: 2026-02-03 14:00:23 + * @Last Modified by: ZhaoYing + * @Last Modified time: 2026-02-03 14:00:23 + */ import { request } from '@/utils/request' import type { CreateModalData } from '@/views/UserManagement/types' import { cookieUtils } from '@/utils/request' -// 用户信息 +// User info export const getUsers = () => { return request.get('/users') } -// 用户列表 +// User list export const getUserListUrl = '/users/superusers' -// 登录 +// Login export const loginUrl = '/token' export const login = (data: { email: string; password: string; invite?: string; username?: string }) => { return request.post(loginUrl, data) } -// 刷新token +// Refresh token export const refreshTokenUrl = '/refresh' export const refreshToken = () => { return request.post(refreshTokenUrl, { refresh_token: cookieUtils.get('refreshToken') }) } -// 重置密码 +// Reset password export const changePassword = (data: { user_id: string; new_password: string }) => { return request.put('/users/admin/change-password', data) } -// 禁用用户 +// Disable user export const deleteUser = (user_id: string) => { return request.delete(`/users/${user_id}`) } -// 启用用户 +// Enable user export const enableUser = (user_id: string) => { return request.post(`/users/${user_id}/activate`) } -// 创建用户 +// Create user export const addUser = (data: CreateModalData) => { return request.post('/users/superuser', data) } -// 注销 +// Logout export const logoutUrl = '/logout' export const logout = () => { return request.post(logoutUrl) diff --git a/web/src/api/workspaces.ts b/web/src/api/workspaces.ts index 4e78194b..01f3be72 100644 --- a/web/src/api/workspaces.ts +++ b/web/src/api/workspaces.ts @@ -1,28 +1,34 @@ +/* + * @Author: ZhaoYing + * @Date: 2026-02-03 14:00:26 + * @Last Modified by: ZhaoYing + * @Last Modified time: 2026-02-03 14:00:26 + */ import { request } from '@/utils/request' import type { SpaceModalData } from '@/views/SpaceManagement/types' -import type { ConfigModalData } from '@/views/UserMemory/types' +import type { SpaceConfigData } from '@/views/SpaceConfig/types' -// 空间列表 +// Workspace list export const getWorkspaces = () => { return request.get('/workspaces') } -// 创建空间 +// Create workspace export const createWorkspace = (values: SpaceModalData) => { return request.post('/workspaces', values) } -// 切换空间 +// Switch workspace export const switchWorkspace = (workspaceId: string) => { return request.put(`/workspaces/${workspaceId}/switch`) } -// 获取空间存储类型 +// Get workspace storage type export const getWorkspaceStorageType = () => { return request.get(`/workspaces/storage`) } -// 获取空间模型配置 +// Get workspace model config export const getWorkspaceModels = () => { return request.get(`/workspaces/workspace_models`) } -// 更新空间模型配置 -export const updateWorkspaceModels = (data: ConfigModalData) => { +// Update workspace model config +export const updateWorkspaceModels = (data: SpaceConfigData) => { return request.put(`/workspaces/workspace_models`, data) }