chore: replace all cn comments of fe to en version by volc api (#320)
This commit is contained in:
@@ -14,5 +14,5 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// 快捷指令在IDE中的配置tool
|
||||
// Quick instructions in the IDE configuration tool
|
||||
export { ShortcutToolConfig } from './shortcut-config';
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// 快捷指令在IDE中的配置tool
|
||||
// Quick instructions in the IDE configuration tool
|
||||
import React, { type FC, useState } from 'react';
|
||||
|
||||
import { useShallow } from 'zustand/react/shallow';
|
||||
@@ -85,7 +85,7 @@ export const ShortcutToolConfig: FC<ShortcutToolConfigProps> = props => {
|
||||
const getSpaceId = useSpaceStore(state => state.getSpaceId);
|
||||
const setHasValidData = useToolValidData();
|
||||
|
||||
// single不展示指定agent的快捷指令
|
||||
// Single command that does not show the specified agent
|
||||
const singleShortcuts = initShortcuts?.filter(shortcut => !shortcut.agent_id);
|
||||
const shortcuts =
|
||||
botMode === BotMode.SingleMode ? singleShortcuts : initShortcuts;
|
||||
@@ -174,7 +174,7 @@ export const ShortcutToolConfig: FC<ShortcutToolConfigProps> = props => {
|
||||
},
|
||||
{ __disableErrorToast: true },
|
||||
);
|
||||
// TODO: hzf 得加上
|
||||
// TODO: hzf has to be added
|
||||
// if (res && res.data?.check_not_pass) {
|
||||
// Toast.error(I18n.t('shortcut_modal_illegal_keyword_detected_error'));
|
||||
// onFail();
|
||||
@@ -214,7 +214,7 @@ export const ShortcutToolConfig: FC<ShortcutToolConfigProps> = props => {
|
||||
{ __disableErrorToast: true },
|
||||
);
|
||||
const strictShortcuts = newShortcut && getStrictShortcuts([newShortcut]);
|
||||
// 一次只能添加一个快捷指令
|
||||
// Only one shortcut can be added at a time
|
||||
const strictShortcut = strictShortcuts?.[0];
|
||||
if (!strictShortcut) {
|
||||
Toast.error('Please fill in the required fields');
|
||||
|
||||
@@ -54,7 +54,7 @@ export const ShortcutItem: FC<ShortcutItemProps> = ({
|
||||
useEffect(() => {
|
||||
connect(dropRef, dragRef);
|
||||
}, [dragRef, dropRef]);
|
||||
// 点击删除,弹出二次确认弹窗
|
||||
// Click Delete to pop up the secondary confirmation pop-up window.
|
||||
const openConfirmRemoveModal = () => {
|
||||
UIModal.info({
|
||||
title: I18n.t('bot_ide_shortcut_removal_confirm'),
|
||||
|
||||
@@ -113,10 +113,10 @@ export const ActionSwitchArea = forwardRef<
|
||||
tool_params_list = [],
|
||||
} = toolInfo || {};
|
||||
const newComponents = initComponentsByToolParams(tool_params_list);
|
||||
// TODO: hzf, 有点复杂,看看可以initValue么
|
||||
// TODO: hzf, it's a bit complicated, let's see if it can initValue
|
||||
formRef.current?.formApi.setValue('components_list', newComponents);
|
||||
setComponents(newComponents);
|
||||
// 只有这种情况需要手动更新数据
|
||||
// Only in this case do you need to manually update the data
|
||||
componentsRef.current?.formApi?.setValues(newComponents);
|
||||
|
||||
formRef.current?.formApi.setValue('tool_type', tool_type);
|
||||
|
||||
@@ -39,7 +39,7 @@ export const initComponentsByToolParams = (
|
||||
};
|
||||
});
|
||||
|
||||
// 获取没有被使用的组件
|
||||
// Get unused components
|
||||
export const getUnusedComponents = (
|
||||
shortcut: ShortcutEditFormValues,
|
||||
): shortcut_command.Components[] => {
|
||||
|
||||
@@ -14,16 +14,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// format选择的插件参数列表
|
||||
// Format selected plugin parameter list
|
||||
import { type WorkFlowItemType } from '@coze-studio/bot-detail-store';
|
||||
import { type PluginApi, ToolType } from '@coze-arch/bot-api/playground_api';
|
||||
|
||||
import { type ToolInfo } from '../../../types';
|
||||
|
||||
// 最多勾选10个,如果入参数量超过10个,仅勾选其中10个,优先勾选required参数;勾满10个时,其他checkbox置灰不可继续勾选。
|
||||
// Check up to 10 parameters. If the number of input parameters exceeds 10, only 10 of them will be checked, and the required parameters will be selected first; when 10 parameters are checked, other checkboxes out grey cannot be checked.
|
||||
export const MAX_TOOL_PARAMS_COUNT = 10;
|
||||
|
||||
// 初始化工具列表参数
|
||||
// Initialization tool list parameters
|
||||
export const initToolInfoByToolApi = (
|
||||
toolApi?: WorkFlowItemType | PluginApi,
|
||||
): ToolInfo | null => {
|
||||
@@ -38,7 +38,7 @@ export const initToolInfoByToolApi = (
|
||||
|
||||
const { tool_params_list } = workflowPluginProcessedToolInfo;
|
||||
|
||||
// 对params进行排序,将required=true的字段排在前面
|
||||
// Sort params to rank fields with required = true first
|
||||
const sortedParams = tool_params_list?.sort(
|
||||
(a, b) => (b.required ? 1 : -1) - (a.required ? 1 : -1),
|
||||
);
|
||||
@@ -60,7 +60,7 @@ export const initToolInfoByToolApi = (
|
||||
};
|
||||
};
|
||||
|
||||
// workflow参数转化为toolParams
|
||||
// Convert workflow parameters to toolParams
|
||||
export const initToolInfoByWorkFlow = (
|
||||
workFlow: WorkFlowItemType,
|
||||
): ToolInfo => {
|
||||
@@ -86,7 +86,7 @@ export const initToolInfoByPlugin = (plugin: PluginApi): ToolInfo => {
|
||||
};
|
||||
};
|
||||
|
||||
// 获取skillModal开启的tab
|
||||
// Get tabs opened by skillModal
|
||||
export const getSkillModalTab = (): (
|
||||
| 'plugin'
|
||||
| 'workflow'
|
||||
|
||||
@@ -53,7 +53,7 @@ export const ButtonName: FC<ButtonNameProps> = props => {
|
||||
noLabel
|
||||
fieldClassName="!pb-0"
|
||||
onLoadList={list => {
|
||||
// 如果是编辑状态,不设置默认icon, 新增下默认选中列表第一个icon
|
||||
// If it is an editing state, do not set the default icon, and add the first icon in the default selected list.
|
||||
const isEdit = !!editedShortcut.command_id;
|
||||
if (isEdit) {
|
||||
return;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { type FC, useState } from 'react';
|
||||
|
||||
import cls from 'classnames';
|
||||
@@ -107,7 +107,7 @@ export const IconListField = () => (
|
||||
<div className="flex justify-center items-center flex-col w-[420px] h-[148px]">
|
||||
<IconCozWarningCircle className="mb-4 w-8 h-8 coz-fg-hglt-red" />
|
||||
<div className="coz-fg-secondary text-xs">
|
||||
{/*@ts-expect-error --替换*/}
|
||||
{/* @ts-expect-error -- replace*/}
|
||||
{I18n.t('Connection failed')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -86,7 +86,7 @@ export const ComponentDefaultValue: FC<ComponentDefaultValueProps> = props => {
|
||||
);
|
||||
}
|
||||
if (type === 'upload') {
|
||||
// 先置灰,后续放开上传默认值
|
||||
// Grey out first, then release the upload default value.
|
||||
return <UploadField />;
|
||||
// return (
|
||||
// <UploadDefaultValue
|
||||
|
||||
@@ -67,13 +67,13 @@ export const getInputTypeFromFile = (file: File): UploadItemType | '' => {
|
||||
return getInputTypeFromFileType(fileType);
|
||||
};
|
||||
|
||||
// 判断文件是否超过最大限制
|
||||
// Determine whether the file exceeds the maximum limit
|
||||
export const isOverMaxSizeByUploadItemConfig = (
|
||||
file: File | undefined,
|
||||
config: UploadItemConfig | undefined,
|
||||
): {
|
||||
isOverSize: boolean;
|
||||
// 单位 MB
|
||||
// Unit MB
|
||||
maxSize?: number;
|
||||
} => {
|
||||
if (!file) {
|
||||
@@ -104,7 +104,7 @@ export const isOverMaxSizeByUploadItemConfig = (
|
||||
};
|
||||
};
|
||||
|
||||
// 根据acceptUploadItemTypes获取accept
|
||||
// Accept based on acceptUploadItemTypes
|
||||
export const getAcceptByUploadItemTypes = (
|
||||
acceptUploadItemTypes: UploadItemType[],
|
||||
) => {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { forwardRef, useImperativeHandle, useRef, useState } from 'react';
|
||||
|
||||
import { DndProvider } from '@coze-studio/components/dnd-provider';
|
||||
@@ -45,7 +45,7 @@ import { tableEmpty } from './empty';
|
||||
import styles from './index.module.less';
|
||||
|
||||
export interface ComponentsTableProps {
|
||||
components: shortcut_command.Components[]; // 变量列表
|
||||
components: shortcut_command.Components[]; // Variable list
|
||||
onChange?: (components: shortcut_command.Components[]) => void;
|
||||
toolType?: shortcut_command.ToolType;
|
||||
toolInfo: ToolInfo;
|
||||
@@ -59,7 +59,7 @@ export interface ComponentsTableActions {
|
||||
|
||||
const MAX_COMPONENTS = 10;
|
||||
|
||||
// 半受控组件,使用初始值 + 暴露 API 的方式,方便内部维护本地 id 用于拖拽排序标识数据
|
||||
// Semi-controlled component, using initial value + exposed API to facilitate internal maintenance of local ID for dragging and dropping sorting identification data
|
||||
export const ComponentsTable = forwardRef<
|
||||
{ formApi?: ComponentsTableActions },
|
||||
ComponentsTableProps
|
||||
@@ -80,7 +80,7 @@ export const ComponentsTable = forwardRef<
|
||||
formApi: formRef.current
|
||||
? {
|
||||
validate: async (...props) => {
|
||||
// 在这里统一处理,避免多个相同字段触发多次 toast
|
||||
// It is handled uniformly here to avoid multiple identical fields triggering multiple toasts.
|
||||
if (
|
||||
values.some(
|
||||
component =>
|
||||
@@ -128,10 +128,10 @@ export const ComponentsTable = forwardRef<
|
||||
(isBefore ? 0 : 1);
|
||||
sourceItem && newValues.splice(targetIndex, 0, sourceItem);
|
||||
errors.splice(targetIndex, 0, sourceError);
|
||||
// 前后 index 相同的情况不触发 onChange 避免频繁 rerender
|
||||
// Do not trigger onChange if the index is the same before and after to avoid frequent rerender
|
||||
if (sourceIndex !== targetIndex) {
|
||||
onChangeInner(newValues);
|
||||
// 只在拖拽排序后,需要手动更新 form value
|
||||
// Only after dragging sort, you need to manually update the form value
|
||||
formRef.current?.setValues(
|
||||
{
|
||||
values: newValues,
|
||||
@@ -190,7 +190,7 @@ export const ComponentsTable = forwardRef<
|
||||
<DndProvider>
|
||||
<Form<{ values: ComponentsWithId[] }>
|
||||
initValues={{ values }}
|
||||
// 手动触发校验,避免受增删和拖拽排序影响
|
||||
// Manually trigger validation to avoid being affected by addition, deletion and drag-and-drop sorting
|
||||
trigger="custom"
|
||||
autoComplete="off"
|
||||
disabled={disabled}
|
||||
@@ -199,16 +199,16 @@ export const ComponentsTable = forwardRef<
|
||||
const changedKeys = Object.keys(changedValues);
|
||||
if (
|
||||
changedKeys.length === 1 &&
|
||||
// 只在表单修改场景下触发 onChange 避免无限循环
|
||||
// Trigger onChange only in form modification scenarios to avoid infinite loops
|
||||
changedKeys[0]?.startsWith('values.[')
|
||||
) {
|
||||
onChangeInner([...newValues.values]);
|
||||
// 只在编辑表单场景下对具体字段触发校验,其它场景(整行的增删排序)不触发校验
|
||||
// Validation is only triggered for specific fields in the edit form scenario, and verification is not triggered in other scenarios (addition and deletion sorting of entire lines)
|
||||
setTimeout(() => {
|
||||
if (formRef.current) {
|
||||
checkDuplicateName(newValues.values, formRef.current);
|
||||
}
|
||||
// @ts-expect-error semi 的类型定义无法支持多段 path
|
||||
// @ts-expect-error -- The type definition of semi cannot support multi-segment paths
|
||||
formRef.current?.validate([changedKeys[0]]);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ export const checkDuplicateName = (
|
||||
}
|
||||
});
|
||||
setTimeout(() => {
|
||||
// 避免修改后立刻被 field 自己的校验状态覆盖
|
||||
// Avoid being overwritten by the field's own check state immediately after modification
|
||||
Object.entries(fieldMap).forEach(([name, indexArray]) => {
|
||||
const isDuplicated = indexArray.length > 1;
|
||||
indexArray.forEach(index => {
|
||||
@@ -81,7 +81,7 @@ export const getComponentTypeSelectFormInitValues = (): ComponentTypeItem => ({
|
||||
type: 'text',
|
||||
});
|
||||
|
||||
// 定义一个映射对象,将ComponentTypeItem的type映射到对应的input_type和其他字段
|
||||
// Define a mapping object that maps the ComponentTypeItem type to the corresponding input_type and other fields
|
||||
const componentTypeHandlers = {
|
||||
text: () => ({ input_type: InputType.TextInput }),
|
||||
select: (value: ComponentTypeItem) => {
|
||||
@@ -126,11 +126,11 @@ export const getSubmitFieldFromComponentTypeForm = (
|
||||
return result;
|
||||
}
|
||||
|
||||
// 如果没有找到处理函数,就返回默认值
|
||||
// If no handler is found, the default value is returned
|
||||
return { input_type: InputType.TextInput };
|
||||
};
|
||||
|
||||
// 是否是上传类型
|
||||
// Is it the upload type?
|
||||
export const isUploadType = (
|
||||
type: InputType,
|
||||
): type is
|
||||
@@ -157,7 +157,7 @@ export const isUploadType = (
|
||||
InputType.MixUpload,
|
||||
].includes(type);
|
||||
|
||||
// 将input_type映射到对应的处理函数
|
||||
// Map input_type to the corresponding handler
|
||||
const inputTypeHandlers = {
|
||||
[InputType.TextInput]: () => ({ type: 'text' }),
|
||||
[InputType.Select]: (options: string[] = []) => ({
|
||||
@@ -194,7 +194,7 @@ export const getComponentTypeFormBySubmitField = (
|
||||
};
|
||||
|
||||
/**
|
||||
* 1. 修改components列表中对应组件的hide:true
|
||||
* 1. Modify the hide of the corresponding component in the components list: true
|
||||
*/
|
||||
export const modifyComponentWhenSwitchChange = ({
|
||||
components,
|
||||
@@ -215,7 +215,7 @@ export const modifyComponentWhenSwitchChange = ({
|
||||
return item;
|
||||
});
|
||||
|
||||
// components switch是否disable
|
||||
// Components switching disabled
|
||||
export const isSwitchDisabled = ({
|
||||
components,
|
||||
record,
|
||||
@@ -233,17 +233,17 @@ export const isSwitchDisabled = ({
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用工具&为必填参数
|
||||
* Use tools & required parameters
|
||||
*/
|
||||
return !!toolInfo?.tool_params_list?.find(t => t.name === record.parameter)
|
||||
?.required;
|
||||
})();
|
||||
|
||||
// 组件超过最大数量, 不允许开启
|
||||
// Components exceed the maximum number and are not allowed to be opened
|
||||
const isMaxCount =
|
||||
record.hide && components.filter(com => !com.hide).length >= MAX_COMPONENTS;
|
||||
|
||||
/** 必填且没有默认值不允许关闭 */
|
||||
/** Required and no default value Closure is not allowed */
|
||||
const isFinalRequired = isRequired && !isWithDefaultValue;
|
||||
|
||||
return isFinalRequired || isMaxCount;
|
||||
|
||||
@@ -308,7 +308,7 @@ const DraggableBodyRow: FC<
|
||||
onMove: OnMove<string>;
|
||||
}>
|
||||
> = ({ id, onMove, children, sortable }) => {
|
||||
// 因为 name 可能为空,这里拿 shortid 做一个兜底
|
||||
// Because the name may be empty, take shortid as a bottom line here.
|
||||
const dropRef = useRef<HTMLElement>(null);
|
||||
const { connect } = useDnDSortableItem<string>({
|
||||
type,
|
||||
@@ -317,7 +317,7 @@ const DraggableBodyRow: FC<
|
||||
enabled: sortable,
|
||||
});
|
||||
useEffect(() => {
|
||||
// 为了避免复杂的跨组件传值,这里稍微直接操作一下 DOM ,非常抱歉
|
||||
// In order to avoid complicated cross-component value transfer, here is a little direct manipulation of the DOM, I'm very sorry.
|
||||
const handleRef = {
|
||||
current: (dropRef.current?.querySelector(`#${handleId}`) ??
|
||||
null) as HTMLElement | null,
|
||||
@@ -329,7 +329,7 @@ const DraggableBodyRow: FC<
|
||||
|
||||
export const tableComponents = {
|
||||
body: {
|
||||
// semi-ui 导出的类型定义非常不负责任
|
||||
// The type definition exported by semi-ui is very irresponsible
|
||||
row: DraggableBodyRow,
|
||||
},
|
||||
} as unknown as TableComponents;
|
||||
|
||||
@@ -20,11 +20,11 @@ import { Form } from '@coze-arch/bot-semi';
|
||||
|
||||
import style from './index.module.less';
|
||||
|
||||
// TODO: hzf, 取名component有点奇怪
|
||||
// TODO: hzf, the named component is a bit strange
|
||||
export type FormInputWithMaxCountProps = {
|
||||
maxCount: number;
|
||||
} & React.ComponentProps<typeof Form.Input>;
|
||||
// input后带上suffix,表示能够输入的最大字数
|
||||
// After input, put a suffix to indicate the maximum number of words that can be entered
|
||||
export const FormInputWithMaxCount = (props: FormInputWithMaxCountProps) => {
|
||||
const [count, setCount] = React.useState(0);
|
||||
const handleChange = (v: string) => {
|
||||
|
||||
@@ -32,7 +32,7 @@ export const getSubmitValue = (
|
||||
const newValues = { ...values };
|
||||
|
||||
/**
|
||||
* 最先执行 根据是否包含 components_list 设置 send_type
|
||||
* Execute first, depending on whether components_list is included send_type
|
||||
*/
|
||||
mutableSendType(newValues);
|
||||
|
||||
@@ -50,7 +50,7 @@ export const getSubmitValue = (
|
||||
if (!use_tool) {
|
||||
mutableInitNotUseToolFormValues(newValues);
|
||||
}
|
||||
// TODO: hzf干掉不合理
|
||||
// TODO: hzf killing is unreasonable
|
||||
return newValues as ShortCutCommand;
|
||||
};
|
||||
|
||||
@@ -63,7 +63,7 @@ const mutableSendType = (value: ShortcutEditFormValues) => {
|
||||
};
|
||||
|
||||
/**
|
||||
* 为了兼容,需要在修改components_list的default_value,hide的时候同步修改toolParams
|
||||
* For compatibility, you need to modify the toolParams synchronously when modifying the default_value and hide of the components_list
|
||||
* 1.components_list.hide => !toolParams.refer_component
|
||||
* 2.components_list.default_value => refer_component:false && toolParams.default_value
|
||||
*/
|
||||
@@ -90,7 +90,7 @@ export const findToolParamsByComponent = (
|
||||
component: Components,
|
||||
) => params?.find(param => param.name === component.parameter);
|
||||
|
||||
// 初始化query类型的表单参数
|
||||
// Initialize form parameters for query types
|
||||
const mutableInitQueryFormValues = (values: ShortcutEditFormValues): void => {
|
||||
values.tool_type = undefined;
|
||||
values.plugin_id = '';
|
||||
@@ -104,7 +104,7 @@ const mutableInitQueryFormValues = (values: ShortcutEditFormValues): void => {
|
||||
values.card_schema = '';
|
||||
};
|
||||
|
||||
// 初始化使用插件组件的时候表单参数
|
||||
// Initialize form parameters when using plug-in components
|
||||
const mutableInitNotUseToolFormValues = (
|
||||
values: ShortcutEditFormValues,
|
||||
): void => {
|
||||
@@ -137,10 +137,10 @@ const mutableFormatCommandName = (values: ShortcutEditFormValues): void => {
|
||||
};
|
||||
|
||||
/**
|
||||
* 筛选toolParams存在,components中不存在的变量
|
||||
* 并且refer_component=false,
|
||||
* 转化为components_list
|
||||
* 用于向前兼容,旧指令中tool的默认参数放在toolParams中
|
||||
* Filter toolParams exists, variables that do not exist in components
|
||||
* And refer_component = false,
|
||||
* Converted to components_list
|
||||
* For forward compatibility, the default parameters of tool in the old directive are placed in toolParams
|
||||
*/
|
||||
export const initComponentsListFromToolParams = (
|
||||
components: Components[],
|
||||
@@ -167,10 +167,10 @@ export const initComponentsListFromToolParams = (
|
||||
};
|
||||
|
||||
/**
|
||||
* 兼容旧指令
|
||||
* 如果InputType为 UploadImage, UploadDoc, UploadTable, UploadAudio,
|
||||
* 判断upload_options是否为空
|
||||
* 为空,加上对应的upload_options
|
||||
* Compatible with outdated instructions
|
||||
* If the InputType is UploadImage, UploadDoc, UploadTable, UploadAudio,
|
||||
* Determine if upload_options is empty
|
||||
* Is empty, plus the corresponding upload_options
|
||||
*/
|
||||
export const initComponentsUploadOptions = (
|
||||
components: Components[],
|
||||
@@ -198,14 +198,14 @@ export const initComponentsUploadOptions = (
|
||||
export const getInitialValues = (
|
||||
initShortcut?: ShortCutCommand,
|
||||
): ShortcutEditFormValues => {
|
||||
// 初始化
|
||||
// initialization
|
||||
if (!initShortcut) {
|
||||
return {
|
||||
send_type: SendType.SendTypeQuery,
|
||||
use_tool: false,
|
||||
};
|
||||
}
|
||||
// 回显
|
||||
// echo
|
||||
const {
|
||||
shortcut_command,
|
||||
tool_type,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import React, {
|
||||
type Dispatch,
|
||||
type FC,
|
||||
@@ -106,7 +106,7 @@ export const ShortcutEditModal: FC<ShortcutEditModalProps> = props => {
|
||||
getInitialValues(shortcut),
|
||||
);
|
||||
|
||||
// 使用技能 & 未选择工具 => 禁止提交
|
||||
// Use Skills & Unselected Tools = > Forbid Submissions
|
||||
const disableSubmit =
|
||||
editedShortcut?.use_tool && !editedShortcut?.tool_info?.tool_name;
|
||||
|
||||
@@ -127,7 +127,7 @@ export const ShortcutEditModal: FC<ShortcutEditModalProps> = props => {
|
||||
console.log('onConfirm', formattedValues);
|
||||
|
||||
if (mode === 'create') {
|
||||
// TODO: hzf add的类型应该没有command_id
|
||||
// TODO: hzf add type should have no command_id
|
||||
onAdd?.(formattedValues, () => {
|
||||
setConfirmLoading(false);
|
||||
});
|
||||
@@ -146,7 +146,7 @@ export const ShortcutEditModal: FC<ShortcutEditModalProps> = props => {
|
||||
await formRef.current?.formApi.validate();
|
||||
|
||||
return actionSwitchAreaRef.current?.validate();
|
||||
// eslint-disable-next-line @coze-arch/use-error-in-catch -- 正常表单校验不需要处理e
|
||||
// eslint-disable-next-line @coze-arch/use-error-in-catch -- normal form validation does not require processing e
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
@@ -166,7 +166,7 @@ export const ShortcutEditModal: FC<ShortcutEditModalProps> = props => {
|
||||
|
||||
const { data: pluginData } = useRequest(
|
||||
async () => {
|
||||
// 方便类型推断
|
||||
// convenient type inference
|
||||
if (shortcut?.plugin_id && spaceId) {
|
||||
const res = await PluginDevelopApi.GetPlaygroundPluginList({
|
||||
page: 1,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import React, { type RefObject, useMemo, useRef, useState } from 'react';
|
||||
|
||||
import cls from 'classnames';
|
||||
@@ -61,7 +61,7 @@ export const SwitchAgent = (props: SwitchAgentProps) => {
|
||||
if (!editedShortcut.agent_id) {
|
||||
return {
|
||||
defaultAgentId: '',
|
||||
// @ts-expect-error --后面替换
|
||||
// @ts-expect-error -- replace later
|
||||
defaultName: I18n.t('Do not specify'),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -78,10 +78,10 @@ const ExpressionEditorContainer = forwardRef<
|
||||
useEffect(() => model.setVariableTree(variableTree), [variableTree]);
|
||||
useEffect(() => model.setFocus(focus), [focus]);
|
||||
|
||||
// 同步表单值变化
|
||||
// Synchronize form value changes
|
||||
useEffect(() => {
|
||||
if (model.value === formValue) {
|
||||
// 无需同步
|
||||
// No synchronization required
|
||||
return;
|
||||
}
|
||||
model.setValue(formValue);
|
||||
|
||||
@@ -70,7 +70,7 @@ const VarQueryTextarea: FC<UsageWithVarTextAreaProps> = props => {
|
||||
|
||||
useEffect(() => editorRef.current?.model.setFocus(focus), [focus]);
|
||||
|
||||
// 设置防抖防止 onFocus / onBlur 在点击时出现抖动
|
||||
// Set anti-shake to prevent onFocus/onBlur from shaking when clicked
|
||||
const setFocus = useCallback(
|
||||
debounce((newFocusValue: boolean) => {
|
||||
_setFocus(newFocusValue);
|
||||
|
||||
@@ -55,7 +55,7 @@ interface ExpressionEditorSuggestionProps {
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动提示
|
||||
* autoprompt
|
||||
*/
|
||||
export const VarExpressionEditorSuggestion: FC<
|
||||
ExpressionEditorSuggestionProps
|
||||
|
||||
@@ -23,7 +23,7 @@ import type { ShortCutCommand } from '@coze-agent-ide/tool-config';
|
||||
export enum OpenModeType {
|
||||
OnlyOnceAdd = 'only_once_add',
|
||||
}
|
||||
// TODO: hzf 两份定义?
|
||||
// TODO: hzf two definitions?
|
||||
export interface SkillsModalProps {
|
||||
tabsConfig?: {
|
||||
plugin?: {
|
||||
@@ -44,9 +44,9 @@ export interface SkillsModalProps {
|
||||
};
|
||||
};
|
||||
tabs: ('plugin' | 'workflow' | 'datasets' | 'imageFlow')[];
|
||||
/** 打开弹窗模式:
|
||||
* 默认不传
|
||||
* only_once_add:仅可添加一次后关闭,并返回callback函数
|
||||
/** Open pop-up mode:
|
||||
* Do not pass by default
|
||||
* only_once_add: close after adding only once and return the callback function
|
||||
*/
|
||||
openMode?: OpenModeType;
|
||||
openModeCallback?: (val?: PluginApi | WorkFlowItemType) => void;
|
||||
|
||||
Reference in New Issue
Block a user