chore: replace all cn comments of fe to en version by volc api (#320)

This commit is contained in:
tecvan
2025-07-31 10:32:15 +08:00
committed by GitHub
parent 716ec0cba8
commit 71f6245a01
2960 changed files with 15545 additions and 15545 deletions

View File

@@ -98,7 +98,7 @@ export const MockForm = React.forwardRef(
}));
useEffect(() => {
eventEmitter.on('change', (...args: any[]) => {
// 实际上都是假的咯 假设 args 第一个参数是 field 第二个参数是具体 value
// In fact, it is all false. Suppose the first argument of args is field and the second argument is a specific value.
valuesRef.current[args[0]] = args[1];
props.onValueChange(valuesRef.current, args[1]);
});

View File

@@ -59,7 +59,7 @@ export const StepFooter: FC = () => {
}
const res = await callbackResult;
// 返回 false 则直接 return
// If it returns false, it will be returned directly.
if (typeof res === 'boolean' && res === false) {
setSubmitButtonLoading(false);
return;
@@ -71,7 +71,7 @@ export const StepFooter: FC = () => {
// onSubmit
try {
// 判断传入的 submit 函数如果是异步,则按钮 loading
// Determine if the passed submit function is asynchronous, then the button loading
const callbackResult = onSubmit?.();
if (callbackResult instanceof Promise) {
setSubmitButtonLoading(true);
@@ -79,10 +79,10 @@ export const StepFooter: FC = () => {
await callbackResult;
if (isLastStep) {
//关闭
//close
onCancel?.();
} else {
// 下一步
// Next step
useStepStore.setState(state => ({
step: Math.min(state.step + 1, lastStep),
}));
@@ -95,10 +95,10 @@ export const StepFooter: FC = () => {
const handleClickPrev = () => {
getCallbacks()?.onPrevious?.();
if (isFirstStep) {
// 关闭
// close
onCancel?.();
} else {
// 上一步
// previous step
useStepStore.setState(state => ({
step: Math.max(state.step - 1, firstStep),
}));

View File

@@ -118,7 +118,7 @@ export const TablePreview: FC = () => {
});
let res: AddTableResponse;
try {
// TODO:此需求暂停,后端下线,后续待开放
// TODO: This demand is suspended, the backend is offline, and it will be opened later.
// res = await DataModelApi.AddTable({
// file: {
// tos_uri: fileList[0].response.upload_uri,

View File

@@ -121,7 +121,7 @@ export const TableStructure: FC = () => {
let res: PreviewTableFileResponse;
try {
// TODO:此需求暂停,后端下线,后续待开放
// TODO: This demand is suspended, the backend is offline, and it will be opened later.
// res = await DataModelApi.PreviewTableFile({
// file: {
// tos_uri: fileList[0].response.upload_uri,
@@ -168,7 +168,7 @@ export const TableStructure: FC = () => {
}
});
// 上一步保存当前状态
// Previous Save the current state
onPrevious(() => {
const tableBasicValue =
// @ts-expect-error -- linter-disable-autofix
@@ -265,7 +265,7 @@ export const TableStructure: FC = () => {
};
if (changedKeys.length === 1 && changedKeys.includes('sheetID')) {
// FIXME: 此处 semi 有 bug始终是 override 更新,所以需要也添加上 sheetID 属性
// FIXME: There is a bug in semi here, and it is always override update, so you need to add the sheetID attribute as well.
// @ts-expect-error -- linter-disable-autofix
excelInfoFormRef.current.formApi.setValues({
sheetID: changedValue.sheetID,
@@ -274,7 +274,7 @@ export const TableStructure: FC = () => {
});
}
// 切换 sheet
// Switch sheet
if (
changedKeys.length === 3 &&
changedKeys.includes('headerRow') &&
@@ -284,7 +284,7 @@ export const TableStructure: FC = () => {
await reloadTableValue({ updateTableName: true });
}
// 仅更新 headerRow
// Update headerRow only
if (changedKeys.length === 1 && changedKeys.includes('headerRow')) {
// @ts-expect-error -- linter-disable-autofix
if (changedValue.headerRow >= values.dataStartRow) {
@@ -299,7 +299,7 @@ export const TableStructure: FC = () => {
}
}
// 仅更新 dataStartRow
// Update dataStartRow only
if (
changedKeys.length === 1 &&
changedKeys.includes('dataStartRow')

View File

@@ -163,7 +163,7 @@ export const Upload: FC = () => {
}
try {
// 业务
// business
const { name, fileInstance } = file;
if (fileInstance) {
@@ -246,7 +246,7 @@ export const Upload: FC = () => {
setCurrentState({
fileList: fileList.filter((f, i) => index !== i),
});
// reset 配置
// Reset configuration
setTableStructure({
excelBasicInfo: undefined,
excelValue: undefined,
@@ -380,7 +380,7 @@ export const Upload: FC = () => {
style={{
height: '100%',
/**
* NOTE: 此处采取 css 隐藏是为了保持 upload 过程,否则会取消上传
* NOTE: css hiding is taken here to keep the upload process, otherwise the upload will be cancelled
*/
...(fileList.length > 0
? {
@@ -395,8 +395,8 @@ export const Upload: FC = () => {
});
}}
beforeUpload={fileInfo => {
// 不通过 maxSize 属性来限制的原因是
// 只有 beforeUpload 钩子能改 validateMessage
// The reason for not limiting by the maxSize property is
// Only the beforeUpload hook can change validateMessage
const res = {
fileInstance: fileInfo.file.fileInstance,
status: fileInfo.file.status,
@@ -438,7 +438,7 @@ export const Upload: FC = () => {
dragMainText={I18n.t('db_table_0126_016')}
dragSubText={I18n.t('db_table_0126_017')}
onChange={({ fileList: files }) => {
// 存在校验通过的才上传
// It will only be uploaded if the verification is passed.
if (files.some(f => f.shouldUpload)) {
setCurrentState({
fileList: files,

View File

@@ -14,6 +14,6 @@
* limitations under the License.
*/
// 20MB 限制
// 20MB limit
export const ACCEPT_FILE_MAX_SIZE = 20 * 1024 * 1024;
export const ACCEPT_FILE_TYPES = ['.xlsx', '.xls', '.csv'].join(',');

View File

@@ -62,7 +62,7 @@ export default class DatamodelService<T> {
*
* [jump to BAM]()
*
* Table Import】导入文件数据预检查
* [Table Import] Import file data pre-check
*/
PreviewTableFile(
req: table_import.PreviewTableFileRequest,
@@ -84,7 +84,7 @@ export default class DatamodelService<T> {
*
* [jump to BAM]()
*
* Table Import】导入文件数据任务信息查询
* [Table Import] Import file data task information query
*/
QueryTableFileTaskStatus(
req: table_import.QueryTableFileTaskStatusRequest,
@@ -107,7 +107,7 @@ export default class DatamodelService<T> {
*
* [jump to BAM]()
*
* Table Import】导入文件添加table
* [Table Import] Import file Add table
*/
AddTable(
req: table_import.AddTableRequest,

View File

@@ -22,33 +22,33 @@
export type Int64 = string | number;
export enum BotTableRWMode {
/** 单用户模式 */
/** single user mode */
LimitedReadWrite = 1,
/** 只读模式 */
/** read-only mode */
ReadOnly = 2,
/** 多用户模式 */
/** multi-user mode */
UnlimitedReadWrite = 3,
/** Max 边界值 */
/** Max boundary value */
RWModeMax = 4,
}
export enum BotTableStatus {
/** 初始化(不可用) */
/** Initialization (not available) */
Init = 0,
/** 已上线 */
/** It's online now. */
Online = 1,
/** 删除 */
/** delete */
Delete = 2,
/** 草稿态(未 publish */
/** Draft status (not published) */
Draft = 3,
}
export enum FieldItemType {
/** 文本 */
/** Text */
Text = 1,
/** 数字 */
/** number */
Number = 2,
/** 时间 */
/** time */
Date = 3,
/** float */
Float = 4,
@@ -56,13 +56,13 @@ export enum FieldItemType {
Boolean = 5,
}
/** Table model相关常量,结构体定义 */
/** Table model related constants, structure definitions */
export enum FieldType {
/** 文本 */
/** Text */
Text = 1,
/** 数字 */
/** number */
Number = 2,
/** 时间 */
/** time */
Date = 3,
/** float */
Float = 4,
@@ -71,49 +71,49 @@ export enum FieldType {
}
export enum ImportFileTaskStatus {
/** 任务初始化 */
/** task initialization */
Init = 1,
/** 任务处理中 */
/** Task in progress */
Enqueue = 2,
/** 任务成功 */
/** Mission successful */
Succeed = 3,
/** 任务失败 */
/** Mission failed */
Failed = 4,
}
export enum Language {
/** 中文 */
/** Chinese */
Chinese = 1,
/** 英文 */
/** English */
English = 2,
}
export enum TableType {
/** 草稿 */
/** draft */
DraftTable = 1,
/** 线上 */
/** online */
OnlineTable = 2,
}
export interface FieldItem {
/** 字段名称,用户自定义,可能为中文 */
/** Field name, user-defined, possibly in Chinese */
name: string;
desc?: string;
type: FieldItemType;
must_required?: boolean;
/** 字段Id服务端生成全局唯一新增为0 */
/** Field Id, server level generated, globally unique (added as 0) */
id?: Int64;
/** 字段名称语言类型 */
/** Field Name Language Type */
lang?: Language;
/** 物理字段名,服务端生成,单个table下唯一 */
/** Physical field name, server level generation, unique under a single table */
physics_name?: string;
/** 是否主键 */
/** Whether primary key */
primary_key?: boolean;
/** 字段可见性1:用户自定义2:业务定义对用户可见3:业务定义,对用户隐藏 */
/** Field visibility, 1: user-defined; 2: business definition, visible to users; 3: business definition, hidden from users */
visibility?: number;
/** 在excel文档中使用映射到excel中对应的列 */
/** Used in an excel document, map to the corresponding column in excel */
sequence?: string;
/** 业务自定义扩展field元数据 */
/** Business custom extension field metadata */
map_ext_meta?: Record<string, string>;
}
/* eslint-enable */

View File

@@ -33,15 +33,15 @@ export interface AddTableRequest {
}
export interface AddTableResponse {
/** 相关id. bot_id */
/** Related id bot_id */
bot_id: string;
/** table_id */
table_id: string;
/** 表名 */
/** table name */
table_name: string;
/** 上传 TableFile 的 task id用于后期查询使用.
DataModelService 使用 GID 保证 task_id 全局唯一,后续查询时只需要 task_id.
DataModel 服务会记录 table 的 lastTaskID, 查询时可以通过 table_id 查到唯一的
/** Upload the task id of TableFile for later query use.
DataModelService uses GID to ensure that task_id globally unique, and subsequent queries only require task_id.
The DataModel service will record the lastTaskID of the table, which can be found by table_id when querying
task_id */
task_id: Int64;
code: number;
@@ -51,24 +51,24 @@ task_id */
export interface FileInfo {
/** tos uri */
tos_uri: string;
/** Excel 行号 */
/** Excel line number */
header_row: Int64;
/** Excel 数据开始行 */
/** Excel data start line */
start_data_row: Int64;
/** Excel sheet id, 0 for default */
sheet_id?: number;
}
export interface ImportTableInfo {
/** table 所属的 bot_id */
/** Table belongs to bot_id */
bot_id: string;
/** 表名 */
/** table name */
table_name: string;
/** 表描述 */
/** table description */
table_desc?: string;
/** 字段信息 */
/** Field information */
table_meta: Array<table_base.FieldItem>;
/** 空间ID */
/** Space ID */
space_id: string;
}

View File

@@ -76,7 +76,7 @@ export const useUploadProgress = (params: {
try {
let res: QueryTableFileTaskStatusResponse;
try {
// TODO:此需求暂停,后端下线,后续待开放
// TODO: This demand is suspended, the backend is offline, and it will be opened later.
// res = await DataModelApi.QueryTableFileTaskStatus({
// table_id: tableID,
// bot_id: botID,
@@ -89,7 +89,7 @@ export const useUploadProgress = (params: {
throw error;
}
// 不在Processing则停止轮询
// Stop polling without Processing
// @ts-expect-error -- linter-disable-autofix
if (res?.status !== ImportFileTaskStatus.Enqueue) {
clearInterval(importResultRef.current);
@@ -97,8 +97,8 @@ export const useUploadProgress = (params: {
}
/**
* 成功后---写入localStorage
* 没有任务---写入localStorage
* After success --- write to localStorage
* No task --- write to localStorage
*/
if (
// @ts-expect-error -- linter-disable-autofix
@@ -129,7 +129,7 @@ export const useUploadProgress = (params: {
};
useEffect(() => {
// 读取localStorage,减少不必要的请求次数
// Read localStorage to reduce unnecessary requests
const lsMap = readFromLocalStorage();
const inLocaleStorage = (lsMap[botID] || []).includes(tableID);

View File

@@ -29,7 +29,7 @@ export interface initialConfigStore {
}) => Promise<void>;
}
// 用来存储静态状态,非初始化场景下,仅只读不可修改
// Used to store static state, in non-initialization scenarios, read-only and not modifiable
export const useInitialConfigStore = create<initialConfigStore>()(set => ({
onCancel: noop,
botId: '',

View File

@@ -131,7 +131,7 @@ export const DatabaseModal: React.FC<DatabaseModalProps> = props => {
mapOfShouldHidingDatabaseTableStructureTips,
setMapOfShouldHidingDatabaseTableStructureTips,
] = useLocalStorageState<string | undefined>(
// FIXME: 此属性名意义不明确,处为了兼容,暂不修改此属性名,但后续需要使用更明确的命名
// FIXME: The meaning of this property name is unclear. For compatibility, this property name will not be modified for the time being, but a more explicit naming needs to be used in the future.
'use-local-storage-state-modify-tips',
{
defaultValue: '',
@@ -181,9 +181,9 @@ export const DatabaseModal: React.FC<DatabaseModalProps> = props => {
const showEntry = isEntry && !isEdit && !NL2DBInfo;
const shouldShowAIGenerate =
/**
* 1. 入口不展示
* 2. 编辑态不展示
* 3. Excel导入时不展示
* 1. The entrance is not displayed
* 2. Editing status is not displayed
* 3. Excel is not displayed when importing
*/
!showEntry && !isEdit && createType !== CreateType.excel;
@@ -280,8 +280,8 @@ export const DatabaseModal: React.FC<DatabaseModalProps> = props => {
})),
});
// data 是初始值,此处需要手动 setState 更新子组件状态
// Modal 已提前关闭,子组件卸载,则 ref 为空,需要加上可选链判断一下
// Data is the initial value, where you need to manually setState to update the subcomponent state
// If Modal has been closed early and the subassembly is uninstalled, the ref is empty. You need to add an optional chain to judge.
tableStructureRef.current?.setTableFieldsList(
// @ts-expect-error -- linter-disable-autofix
res.bot_table_list[0].field_list.map(i => ({
@@ -562,7 +562,7 @@ export const DatabaseModal: React.FC<DatabaseModalProps> = props => {
onDeleteField={list => {
setIsDeletedField(
!database.tableMemoryList.every(i =>
// TODO: 当前field id生成规则有问题故暂时使用 nanoid 替换
// TODO: There is a problem with the current field id generation rule, so the nanoid is temporarily replaced
list.find(j => j.nanoid === i.nanoid),
),
);

View File

@@ -20,7 +20,7 @@ import { I18n } from '@coze-arch/i18n';
import { type MapperItem, type TriggerType, VerifyType } from '../../../types';
// 校验 Table Name Field Name
// Validation Table Name and Field Name
const namingRegexMapper = [
{
type: 1,
@@ -49,7 +49,7 @@ export const validateNaming = (str: string, errList: string[] = []) => {
return list;
};
// 校验 Table Fields
// Validation Table Fields
export const thMapper: MapperItem[] = [
{
label: I18n.t('db_add_table_field_name'),
@@ -120,7 +120,7 @@ export const validateFields = (
const msg = verifyItem.message;
switch (verifyItem.type) {
case VerifyType.Required: {
// 报错出现时机:点击保存按钮时,出现提示。表中某一行填写了数据,但是未填写必填字段时,需要报错
// When the error occurs: When clicking the Save button, a prompt appears. When a row in the table fills in the data, but the required fields are not filled in, an error needs to be reported.
if (
trigger === 'save' &&
!value &&
@@ -131,14 +131,14 @@ export const validateFields = (
) {
listItem.errorMapper[thKey].push(msg);
}
// 报错消失时机:必填输入框输入了内容后,报错立刻消失
// Error reporting and disappearance timing: Required text box After entering the content, the error will disappear immediately
if (trigger === 'change' && value) {
listItem.errorMapper[thKey] = errTarget.filter(i => i !== msg);
}
break;
}
case VerifyType.Unique: {
// 报错出现时机:点击保存按钮时,出现提示。
// When the error occurs: When you click the Save button, a prompt appears.
if (
trigger === 'save' &&
value &&
@@ -146,7 +146,7 @@ export const validateFields = (
) {
listItem.errorMapper[thKey].push(msg);
}
// 报错消失时机:必填输入框输入了内容后,报错立刻消失
// Error reporting and disappearance timing: Required text box After entering the content, the error will disappear immediately
if (
trigger === 'change' &&
value &&
@@ -157,7 +157,7 @@ export const validateFields = (
break;
}
case VerifyType.Naming: {
// 报错出现时机:命名格式有问题,失去焦点时,立刻校验格式
// Error timing: There is a problem with the naming format. When you lose focus, check the format immediately
if (
trigger === 'save' ||
trigger === 'blur' ||

View File

@@ -97,10 +97,10 @@ export interface DatabaseTableStructureProps {
loading?: boolean;
loadingTips?: string;
/**
* excel: 单用户模式|只读模式
* normal: 单用户模式|只读模式
* expert: 单用户模式|只读模式|多用户模式
* undefined: 不支持读写模式
* Excel: single user mode | read-only mode
* Normal: Single user mode | Read-only mode
* Expert: Single user mode | Read-only mode | Multi-user mode
* Undefined: Read and write modes are not supported
*/
readAndWriteModeOptions?: ReadAndWriteModeOptions;
enableAdd?: boolean;
@@ -219,11 +219,11 @@ export const DatabaseTableStructure = forwardRef<
};
const verifyAllBeforeSave = async (): Promise<boolean> => {
// 触发 tableFields 校验
// Trigger tableFields validation
const validatedTableFieldsList = validateFields(tableFieldsList, 'save');
setTableFieldsList(validatedTableFieldsList);
// 触发并校验 tableBasicInfo
// Trigger and validate tableBasicInfo
try {
// @ts-expect-error -- linter-disable-autofix
await tableBasicInfoFormRef.current.formApi.validate(['name']);
@@ -231,7 +231,7 @@ export const DatabaseTableStructure = forwardRef<
return false;
}
// 校验 tableFields
// Validation tableFields
if (
validatedTableFieldsList.find(i =>
Object.keys(i.errorMapper || {}).find(
@@ -242,7 +242,7 @@ export const DatabaseTableStructure = forwardRef<
return false;
}
// 校验 tableFields 是否为空
// Verify that tableFields is empty
if (isEmptyList) {
return false;
}
@@ -354,7 +354,7 @@ export const DatabaseTableStructure = forwardRef<
}
};
// 初始化 ref 属性
// Initialize ref attribute
useImperativeHandle<DatabaseTableStructureRef, DatabaseTableStructureRef>(
ref,
() => ({
@@ -374,7 +374,7 @@ export const DatabaseTableStructure = forwardRef<
[isReadonly, tableFieldsList, tableBasicInfoFormRef],
);
// 自定义表单项组件
// Custom form item component
const FormInputInner: FC<any> = useCallback(
p => {
const { onChange, value, onBlur, validateStatus } = p;
@@ -413,7 +413,7 @@ export const DatabaseTableStructure = forwardRef<
[],
);
// 校验是否 disable 下一步按钮
// Verify that the Next button is disabled
useComputingEnableGoToNextStep?.(tableFieldsList);
const dataSource = enableAdd

View File

@@ -103,7 +103,7 @@ export const DATABASE_CONTENT_CHECK_ERROR_CODE = 708024072;
export const DATABASE_CONTENT_CHECK_ERROR_CODE_NEW = 708334072;
/**
* 内置字段: uuid
* Built-in field: uuid
*/
export const USER_ID_FIELD: TableMemoryItem = {
name: 'uuid',
@@ -115,7 +115,7 @@ export const USER_ID_FIELD: TableMemoryItem = {
};
/**
* 内置字段: id
* Built-in field: id
*/
export const ID_FIELD: TableMemoryItem = {
name: 'id',
@@ -127,6 +127,6 @@ export const ID_FIELD: TableMemoryItem = {
};
/**
* 内置系统字段
* Built-in system fields
*/
export const SYSTEM_FIELDS = [USER_ID_FIELD, ID_FIELD];

View File

@@ -28,9 +28,9 @@ export enum CreateType {
custom = 'custom',
template = 'template',
excel = 'excel',
// 推荐建表
// recommended table
recommend = 'recommend',
// 输入自然语言建表
// Enter natural language to build a table
naturalLanguage = 'naturalLanguage',
}