Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🌐 chore: translate non-English comments to English in openapi-types-common (#15255)

LobeHub Botb14f1dba5c1c
diff --git a/packages/openapi/src/common/base.controller.ts b/packages/openapi/src/common/base.controller.ts
index f70fc1a3354..f1ebbf5c645 100644
--- a/packages/openapi/src/common/base.controller.ts
+++ b/packages/openapi/src/common/base.controller.ts
@@ -212,7 +212,7 @@ export abstract class BaseController {
const hasPermission = await this.hasPermission(c, permission);
if (!hasPermission) {
throw new HTTPException(403, {
- message: errorMessage || `您没有权限执行此操作:${permission}`,
+ message: errorMessage || `You do not have permission to perform this operation: ${permission}`,
});
}
}
@@ -250,7 +250,7 @@ export abstract class BaseController {
throw new HTTPException(403, {
message:
errorMessage ||
- `您没有权限执行此操作,需要以下权限之一:${permissionKeys
+ `You do not have permission to perform this operation. One of the following permissions is required: ${permissionKeys
.map((key) => RBAC_PERMISSIONS[key])
.join(', ')}`,
});
diff --git a/packages/openapi/src/common/base.service.ts b/packages/openapi/src/common/base.service.ts
index 0c1e00d651a..c89d1e660e5 100644
--- a/packages/openapi/src/common/base.service.ts
+++ b/packages/openapi/src/common/base.service.ts
@@ -99,7 +99,7 @@ export abstract class BaseService implements IBaseService {
* @param fallbackMessage Default error message
*/
protected handleServiceError(error: unknown, operation: string): never {
- this.log('error', `${operation}失败`, { error });
+ this.log('error', `${operation} failed`, { error });
// If it is a known business error, throw it directly
if (
@@ -115,7 +115,7 @@ export abstract class BaseService implements IBaseService {
throw error;
}
- const errorMessage = `${operation}失败: ${error instanceof Error ? error.message : '未知错误'}`;
+ const errorMessage = `${operation} failed: ${error instanceof Error ? error.message : 'unknown error'}`;
// Wrap all other errors as business errors
throw this.createBusinessError(errorMessage);
@@ -293,7 +293,7 @@ export abstract class BaseService implements IBaseService {
}
}
} catch (error) {
- this.log('error', '获取目标用户ID失败', { error, target });
+ this.log('error', 'Failed to get target user ID', { error, target });
return;
}
}
@@ -333,13 +333,13 @@ export abstract class BaseService implements IBaseService {
userId: this.userId,
};
- this.log('info', '权限检查', logContext);
+ this.log('info', 'Permission check', logContext);
/**
* When the user has ALL permission, pass the check directly
*/
if (hasGlobalAccess) {
- this.log('info', `权限通过:当前user拥有 ${permissionKey} 的最高权限`, logContext);
+ this.log('info', `Permission granted: current user has highest ${permissionKey} permission`, logContext);
return {
condition: resourceBelongTo ? { userId: resourceBelongTo } : undefined,
isPermitted: true,
@@ -352,7 +352,7 @@ export abstract class BaseService implements IBaseService {
* 2. Querying a specific user's data, but the target resource does not belong to the current user
*/
if (!resourceBelongTo || resourceBelongTo !== this.userId) {
- this.log('warn', '权限拒绝:当前user没有ALL权限,或目标资源不属于当前用户', logContext);
+ this.log('warn', 'Permission denied: current user has no ALL permission, or target resource does not belong to current user', logContext);
return {
isPermitted: false,
message: `no permission,current user has no ALL permission,and resource not belong to current user`,
@@ -368,14 +368,14 @@ export abstract class BaseService implements IBaseService {
const hasOwnerAccess = await this.hasOwnerPermission(permissionKey);
if (hasOwnerAccess) {
- this.log('info', '权限通过:当前user拥有owner权限', logContext);
+ this.log('info', 'Permission granted: current user has owner permission', logContext);
return {
condition: { userId: resourceBelongTo },
isPermitted: true,
};
}
- this.log('warn', '权限拒绝:目标资源属于当前用户,但用户没有对应操作的owner权限', logContext);
+ this.log('warn', 'Permission denied: target resource belongs to current user, but user has no owner permission for this operation', logContext);
return {
isPermitted: false,
message: `no permission,resource belong to current user,but current user has no any ${permissionKey} permission`,
@@ -383,7 +383,7 @@ export abstract class BaseService implements IBaseService {
}
// If we reach here, apply fallback logic
- this.log('info', `兜底: no permission`, logContext);
+ this.log('info', `Fallback: no permission`, logContext);
return {
isPermitted: false,
message: `permission validation error for: ${permissionKey}`,
@@ -414,7 +414,7 @@ export abstract class BaseService implements IBaseService {
// If the user has global permission, allow the batch operation directly
if (hasGlobalAccess) {
- this.log('info', `权限通过:批量操作,当前user拥有 ${permissionKey} ALL权限`);
+ this.log('info', `Permission granted: batch operation, current user has ${permissionKey} ALL permission`);
return { isPermitted: true };
}
@@ -497,25 +497,25 @@ export abstract class BaseService implements IBaseService {
default: {
return {
isPermitted: false,
- message: '未提供有效的资源 ID',
+ message: 'No valid resource ID provided',
};
}
}
} catch (error) {
- this.log('error', '获取目标用户ID失败', { error, targetInfoIds });
+ this.log('error', 'Failed to get target user IDs', { error, targetInfoIds });
return {
isPermitted: false,
- message: '获取资源信息失败',
+ message: 'Failed to get resource info',
};
}
// If no resources are found
if (userIds.length === 0) {
- this.log('warn', '未找到任何目标资源', { permissionKey, targetInfoIds });
+ this.log('warn', 'No target resources found', { permissionKey, targetInfoIds });
return {
condition: { userIds },
isPermitted: false,
- message: '未找到任何目标资源',
+ message: 'No target resources found',
};
}
@@ -528,13 +528,13 @@ export abstract class BaseService implements IBaseService {
if (hasOwnerAccess) {
this.log(
'info',
- `权限通过:批量操作,所有资源属于当前用户,且拥有 ${permissionKey} owner 权限`,
+ `Permission granted: batch operation, all resources belong to current user and user has ${permissionKey} owner permission`,
);
return { condition: { userIds }, isPermitted: true };
}
// If all resources belong to the current user but the user has no owner permission, deny the operation
- this.log('warn', '权限拒绝:批量操作需要 ${permissionKey} ALL/owner 权限', {
+ this.log('warn', 'Permission denied: batch operation requires ${permissionKey} ALL/owner permission', {
permissionKey,
targetInfoIds,
userIds,
@@ -546,7 +546,7 @@ export abstract class BaseService implements IBaseService {
}
// Some resources in the operation do not belong to the current user; deny directly
- this.log('warn', `权限拒绝:批量操作需要 ${permissionKey} ALL/owner 权限`, {
+ this.log('warn', `Permission denied: batch operation requires ${permissionKey} ALL/owner permission`, {
permissionKey,
targetInfoIds,
userIds,
@@ -607,7 +607,7 @@ export abstract class BaseService implements IBaseService {
const isPermitted = missingPermissions.length === 0;
- this.log('info', '聊天权限检查', {
+ this.log('info', 'Chat permission check', {
isPermitted,
missingPermissions,
userId: this.userId,
@@ -616,7 +616,7 @@ export abstract class BaseService implements IBaseService {
if (!isPermitted) {
return {
isPermitted: false,
- message: `缺少必要权限:${missingPermissions.join(', ')}`,
+ message: `Missing required permissions: ${missingPermissions.join(', ')}`,
missingPermissions,
};
}
diff --git a/packages/openapi/src/controllers/agent-group.controller.ts b/packages/openapi/src/controllers/agent-group.controller.ts
index 46f7fc99413..df5796feffc 100644
--- a/packages/openapi/src/controllers/agent-group.controller.ts
+++ b/packages/openapi/src/controllers/agent-group.controller.ts
@@ -25,7 +25,7 @@ export class AgentGroupController extends BaseController {
const agentGroupService = new AgentGroupService(db, this.getUserId(c));
const agentGroups = await agentGroupService.getAgentGroups();
- return this.success(c, agentGroups, '获取助理分类列表成功');
+ return this.success(c, agentGroups, 'Agent category list retrieved successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -42,7 +42,7 @@ export class AgentGroupController extends BaseController {
const { id: groupId } = this.getParams<{ id: string }>(c);
if (!groupId) {
- return this.error(c, '助理分类 ID 是必需的', 400);
+ return this.error(c, 'Agent category ID is required', 400);
}
const db = await this.getDatabase();
@@ -50,10 +50,10 @@ export class AgentGroupController extends BaseController {
const agentGroup = await agentGroupService.getAgentGroupById(groupId);
if (!agentGroup) {
- return this.error(c, '助理分类不存在', 404);
+ return this.error(c, 'Agent category not found', 404);
}
- return this.success(c, agentGroup, '获取助理分类详情成功');
+ return this.success(c, agentGroup, 'Agent category details retrieved successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -76,7 +76,7 @@ export class AgentGroupController extends BaseController {
return c.json(
{
data: { id: groupId },
- message: '助理分类创建成功',
+ message: 'Agent category created successfully',
success: true,
timestamp: new Date().toISOString(),
},
@@ -99,7 +99,7 @@ export class AgentGroupController extends BaseController {
const body = await this.getBody<Omit<UpdateAgentGroupRequest, 'id'>>(c);
if (!groupId) {
- return this.error(c, '助理分类 ID 是必需的', 400);
+ return this.error(c, 'Agent category ID is required', 400);
}
const request: UpdateAgentGroupRequest = {
@@ -111,7 +111,7 @@ export class AgentGroupController extends BaseController {
const agentGroupService = new AgentGroupService(db, this.getUserId(c));
await agentGroupService.updateAgentGroup(request);
- return this.success(c, null, '助理分类更新成功');
+ return this.success(c, null, 'Agent category updated successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -128,7 +128,7 @@ export class AgentGroupController extends BaseController {
const { id: groupId } = this.getParams<{ id: string }>(c);
if (!groupId) {
- return this.error(c, '助理分类 ID 是必需的', 400);
+ return this.error(c, 'Agent category ID is required', 400);
}
const request: DeleteAgentGroupRequest = {
@@ -139,7 +139,7 @@ export class AgentGroupController extends BaseController {
const agentGroupService = new AgentGroupService(db, this.getUserId(c));
await agentGroupService.deleteAgentGroup(request);
- return this.success(c, null, '助理分类删除成功');
+ return this.success(c, null, 'Agent category deleted successfully');
} catch (error) {
return this.handleError(c, error);
}
diff --git a/packages/openapi/src/controllers/agent.controller.ts b/packages/openapi/src/controllers/agent.controller.ts
index d82546c4501..a2bc2d8adf6 100644
--- a/packages/openapi/src/controllers/agent.controller.ts
+++ b/packages/openapi/src/controllers/agent.controller.ts
@@ -28,7 +28,7 @@ export class AgentController extends BaseController {
const agentService = new AgentService(db, this.getUserId(c));
const agentsList = await agentService.queryAgents(request);
- return this.success(c, agentsList, '获取 Agent 列表成功');
+ return this.success(c, agentsList, 'Agent list retrieved successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -48,7 +48,7 @@ export class AgentController extends BaseController {
const agentService = new AgentService(db, this.getUserId(c));
const createdAgent = await agentService.createAgent(body);
- return this.success(c, createdAgent, 'Agent 创建成功');
+ return this.success(c, createdAgent, 'Agent created successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -74,7 +74,7 @@ export class AgentController extends BaseController {
const agentService = new AgentService(db, this.getUserId(c));
const updatedAgent = await agentService.updateAgent(updateRequest);
- return this.success(c, updatedAgent, 'Agent 更新成功');
+ return this.success(c, updatedAgent, 'Agent updated successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -95,7 +95,7 @@ export class AgentController extends BaseController {
const agentService = new AgentService(db, this.getUserId(c));
await agentService.deleteAgent(request);
- return this.success(c, null, 'Agent 删除成功');
+ return this.success(c, null, 'Agent deleted successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -115,10 +115,10 @@ export class AgentController extends BaseController {
const agent = await agentService.getAgentById(agentId);
if (!agent) {
- return this.error(c, 'Agent 不存在', 404);
+ return this.error(c, 'Agent not found', 404);
}
- return this.success(c, agent, '获取 Agent 详情成功');
+ return this.success(c, agent, 'Agent details retrieved successfully');
} catch (error) {
return this.handleError(c, error);
}
diff --git a/packages/openapi/src/controllers/chat.controller.ts b/packages/openapi/src/controllers/chat.controller.ts
index f30ec6c1270..cce0c1d4809 100644
--- a/packages/openapi/src/controllers/chat.controller.ts
+++ b/packages/openapi/src/controllers/chat.controller.ts
@@ -28,7 +28,7 @@ export class ChatController extends BaseController {
}
const result = await chatService.chat(chatParams);
- return this.success(c, result, '聊天对话成功');
+ return this.success(c, result, 'Chat completed successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -48,7 +48,7 @@ export class ChatController extends BaseController {
const chatService = new ChatService(db, userId);
const result = await chatService.translate(translateParams);
- return this.success(c, { translatedText: result }, '翻译成功');
+ return this.success(c, { translatedText: result }, 'Translation successful');
} catch (error) {
return this.handleError(c, error);
}
@@ -68,7 +68,7 @@ export class ChatController extends BaseController {
const chatService = new ChatService(db, userId);
const result = await chatService.generateReply(generationParams);
- return this.success(c, { reply: result }, '生成回复成功');
+ return this.success(c, { reply: result }, 'Reply generated successfully');
} catch (error) {
return this.handleError(c, error);
}
diff --git a/packages/openapi/src/controllers/message-translation.controller.ts b/packages/openapi/src/controllers/message-translation.controller.ts
index a91dc3d05cf..2d15367fd8e 100644
--- a/packages/openapi/src/controllers/message-translation.controller.ts
+++ b/packages/openapi/src/controllers/message-translation.controller.ts
@@ -23,7 +23,7 @@ export class MessageTranslationController extends BaseController {
const translateService = new MessageTranslateService(db, userId);
const translate = await translateService.getTranslateByMessageId(messageId);
- return this.success(c, translate, '获取翻译信息成功');
+ return this.success(c, translate, 'Translation info retrieved successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -47,7 +47,7 @@ export class MessageTranslationController extends BaseController {
...translatePayload,
});
- return this.success(c, result, '翻译消息成功');
+ return this.success(c, result, 'Message translated successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -68,7 +68,7 @@ export class MessageTranslationController extends BaseController {
const translateService = new MessageTranslateService(db, userId);
const result = await translateService.updateTranslateInfo({ ...configData, messageId });
- return this.success(c, result, '更新翻译信息成功');
+ return this.success(c, result, 'Translation info updated successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -87,7 +87,7 @@ export class MessageTranslationController extends BaseController {
const translateService = new MessageTranslateService(db, userId);
const result = await translateService.deleteTranslateByMessageId(messageId);
- return this.success(c, result, '删除翻译信息成功');
+ return this.success(c, result, 'Translation info deleted successfully');
} catch (error) {
return this.handleError(c, error);
}
diff --git a/packages/openapi/src/controllers/message.controller.ts b/packages/openapi/src/controllers/message.controller.ts
index 6581e8cf549..64de38c034e 100644
--- a/packages/openapi/src/controllers/message.controller.ts
+++ b/packages/openapi/src/controllers/message.controller.ts
@@ -30,7 +30,7 @@ export class MessageController extends BaseController {
const messageService = new MessageService(db, userId);
const result = await messageService.countMessages(processedQuery);
- return this.success(c, result, '查询消息数量成功');
+ return this.success(c, result, 'Message count retrieved successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -50,7 +50,7 @@ export class MessageController extends BaseController {
const messageService = new MessageService(db, userId);
const result = await messageService.getMessages(request);
- return this.success(c, result, '获取消息列表成功');
+ return this.success(c, result, 'Message list retrieved successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -71,10 +71,10 @@ export class MessageController extends BaseController {
const message = await messageService.getMessageById(id);
if (!message) {
- return this.error(c, '消息不存在或无权限访问', 404);
+ return this.error(c, 'Message not found or access denied', 404);
}
- return this.success(c, message, '获取消息详情成功');
+ return this.success(c, message, 'Message details retrieved successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -94,7 +94,7 @@ export class MessageController extends BaseController {
const messageService = new MessageService(db, userId);
const result = await messageService.createMessage(messageData);
- return this.success(c, result, '创建消息成功');
+ return this.success(c, result, 'Message created successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -114,7 +114,7 @@ export class MessageController extends BaseController {
const messageService = new MessageService(db, userId);
const result = await messageService.createMessageWithAIReply(messageData);
- return this.success(c, result, '创建消息并生成AI回复成功');
+ return this.success(c, result, 'Message created and AI reply generated successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -134,7 +134,7 @@ export class MessageController extends BaseController {
const messageService = new MessageService(db, userId);
await messageService.deleteMessage(id);
- return this.success(c, null, '删除消息成功');
+ return this.success(c, null, 'Message deleted successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -154,7 +154,7 @@ export class MessageController extends BaseController {
const messageService = new MessageService(db, userId);
const result = await messageService.deleteBatchMessages(messageIds);
- return this.success(c, result, '批量删除消息成功');
+ return this.success(c, result, 'Messages deleted in batch successfully');
} catch (error) {
return this.handleError(c, error);
}
diff --git a/packages/openapi/src/controllers/model.controller.ts b/packages/openapi/src/controllers/model.controller.ts
index 1c83c345fc4..45195c68c47 100644
--- a/packages/openapi/src/controllers/model.controller.ts
+++ b/packages/openapi/src/controllers/model.controller.ts
@@ -19,7 +19,7 @@ export class ModelController extends BaseController {
const result = await modelService.getModels(query);
- return this.success(c, result, '获取模型列表成功');
+ return this.success(c, result, 'Model list retrieved successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -37,7 +37,7 @@ export class ModelController extends BaseController {
const modelService = new ModelService(db, this.getUserId(c));
const result = await modelService.getModelDetail(providerId, modelId);
- return this.success(c, result, '获取模型详情成功');
+ return this.success(c, result, 'Model details retrieved successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -52,14 +52,14 @@ export class ModelController extends BaseController {
const body = await this.getBody<CreateModelRequest>(c);
if (!body) {
- return this.error(c, '请求体不能为空', 400);
+ return this.error(c, 'Request body cannot be empty', 400);
}
const db = await this.getDatabase();
const modelService = new ModelService(db, this.getUserId(c));
const result = await modelService.createModel(body);
- return this.success(c, result, '创建模型成功');
+ return this.success(c, result, 'Model created successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -75,14 +75,14 @@ export class ModelController extends BaseController {
const body = await this.getBody<UpdateModelRequest>(c);
if (!body) {
- return this.error(c, '请求体不能为空', 400);
+ return this.error(c, 'Request body cannot be empty', 400);
}
const db = await this.getDatabase();
const modelService = new ModelService(db, this.getUserId(c));
const result = await modelService.updateModel(providerId, modelId, body);
- return this.success(c, result, '更新模型成功');
+ return this.success(c, result, 'Model updated successfully');
} catch (error) {
return this.handleError(c, error);
}
diff --git a/packages/openapi/src/controllers/permission.controller.ts b/packages/openapi/src/controllers/permission.controller.ts
index 71c39a54cdc..d390824e54a 100644
--- a/packages/openapi/src/controllers/permission.controller.ts
+++ b/packages/openapi/src/controllers/permission.controller.ts
@@ -58,7 +58,7 @@ export class PermissionController extends BaseController {
const body = await this.getBody<CreatePermissionRequest>(c);
if (!body) {
- return this.error(c, '请求体不能为空', 400);
+ return this.error(c, 'Request body cannot be empty', 400);
}
const db = await this.getDatabase();
@@ -80,7 +80,7 @@ export class PermissionController extends BaseController {
const body = await this.getBody<UpdatePermissionRequest>(c);
if (!body) {
- return this.error(c, '请求体不能为空', 400);
+ return this.error(c, 'Request body cannot be empty', 400);
}
const db = await this.getDatabase();
diff --git a/packages/openapi/src/controllers/provider.controller.ts b/packages/openapi/src/controllers/provider.controller.ts
index 228453b3cb4..c4e9854aa5e 100644
--- a/packages/openapi/src/controllers/provider.controller.ts
+++ b/packages/openapi/src/controllers/provider.controller.ts
@@ -24,7 +24,7 @@ export class ProviderController extends BaseController {
const result = await providerService.getProviders(query);
- return this.success(c, result, '获取 Provider 列表成功');
+ return this.success(c, result, 'Provider list retrieved successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -39,7 +39,7 @@ export class ProviderController extends BaseController {
const providerService = new ProviderService(db, this.getUserId(c));
const provider = await providerService.getProviderDetail(request);
- return this.success(c, provider, '获取 Provider 详情成功');
+ return this.success(c, provider, 'Provider details retrieved successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -53,7 +53,7 @@ export class ProviderController extends BaseController {
const providerService = new ProviderService(db, this.getUserId(c));
const created = await providerService.createProvider({ ...body, source: 'custom' });
- return this.success(c, created, '创建 Provider 成功');
+ return this.success(c, created, 'Provider created successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -73,7 +73,7 @@ export class ProviderController extends BaseController {
const providerService = new ProviderService(db, this.getUserId(c));
const updated = await providerService.updateProvider(request);
- return this.success(c, updated, '更新 Provider 成功');
+ return this.success(c, updated, 'Provider updated successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -88,7 +88,7 @@ export class ProviderController extends BaseController {
const providerService = new ProviderService(db, this.getUserId(c));
const result = await providerService.deleteProvider(request);
- return this.success(c, result, '删除 Provider 成功');
+ return this.success(c, result, 'Provider deleted successfully');
} catch (error) {
return this.handleError(c, error);
}
diff --git a/packages/openapi/src/controllers/role.controller.ts b/packages/openapi/src/controllers/role.controller.ts
index c45687efbbe..7566082ca23 100644
--- a/packages/openapi/src/controllers/role.controller.ts
+++ b/packages/openapi/src/controllers/role.controller.ts
@@ -43,14 +43,14 @@ export class RoleController extends BaseController {
const body = await this.getBody<CreateRoleRequest>(c);
if (!body) {
- return this.error(c, '请求体不能为空', 400);
+ return this.error(c, 'Request body cannot be empty', 400);
}
const db = await this.getDatabase();
const roleService = new RoleService(db, this.getUserId(c));
const createdRole = await roleService.createRole(body);
- return this.success(c, createdRole, '角色创建成功');
+ return this.success(c, createdRole, 'Role created successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -109,14 +109,14 @@ export class RoleController extends BaseController {
const body = await this.getBody<UpdateRolePermissionsRequest>(c);
if (!body) {
- return this.error(c, '请求体不能为空', 400);
+ return this.error(c, 'Request body cannot be empty', 400);
}
const db = await this.getDatabase();
const roleService = new RoleService(db, this.getUserId(c));
const result = await roleService.updateRolePermissions(id, body);
- return this.success(c, result, '角色权限更新成功');
+ return this.success(c, result, 'Role permissions updated successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -134,7 +134,7 @@ export class RoleController extends BaseController {
const roleService = new RoleService(db, this.getUserId(c));
const result = await roleService.clearRolePermissions(roleId);
- return this.success(c, result, '角色权限已清空');
+ return this.success(c, result, 'Role permissions cleared');
} catch (error) {
return this.handleError(c, error);
}
@@ -152,14 +152,14 @@ export class RoleController extends BaseController {
const body = await this.getBody<UpdateRoleRequest>(c);
if (!body) {
- return this.error(c, '请求体不能为空', 400);
+ return this.error(c, 'Request body cannot be empty', 400);
}
const db = await this.getDatabase();
const roleService = new RoleService(db, this.getUserId(c));
const updatedRole = await roleService.updateRole(id, body);
- return this.success(c, updatedRole, '角色更新成功');
+ return this.success(c, updatedRole, 'Role updated successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -175,7 +175,7 @@ export class RoleController extends BaseController {
const roleService = new RoleService(db, this.getUserId(c));
const result = await roleService.deleteRole(id);
- return this.success(c, result, '角色删除成功');
+ return this.success(c, result, 'Role deleted successfully');
} catch (error) {
return this.handleError(c, error);
}
diff --git a/packages/openapi/src/controllers/topic.controller.ts b/packages/openapi/src/controllers/topic.controller.ts
index 9a2d79f45e2..5f8be1a8106 100644
--- a/packages/openapi/src/controllers/topic.controller.ts
+++ b/packages/openapi/src/controllers/topic.controller.ts
@@ -20,7 +20,7 @@ export class TopicController extends BaseController {
const topics = await topicService.getTopics(request);
- return this.success(c, topics, '获取话题列表成功');
+ return this.success(c, topics, 'Topic list retrieved successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -40,7 +40,7 @@ export class TopicController extends BaseController {
const topicService = new TopicService(db, userId);
const topic = await topicService.getTopicById(id);
- return this.success(c, topic, '获取话题成功');
+ return this.success(c, topic, 'Topic retrieved successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -60,7 +60,7 @@ export class TopicController extends BaseController {
const topicService = new TopicService(db, userId);
const newTopic = await topicService.createTopic(payload);
- return this.success(c, newTopic, '创建话题成功');
+ return this.success(c, newTopic, 'Topic created successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -81,7 +81,7 @@ export class TopicController extends BaseController {
const topicService = new TopicService(db, userId);
const updatedTopic = await topicService.updateTopic(id, payload);
- return this.success(c, updatedTopic, '更新话题成功');
+ return this.success(c, updatedTopic, 'Topic updated successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -101,7 +101,7 @@ export class TopicController extends BaseController {
const topicService = new TopicService(db, userId);
await topicService.deleteTopic(topicId);
- return this.success(c, null, '删除话题成功');
+ return this.success(c, null, 'Topic deleted successfully');
} catch (error) {
return this.handleError(c, error);
}
diff --git a/packages/openapi/src/controllers/user.controller.ts b/packages/openapi/src/controllers/user.controller.ts
index e89dfeb048d..92761b5d89e 100644
--- a/packages/openapi/src/controllers/user.controller.ts
+++ b/packages/openapi/src/controllers/user.controller.ts
@@ -26,7 +26,7 @@ export class UserController extends BaseController {
const userService = new UserService(db, this.getUserId(c));
const userInfo = await userService.getCurrentUser();
- return this.success(c, userInfo, '获取用户信息成功');
+ return this.success(c, userInfo, 'User info retrieved successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -47,7 +47,7 @@ export class UserController extends BaseController {
const userList = await userService.queryUsers(request);
- return this.success(c, userList, '获取用户列表成功');
+ return this.success(c, userList, 'User list retrieved successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -67,7 +67,7 @@ export class UserController extends BaseController {
const userService = new UserService(db, this.getUserId(c));
const newUser = await userService.createUser(userData);
- return this.success(c, newUser, '用户创建成功');
+ return this.success(c, newUser, 'User created successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -87,7 +87,7 @@ export class UserController extends BaseController {
const userService = new UserService(db, this.getUserId(c));
const user = await userService.getUserById(id);
- return this.success(c, user, '获取用户信息成功');
+ return this.success(c, user, 'User info retrieved successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -108,7 +108,7 @@ export class UserController extends BaseController {
const userService = new UserService(db, this.getUserId(c));
const updatedUser = await userService.updateUser(id, userData);
- return this.success(c, updatedUser, '用户信息更新成功');
+ return this.success(c, updatedUser, 'User info updated successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -128,7 +128,7 @@ export class UserController extends BaseController {
const userService = new UserService(db, this.getUserId(c));
const result = await userService.deleteUser(id);
- return this.success(c, result, '用户删除成功');
+ return this.success(c, result, 'User deleted successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -146,7 +146,7 @@ export class UserController extends BaseController {
const body = await this.getBody<UpdateUserRolesRequest>(c);
if (!body) {
- return this.error(c, '请求体不能为空', 400);
+ return this.error(c, 'Request body cannot be empty', 400);
}
// Get database connection and create service instance
@@ -154,7 +154,7 @@ export class UserController extends BaseController {
const userService = new UserService(db, this.getUserId(c));
const result = await userService.updateUserRoles(id, body);
- return this.success(c, result, '用户角色更新成功');
+ return this.success(c, result, 'User roles updated successfully');
} catch (error) {
return this.handleError(c, error);
}
@@ -172,7 +172,7 @@ export class UserController extends BaseController {
const userService = new UserService(db, this.getUserId(c));
const result = await userService.clearUserRoles(id);
- return this.success(c, result, '已清空用户角色');
+ return this.success(c, result, 'User roles cleared');
} catch (error) {
return this.handleError(c, error);
}
@@ -193,7 +193,7 @@ export class UserController extends BaseController {
const userService = new UserService(db, this.getUserId(c));
const userRoles = await userService.getUserRoles(id);
- return this.success(c, userRoles, '获取用户角色成功');
+ return this.success(c, userRoles, 'User roles retrieved successfully');
} catch (error) {
return this.handleError(c, error);
}
diff --git a/packages/openapi/src/helpers/file.ts b/packages/openapi/src/helpers/file.ts
index aee06dcc43d..e9c5162280e 100644
--- a/packages/openapi/src/helpers/file.ts
+++ b/packages/openapi/src/helpers/file.ts
@@ -46,7 +46,7 @@ export function addFilesUrlPrefix<T extends { path?: string; url?: string }>(fil
export async function parseFormData(c: Context): Promise<FormData> {
const contentType = c.req.header('content-type') || '';
if (!/multipart\/form-data/i.test(contentType)) {
- throw new Error('Content-Type 必须是 multipart/form-data');
+ throw new Error('Content-Type must be multipart/form-data');
}
// Prefer formidable (streaming, robust); fall back to native formData() on failure
@@ -54,14 +54,14 @@ export async function parseFormData(c: Context): Promise<FormData> {
const webReq = c.req.raw as Request;
const webBody = webReq.body;
if (!webBody) {
- throw new Error('解析失败:当前请求缺少可读的 body 流');
+ throw new Error('Parse failed: request body stream is not readable');
}
// Convert Web ReadableStream to Node Readable (Node 18+)
const nodeReadable =
typeof Readable?.fromWeb === 'function' ? Readable.fromWeb(webBody as any) : null;
if (!nodeReadable) {
- throw new Error('解析失败:运行时不支持 Readable.fromWeb,将不进行回退');
+ throw new Error('Parse failed: Readable.fromWeb is not supported in this runtime, no fallback applied');
}
// Construct a minimal Node-like IncomingMessage for formidable
@@ -125,6 +125,6 @@ export async function parseFormData(c: Context): Promise<FormData> {
return fd;
} catch (e) {
// Re-throw the error to let the caller handle it via unified exception handling
- throw e instanceof Error ? e : new Error('parseFormData 解析失败');
+ throw e instanceof Error ? e : new Error('parseFormData failed');
}
}
diff --git a/packages/openapi/src/types/agent-group.type.ts b/packages/openapi/src/types/agent-group.type.ts
index 1a0f9d9cb62..32c6e832ad7 100644
--- a/packages/openapi/src/types/agent-group.type.ts
+++ b/packages/openapi/src/types/agent-group.type.ts
@@ -14,7 +14,7 @@ export interface CreateAgentGroupRequest {
}
export const CreateAgentGroupRequestSchema = z.object({
- name: z.string().min(1, '助理分类名称不能为空'),
+ name: z.string().min(1, 'Agent category name cannot be empty'),
sort: z.number().nullish(),
});
@@ -28,7 +28,7 @@ export interface UpdateAgentGroupRequest {
}
export const UpdateAgentGroupRequestSchema = z.object({
- name: z.string().min(1, '助理分类名称不能为空').nullish(),
+ name: z.string().min(1, 'Agent category name cannot be empty').nullish(),
sort: z.number().nullish(),
});
@@ -49,5 +49,5 @@ export type AgentGroupListResponse = SessionGroupItem[];
// ==================== Common Schemas ====================
export const AgentGroupIdParamSchema = z.object({
- id: z.string().min(1, '助理分类 ID 不能为空'),
+ id: z.string().min(1, 'Agent category ID cannot be empty'),
});
diff --git a/packages/openapi/src/types/agent.type.ts b/packages/openapi/src/types/agent.type.ts
index 2b291c7edad..e63dbcb4c31 100644
--- a/packages/openapi/src/types/agent.type.ts
+++ b/packages/openapi/src/types/agent.type.ts
@@ -47,7 +47,7 @@ export const CreateAgentRequestSchema = z.object({
params: z.record(z.unknown()).nullish(),
provider: z.string().nullish(),
systemRole: z.string().nullish(),
- title: z.string().min(1, '标题不能为空'),
+ title: z.string().min(1, 'Title cannot be empty'),
});
/**
@@ -68,7 +68,7 @@ export interface AgentDeleteRequest {
}
export const AgentDeleteRequestSchema = z.object({
- agentId: z.string().min(1, 'Agent ID 不能为空'),
+ agentId: z.string().min(1, 'Agent ID cannot be empty'),
migrateSessionTo: z.string().nullish(),
});
@@ -193,5 +193,5 @@ export interface AgentDetailResponse extends AgentItem {
// ==================== Common Schemas ====================
export const AgentIdParamSchema = z.object({
- id: z.string().min(1, 'Agent ID 不能为空'),
+ id: z.string().min(1, 'Agent ID cannot be empty'),
});
diff --git a/packages/openapi/src/types/chat.type.ts b/packages/openapi/src/types/chat.type.ts
index 9585fc705bb..5ac497caca1 100644
--- a/packages/openapi/src/types/chat.type.ts
+++ b/packages/openapi/src/types/chat.type.ts
@@ -24,13 +24,13 @@ export const ChatServiceParamsSchema = z.object({
messages: z
.array(
z.object({
- content: z.string().min(1, '消息内容不能为空'),
+ content: z.string().min(1, 'Message content cannot be empty'),
role: z.enum(['user', 'assistant', 'system'], {
- required_error: '角色必须为user、assistant或system',
+ required_error: 'Role must be user, assistant, or system',
}),
}),
)
- .min(1, '消息列表不能为空'),
+ .min(1, 'Message list cannot be empty'),
model: z.string().nullish(),
provider: z.string().nullish(),
stream: z.boolean().nullish(),
@@ -66,11 +66,11 @@ export interface TranslateServiceParams {
}
export const TranslateServiceParamsSchema = z.object({
- from: z.string().min(1, '源语言不能为空').optional(),
+ from: z.string().min(1, 'Source language cannot be empty').optional(),
model: z.string().nullish(),
provider: z.string().nullish(),
- text: z.string().min(1, '待翻译文本不能为空'),
- to: z.string().min(1, '目标语言不能为空'),
+ text: z.string().min(1, 'Text to translate cannot be empty'),
+ to: z.string().min(1, 'Target language cannot be empty'),
});
// ==================== Message Generation Types ====================
@@ -113,7 +113,7 @@ export const MessageGenerationParamsSchema = z.object({
.nullish(),
conversationHistory: z.array(
z.object({
- content: z.string().min(1, '消息内容不能为空'),
+ content: z.string().min(1, 'Message content cannot be empty'),
role: z.enum(['user', 'assistant', 'system']),
}),
),
diff --git a/packages/openapi/src/types/common.type.ts b/packages/openapi/src/types/common.type.ts
index cd1afad6d53..2b2f4ac42eb 100644
--- a/packages/openapi/src/types/common.type.ts
+++ b/packages/openapi/src/types/common.type.ts
@@ -23,7 +23,7 @@ export const PaginationQuerySchema = z.object({
if (!val) return ''; // Allow empty value, convert to empty string
return val.trim();
})
- .refine((val) => val.length <= 100, '搜索关键词长度不能超过100个字符'),
+ .refine((val) => val.length <= 100, 'Search keyword cannot exceed 100 characters'),
page: z
.string()
.transform((val) => parseInt(val, 10))
diff --git a/packages/openapi/src/types/file.type.ts b/packages/openapi/src/types/file.type.ts
index e3c40bd3c92..fb9ebb7e64c 100644
--- a/packages/openapi/src/types/file.type.ts
+++ b/packages/openapi/src/types/file.type.ts
@@ -180,7 +180,7 @@ export interface BatchGetFilesRequest {
}
export const BatchGetFilesRequestSchema = z.object({
- fileIds: z.array(z.string().min(1, '文件ID不能为空')).min(1, '文件ID列表不能为空'),
+ fileIds: z.array(z.string().min(1, 'File ID cannot be empty')).min(1, 'File ID list cannot be empty'),
});
/**
@@ -356,7 +356,7 @@ export interface FileChunkStatusResponse {
// ==================== Common Schemas ====================
export const FileIdParamSchema = z.object({
- id: z.string().min(1, '文件 ID 不能为空'),
+ id: z.string().min(1, 'File ID cannot be empty'),
});
// ==================== File Update Types ====================
diff --git a/packages/openapi/src/types/knowledge-base.type.ts b/packages/openapi/src/types/knowledge-base.type.ts
index dbdc6fed7fd..2b170fc114c 100644
--- a/packages/openapi/src/types/knowledge-base.type.ts
+++ b/packages/openapi/src/types/knowledge-base.type.ts
@@ -37,7 +37,7 @@ export interface KnowledgeBaseFileBatchRequest {
}
export const KnowledgeBaseFileBatchSchema = z.object({
- fileIds: z.array(z.string().min(1, '文件ID不能为空')).min(1, '文件ID列表不能为空'),
+ fileIds: z.array(z.string().min(1, 'File ID cannot be empty')).min(1, 'File ID list cannot be empty'),
});
/**
@@ -49,7 +49,7 @@ export interface MoveKnowledgeBaseFilesRequest extends KnowledgeBaseFileBatchReq
}
export const MoveKnowledgeBaseFilesSchema = KnowledgeBaseFileBatchSchema.extend({
- targetKnowledgeBaseId: z.string().min(1, '目标知识库 ID 不能为空'),
+ targetKnowledgeBaseId: z.string().min(1, 'Target knowledge base ID cannot be empty'),
});
/**
@@ -99,7 +99,7 @@ export type KnowledgeBaseListResponse = PaginationQueryResponse<{
* Knowledge base ID parameter
*/
export const KnowledgeBaseIdParamSchema = z.object({
- id: z.string().min(1, '知识库 ID 不能为空'),
+ id: z.string().min(1, 'Knowledge base ID cannot be empty'),
});
/**
@@ -115,9 +115,9 @@ export interface CreateKnowledgeBaseRequest {
}
export const CreateKnowledgeBaseSchema = z.object({
- avatar: z.string().url('头像必须是有效的URL').optional(),
- description: z.string().max(1000, '知识库描述过长').optional(),
- name: z.string().min(1, '知识库名称不能为空').max(255, '知识库名称过长'),
+ avatar: z.string().url('Avatar must be a valid URL').optional(),
+ description: z.string().max(1000, 'Knowledge base description is too long').optional(),
+ name: z.string().min(1, 'Knowledge base name cannot be empty').max(255, 'Knowledge base name is too long'),
});
/**
@@ -141,9 +141,9 @@ export interface UpdateKnowledgeBaseRequest {
}
export const UpdateKnowledgeBaseSchema = z.object({
- avatar: z.string().url('头像必须是有效的URL').optional(),
- description: z.string().max(1000, '知识库描述过长').optional(),
- name: z.string().min(1, '知识库名称不能为空').max(255, '知识库名称过长').optional(),
+ avatar: z.string().url('Avatar must be a valid URL').optional(),
+ description: z.string().max(1000, 'Knowledge base description is too long').optional(),
+ name: z.string().min(1, 'Knowledge base name cannot be empty').max(255, 'Knowledge base name is too long').optional(),
});
/**
diff --git a/packages/openapi/src/types/message.type.ts b/packages/openapi/src/types/message.type.ts
index a12e92e33a8..0ee1000ce75 100644
--- a/packages/openapi/src/types/message.type.ts
+++ b/packages/openapi/src/types/message.type.ts
@@ -13,7 +13,7 @@ export interface MessagesQueryByTopicRequest {
}
export const MessagesQueryByTopicRequestSchema = z.object({
- topicId: z.string().min(1, '话题ID不能为空'),
+ topicId: z.string().min(1, 'Topic ID cannot be empty'),
});
/**
@@ -36,7 +36,7 @@ export interface CountByTopicsRequest {
}
export const CountByTopicsRequestSchema = z.object({
- topicIds: z.array(z.string()).min(1, '话题ID数组不能为空'),
+ topicIds: z.array(z.string()).min(1, 'Topic ID array cannot be empty'),
});
export interface CountByUserRequest {
@@ -44,7 +44,7 @@ export interface CountByUserRequest {
}
export const CountByUserRequestSchema = z.object({
- userId: z.string().min(1, '用户ID不能为空'),
+ userId: z.string().min(1, 'User ID cannot be empty'),
});
// ==================== Message List Query Types ====================
@@ -67,7 +67,7 @@ export const MessagesListQuerySchema = z
})
.extend(PaginationQuerySchema.shape)
.refine((data) => Boolean(data.topicId || data.userId), {
- message: '至少需要提供一个过滤参数:topicId 或 userId',
+ message: 'At least one filter parameter must be provided: topicId or userId',
});
// ==================== Message Search Types ====================
@@ -79,7 +79,7 @@ export interface SearchMessagesByKeywordRequest {
}
export const SearchMessagesByKeywordRequestSchema = z.object({
- keyword: z.string().min(1, '搜索关键词不能为空'),
+ keyword: z.string().min(1, 'Search keyword cannot be empty'),
limit: z.number().min(1).max(100).nullish().default(20),
offset: z.number().min(0).nullish().default(0),
});
@@ -122,8 +122,8 @@ export interface MessagesCreateRequest {
}
export const MessagesCreateRequestSchema = z.object({
- content: z.string().min(1, '消息内容不能为空'),
- role: z.enum(['user', 'system', 'assistant', 'tool'], { required_error: '角色类型无效' }),
+ content: z.string().min(1, 'Message content cannot be empty'),
+ role: z.enum(['user', 'system', 'assistant', 'tool'], { required_error: 'Invalid role type' }),
// AI-related fields
model: z.string().nullish(), // Model used
@@ -158,7 +158,7 @@ export const MessagesCreateRequestSchema = z.object({
});
export const MessagesCreateWithReplyRequestSchema = MessagesCreateRequestSchema.extend({
- role: z.literal('user', { errorMap: () => ({ message: '创建 AI 回复时 role 必须为 user' }) }),
+ role: z.literal('user', { errorMap: () => ({ message: 'Role must be user when creating an AI reply' }) }),
});
export type MessagesCreateWithReplyRequest = z.infer<typeof MessagesCreateWithReplyRequestSchema>;
@@ -174,7 +174,7 @@ export interface MessagesUpdateRequest {
}
export const MessagesUpdateRequestSchema = z.object({
- content: z.string().min(1, '消息内容不能为空').nullish(),
+ content: z.string().min(1, 'Message content cannot be empty').nullish(),
favorite: z.boolean().nullish(),
metadata: z.any().nullish(),
reasoning: z.any().nullish(),
@@ -190,7 +190,7 @@ export interface MessagesDeleteBatchRequest {
}
export const MessagesDeleteBatchRequestSchema = z.object({
- messageIds: z.array(z.string().min(1, '消息ID不能为空')).min(1, '消息ID数组不能为空'),
+ messageIds: z.array(z.string().min(1, 'Message ID cannot be empty')).min(1, 'Message ID array cannot be empty'),
});
// ==================== Message Response Types ====================
@@ -218,5 +218,5 @@ export type MessageListResponse = PaginationQueryResponse<{
// ==================== Common Schemas ====================
export const MessageIdParamSchema = z.object({
- id: z.string().min(1, '消息ID不能为空'),
+ id: z.string().min(1, 'Message ID cannot be empty'),
});
diff --git a/packages/openapi/src/types/model.type.ts b/packages/openapi/src/types/model.type.ts
index 6466ca95d7f..554f198b5cc 100644
--- a/packages/openapi/src/types/model.type.ts
+++ b/packages/openapi/src/types/model.type.ts
@@ -52,7 +52,7 @@ const ModelPayloadBaseSchema = z.object({
config: z.record(z.unknown()).nullish(),
contextWindowTokens: z.number().int().nullish(),
description: z.string().nullish(),
- displayName: z.string().min(1, '模型显示名称不能为空'),
+ displayName: z.string().min(1, 'Model display name cannot be empty'),
enabled: z.boolean().nullish(),
organization: z.string().nullish(),
parameters: z.record(z.unknown()).nullish(),
@@ -66,9 +66,9 @@ const ModelPayloadBaseSchema = z.object({
});
export const CreateModelRequestSchema = ModelPayloadBaseSchema.extend({
- displayName: z.string().min(1, '模型显示名称不能为空'),
- id: z.string().min(1, '模型 ID 不能为空').max(150, '模型 ID 不能超过 150 个字符'),
- providerId: z.string().min(1, 'Provider ID 不能为空').max(64, 'Provider ID 不能超过 64 个字符'),
+ displayName: z.string().min(1, 'Model display name cannot be empty'),
+ id: z.string().min(1, 'Model ID cannot be empty').max(150, 'Model ID cannot exceed 150 characters'),
+ providerId: z.string().min(1, 'Provider ID cannot be empty').max(64, 'Provider ID cannot exceed 64 characters'),
});
export const UpdateModelRequestSchema = ModelPayloadBaseSchema.partial();
@@ -77,6 +77,6 @@ export type CreateModelRequest = z.infer<typeof CreateModelRequestSchema>;
export type UpdateModelRequest = z.infer<typeof UpdateModelRequestSchema>;
export const ModelIdParamSchema = z.object({
- modelId: z.string().min(1, '模型 ID 不能为空').max(150, '模型 ID 不能超过 150 个字符'),
- providerId: z.string().min(1, 'Provider ID 不能为空').max(64, 'Provider ID 不能超过 64 个字符'),
+ modelId: z.string().min(1, 'Model ID cannot be empty').max(150, 'Model ID cannot exceed 150 characters'),
+ providerId: z.string().min(1, 'Provider ID cannot be empty').max(64, 'Provider ID cannot exceed 64 characters'),
});
diff --git a/packages/openapi/src/types/provider.type.ts b/packages/openapi/src/types/provider.type.ts
index e92dfbac232..0bfa87406f9 100644
--- a/packages/openapi/src/types/provider.type.ts
+++ b/packages/openapi/src/types/provider.type.ts
@@ -60,14 +60,14 @@ const ProviderPayloadBaseSchema = z.object({
fetchOnClient: z.boolean().nullable().optional(),
keyVaults: z.record(z.string()).optional(),
logo: z.string().nullable().optional(),
- name: z.string().min(1, 'Provider 名称不能为空').nullable().optional(),
+ name: z.string().min(1, 'Provider name cannot be empty').nullable().optional(),
settings: z.record(z.unknown()).optional(),
sort: z.number().int().nullable().optional(),
source: z.enum(['builtin', 'custom']).optional(),
});
export const CreateProviderRequestSchema = ProviderPayloadBaseSchema.extend({
- id: z.string().min(1, 'Provider ID 不能为空'),
+ id: z.string().min(1, 'Provider ID cannot be empty'),
});
export const UpdateProviderRequestSchema = ProviderPayloadBaseSchema.extend({
@@ -105,7 +105,7 @@ export type UpdateProviderResponse = ProviderDetailResponse;
// ==================== Provider Param Schemas ====================
export const ProviderIdParamSchema = z.object({
- id: z.string().min(1, 'Provider ID 不能为空').max(64, 'Provider ID 不能超过 64 个字符'),
+ id: z.string().min(1, 'Provider ID cannot be empty').max(64, 'Provider ID cannot exceed 64 characters'),
});
export type ProviderIdParam = z.infer<typeof ProviderIdParamSchema>;
diff --git a/packages/openapi/src/types/role.type.ts b/packages/openapi/src/types/role.type.ts
index 6ccedfbb586..8ae69634ba1 100644
--- a/packages/openapi/src/types/role.type.ts
+++ b/packages/openapi/src/types/role.type.ts
@@ -61,10 +61,10 @@ export type CreateRoleRequest = {
export const CreateRoleRequestSchema = z.object({
description: z.string().nullish(),
- displayName: z.string().min(1, '显示名称不能为空'),
+ displayName: z.string().min(1, 'Display name cannot be empty'),
isActive: z.boolean().nullish().default(true),
isSystem: z.boolean().nullish().default(false),
- name: z.string().min(1, '角色名称不能为空'),
+ name: z.string().min(1, 'Role name cannot be empty'),
});
/**
@@ -84,8 +84,8 @@ export type UpdateRolePermissionsRequest = {
export const UpdateRolePermissionsRequestSchema = z
.object({
- grant: z.array(z.string().min(1, '权限 ID 不能为空')).nullish(),
- revoke: z.array(z.string().min(1, '权限 ID 不能为空')).nullish(),
+ grant: z.array(z.string().min(1, 'Permission ID cannot be empty')).nullish(),
+ revoke: z.array(z.string().min(1, 'Permission ID cannot be empty')).nullish(),
})
.refine(
(data) => {
@@ -94,14 +94,14 @@ export const UpdateRolePermissionsRequestSchema = z
return grantLength > 0 || revokeLength > 0;
},
{
- message: '至少需要提供一个要授予或撤销的权限 ID',
+ message: 'At least one permission ID to grant or revoke must be provided',
},
);
// ==================== Common Schemas ====================
export const RoleIdParamSchema = z.object({
- id: z.string().min(1, '角色 ID 不正确'),
+ id: z.string().min(1, 'Invalid role ID'),
});
export { PaginationQuerySchema as RolePermissionsListQuerySchema } from './common.type';
diff --git a/packages/openapi/src/types/topic.type.ts b/packages/openapi/src/types/topic.type.ts
index 9620065a6d4..91bdfb8be48 100644
--- a/packages/openapi/src/types/topic.type.ts
+++ b/packages/openapi/src/types/topic.type.ts
@@ -44,7 +44,7 @@ export const TopicCreateRequestSchema = z.object({
clientId: z.string().optional(),
favorite: z.boolean().optional(),
groupId: z.string().nullish(),
- title: z.string().min(1, '标题不能为空'),
+ title: z.string().min(1, 'Title cannot be empty'),
});
export interface TopicUpdateRequest {
@@ -65,7 +65,7 @@ export const TopicUpdateRequestSchema = z.object({
workingDirectory: z.string().optional(),
})
.optional(),
- title: z.string().min(1, '标题不能为空').optional(),
+ title: z.string().min(1, 'Title cannot be empty').optional(),
});
// ==================== Topic Response Types ====================
@@ -85,13 +85,13 @@ export type TopicListResponse = PaginationQueryResponse<{
// ==================== Common Schemas ====================
export const TopicGetParamSchema = z.object({
- id: z.string().min(1, '话题ID不能为空'),
+ id: z.string().min(1, 'Topic ID cannot be empty'),
});
export const TopicDeleteParamSchema = z.object({
- id: z.string().min(1, '话题ID不能为空'),
+ id: z.string().min(1, 'Topic ID cannot be empty'),
});
export const TopicUpdateParamSchema = z.object({
- id: z.string().min(1, '话题ID不能为空'),
+ id: z.string().min(1, 'Topic ID cannot be empty'),
});
diff --git a/packages/openapi/src/types/user.type.ts b/packages/openapi/src/types/user.type.ts
index a98ff98190d..7fded0ca6c6 100644
--- a/packages/openapi/src/types/user.type.ts
+++ b/packages/openapi/src/types/user.type.ts
@@ -41,14 +41,14 @@ export interface CreateUserRequest {
export const CreateUserRequestSchema = z.object({
avatar: z.string().nullish(),
- email: z.string().email('邮箱格式不正确').nullish(),
+ email: z.string().email('Invalid email format').nullish(),
firstName: z.string().nullish(),
fullName: z.string().nullish(),
id: z.string().nullish(),
lastName: z.string().nullish(),
phone: z.string().nullish(),
- roleIds: z.array(z.string().min(1, '角色ID不能为空')).nullish(),
- username: z.string().min(1, '用户名不能为空').nullish(),
+ roleIds: z.array(z.string().min(1, 'Role ID cannot be empty')).nullish(),
+ username: z.string().min(1, 'Username cannot be empty').nullish(),
});
/**
@@ -72,15 +72,15 @@ export interface UpdateUserRequest {
*/
export const UpdateUserRequestSchema = z.object({
avatar: z.string().nullish(),
- email: z.string().email('邮箱格式不正确').nullish(),
+ email: z.string().email('Invalid email format').nullish(),
firstName: z.string().nullish(),
fullName: z.string().nullish(),
isOnboarded: z.boolean().nullish(),
lastName: z.string().nullish(),
phone: z.string().nullish(),
preference: z.any().nullish(),
- roleIds: z.array(z.string().min(1, '角色ID不能为空')).nullish(),
- username: z.string().min(1, '用户名不能为空').nullish(),
+ roleIds: z.array(z.string().min(1, 'Role ID cannot be empty')).nullish(),
+ username: z.string().min(1, 'Username cannot be empty').nullish(),
});
// ==================== User Search Types ====================
@@ -104,8 +104,8 @@ export interface AddRoleRequest {
}
export const AddRoleRequestSchema = z.object({
- expiresAt: z.string().datetime('过期时间必须是有效的ISO 8601格式').nullish(),
- roleId: z.string().min(1, '角色ID不能为空'),
+ expiresAt: z.string().datetime('Expiry time must be a valid ISO 8601 format').nullish(),
+ roleId: z.string().min(1, 'Role ID cannot be empty'),
});
/**
@@ -119,7 +119,7 @@ export interface UpdateUserRolesRequest {
export const UpdateUserRolesRequestSchema = z
.object({
addRoles: z.array(AddRoleRequestSchema).nullish(),
- removeRoles: z.array(z.string().min(1, '角色ID不能为空')).nullish(),
+ removeRoles: z.array(z.string().min(1, 'Role ID cannot be empty')).nullish(),
})
.refine(
(data) => {
@@ -130,7 +130,7 @@ export const UpdateUserRolesRequestSchema = z
);
},
{
- message: '必须指定要添加或移除的角色',
+ message: 'At least one role to add or remove must be specified',
},
)
.refine(
@@ -145,7 +145,7 @@ export const UpdateUserRolesRequestSchema = z
return overlap.length === 0;
},
{
- message: '不能同时添加和移除同一个角色',
+ message: 'Cannot add and remove the same role simultaneously',
},
);
@@ -178,5 +178,5 @@ export interface UserRoleOperationResult {
// ==================== Common Schemas ====================
export const UserIdParamSchema = z.object({
- id: z.string().min(1, '用户ID不能为空'),
+ id: z.string().min(1, 'User ID cannot be empty'),
});