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

@@ -25,13 +25,13 @@ export const generateFieldComponent = (
options: GenerateFieldComponentOptions,
) => {
const { type, validateJsonSchema } = options;
/** 音色类型 */
/** timbre type */
if (ViewVariableType.Voice === type) {
return {
['x-component']: 'SelectVoice',
};
}
/** 文件类型 */
/** file type */
if (ViewVariableType.isFileType(type)) {
const fileType = [
ViewVariableType.Image,
@@ -42,14 +42,14 @@ export const generateFieldComponent = (
return {
['x-component']: 'TypedFileInput',
['x-component-props']: {
// 如果是数组类型,则表明是多选的文件选择器
// If it is an array type, it indicates that it is a multi-selected file selector
multiple: ViewVariableType.isArrayType(type),
accept: getFileAccept(type),
fileType,
},
};
}
/** 排除文件类型的对象类型、数组类型 */
/** Exclude object types and array types for file types */
if (ViewVariableType.isArrayType(type) || ViewVariableType.Object === type) {
return {
['x-component']: 'InputJson',
@@ -80,7 +80,7 @@ export const generateFieldComponent = (
['x-component']: 'InputTime',
};
}
/** string 类型和其它未知类型都渲染普通输入框 */
/** String type and other unknown types all render normal text boxes */
return {
['x-component']: 'InputString',
};

View File

@@ -29,8 +29,8 @@ interface GenerateFieldValidatorOptions {
}
/**
* ajv 实例缓存
* 无需导入创建或者多次创建,优化内存开销
* AJV instance cache
* No need to import or create multiple times, optimizing memory overhead
*/
let ajvCache: undefined | Ajv;
@@ -45,7 +45,7 @@ export const generateFieldValidator = (
param_name: title || name,
});
}
// 如果有结构化描述,还需要对值进行反序列化校验
// If there is a structured description, the value also needs to be deserialized
if (validateJsonSchema && value !== undefined) {
if (!ajvCache) {
ajvCache = new Ajv();
@@ -57,9 +57,9 @@ export const generateFieldValidator = (
return valid ? undefined : I18n.t('workflow_debug_wrong_json');
} catch {
/**
* 报错有多种可能,预期结果都是校验不通过
* 1. 值反序列化失败
* 2. 反序列化的值不合法
* There are many possibilities for error reporting, and the expected result is that the verification fails.
* 1. Value deserialization failed
* 2. The deserialized value is not legal
*/
return I18n.t('workflow_debug_wrong_json');
}

View File

@@ -32,7 +32,7 @@ interface GenerateFieldOptions {
}
/**
* 表单 Field Schema 计算
* Form Field Schema Calculation
*/
export const generateField = (options: GenerateFieldOptions): IFormSchema => {
const {
@@ -57,9 +57,9 @@ export const generateField = (options: GenerateFieldOptions): IFormSchema => {
},
['x-origin-type']: type as unknown as string,
...generateFieldValidator(options),
// 渲染组件相关
// rendering component related
...generateFieldComponent({ type, validateJsonSchema }),
// component 也自带默认值,入参的默认值优先级更高
// Component also comes with default values, and the default values of imported parameters have higher priority
defaultValue,
...extra,
};

View File

@@ -17,7 +17,7 @@
import { isObject } from 'lodash-es';
/**
* 是否是空的 properties
* Is it an empty property?
*/
export const isFormSchemaPropertyEmpty = (properties: unknown) =>
isObject(properties) ? !Object.keys(properties).length : true;