chore: replace all cn comments of fe to en version by volc api (#320)
This commit is contained in:
@@ -22,7 +22,7 @@ export enum BotE2e {
|
||||
BotListIconDel = 'bot.list.delete.icon',
|
||||
BotListIconEdit = 'bot.list.edit.icon',
|
||||
BotKnowledgeAutoMaticBtn = 'bot.knowledge.auto_matic.btn',
|
||||
/** 知识库设置弹框 */
|
||||
/** Knowledge base settings pop-up box */
|
||||
BotKnowledgeSettingModalTitle = 'bot.knowledge.setting.modal.title.text',
|
||||
BotKnowledgeSettingModalAutoRadio = 'bot.knowledge.setting.modal.auto.radio',
|
||||
BotKnowledgeSettingModalManualRadio = 'bot.knowledge.setting.modal.manual.radio',
|
||||
@@ -32,7 +32,7 @@ export enum BotE2e {
|
||||
BotKnowledgeSettingShowSourceDisplaySwitch = 'bot.knowledge.setting.show.source.display.switch',
|
||||
BotKnowledgeSettingShowSourceModeCardRadio = 'bot.knowledge.setting.show.source.mode.cardlist.radio',
|
||||
BotKnowledgeSettingShowSourceModeTextRadio = 'bot.knowledge.setting.show.source.mode.replybottom.radio',
|
||||
/** 选择知识库列表 */
|
||||
/** Select Knowledge Base List */
|
||||
BotKnowledgeSelectListModalCreateBtn = 'bot.knowledge.select.list.modal.create.btn',
|
||||
BotKnowledgeSelectListModalCreateDateSelect = 'bot.knowledge.select.list.modal.create.date.select',
|
||||
BotKnowledgeSelectListModalAllTab = 'bot.knowledge.select.list.modal.all.tab',
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
export enum KnowledgeE2e {
|
||||
KnowledgeTab = 'knowledge.tab',
|
||||
// 知识库列表
|
||||
// Knowledge Base List
|
||||
// KnowledgeSearch = 'ui.search_input',
|
||||
KnowledgeSearchType = 'knowledge.list.search.type.select',
|
||||
KnowledgeSearchFounder = 'knowledge.list.search.founder.select',
|
||||
KnowledgeCreateBtn = 'knowledge.list.create.btn',
|
||||
/** 以ui前缀开头的是原来就打过的标,列表页需要根据index去定位 */
|
||||
/** The one starting with the ui prefix is the original mark, and the list page needs to be positioned according to the index. */
|
||||
// KnowledgeListName = 'knowledge.list.name.text',
|
||||
// KnowledgeListIcon = 'ui.table-meta',
|
||||
// KnowledgeListIconDel = 'ui.table-action.delete',
|
||||
@@ -32,7 +32,7 @@ export enum KnowledgeE2e {
|
||||
KnowledgeListTableTab = 'knowledge.list.table.tab',
|
||||
KnowledgeEditModalDescInput = 'knowledge.edit.modal.desc.input',
|
||||
KnowledgeEditModalNameInput = 'knowledge.edit.modal.name.input',
|
||||
// 创建知识库弹框
|
||||
// Create a knowledge base popup
|
||||
CreateKnowledgeModal = 'knowledge.create.modal',
|
||||
CreateKnowledgeModalTitle = 'knowledge.create.modal.title.text',
|
||||
CreateKnowledgeModalTextRadioGroup = 'knowledge.create.modal.text.RadioGroup',
|
||||
@@ -57,9 +57,9 @@ export enum KnowledgeE2e {
|
||||
CreateKnowledgeModalTextLarkRadio = 'knowledge.create.modal.text.lark.radio',
|
||||
CreateKnowledgeModalTableLarkRadio = 'knowledge.create.modal.table.lark.radio',
|
||||
CreateKnowledgeModalSubmitAndImportButton = 'knowledge.create.modal.submit_and_import.button',
|
||||
// 创建文本类型
|
||||
// Create a text type
|
||||
CreateTextUploadNav = 'knowledge.create.text.upload.nav.text',
|
||||
/** 创建知识库步骤条 */
|
||||
/** Create a knowledge base step bar */
|
||||
// CreateKnowledgeStepUploadFile = 'knowledge.create.step.upload',
|
||||
// CreateKnowledgeStepSegment = 'knowledge.create.step.segment',
|
||||
// CreateKnowledgeStepProcess = 'knowledge.create.step.process',
|
||||
@@ -69,7 +69,7 @@ export enum KnowledgeE2e {
|
||||
UploadUnitAddBtn = 'knowledge.create.unit.add.btn',
|
||||
UploadUnitCancelBtn = 'knowledge.create.unit.cancel.btn',
|
||||
CreateUnitConfirmBtn = 'knowledge.create.unit.confirm.btn',
|
||||
/** 本地上传列表 */
|
||||
/** local upload list */
|
||||
LocalUploadListName = 'knowledge.upload.list.name.input',
|
||||
LocalUploadListNameView = 'knowledge.upload.list.name.text',
|
||||
LocalUploadListStatus = 'knowledge.upload.list.status.text',
|
||||
@@ -86,14 +86,14 @@ export enum KnowledgeE2e {
|
||||
CreateUnitListProgressName = 'knowledge.create.unit.progress.name.text',
|
||||
CreateUnitListProgressPercent = 'knowledge.create.unit.progress.percent.text',
|
||||
|
||||
/** 创建text-online类型(url) */
|
||||
/** Create a text-online type (url) */
|
||||
OnlineUploadAutoBtn = 'knowledge.create.text.online.auto.btn',
|
||||
OnlineUploadManualBtn = 'knowledge.create.text.online.manual.btn',
|
||||
OnlineUploadModal = 'knowledge.create.text.online.upload.modal',
|
||||
OnlineUploadModalAddTypeSelect = 'knowledge.create.text.online.upload.modal.add_type.select',
|
||||
OnlineUploadModalFrequencySelect = 'knowledge.create.text.online.upload.modal.frequency.select',
|
||||
OnlineUploadModalExampleUrlSelect = 'knowledge.create.text.online.upload.modal.example_url.input',
|
||||
/** 创建text-custom类型 */
|
||||
/** Create a text-custom type */
|
||||
CustomUploadNameInput = 'knowledge.create.custom.upload.name.input',
|
||||
SegmentEditor = 'knowledge.segment.editor',
|
||||
SegmentEditorInsertImgBtn = 'knowledge.segment.editor.insert_img.btn',
|
||||
@@ -131,14 +131,14 @@ export enum KnowledgeE2e {
|
||||
ImageAnnotationAllTab = 'knowledge.create.image.annotation.all.tab',
|
||||
ImageAnnotationUnAnnotationTab = 'knowledge.create.image.annotation.un_annotation.tab',
|
||||
ImageAnnotationAnnotationedTab = 'knowledge.create.image.annotation.annotationed.tab',
|
||||
/** 增量 */
|
||||
/** increment */
|
||||
IncrementTableUploadStructureTitle = 'knowledge.increment.table.upload.structure_title.text',
|
||||
IncrementTableUploadStructureColumnName = 'knowledge.increment.table.upload.structure_column_name.input',
|
||||
IncrementTableUploadStructureAddBtn = 'knowledge.increment.table.upload.structure_add.btn',
|
||||
|
||||
// CreateKnowledgeModalCancelBtn = 'knowledge.create.modal.cancel.btn',
|
||||
// CreateKnowledgeModalNextBtn = 'knowledge.create.modal.next.btn',
|
||||
/** segment详情页 */
|
||||
/** Segment details page */
|
||||
SegmentDetailUpdateBtn = 'knowledge.segment.detail.update.btn',
|
||||
SegmentDetailTitle = 'knowledge.segment.detail.title.text',
|
||||
SegmentDetailTitleEditIcon = 'knowledge.segment.detail.title.edit.icon',
|
||||
@@ -167,16 +167,16 @@ export enum KnowledgeE2e {
|
||||
SegmentDetailBatchFrequencyModalSelect = 'knowledge.segment.detail.batch_frequency.modal.select',
|
||||
SegmentDetailBatchFrequencyModalcheckboxAll = 'knowledge.segment.detail.batch_frequency.modal.checkbox_all',
|
||||
SegmentDetailBatchFrequencyModalcheckboxItem = 'knowledge.segment.detail.batch_frequency.modal.checkbox_item',
|
||||
/** segment详情页重新分段流程页 */
|
||||
/** Segment details page Re-segment process page */
|
||||
ResegmentUploadUnitNextBtn = 'knowledge.resegment.unit.next.btn',
|
||||
ResegmentUnitConfirmBtn = 'knowledge.resegment.unit.confirm.btn',
|
||||
/** knowledge通用 */
|
||||
/** Common knowledge */
|
||||
UnitDetailTags = 'knowledge.unit.detail.tags',
|
||||
UnitDetailTagsProcessing = 'knowledge.unit.detail.tags.processing.tag',
|
||||
UnitDetailTagsFailed = 'knowledge.unit.detail.tags.failed.tag',
|
||||
KnowledgeAddContentNavBar = 'knowledge.unit.add.content.navbar',
|
||||
}
|
||||
/** 底层组件 */
|
||||
/** underlying components */
|
||||
export const UIE2E = [
|
||||
'ui.select.option',
|
||||
'ui.table-action.delete',
|
||||
|
||||
@@ -38,6 +38,6 @@ class FeatureRegistryManager extends ExternalStore<
|
||||
}
|
||||
|
||||
/**
|
||||
* FeatureRegistryManager 的实例,用于注册和注销 FeatureRegistry。开发过程中 FeatureRegistry 初始化的时候会写入到这个实例中,方便调试。
|
||||
* FeatureRegistryManager instance for registering and unregistering FeatureRegistry. It will be written to this instance when FeatureRegistry is initialized during development, which is convenient for debugging.
|
||||
*/
|
||||
export const featureRegistryManager = new FeatureRegistryManager();
|
||||
|
||||
@@ -24,14 +24,14 @@ import { featureRegistryManager } from './feature-registry-manager';
|
||||
import { ExternalStore } from './external-store';
|
||||
|
||||
export type FeatureModule<Type, Module> = Module & {
|
||||
type: Type | string; // 默认给Module增加type字段, 方便作为组件的key
|
||||
type: Type | string; // By default, add the type field to the Module, which is convenient as the key of the component
|
||||
};
|
||||
|
||||
export interface FeatureConfig<Type, Module> {
|
||||
type: Type | string;
|
||||
module?: Module;
|
||||
loader?: () => Promise<{ default: Module }>;
|
||||
tags?: string[]; // 通常用于Feature分组
|
||||
tags?: string[]; // Usually Used for Feature Grouping
|
||||
}
|
||||
|
||||
export interface DefaultFeatureConfig<Type, Module>
|
||||
@@ -39,7 +39,7 @@ export interface DefaultFeatureConfig<Type, Module>
|
||||
module: Module;
|
||||
}
|
||||
|
||||
// 通过解析context获取当前应当使用的Feature类型
|
||||
// Get the Feature type that should be used by parsing the context
|
||||
export interface FeatureTypeParser<Type, Context> {
|
||||
(context: Context): Type | string;
|
||||
}
|
||||
@@ -207,7 +207,7 @@ export class FeatureRegistry<Type, Module, Context = undefined> extends External
|
||||
});
|
||||
}
|
||||
|
||||
// 调用Feature loader加载组件
|
||||
// Feature loader to load component
|
||||
async load(type: Type | string): Promise<void> {
|
||||
const feature = this.getFeature(type);
|
||||
if (!feature) {
|
||||
@@ -235,7 +235,7 @@ export class FeatureRegistry<Type, Module, Context = undefined> extends External
|
||||
});
|
||||
}
|
||||
|
||||
// 判断Feature是否已经加载完成
|
||||
// Determine whether the Feature has been loaded
|
||||
isLoaded(type: Type | string): boolean {
|
||||
const feature = this.getFeature(type);
|
||||
if (!feature) {
|
||||
@@ -252,16 +252,16 @@ export class FeatureRegistry<Type, Module, Context = undefined> extends External
|
||||
return true;
|
||||
}
|
||||
|
||||
// Feature是否注册
|
||||
// Features Registration
|
||||
has(type: Type | string): boolean {
|
||||
return Boolean(this.getFeature(type));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 Feature Module
|
||||
* Get Feature Modules
|
||||
*
|
||||
* @param type Feature 类型
|
||||
* @returns 如果 Feature 不存在或者 Feature.Module 是空则返回 undefined
|
||||
* @param type Feature type
|
||||
* @Returns undefined if Feature does not exist or Feature. Module is empty
|
||||
*/
|
||||
getModule(type: Type | string): Module | undefined {
|
||||
const feature = this.getFeature(type);
|
||||
@@ -285,9 +285,9 @@ export class FeatureRegistry<Type, Module, Context = undefined> extends External
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 Feature Module
|
||||
* Get Feature Modules
|
||||
*
|
||||
* @deprecated【注意!】这个方法使用时要注意,因为它会导致 module 的 type 字段被覆盖,使用 `getModule()` 方法
|
||||
* @Deprecated [Note!] Be careful when using this method, because it will cause the type field of the module to be overwritten, use the'getModule () 'method
|
||||
*/
|
||||
get(type: Type | string): FeatureModule<Type, Module> | undefined {
|
||||
const feature = this.getFeature(type);
|
||||
@@ -329,7 +329,7 @@ export class FeatureRegistry<Type, Module, Context = undefined> extends External
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有 Feature 模块的 entries,key 是 feature type,value 是 feature module
|
||||
* Get entries for all Feature modules, key is feature type, value is feature module
|
||||
*/
|
||||
entries(): [Type | string, Module][] {
|
||||
const { featureMap } = this;
|
||||
@@ -358,7 +358,7 @@ export class FeatureRegistry<Type, Module, Context = undefined> extends External
|
||||
>[];
|
||||
}
|
||||
|
||||
// 通过context获取对应的Feature类型
|
||||
// Get the corresponding Feature type through context
|
||||
getTypeByContext(context: Context): Type | string {
|
||||
const { featureTypeParser } = this;
|
||||
if (!featureTypeParser) {
|
||||
@@ -381,7 +381,7 @@ export class FeatureRegistry<Type, Module, Context = undefined> extends External
|
||||
}
|
||||
}
|
||||
|
||||
// 通过context获取对应的Feature模块
|
||||
// Get the corresponding Feature module through the context
|
||||
getByContext(context: Context): FeatureModule<Type, Module> | undefined {
|
||||
const type = this.getTypeByContext(context);
|
||||
return this.get(type);
|
||||
@@ -394,7 +394,7 @@ export class FeatureRegistry<Type, Module, Context = undefined> extends External
|
||||
return this.getAsync(type);
|
||||
}
|
||||
|
||||
// 获取默认Feature模块
|
||||
// Get Default Feature Module
|
||||
getDefault(): FeatureModule<Type, Module> | undefined {
|
||||
if (!this.defaultFeature) {
|
||||
return undefined;
|
||||
@@ -405,12 +405,12 @@ export class FeatureRegistry<Type, Module, Context = undefined> extends External
|
||||
};
|
||||
}
|
||||
|
||||
// 获取默认Feature类型
|
||||
// Get Default Feature Type
|
||||
getDefaultType(): Type | string | undefined {
|
||||
return this.defaultFeature?.type;
|
||||
}
|
||||
|
||||
// 设置默认Feature
|
||||
// Set Default Features
|
||||
setDefaultFeature(feature: DefaultFeatureConfig<Type, Module>) {
|
||||
const { type } = feature;
|
||||
const key = this.getFeatureKey(type);
|
||||
@@ -420,14 +420,14 @@ export class FeatureRegistry<Type, Module, Context = undefined> extends External
|
||||
});
|
||||
}
|
||||
|
||||
// 设置Feature类型解析函数
|
||||
// Setting Features Type Resolving Functions
|
||||
setFeatureTypeParser(parser: FeatureTypeParser<Type, Context>) {
|
||||
this.featureTypeParser = parser.bind({
|
||||
/**
|
||||
* @internal
|
||||
* 内部暴露的非标准 has 方法
|
||||
* 用于实现在返回类型时,查找当前类型是否有注册。
|
||||
* 注意:根据情况,谨慎使用,勿滥用!
|
||||
* Non-standard methods of internal exposure has
|
||||
* Used to find whether the current type is registered when returning a type.
|
||||
* Attention: According to the situation, use it with caution and do not abuse it!
|
||||
*/
|
||||
internalHas: (type: Type | string): boolean => {
|
||||
try {
|
||||
@@ -458,7 +458,7 @@ export class FeatureRegistry<Type, Module, Context = undefined> extends External
|
||||
});
|
||||
}
|
||||
|
||||
// 获取包含对应Tag的Feature模块
|
||||
// Get the Feature Module containing the corresponding Tag
|
||||
getByTag(tag: string): FeatureModule<Type, Module>[] {
|
||||
const { featureMap } = this;
|
||||
const features = [...featureMap.values()].filter(feature =>
|
||||
|
||||
@@ -19,7 +19,7 @@ import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
||||
import type { IExternalStore } from './external-store';
|
||||
|
||||
/**
|
||||
* 订阅拥有 subscribe 和 getSnapshot 方法的抽象 registry 的变化,内部使用 useSyncExternalStore 实现
|
||||
* Changes to the abstract registry with subscribe and getSnapshot methods, internally using useSyncExternalStore implementation
|
||||
*/
|
||||
export const useRegistryState = <T>(registry: IExternalStore<T>) => {
|
||||
const state = useSyncExternalStore(
|
||||
|
||||
@@ -27,13 +27,13 @@ enum ParamsIndex {
|
||||
}
|
||||
|
||||
/**
|
||||
* 与use-data-reporter区分使用
|
||||
* use-data-reporter用于组件场景
|
||||
* data-reporter用于ts/js场景
|
||||
* Distinguished from use-data-reporter
|
||||
* Use-data-reporter for component scenarios
|
||||
* Data-reporter for ts/js scenarios
|
||||
*/
|
||||
class DataReporter {
|
||||
/**
|
||||
* 获取公共的meta信息
|
||||
* Access to public meta information
|
||||
*/
|
||||
getMeta() {
|
||||
const pathName = window.location.pathname;
|
||||
@@ -49,7 +49,7 @@ class DataReporter {
|
||||
}
|
||||
|
||||
/**
|
||||
* 错误事件上报
|
||||
* Error event reporting
|
||||
* @param namespace
|
||||
* @param event
|
||||
*/
|
||||
@@ -62,7 +62,7 @@ class DataReporter {
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义事件上报
|
||||
* Customs event report
|
||||
* @param namespace
|
||||
* @param event
|
||||
*/
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { useRef, useEffect } from 'react';
|
||||
|
||||
export function useUnmountSignal() {
|
||||
@@ -35,7 +35,7 @@ export function useUnmountSignal() {
|
||||
return controllerRef.current.signal;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- 得是 any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- must be any
|
||||
export function abortable<T extends (...args: any[]) => any | Promise<any>>(
|
||||
func: T,
|
||||
abortSignal: AbortSignal,
|
||||
|
||||
@@ -35,7 +35,7 @@ const LimitCount: React.FC<LimitCountProps> = ({ maxLen, len }) => (
|
||||
);
|
||||
|
||||
export interface InputWithCountProps extends InputProps {
|
||||
// 设置字数限制并显示字数统计
|
||||
// Set word limits and display word count
|
||||
getValueLength?: (value?: InputProps['value'] | string) => number;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ export const getDatabasePageQuery = (): DatabasePageQuery => {
|
||||
};
|
||||
};
|
||||
|
||||
/** 获取 databse 页面模式,如果等于 'modal' 则需要使用全屏形态 */
|
||||
/** Get the Databse page mode, if it is equal to'modal ', you need to use the full-screen mode */
|
||||
export const getDatabasePageMode = (): DatabasePageQuery['page_mode'] => {
|
||||
if (isDatabasePathname()) {
|
||||
return getDatabasePageQuery()?.page_mode;
|
||||
@@ -44,6 +44,6 @@ export const getDatabasePageMode = (): DatabasePageQuery['page_mode'] => {
|
||||
return 'normal';
|
||||
};
|
||||
|
||||
/** 当前 Database 页面模式是弹窗(全屏)形式 */
|
||||
/** The current Database page mode is a pop-up (full screen) format */
|
||||
export const databasePageModeIsModal = (): boolean =>
|
||||
getDatabasePageMode() === 'modal';
|
||||
|
||||
@@ -21,7 +21,7 @@ import { type DocumentSource } from '@coze-arch/bot-api/knowledge';
|
||||
import { isFeishuOrLarkDocumentSource } from './feishu-lark';
|
||||
|
||||
/**
|
||||
* FIXME: 由于后端限制,前端需要在Feishu/Lark路径上去除30天的更新频率,等后续后端解决后即可去掉
|
||||
* FIXME: Due to backend limitations, the front end needs to remove the 30-day update frequency on the Feishu/Lark path, which can be removed after the subsequent backend is resolved.
|
||||
*/
|
||||
export const getUpdateIntervalOptions = (
|
||||
params: {
|
||||
@@ -84,7 +84,7 @@ export const getAppendUpdateIntervalOptions = () => [
|
||||
},
|
||||
];
|
||||
|
||||
// table类型暂时禁用追加更新的更新类型,待后续支持后下掉区分逻辑
|
||||
// Table type Temporarily disables the update type of additional updates, and drops the distinction logic after subsequent support
|
||||
export const getUpdateTypeOptions = (type: FormatType) => [
|
||||
{
|
||||
value: 1,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
const DOMAIN_REGEXP = /^([0-9a-zA-Z-]{1,}\.)+([a-zA-Z]{2,})$/;
|
||||
|
||||
export function isValidUrl(url: string): boolean {
|
||||
@@ -24,7 +24,7 @@ export function isValidUrl(url: string): boolean {
|
||||
// cp-disable-next-line
|
||||
(url.indexOf('https://') !== -1 || url.indexOf('http://') !== -1)
|
||||
);
|
||||
// eslint-disable-next-line @coze-arch/use-error-in-catch -- 根据函数功能无需 throw error
|
||||
// eslint-disable-next-line @coze-arch/use-error-in-catch -- no need to throw error according to function function
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user