chore: replace all cn comments of fe to en version by volc api (#320)
This commit is contained in:
@@ -42,9 +42,9 @@ export interface AuthorizeButtonProps {
|
||||
revokeSuccess: (id: string) => void;
|
||||
authInfo: AuthLoginInfo;
|
||||
isMouseIn?: boolean;
|
||||
/** 是否使用 Coze 2.0 的 Button 组件,默认 false */
|
||||
/** Whether to use the Button component of Coze 2.0, the default is false */
|
||||
isV2?: boolean;
|
||||
/** 自定义 Coze 2.0 Button 的 props */
|
||||
/** Custom Coze 2.0 Button props */
|
||||
v2ButtonProps?: ButtonProps;
|
||||
onBeforeAuthRedirect?: (
|
||||
parameters: Pick<AuthorizeButtonProps, 'id' | 'authInfo' | 'origin'>,
|
||||
@@ -156,7 +156,7 @@ export const AuthorizeButton = ({
|
||||
|
||||
return status === ConfigStatus.Configured ? (
|
||||
<>
|
||||
{/* 在 hover 渠道表单对应行,或“撤销授权”弹窗显示中时,显示“撤销授权”按钮 */}
|
||||
{/* Display the "Revoke Authorization" button in the corresponding line of the hover channel form, or in the display of the "Revoke Authorization" pop-up window */}
|
||||
{isMouseIn || revokeModalVisible ? authButton : null}
|
||||
{revokeModal(
|
||||
agentType === 'project' ? (
|
||||
|
||||
@@ -53,17 +53,17 @@ export const AutoGenerateButton: React.FC<AutoGenerateProps> = ({
|
||||
}, [loading]);
|
||||
|
||||
const handleClick = () => {
|
||||
// loading时 触发stop生成
|
||||
// When loading, stop generating
|
||||
if (loading) {
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
// 有开场白时 点击触发二次确认弹窗
|
||||
// When there is an opening statement, click to trigger the secondary confirmation pop-up window.
|
||||
if (needConfirmAgain) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 其余触发自动生成开场白逻辑
|
||||
// The remaining triggers automatically generate opening logic
|
||||
generate();
|
||||
};
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ export const ConnectorField = (props: ConnectorFieldProps) => {
|
||||
}
|
||||
|
||||
function createRules(fieldSchema: FormSchemaItem): RuleItem[] {
|
||||
// 确保 formItemSchema.rules 是一个数组
|
||||
// Make sure formItemSchema.rules is an array
|
||||
const itemRules = fieldSchema.rules ?? [];
|
||||
|
||||
const rules = itemRules.map(rule => {
|
||||
@@ -91,7 +91,7 @@ export const ConnectorField = (props: ConnectorFieldProps) => {
|
||||
return { ...rule, ...(ruleMessage && { message: ruleMessage }) };
|
||||
});
|
||||
|
||||
// 添加 'required' 规则
|
||||
// Add'required 'rule
|
||||
rules.push({
|
||||
required: fieldSchema.required,
|
||||
message: I18n.t('bot_publish_field_placeholder', {
|
||||
@@ -116,7 +116,7 @@ export const ConnectorField = (props: ConnectorFieldProps) => {
|
||||
logger.error({ error: e as Error });
|
||||
values = [];
|
||||
}
|
||||
// 添加一个默认空值
|
||||
// Add a default null value
|
||||
if (!values.length) {
|
||||
values.push('');
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ export interface ConnectorFormProps {
|
||||
|
||||
const DEFAULT_FORM_STEP = 2;
|
||||
|
||||
// 多选 Select 在 Form 中的 value 是 string[],但提交到后端需要转换成 JSON string
|
||||
// Multiple Select The value in the Form is string [], but it needs to be converted to a JSON string when submitted to the backend.
|
||||
type FormValues = Record<string, string | string[]>;
|
||||
|
||||
export const ConnectorForm = forwardRef(
|
||||
@@ -75,7 +75,7 @@ export const ConnectorForm = forwardRef(
|
||||
}));
|
||||
|
||||
useEffect(() => {
|
||||
// 解决formApiRef.current取值不实时问题
|
||||
// Solve the problem that the value of formApiRef.current is not real-time
|
||||
update();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps -- ignore
|
||||
}, [schemaAreaInfo]);
|
||||
|
||||
@@ -34,7 +34,7 @@ export const ConnectorLink = ({
|
||||
botId: string;
|
||||
initValue?: TFormData;
|
||||
}) => {
|
||||
//支持通配URL
|
||||
//Support for wildcard URLs
|
||||
const formatUrl = (url?: string) => {
|
||||
let newUrl = url ?? '';
|
||||
if (newUrl) {
|
||||
|
||||
@@ -87,7 +87,7 @@ export const useConnectorFormModal = ({
|
||||
if (onUnbind) {
|
||||
onUnbind();
|
||||
} else {
|
||||
// 兼容历史逻辑,未传入 onUnbind 时,解绑后也调用 onSuccess
|
||||
// Compatible with historical logic, when onUnbind is not passed in, onSuccess is also called after unbinding.
|
||||
onSuccess({
|
||||
...(initValue as BotPublishConnectorInfo),
|
||||
bind_info: {},
|
||||
@@ -138,9 +138,9 @@ export const useConnectorFormModal = ({
|
||||
const { schema_area_pages: schemaPages = [] } = connectorConfigInfo ?? {};
|
||||
|
||||
const bindCb = (data: BindConnectorResponse) => {
|
||||
/** 适用Kv+Auth授权场景:KvAuthBind = 4
|
||||
* reddit渠道:若成功返回client_id,则覆盖auth_login_info中的client_id,并附带加密state跳转授权页面
|
||||
* 其余渠道:若成功返回auth_params,则合并auth_login_info作为授权链接参数跳转
|
||||
/** Applicable to Kv + Auth authorization scenarios: KvAuthBind = 4
|
||||
* Reddit channel: If the client_id is successfully returned, the client_id in the auth_login_info will be overwritten and the encrypted state jump authorization page will be attached
|
||||
* Other channels: If the auth_params is successfully returned, the merge auth_login_info jump as the authorization link parameter
|
||||
* */
|
||||
if (
|
||||
initValue?.bind_type === BindType.KvAuthBind &&
|
||||
@@ -254,7 +254,7 @@ export const useConnectorFormModal = ({
|
||||
{schemaPages?.length &&
|
||||
step !== 0 &&
|
||||
schemaPages[step]?.api_action !== SchemaAreaPageApi.NotQuery ? (
|
||||
// 页面按钮不执行任何操作时 不展示上一步
|
||||
// When the page button does not perform any action, the previous step is not displayed
|
||||
<UIButton
|
||||
theme="solid"
|
||||
onClick={() => {
|
||||
|
||||
@@ -35,7 +35,7 @@ interface IItemGridView {
|
||||
|
||||
export function ItemGridView(props: IItemGridView) {
|
||||
const { title, resources, showStatus = false, onResourceClick } = props;
|
||||
// HACK: 由于 grid 布局下边界线是透出的背景色,所以 resource 数量为单数的时候需要补齐一个
|
||||
// HACK: Since the boundary line under the grid layout is the transparent background color, one needs to be filled when the number of resources is singular
|
||||
const isEven = size(resources) % 2 === 0;
|
||||
const finalResources = isEven
|
||||
? resources
|
||||
|
||||
@@ -65,7 +65,7 @@ export function useSelectSpacePane() {
|
||||
) : (
|
||||
<SelectorItem
|
||||
space={{
|
||||
// MOCK: 用于展示未加入任何空间的兜底情况
|
||||
// MOCK: used to show the bottom of the cover without joining any space
|
||||
name: I18n.t('resource_move_no_team_joined'),
|
||||
}}
|
||||
disabled
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* eslint-disable @coze-arch/max-line-per-function -- 不好拆 */
|
||||
|
||||
/* eslint-disable @coze-arch/max-line-per-function -- not easy to dismantle */
|
||||
import React, { useCallback, useState } from 'react';
|
||||
|
||||
import { size } from 'lodash-es';
|
||||
@@ -41,27 +41,27 @@ interface BotMoveFailedModalOptions {
|
||||
*/
|
||||
botInfo: Pick<DraftBot, 'id' | 'name'> | null;
|
||||
/**
|
||||
* 更新 bot 状态
|
||||
* Update bot status
|
||||
*/
|
||||
onUpdateBotStatus?: (status: DraftBotStatus) => void;
|
||||
/**
|
||||
* 迁移成功等效于删除 bot
|
||||
* Successful migration is equivalent to deleting the bot
|
||||
*/
|
||||
onMoveSuccess?: () => void;
|
||||
}
|
||||
|
||||
interface UseBotMoveFailedModalValue {
|
||||
/**
|
||||
* 打开弹窗的方法
|
||||
* @param {BotMoveModalOptions} [options] - 此次打开Modal的配置项
|
||||
* How to open the pop-up window
|
||||
* @Param {BotMoveModalOptions} [options] - Open Modal's configuration item this time
|
||||
*/
|
||||
open: (options?: BotMoveFailedModalOptions) => void;
|
||||
/**
|
||||
* 关闭弹窗的方法
|
||||
* How to close the pop-up window
|
||||
*/
|
||||
close: () => void;
|
||||
/**
|
||||
* 弹窗组件实例,需要手动挂载一下
|
||||
* The pop-up component instance needs to be mounted manually.
|
||||
*/
|
||||
modalNode: React.ReactNode;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* eslint-disable @coze-arch/max-line-per-function -- 难拆*/
|
||||
|
||||
/* eslint-disable @coze-arch/max-line-per-function -- difficult to remove*/
|
||||
import React, { useCallback, useState } from 'react';
|
||||
|
||||
import classNames from 'classnames';
|
||||
@@ -50,31 +50,31 @@ interface BotMoveModalOptions {
|
||||
*/
|
||||
botInfo: Pick<DraftBot, 'name' | 'id'> | null;
|
||||
/**
|
||||
* 更新 bot 状态
|
||||
* Update bot status
|
||||
*/
|
||||
onUpdateBotStatus?: (status: DraftBotStatus) => void;
|
||||
/**
|
||||
* 迁移成功等效于删除 bot
|
||||
* Successful migration is equivalent to deleting the bot
|
||||
*/
|
||||
onMoveSuccess?: () => void;
|
||||
/**
|
||||
* 关闭 modal
|
||||
* Close modal
|
||||
*/
|
||||
onClose?: () => void;
|
||||
}
|
||||
|
||||
interface UseBotMoveModalValue {
|
||||
/**
|
||||
* 打开弹窗的方法
|
||||
* @param {BotMoveModalOptions} [options] - 此次打开Modal的配置项
|
||||
* How to open the pop-up window
|
||||
* @Param {BotMoveModalOptions} [options] - Open Modal's configuration item this time
|
||||
*/
|
||||
open: (options?: BotMoveModalOptions) => void;
|
||||
/**
|
||||
* 关闭弹窗的方法
|
||||
* How to close the pop-up window
|
||||
*/
|
||||
close: () => void;
|
||||
/**
|
||||
* 弹窗组件实例,需要手动挂载一下
|
||||
* The pop-up component instance needs to be mounted manually.
|
||||
*/
|
||||
modalNode: React.ReactNode;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ export const ChatBackground: React.FC<ITextToSpeechProps> = ({ title }) => {
|
||||
|
||||
const defaultExpand = useDefaultExPandCheck({
|
||||
blockKey: SkillKeyEnum.BACKGROUND_IMAGE_BLOCK,
|
||||
configured: hasBackGroundImage || showDot, // 无图 有进行中的状态也展示背景图模块不允许被隐藏
|
||||
configured: hasBackGroundImage || showDot, // No picture, there is a status in progress, and the background cover module is not allowed to be hidden.
|
||||
});
|
||||
|
||||
const userInfo = userStoreService.useUserInfo();
|
||||
|
||||
@@ -35,7 +35,7 @@ import styles from './index.module.less';
|
||||
interface CommonTextareaType {
|
||||
textAreaClassName?: string;
|
||||
textAreaProps?: Partial<TextAreaProps>;
|
||||
// 一种特殊的针对placeholder处理方式,::placeholder达不到预期
|
||||
// A special treatment for placeholders, where:: placeholders do not meet expectations
|
||||
emptyClassName?: string;
|
||||
}
|
||||
interface ChatflowCustomTextareaProps extends TextAreaProps {
|
||||
@@ -44,11 +44,11 @@ interface ChatflowCustomTextareaProps extends TextAreaProps {
|
||||
value: string,
|
||||
e: React.MouseEvent<HTMLTextAreaElement, MouseEvent>,
|
||||
) => void;
|
||||
/** 展示模式(即需要省略时)的配置 */
|
||||
/** Configuration of presentation mode (i.e. when omitted) */
|
||||
ellipse?: {
|
||||
rows?: number;
|
||||
} & CommonTextareaType;
|
||||
/** 编辑模式(即需要自动适应)的配置 */
|
||||
/** Configuration of editing mode (i.e. requires automatic adaptation) */
|
||||
autoSize?: {
|
||||
maxHeight?: number;
|
||||
} & CommonTextareaType;
|
||||
@@ -87,10 +87,10 @@ export const CollapsibleTextarea = forwardRef(
|
||||
|
||||
useEffect(() => {
|
||||
if (focused) {
|
||||
// 加timeout可以实现focus的时候滚动到最底并光标在最后
|
||||
// Add timeout to scroll to the bottom and cursor at the end when focusing.
|
||||
setTimeout(() => {
|
||||
if (textAreaRef.current) {
|
||||
// 默认光标在最后
|
||||
// Default cursor at the end
|
||||
textAreaRef.current.setSelectionRange(
|
||||
Number.MAX_SAFE_INTEGER,
|
||||
Number.MAX_SAFE_INTEGER,
|
||||
@@ -107,13 +107,13 @@ export const CollapsibleTextarea = forwardRef(
|
||||
return (
|
||||
<TextArea
|
||||
autosize
|
||||
// key是保证readonly变化后重新渲染
|
||||
// The key is to ensure readonly after changes
|
||||
key="not-readonly"
|
||||
style={
|
||||
autoSize?.maxHeight
|
||||
? // 这里的 style 会应用到 wrapper 上,不限定高度时会意外出现滚动条,只能通过变量修改 textarea 的 overflow
|
||||
// 此外,max-height 会导致预期外的 blur 事件,也只能通过 css 变量将 max-height 动态传给 textarea
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- 传递 css 变量
|
||||
? // The style here will be applied to the wrapper, and the scroll bar will appear unexpectedly when the height is not limited. You can only modify the overflow of the textarea through variables.
|
||||
// In addition, max-height causes an unexpected blur event, and max-height can only be dynamically passed to textarea through the css variable
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- pass css variable
|
||||
({
|
||||
'--chatflow-custom-textarea-overflow-y': 'auto',
|
||||
'--chatflow-custom-textarea-focused-max-height': `${autoSize.maxHeight}px`,
|
||||
@@ -143,7 +143,7 @@ export const CollapsibleTextarea = forwardRef(
|
||||
}
|
||||
return (
|
||||
<TextArea
|
||||
// key是保证readonly变化后重新渲染
|
||||
// The key is to ensure readonly after changes
|
||||
key="readonly"
|
||||
style={{ WebkitLineClamp: ellipse?.rows }}
|
||||
value={value}
|
||||
|
||||
@@ -34,13 +34,13 @@ interface KvBindButtonProps {
|
||||
setDataSource?: (value: SetStateAction<BotPublishConnectorInfo[]>) => void;
|
||||
setSelectedPlatforms?: (id: SetStateAction<string[]>) => void;
|
||||
record: BotPublishConnectorInfo | PublishConnectorInfo;
|
||||
/** 渠道配置成功的回调。若不传入 `unbindCallback`,解绑渠道也会调用该回调,且 bind_id 为空字符串 `''` */
|
||||
/** The callback of the successful channel configuration. If'unbindCallback 'is not passed, the callback will also be called by unbinding the channel, and the bind_id is empty string "" */
|
||||
bindSuccessCallback?: (value: PublishConnectorInfo | undefined) => void;
|
||||
/** 解绑渠道的回调 */
|
||||
/** Callback of untied channels */
|
||||
unbindCallback?: () => void;
|
||||
/** 绑定的 agent_type 。默认为 bot */
|
||||
/** Bound agent_type. Defaults to bot */
|
||||
origin?: 'project' | 'bot';
|
||||
/** 绑定的 bot_id/project_id 。不传则根据 origin 从路由参数中获取 */
|
||||
/** The bound bot_id/project_id. If not passed, get it from the route parameter according to origin */
|
||||
originId?: string;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ export const KvBindButton = ({
|
||||
originId,
|
||||
}: KvBindButtonProps) => {
|
||||
const { bot_id = '', project_id = '' } = useParams<DynamicParams>();
|
||||
// 传给后端的参数名字是 bot_id,另外使用参数 agent_type 来区分 0-bot 1-project
|
||||
// The name of the parameter passed to the backend is bot_id, and the parameter agent_type is used to distinguish 0-bot 1-project.
|
||||
const botId = originId ?? (origin === 'bot' ? bot_id : project_id);
|
||||
const bindSuccessCb = (
|
||||
value: BotPublishConnectorInfo | PublishConnectorInfo | undefined,
|
||||
@@ -66,7 +66,7 @@ export const KvBindButton = ({
|
||||
setDataSource?.((list: BotPublishConnectorInfo[]) => {
|
||||
const target = list.find(l => l.id === value?.id);
|
||||
if (target) {
|
||||
// 解绑旧的服务号后,需要隐藏掉旧的服务号渠道,不允许再绑定
|
||||
// After unbinding the old service number, you need to hide the old service number channel and do not allow it to be bound again.
|
||||
if (target.id === OLD_WX_FWH_ID && !value?.bind_id) {
|
||||
return list.filter(item => item.id !== OLD_WX_FWH_ID);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export const VariableGroupWrapper = (
|
||||
key: string | ReactNode;
|
||||
description: string | ReactNode;
|
||||
};
|
||||
defaultOpen?: boolean; // 添加默认展开属性
|
||||
defaultOpen?: boolean; // Add default expansion properties
|
||||
level?: number;
|
||||
}>,
|
||||
) => {
|
||||
|
||||
@@ -41,7 +41,7 @@ import s from './index.module.less';
|
||||
|
||||
export type TVariable = VariableItem & {
|
||||
enable?: boolean;
|
||||
must_not_use_in_prompt?: string; // 服务端类型已上线无法改boolean。""、"false"、"true"
|
||||
must_not_use_in_prompt?: string; // The server level type is online and cannot be changed to boolean. "," false "," true "
|
||||
ext_desc?: string;
|
||||
prompt_disabled?: boolean;
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
@@ -94,7 +94,7 @@ export const useSystemVariables = (
|
||||
group_conf: [],
|
||||
},
|
||||
);
|
||||
// 分组新逻辑
|
||||
// group new logic
|
||||
const configInfo = initSysVarStatus(resData);
|
||||
setConfig(configInfo);
|
||||
});
|
||||
@@ -108,7 +108,7 @@ export const useSystemVariables = (
|
||||
conf: [],
|
||||
groupConf: [],
|
||||
});
|
||||
// 这里需要根据config来设置sysVariables
|
||||
// Here you need to set sysVariables according to the config.
|
||||
const sysVariables = useMemo(() => {
|
||||
const group = sysConfig.groupConf?.reduce(
|
||||
(prev, cur) => prev.concat(cur?.var_info_list),
|
||||
@@ -117,7 +117,7 @@ export const useSystemVariables = (
|
||||
return [...sysConfig.conf, ...group];
|
||||
}, [sysConfig]);
|
||||
|
||||
// 拼接已启用的系统变量和自定义变量
|
||||
// Splice enabled system variables and custom variables
|
||||
const enableVariables = useMemo(() => {
|
||||
const enableSysVariables =
|
||||
sysVariables
|
||||
@@ -356,7 +356,7 @@ export const useSystemVariables = (
|
||||
: undefined,
|
||||
}));
|
||||
|
||||
// 系统变量
|
||||
// system variable
|
||||
const sysConfigList: ISysConfigItem[] = sysConfig?.conf?.map(item =>
|
||||
configItem(item),
|
||||
);
|
||||
|
||||
@@ -123,7 +123,7 @@ export const MemoryAddModal: React.FC<MemoryAddModalProps> = props => {
|
||||
}, [props.activeId, props.visible]);
|
||||
|
||||
useEffect(() => {
|
||||
// 控制高亮的元素滚至视区内
|
||||
// Controls the highlighted elements to roll into the viewport
|
||||
if (highLight) {
|
||||
document.getElementsByClassName('active-row')?.[0]?.scrollIntoView();
|
||||
}
|
||||
@@ -416,7 +416,7 @@ export const MemoryAddModal: React.FC<MemoryAddModalProps> = props => {
|
||||
'gap-y-2',
|
||||
)}
|
||||
>
|
||||
{/* 用户变量 */}
|
||||
{/* user variable */}
|
||||
<VariableGroupWrapper
|
||||
variableGroup={{
|
||||
key: I18n.t('variable_user_name'),
|
||||
@@ -433,7 +433,7 @@ export const MemoryAddModal: React.FC<MemoryAddModalProps> = props => {
|
||||
header={<UserParamHeader isReadonly={isReadonly} />}
|
||||
/>
|
||||
</VariableGroupWrapper>
|
||||
{/* 系统变量 */}
|
||||
{/* system variable */}
|
||||
<VariableGroupWrapper
|
||||
variableGroup={{
|
||||
key: I18n.t('variable_system_name'),
|
||||
@@ -463,7 +463,7 @@ export const MemoryAddModal: React.FC<MemoryAddModalProps> = props => {
|
||||
showType="variableList"
|
||||
addTemplate={(arr: VariableItem[]) => {
|
||||
const result = [
|
||||
// 使用模版时覆盖历史变量
|
||||
// Override history variables when using templates
|
||||
// ...variables,
|
||||
...arr.map(q => ({
|
||||
id: nanoid(),
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* 检查没有遗漏的项
|
||||
* Check for no missing items
|
||||
*/
|
||||
export const exhaustiveCheckSimple = (_: never) => undefined;
|
||||
|
||||
@@ -89,7 +89,7 @@ export const Setting: React.FC<{ modelId: string }> = ({ modelId }) => {
|
||||
dataSetInfo={knowledge.dataSetInfo}
|
||||
onDataSetInfoChange={async newVal => {
|
||||
const { auto } = newVal;
|
||||
// 修改调用模式时做前置检查
|
||||
// Pre-check when modifying the invocation mode
|
||||
if (auto !== knowledge.dataSetInfo.auto) {
|
||||
try {
|
||||
setLocked(true);
|
||||
@@ -218,8 +218,8 @@ export const DataSetAreaItem: FC<IDataSetAreaProps> = ({
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
// 排除首次初始化和删除更新,原因:
|
||||
// 因为删除会快速操作,useEffect 追踪到数据可能是最终结果,无法保证每次删除都能监听到
|
||||
// Exclude first initialization and deletion of updates for:
|
||||
// Because deletion is quick, useEffect traces that the data may be the final result, and there is no guarantee that every deletion will be monitored
|
||||
if (initRef.current && removedIds.length === 0) {
|
||||
updateSkillKnowledgeDatasetList(
|
||||
dataSetList.map(d => ({
|
||||
@@ -409,7 +409,7 @@ export const useDataSetArea = () => {
|
||||
const validDatasetList = (resp?.dataset_list ?? []).filter(item =>
|
||||
knowledge.dataSetList.some(i => i.dataset_id === item.dataset_id),
|
||||
);
|
||||
// 方便数据复用
|
||||
// Easy data reuse
|
||||
useDraftBotDataSetStore.getState().batchUpdate(validDatasetList);
|
||||
setDataSetList(validDatasetList);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ interface InputSliderProps {
|
||||
marks?: SliderProps['marks'];
|
||||
className?: string;
|
||||
|
||||
/** 是否使用 rc-slider 替换 semi-slider,目前 semi-slider 存在一个比较明显的 bug,在缩放场景下,拖拽定位存在问题,已经反馈等待修复 */
|
||||
/** Whether to use rc-slider to replace semi-slider? At present, there is an obvious bug in semi-slider. In the zoom scene, there is a problem with drag and drop positioning, which has been fed back and is waiting to be fixed. */
|
||||
useRcSlider?: boolean;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ export function ChangeButton({
|
||||
}: ChangeButtonProps) {
|
||||
const [FLAGS] = useFlags();
|
||||
|
||||
// 即将支持,敬请期待
|
||||
// Support soon, so stay tuned.
|
||||
const showText = modeInfo?.showText || FLAGS['bot.studio.prompt_diff'];
|
||||
const ToolTipFragment = tooltip ? Tooltip : React.Fragment;
|
||||
|
||||
|
||||
@@ -60,11 +60,11 @@ export const ModeSelect: React.FC<ModeSelectProps> = ({
|
||||
const handleModeChange = async (value: BotMode) => {
|
||||
try {
|
||||
setBotState({ modeSwitching: true });
|
||||
// bot信息全量保存
|
||||
// The bot information is fully saved.
|
||||
const { botSkillInfo } = getBotDetailDtoInfo();
|
||||
await updateBotRequest(botSkillInfo);
|
||||
|
||||
// 服务端约定 切换模式需要单独调一次只传 bot_mode 的 update
|
||||
// Server level convention, switching mode needs to be adjusted once, only bot_mode update is transmitted.
|
||||
const switchModeParams = {
|
||||
bot_mode: value,
|
||||
...(value === BotMode.MultiMode
|
||||
|
||||
@@ -45,7 +45,7 @@ export const useInitEditor = ({
|
||||
editorRef,
|
||||
});
|
||||
}
|
||||
// 滚动到顶部
|
||||
// Scroll to top
|
||||
editorRef.current?.scrollModule?.scrollTo({
|
||||
top: 0,
|
||||
});
|
||||
|
||||
@@ -56,19 +56,19 @@ export interface OnboardingEditorProps {
|
||||
prologue: string;
|
||||
};
|
||||
isReadonly?: boolean;
|
||||
// 生成中
|
||||
// Generating
|
||||
isGenerating?: boolean;
|
||||
// 聚焦展开
|
||||
// Focus Expand
|
||||
focusExpand?: boolean;
|
||||
onChange?: (context: OnboardingEditorContext) => void;
|
||||
onBlur?: (context: OnboardingEditorContext) => void;
|
||||
noExpand?: boolean; // 右下角展开icon
|
||||
onExpand?: () => void; // 点击展开icon
|
||||
noExpand?: boolean; // Expand icon in lower right corner
|
||||
onExpand?: () => void; // Click expand icon
|
||||
style?: CSSProperties;
|
||||
businessKey?: string; // 用于注册toolbar
|
||||
businessKey?: string; // To register the toolbar
|
||||
noLabel?: boolean;
|
||||
/**
|
||||
* 开启 plainText 模式后,输入内容与原生 textarea 不会有区别,会取消 markdown 支持,并隐藏 toolbar(会覆盖 noToolbar 属性)
|
||||
* When plainText mode is enabled, the input content will not be different from the native textarea, markdown support will be removed, and toolbar will be hidden (the noToolbar property will be overridden).
|
||||
* @default false
|
||||
*/
|
||||
plainText?: boolean;
|
||||
|
||||
@@ -36,7 +36,7 @@ export const sliceEditor = (editorRef: RefObject<Editor>, maxCount: number) => {
|
||||
const sliceCount = currentCount - maxCount;
|
||||
if (sliceCount > 0) {
|
||||
const delta = new ZoneDelta({ zoneId: zone });
|
||||
// 保留maxCount, 删除之后的内容
|
||||
// Keep maxCount, delete the content
|
||||
delta.retain(maxCount).delete(sliceCount);
|
||||
editor.getContentState().apply(delta);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ export const useAddEmptySuggestion = (context: SuggestionListContext) => {
|
||||
} = context.props;
|
||||
useEffect(() => {
|
||||
const addItemIfLastIsNotEmpty = () => {
|
||||
// 如果列表全部有值,且不是只读状态,添加一条空项
|
||||
// If the list has all values and is not read-only, add an empty item
|
||||
const canAddItem =
|
||||
suggested_questions.length < maxItemLength &&
|
||||
suggested_questions.every(sug => sug.content);
|
||||
|
||||
@@ -89,9 +89,9 @@ export const SuggestQuestionItemContent: React.FC<{
|
||||
|
||||
useEffect(() => {
|
||||
if (message.highlight) {
|
||||
// bot详情 - 用户定时任务 - 在开场白中添加引导 - 需要展开开场白模块
|
||||
// Bot Details - User Timed Tasks - Add Bootstrap to Opener - Need to Expand Opener Module
|
||||
emitEvent(OpenBlockEvent.ONBORDING_MESSAGE_BLOCK_OPEN);
|
||||
// 动画效果
|
||||
// animation effect
|
||||
const duration = 250;
|
||||
setTimeout(() => {
|
||||
const settingAreaScrollElement =
|
||||
@@ -103,7 +103,7 @@ export const SuggestQuestionItemContent: React.FC<{
|
||||
behavior: 'smooth',
|
||||
});
|
||||
}
|
||||
// 折叠区域展开 250ms 动画时间
|
||||
// Folded area unfolded 250ms animation time
|
||||
}, duration);
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
@@ -31,9 +31,9 @@ import { CustomPlatform } from './custom';
|
||||
import s from './index.module.less';
|
||||
|
||||
enum ETab {
|
||||
// 自定义渠道
|
||||
// custom channel
|
||||
Custom = 'custom',
|
||||
// 通用渠道
|
||||
// common channel
|
||||
Normal = 'normal',
|
||||
}
|
||||
const PublishPlatformSetting = () => {
|
||||
@@ -56,7 +56,7 @@ const PublishPlatformSetting = () => {
|
||||
|
||||
return (
|
||||
<div className="pt-[10px] w-full h-full" ref={contentRef}>
|
||||
{/* 为企业管理员时才需要显示 tab */}
|
||||
{/* You only need to display tabs when you are an enterprise administrator. */}
|
||||
{showCustomTab ? (
|
||||
<Space spacing={16} className="mb-[16px]">
|
||||
<span
|
||||
@@ -86,7 +86,7 @@ const PublishPlatformSetting = () => {
|
||||
</Space>
|
||||
) : null}
|
||||
<div className={s['publish-platform-frame']}>
|
||||
{/* 为企业管理员时才需要显示 tab */}
|
||||
{/* You only need to display tabs when you are an enterprise administrator. */}
|
||||
{showCustomTab ? (
|
||||
<>
|
||||
{current === ETab.Normal && <NormalPlatform />}
|
||||
|
||||
@@ -37,7 +37,7 @@ export const HandleTooltip: React.FC<HandleTooltipProps> = props => {
|
||||
|
||||
const rafRef = React.useRef<number | null>(null);
|
||||
|
||||
// 用来更新 Tooltip 的位置
|
||||
// To update the location of Tooltip
|
||||
const [refreshKey, setRefreshKey] = React.useState('1');
|
||||
|
||||
function cancelKeepAlign() {
|
||||
|
||||
@@ -139,7 +139,7 @@ export function MultipleSheet({
|
||||
>
|
||||
{title}
|
||||
</div>
|
||||
{/* 头部插槽 */}
|
||||
{/* head slot */}
|
||||
<div className={styles['sheet-header-scope']}> {titleNode}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -181,8 +181,8 @@ export function MultipleSheet({
|
||||
placement={placement}
|
||||
visible={open}
|
||||
getPopupContainer={() =>
|
||||
// @tip 不确定这个PopupContainer的实现逻辑,采用ref.current拿不到最新的值,
|
||||
// @tip Semi需更新至2.54.0以上:当SideSheet的visible为true才挂载可以确保`getPopupContainer`使用querySelector可以获取到父组件dom,但兜底值要去掉(https://github.com/DouyinFE/semi-design/pull/2094)
|
||||
// @Tip is not sure about the implementation logic of this PopupContainer. Using ref.current cannot get the latest value.
|
||||
// @Tip Semi needs to be updated to above 2.54.0: When the visible of the SideSheet is true, it can ensure that'getPopupContainer 'can get the parent component dom using querySelector, but the bottom value should be removed (https://github.com/DouyinFE/semi-design/pull/2094)
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
document.querySelector(`#${containerId}`)!
|
||||
}
|
||||
@@ -194,7 +194,7 @@ export function MultipleSheet({
|
||||
<div
|
||||
className={classNames(styles['sheet-content'], containerClassName)}
|
||||
>
|
||||
{/* 浮层头部 */}
|
||||
{/* Floating head */}
|
||||
|
||||
{renderContent ? (
|
||||
renderContent(header)
|
||||
|
||||
@@ -42,7 +42,7 @@ export function SingleSheet({
|
||||
}: SingleSheetProps) {
|
||||
const headerNode = (
|
||||
<div className={classNames(styles.card, containerClassName)}>
|
||||
{/* 浮层头部 */}
|
||||
{/* Floating head */}
|
||||
<div className={classNames(styles['sheet-header'], headerClassName)}>
|
||||
<div
|
||||
className={classNames(
|
||||
@@ -53,7 +53,7 @@ export function SingleSheet({
|
||||
>
|
||||
{title}
|
||||
</div>
|
||||
{/* 头部插槽 */}
|
||||
{/* head slot */}
|
||||
<div
|
||||
className={classNames(
|
||||
styles['sheet-header-scope'],
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
}
|
||||
|
||||
.prompt-text {
|
||||
/* stylelint-disable-next-line custom-property-pattern -- 设计命名如此 */
|
||||
/* stylelint-disable-next-line custom-property-pattern -- so named */
|
||||
color: var(--Light-usage-text---color-text-0, #1D1C23);
|
||||
font-size: 14px;
|
||||
font-style: normal;
|
||||
@@ -17,7 +17,7 @@
|
||||
}
|
||||
|
||||
.custom-prompt-checkbox :global(.semi-checkbox-addon) {
|
||||
/* stylelint-disable-next-line custom-property-pattern -- 设计命名如此 */
|
||||
/* stylelint-disable-next-line custom-property-pattern -- so named */
|
||||
color: var(--Light-usage-text---color-text-2, rgba(28, 29, 35, 60%));
|
||||
font-size: 14px;
|
||||
font-style: normal;
|
||||
|
||||
@@ -31,13 +31,13 @@ import s from './suggestion-content.module.less';
|
||||
export type SuggestionContentProps = {
|
||||
disabled?: boolean;
|
||||
onChange: (config: Partial<BotSuggestionConfig>) => void;
|
||||
/** mode 是否来自子 bot */
|
||||
/** Is the mode from the child bot? */
|
||||
followBot?: boolean;
|
||||
} & (
|
||||
| {
|
||||
mode: SuggestReplyMode.WithCustomizedPrompt;
|
||||
prompt: string;
|
||||
/** 是否为 multi-agent 模式 */
|
||||
/** Is it in multi-agent mode? */
|
||||
multiAgent?: boolean;
|
||||
}
|
||||
| {
|
||||
@@ -45,7 +45,7 @@ export type SuggestionContentProps = {
|
||||
}
|
||||
);
|
||||
|
||||
/** 自定义 suggestion textarea 最大高度 */
|
||||
/** Custom suggestion textarea maximum height */
|
||||
const MAX_CUSTOM_SUGGESTION_PROMPT_HEIGHT = 340;
|
||||
|
||||
export function SuggestionContent({
|
||||
@@ -58,14 +58,14 @@ export function SuggestionContent({
|
||||
|
||||
return (
|
||||
<div className={s['suggestion-content']}>
|
||||
{/* 无 suggestion */}
|
||||
{/* No suggestion */}
|
||||
{props.mode === SuggestReplyMode.Disable && (
|
||||
<div className={s.description}>
|
||||
{I18n.t('bot_edit_auto_suggestion_off_description')}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 默认 suggestion */}
|
||||
{/* Default suggestion */}
|
||||
{props.mode === SuggestReplyMode.WithDefaultPrompt && (
|
||||
<>
|
||||
<div className={s.description}>
|
||||
@@ -90,7 +90,7 @@ export function SuggestionContent({
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* 自定义 suggestion prompt */}
|
||||
{/* Custom suggestion prompt */}
|
||||
{props.mode === SuggestReplyMode.WithCustomizedPrompt && (
|
||||
<>
|
||||
<div className={s.description}>
|
||||
|
||||
@@ -101,9 +101,9 @@ const BaseTableMemory: FC<TableMemoryProps> = ({
|
||||
if (removeCallback) {
|
||||
removeCallback?.();
|
||||
}
|
||||
// 更新 list
|
||||
// Update list
|
||||
await reloadDatabaseList();
|
||||
// 更新 bot draft
|
||||
// Update bot draft
|
||||
await saveTableMemory();
|
||||
} else {
|
||||
Toast.error(res.msg);
|
||||
@@ -111,14 +111,14 @@ const BaseTableMemory: FC<TableMemoryProps> = ({
|
||||
};
|
||||
|
||||
const onCreateDatabase = async (databaseId: string, draftId: string) => {
|
||||
// NOTE: 绑定/解绑 bot 数据库,需要传入 DatabaseInfo 的 draft_id
|
||||
// NOTE: Bind/unbind the bot database, you need to pass in the draft_id of DatabaseInfo
|
||||
await MemoryApi.BindDatabase({
|
||||
database_id: draftId,
|
||||
bot_id: botId,
|
||||
});
|
||||
// 更新 list
|
||||
// Update list
|
||||
await reloadDatabaseList();
|
||||
// 更新 bot draft
|
||||
// Update bot draft
|
||||
await saveTableMemory();
|
||||
};
|
||||
|
||||
@@ -135,9 +135,9 @@ const BaseTableMemory: FC<TableMemoryProps> = ({
|
||||
if (addCallback) {
|
||||
addCallback?.();
|
||||
}
|
||||
// 更新 list
|
||||
// Update list
|
||||
await reloadDatabaseList();
|
||||
// 更新 bot draft
|
||||
// Update bot draft
|
||||
await saveTableMemory();
|
||||
} else {
|
||||
Toast.error(res.msg);
|
||||
|
||||
Reference in New Issue
Block a user