style(web): translate the comments in the web/src/api directory into English

This commit is contained in:
zhaoying
2026-02-03 14:01:28 +08:00
parent 940c594066
commit fb76f765cc
11 changed files with 118 additions and 56 deletions

View File

@@ -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<string, unknown>) => {
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`)
}

View File

@@ -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<string, unknown>) => {
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<string, unknown>, onMessage?: (data: SSEMessage[]) => void) => {
return handleSSE(`/apps/${app_id}/draft/run/compare`, values, onMessage)
}
// Test run
export const draftRun = (app_id: string, values: Record<string, unknown>, 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<string, unknown>) => {
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)
}

View File

@@ -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;

View File

@@ -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 filefile storage has expiration period

View File

@@ -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}`)
}

View File

@@ -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,

View File

@@ -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'

View File

@@ -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)

View File

@@ -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'

View File

@@ -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)

View File

@@ -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)
}