chore: replace all cn comments of fe to en version by volc api (#320)
This commit is contained in:
@@ -35,33 +35,33 @@ interface FormData {
|
||||
}
|
||||
|
||||
export const CLEAR_CONTEXT_FORM_META: FormMetaV2<FormData> = {
|
||||
// 节点表单渲染
|
||||
// Node form rendering
|
||||
render: () => <FormRender />,
|
||||
|
||||
// 验证触发时机
|
||||
// verification trigger timing
|
||||
validateTrigger: ValidateTrigger.onChange,
|
||||
|
||||
// 验证规则
|
||||
// validation rules
|
||||
validate: {
|
||||
// 必填
|
||||
// Required
|
||||
'inputParameters.0.input': createValueExpressionInputValidate({
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
|
||||
// 副作用管理
|
||||
// Side effect management
|
||||
effect: {
|
||||
nodeMeta: fireNodeTitleChange,
|
||||
outputs: provideNodeOutputVariablesEffect,
|
||||
inputParameters: syncConversationNameEffect,
|
||||
},
|
||||
|
||||
// 节点后端数据 -> 前端表单数据
|
||||
// Node Backend Data - > Frontend Form Data
|
||||
formatOnInit: createTransformOnInit(
|
||||
DEFAULT_CONVERSATION_VALUE,
|
||||
DEFAULT_OUTPUTS,
|
||||
),
|
||||
|
||||
// 前端表单数据 -> 节点后端数据
|
||||
// Front-end form data - > node back-end data
|
||||
formatOnSubmit: transformOnSubmit,
|
||||
};
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** 清空会话历史节点 */
|
||||
/** Clear session history node */
|
||||
|
||||
export { CLEAR_CONTEXT_NODE_REGISTRY } from './node-registry';
|
||||
|
||||
@@ -34,32 +34,32 @@ interface FormData {
|
||||
}
|
||||
|
||||
export const CREATE_CONVERSATION_FORM_META: FormMetaV2<FormData> = {
|
||||
// 节点表单渲染
|
||||
// Node form rendering
|
||||
render: () => <FormRender />,
|
||||
|
||||
// 验证触发时机
|
||||
// verification trigger timing
|
||||
validateTrigger: ValidateTrigger.onChange,
|
||||
|
||||
// 验证规则
|
||||
// validation rules
|
||||
validate: {
|
||||
// 必填
|
||||
// Required
|
||||
'inputParameters.0.input': createValueExpressionInputValidate({
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
|
||||
// 副作用管理
|
||||
// Side effect management
|
||||
effect: {
|
||||
nodeMeta: fireNodeTitleChange,
|
||||
outputs: provideNodeOutputVariablesEffect,
|
||||
},
|
||||
|
||||
// 节点后端数据 -> 前端表单数据
|
||||
// Node Backend Data - > Frontend Form Data
|
||||
formatOnInit: createTransformOnInit(
|
||||
DEFAULT_CONVERSATION_VALUE,
|
||||
DEFAULT_OUTPUTS,
|
||||
),
|
||||
|
||||
// 前端表单数据 -> 节点后端数据
|
||||
// Front-end form data - > node back-end data
|
||||
formatOnSubmit: transformOnSubmit,
|
||||
};
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** 创建会话节点 */
|
||||
/** Create a session node */
|
||||
|
||||
export { CREATE_CONVERSATION_NODE_REGISTRY } from './node-registry';
|
||||
|
||||
@@ -44,19 +44,19 @@ export const createFormMeta = ({
|
||||
formRenderComponent,
|
||||
customValidators = {},
|
||||
}): FormMetaV2<ChatFormData> => {
|
||||
// 定义首字母大写的变量引用组件
|
||||
// Define an uppercase variable reference component
|
||||
const FormRender = formRenderComponent;
|
||||
|
||||
const formMeta = {
|
||||
// 节点表单渲染
|
||||
// Node form rendering
|
||||
render: () => <FormRender />,
|
||||
|
||||
// 验证触发时机
|
||||
// verification trigger timing
|
||||
validateTrigger: ValidateTrigger.onChange,
|
||||
|
||||
// 验证规则
|
||||
// validation rules
|
||||
validate: {
|
||||
// 必填
|
||||
// Required
|
||||
'inputParameters.*.input': createValueExpressionInputValidate({
|
||||
required: ({ name }) => {
|
||||
const fieldName = name
|
||||
@@ -69,20 +69,20 @@ export const createFormMeta = ({
|
||||
...customValidators,
|
||||
},
|
||||
|
||||
// 副作用管理
|
||||
// Side effect management
|
||||
effect: {
|
||||
nodeMeta: fireNodeTitleChange,
|
||||
outputs: provideNodeOutputVariablesEffect,
|
||||
},
|
||||
|
||||
// 节点后端数据 -> 前端表单数据
|
||||
// Node Backend Data - > Frontend Form Data
|
||||
formatOnInit: createTransformOnInit(defaultInputValue, defaultOutputValue),
|
||||
|
||||
// 前端表单数据 -> 节点后端数据
|
||||
// Front-end form data - > node back-end data
|
||||
formatOnSubmit: transformOnSubmit,
|
||||
};
|
||||
|
||||
// 需要同步联动 CONVERSATION_NAME 字段的值
|
||||
// Need to synchronize the value of CONVERSATION_NAME field
|
||||
if (needSyncConversationName) {
|
||||
Object.assign(formMeta.effect, {
|
||||
inputParameters: syncConversationNameEffect,
|
||||
|
||||
@@ -35,10 +35,10 @@ export const FIELD_CONFIG = {
|
||||
required: true,
|
||||
type: VariableTypeDTO.string,
|
||||
|
||||
// 选项默认值
|
||||
// option default
|
||||
defaultValue: 'user',
|
||||
|
||||
// 选项列表
|
||||
// list of options
|
||||
optionsList: [
|
||||
{ label: 'user', value: 'user' },
|
||||
{ label: 'assistant', value: 'assistant' },
|
||||
@@ -56,7 +56,7 @@ export const FIELD_CONFIG = {
|
||||
export const DEFAULT_CONVERSATION_VALUE: InputValueVO[] = Object.keys(
|
||||
FIELD_CONFIG,
|
||||
).map(fieldName => {
|
||||
// 针对 role 字段,需要设置字面量默认值
|
||||
// For the role field, you need to set the literal default
|
||||
if (fieldName === 'role') {
|
||||
return {
|
||||
name: fieldName,
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** 创建消息节点 */
|
||||
/** Create message node */
|
||||
|
||||
export { CREATE_MESSAGE_NODE_REGISTRY } from './node-registry';
|
||||
|
||||
@@ -76,7 +76,7 @@ export const createNodeRegistry = (
|
||||
},
|
||||
size: { width: NODE_WIDTH, height: NODE_HEIGHT },
|
||||
nodeMetaPath: DEFAULT_NODE_META_PATH,
|
||||
inputParametersPath: INPUT_PATH, // 入参路径,试运行等功能依赖该路径提取参数
|
||||
inputParametersPath: INPUT_PATH, // Imported parameter path, practice running and other functions rely on this path to extract parameters
|
||||
getInputVariableTag(name, input, extra) {
|
||||
const field = fieldConfig[name || ''];
|
||||
|
||||
@@ -86,16 +86,16 @@ export const createNodeRegistry = (
|
||||
const content = input?.content as RefExpressionContent;
|
||||
const isRef = content?.keyPath?.length > 0;
|
||||
|
||||
// 初始化流程时,可能变量模块还没有初始化,这里会获取不到变量...
|
||||
// When initializing the process, it is possible that the variable module has not been initialized, and the variable will not be obtained here...
|
||||
const variable = extra?.variableService.getWorkflowVariableByKeyPath(
|
||||
content?.keyPath,
|
||||
{ node: extra?.node, checkScope: true },
|
||||
);
|
||||
|
||||
// 必填场景,如果:
|
||||
// 1. 为空,报错
|
||||
// 2. 不为空
|
||||
// 2.1 引用变量,且变量不存在,报错
|
||||
// Required scene if:
|
||||
// 1. Empty, error reported
|
||||
// 2. Not empty
|
||||
// 2.1 Reference to a variable, and the variable does not exist, an error is reported
|
||||
invalid = ValueExpression.isEmpty(input) || (isRef && !variable);
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ export const createNodeRegistry = (
|
||||
[],
|
||||
) as InputValueDTO[];
|
||||
|
||||
// 对于固定参数类型,需要将 type 字段设置为预定义的类型,而不是右侧填入的变量类型
|
||||
// For fixed parameter types, you need to set the type field to a predefined type, rather than the variable type populated on the right
|
||||
inputParameters.forEach(param => {
|
||||
const config = fieldConfig[param.name || ''];
|
||||
if (config && param.input.type) {
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** 删除会话节点 */
|
||||
/** Delete session node */
|
||||
|
||||
export { DELETE_CONVERSATION_NODE_REGISTRY } from './node-registry';
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** 删除消息节点 */
|
||||
/** Delete message node */
|
||||
|
||||
export { DELETE_MESSAGE_NODE_REGISTRY } from './node-registry';
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** 查询会话历史节点 */
|
||||
/** Query session history node */
|
||||
|
||||
export { QUERY_CONVERSATION_HISTORY_NODE_REGISTRY } from './node-registry';
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** 查询会话列表 */
|
||||
/** Query session list */
|
||||
|
||||
export { QUERY_CONVERSATION_LIST_NODE_REGISTRY } from './node-registry';
|
||||
|
||||
@@ -35,33 +35,33 @@ interface FormData {
|
||||
}
|
||||
|
||||
export const QUERY_MESSAGE_LIST_FORM_META: FormMetaV2<FormData> = {
|
||||
// 节点表单渲染
|
||||
// Node form rendering
|
||||
render: props => <FormRender {...props} />,
|
||||
|
||||
// 验证触发时机
|
||||
// verification trigger timing
|
||||
validateTrigger: ValidateTrigger.onChange,
|
||||
|
||||
// 验证规则
|
||||
// validation rules
|
||||
validate: {
|
||||
// 必填
|
||||
// Required
|
||||
'inputParameters.0.input': createValueExpressionInputValidate({
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
|
||||
// 副作用管理
|
||||
// Side effect management
|
||||
effect: {
|
||||
nodeMeta: fireNodeTitleChange,
|
||||
outputs: provideNodeOutputVariablesEffect,
|
||||
inputParameters: syncConversationNameEffect,
|
||||
},
|
||||
|
||||
// 节点后端数据 -> 前端表单数据
|
||||
// Node Backend Data - > Frontend Form Data
|
||||
formatOnInit: createTransformOnInit(
|
||||
DEFAULT_CONVERSATION_VALUE,
|
||||
DEFAULT_OUTPUTS,
|
||||
),
|
||||
|
||||
// 前端表单数据 -> 节点后端数据
|
||||
// Front-end form data - > node back-end data
|
||||
formatOnSubmit: transformOnSubmit,
|
||||
};
|
||||
|
||||
@@ -14,5 +14,5 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** 查看消息列表(某个会话) */
|
||||
/** View a list of messages (for a session) */
|
||||
export { QUERY_MESSAGE_LIST_NODE_REGISTRY } from './node-registry';
|
||||
|
||||
@@ -26,7 +26,7 @@ import { ValueExpression, WorkflowMode } from '@coze-workflow/base';
|
||||
|
||||
import { CONVERSATION_NAME } from './constants';
|
||||
|
||||
/** 延迟200ms,此时等边连上后,才能检测变量作用域 */
|
||||
/** Delay 200ms. At this time, the variable scope can only be detected after the equilateral connection is connected. */
|
||||
const DELAY = 200;
|
||||
|
||||
const effect: Effect = ({ value, context }) => {
|
||||
@@ -59,7 +59,7 @@ const effect: Effect = ({ value, context }) => {
|
||||
conversationNameItem?.input as ValueExpression,
|
||||
);
|
||||
|
||||
// 如果能够找到开始节点的 CONVERSATION_NAME 参数
|
||||
// If you can find the CONVERSATION_NAME parameters of the start node
|
||||
if (
|
||||
startConversationNameVar &&
|
||||
conversationNameItem &&
|
||||
@@ -76,7 +76,7 @@ const effect: Effect = ({ value, context }) => {
|
||||
formModel.setValueIn('inputParameters', clonedValue);
|
||||
}
|
||||
} else if (!isInIDE && !isChatflow && conversationNameItem && noValue) {
|
||||
// 非项目中的工作流,如果存在没有值的 CONVERSATION_NAME 字段,填入默认值 default
|
||||
// Non-project workflow, if there is a CONVERSATION_NAME field with no value, fill in the default value default
|
||||
if (formModel) {
|
||||
set(conversationNameItem, 'input', {
|
||||
type: 'literal',
|
||||
|
||||
@@ -25,7 +25,7 @@ const isEmptyArrayOrNil = (value: unknown) =>
|
||||
// eslint-disable-next-line eqeqeq
|
||||
(Array.isArray(value) && value.length === 0) || value == null;
|
||||
/**
|
||||
* 节点后端数据 -> 前端表单数据
|
||||
* Node Backend Data - > Frontend Form Data
|
||||
*/
|
||||
export const createTransformOnInit =
|
||||
(
|
||||
@@ -36,8 +36,8 @@ export const createTransformOnInit =
|
||||
const { inputs, outputs } = value || {};
|
||||
const inputParameters = inputs?.inputParameters || [];
|
||||
|
||||
// 由于在提交时,会将没有填值的变量给过滤掉,所以需要在初始化时,将默认值补充进来
|
||||
// 参见:packages/workflow/nodes/src/workflow-json-format.ts:241
|
||||
// Since variables that are not filled in will be filtered out during commit, the default value needs to be added during initialization
|
||||
// See also: packages/workflow/nodes/src/workflow-json-format: 241
|
||||
const refillInputParamters = defaultInputValue.map(cur => {
|
||||
const { name } = cur;
|
||||
const target = inputParameters.find(item => item.name === name);
|
||||
|
||||
@@ -22,7 +22,7 @@ interface FormData {
|
||||
}
|
||||
|
||||
/**
|
||||
* 前端表单数据 -> 节点后端数据
|
||||
* Front-end form data - > node back-end data
|
||||
* @param value
|
||||
* @returns
|
||||
*/
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** 更新会话节点 */
|
||||
/** Update session node */
|
||||
|
||||
export { UPDATE_CONVERSATION_NODE_REGISTRY } from './node-registry';
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** 修改消息节点 */
|
||||
/** Modify message node */
|
||||
|
||||
export { UPDATE_MESSAGE_NODE_REGISTRY } from './node-registry';
|
||||
|
||||
@@ -55,7 +55,7 @@ export const BatchSettingForm = ({
|
||||
const formRef = useRef<BotSemiForm>(null);
|
||||
const isSemiFormDestroyed = useRef(false);
|
||||
const debouncedChange = debounce((v: BatchSettingOnChangeValue) => {
|
||||
// semi form 在销毁时会额外触发onChange从而污染数据,这里避免这样的情况发生
|
||||
// The semi form will trigger an additional onChange when it is destroyed, thereby polluting the data. This situation is avoided here
|
||||
if (isSemiFormDestroyed.current) {
|
||||
return;
|
||||
}
|
||||
@@ -78,7 +78,7 @@ export const BatchSettingForm = ({
|
||||
);
|
||||
|
||||
return (
|
||||
// 防止触发节点选中
|
||||
// Prevent trigger node selection
|
||||
<div
|
||||
className={s['workflow-batch-setting-panel']}
|
||||
onClick={e => e.stopPropagation()}
|
||||
|
||||
@@ -63,7 +63,7 @@ export interface ExpressionEditorContainerProps {
|
||||
}
|
||||
|
||||
/**
|
||||
* 业务逻辑和编辑器逻辑的聚合层
|
||||
* Aggregation layer for business logic and editor logic
|
||||
*/
|
||||
export const ExpressionEditorContainer: FC<
|
||||
ExpressionEditorContainerProps
|
||||
@@ -86,7 +86,7 @@ export const ExpressionEditorContainer: FC<
|
||||
testId,
|
||||
onChangeTrigger = 'onBlur',
|
||||
} = props;
|
||||
const maxLength = undefined; // 临时禁用
|
||||
const maxLength = undefined; // Temporary Disable
|
||||
const variableTree: ExpressionEditorTreeNode[] = useVariableTree();
|
||||
const [focus, _setFocus] = useState<boolean>(false);
|
||||
const { getNodeSetterId } = useNodeTestId();
|
||||
@@ -106,7 +106,7 @@ export const ExpressionEditorContainer: FC<
|
||||
model.setVariableTree(variableTree);
|
||||
model.setFocus(focus);
|
||||
|
||||
// 设置防抖防止 onFocus / onBlur 在点击时出现抖动
|
||||
// Set anti-shake to prevent onFocus/onBlur from shaking when clicked
|
||||
const setFocus = useCallback(
|
||||
debounce((newFocusValue: boolean) => {
|
||||
_setFocus(newFocusValue);
|
||||
@@ -142,8 +142,8 @@ export const ExpressionEditorContainer: FC<
|
||||
}
|
||||
|
||||
/**
|
||||
* 存在输入中文时 value 和 editor.getValue() 始终不一致,导致重渲染的情况
|
||||
* 所以改为 onBlur 时更新表单数据
|
||||
* There is a situation where value and editor.getValue () are always inconsistent when entering Chinese, resulting in re-rendering
|
||||
* So update the form data when changing to onBlur
|
||||
*/
|
||||
const handleOnBlur = () => {
|
||||
if (onChangeTrigger === 'onBlur') {
|
||||
|
||||
@@ -109,7 +109,7 @@ const FixedInputParameters = (props: FixedInputParametersProps) => {
|
||||
),
|
||||
])}
|
||||
literalConfig={{
|
||||
// 下拉选择数据源
|
||||
// Drop down to select the data source
|
||||
optionsList: fieldConfig[_fieldName]?.optionsList,
|
||||
}}
|
||||
isError={!!childState?.errors?.length}
|
||||
|
||||
@@ -28,7 +28,7 @@ import s from './index.module.less';
|
||||
|
||||
export interface FormItemErrorProps extends WithCustomStyle {
|
||||
errors?: FieldState['errors'];
|
||||
// coze 暂无warnings
|
||||
// Coze has no warnings
|
||||
// warnings?: FieldState['warnings'];
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ export const GlobalVariableSelect = (props: Props) => {
|
||||
|
||||
const keyPath = get(value, 'content.keyPath') as string[] | undefined;
|
||||
|
||||
// 监听联动变量变化,从而重新触发 effect
|
||||
// Monitor changes in linkage variables to re-trigger the effect
|
||||
useEffect(() => {
|
||||
const hasDisabledTypes =
|
||||
Array.isArray(disabledTypes) && disabledTypes.length > 0;
|
||||
@@ -135,7 +135,7 @@ export const GlobalVariableSelect = (props: Props) => {
|
||||
const listener = variableService.onListenVariableTypeChange(
|
||||
keyPath,
|
||||
v => {
|
||||
// 如果变量类型变化后,位于 disabledTypes 中,那么需要清空
|
||||
// If the variable type changes and is located in disabledTypes, it needs to be cleared
|
||||
if (v && (disabledTypes || []).includes(v.type)) {
|
||||
onChange?.({
|
||||
type: ValueExpressionType.REF,
|
||||
@@ -281,7 +281,7 @@ export const GlobalVariableSelect = (props: Props) => {
|
||||
? null
|
||||
: optionList.map(option => (
|
||||
<Select.Option
|
||||
// disabled 变化 Option 不会重新渲染,先通过设置 key 的方式兼容一下
|
||||
// Disabled Change Option will not be re-rendered. Please set the key to be compatible first.
|
||||
key={`${option.value}-${option.disabled}`}
|
||||
value={option.value}
|
||||
className={s['global-var-option']}
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* 组件迁移自 packages/workflow/playground/src/form-extensions/setters/node-header
|
||||
* 仅做了对新版节点引擎接口适配
|
||||
* Components migrated from packages/workflow/playground/src/form-extensions/setters/node-header
|
||||
* Only the interface adaptation of the new version of the node engine has been done.
|
||||
*/
|
||||
import React from 'react';
|
||||
|
||||
@@ -70,7 +70,7 @@ export const NodeHeader = withValidation<NodeHeaderProps>(
|
||||
<NodeHeaderComponent
|
||||
title={title}
|
||||
subTitle={subTitle}
|
||||
// 如果是coze2.0新版节点渲染 隐藏掉描述
|
||||
// If it is the new version of coze2.0 node rendering, hide the description.
|
||||
description={description}
|
||||
logo={icon}
|
||||
onTitleChange={newTitle => {
|
||||
|
||||
@@ -63,7 +63,7 @@ export const NodeInputName = ({
|
||||
const variableService = useService(WorkflowVariableFacadeService);
|
||||
const { getNodeSetterId } = useNodeTestId();
|
||||
|
||||
// text 状态受控(删除节点时联动 text 的值)
|
||||
// The text state is controlled (the value of the linked text when deleting a node)
|
||||
useEffect(() => {
|
||||
if (value !== text) {
|
||||
setText(value);
|
||||
@@ -92,7 +92,7 @@ export const NodeInputName = ({
|
||||
|
||||
useEffect(() => {
|
||||
if (initValidate) {
|
||||
// 初始化写值触发校验
|
||||
// Initialize write value to trigger verification
|
||||
onChange(value);
|
||||
onBlur?.();
|
||||
}
|
||||
|
||||
@@ -37,15 +37,15 @@ export type NodeInputNameProps = Omit<
|
||||
initValidate?: boolean;
|
||||
isPureText?: boolean;
|
||||
style?: CSSProperties;
|
||||
/** 同一层的变量表达式 */
|
||||
/** Variable expressions at the same level */
|
||||
input: RefExpression;
|
||||
/** 当前输入列表中所有输入项 */
|
||||
/** All input items in the current input list */
|
||||
inputParameters: Array<InputValueVO>;
|
||||
/** 前缀 */
|
||||
/** prefix */
|
||||
prefix?: string;
|
||||
/** 后缀 */
|
||||
/** suffix */
|
||||
suffix?: string;
|
||||
/** 名称自定义格式化 */
|
||||
/** Name custom formatting */
|
||||
format?: NodeInputNameFormat;
|
||||
tooltip?: string;
|
||||
isError?: boolean;
|
||||
|
||||
@@ -50,12 +50,12 @@ export const createNodeInputNameValidate =
|
||||
validatorConfig?.errorMessage ??
|
||||
I18n.t('workflow_detail_node_error_format');
|
||||
|
||||
/** 命名校验 */
|
||||
/** name check */
|
||||
if (!validatorRule.test(value)) {
|
||||
return validatorErrorMessage;
|
||||
}
|
||||
|
||||
/** 非法值校验 */
|
||||
/** Illegal value verification */
|
||||
if (invalidValues?.[value]) {
|
||||
return invalidValues[value];
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ interface OutputTreeOptions {
|
||||
defaultCollapse?: boolean;
|
||||
needAppendChildWhenNodeIsPreset?: boolean;
|
||||
noCard?: boolean;
|
||||
sortValue?: SortValue; // 排序函数
|
||||
sortValue?: SortValue; // sorting function
|
||||
}
|
||||
type OutputsProps = ComponentProps<OutputTreeValue> &
|
||||
OutputTreeOptions &
|
||||
@@ -105,10 +105,10 @@ export const Outputs = withValidation<OutputsProps>((props: OutputsProps) => {
|
||||
const refresh = useRefresh();
|
||||
const isSettingOnErrorV2 = useIsSettingOnErrorV2();
|
||||
|
||||
// 记录当前batchMode
|
||||
// Record current batchMode
|
||||
const curBatchMode = useRef<BatchMode>();
|
||||
|
||||
// 变更不记录历史
|
||||
// Changes do not record history
|
||||
const onChangeWithoutHistory = (outputTreeValue: OutputTreeValue) => {
|
||||
historyService.stop();
|
||||
onChange(outputTreeValue);
|
||||
@@ -117,7 +117,7 @@ export const Outputs = withValidation<OutputsProps>((props: OutputsProps) => {
|
||||
|
||||
useEffect(() => {
|
||||
/**
|
||||
* 初始化时,赋值curBatchMode,但无需对值做修改
|
||||
* When initializing, assign curBatchMode, but do not modify the value
|
||||
*/
|
||||
if (!curBatchMode.current) {
|
||||
curBatchMode.current = batchMode;
|
||||
@@ -125,7 +125,7 @@ export const Outputs = withValidation<OutputsProps>((props: OutputsProps) => {
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换batch mode 需要将 single mode 的output 包成list, 或将 batch mode 的outputList 去掉list这层
|
||||
* To switch batch mode, you need to wrap the output of single mode into a list, or remove the list layer from the outputList of batch mode
|
||||
*/
|
||||
if (batchMode !== curBatchMode.current) {
|
||||
curBatchMode.current = batchMode;
|
||||
@@ -147,7 +147,7 @@ export const Outputs = withValidation<OutputsProps>((props: OutputsProps) => {
|
||||
|
||||
const { getNodeSetterId } = useNodeTestId();
|
||||
|
||||
// 要对 value 排序,保证 errorbody 这个属性在最下面
|
||||
// To sort value, ensure that the errorbody property is at the bottom
|
||||
const _value = useMemo(() => {
|
||||
const sortedValue = sortValue ? sortValue(value, isBatch) : value;
|
||||
if (needErrorBody) {
|
||||
|
||||
@@ -102,7 +102,7 @@ export const ExpandSheetEditor: FC<ExpandSheetEditorProps> = props => {
|
||||
const getConversationId = () => '';
|
||||
const getPromptContextInfo = useMemo(
|
||||
() => () => ({
|
||||
// workflow 场景下 bot_id 不用传
|
||||
// No need to pass bot_id workflow scenario
|
||||
botId: '',
|
||||
name,
|
||||
description: desc,
|
||||
|
||||
@@ -52,7 +52,7 @@ export const SystemPrompt: FC<SystemPromptProps> = props => {
|
||||
const getConversationId = () => '';
|
||||
const getPromptContextInfo = useMemo(
|
||||
() => () => ({
|
||||
// workflow 场景下 bot_id 不用传
|
||||
// No need to pass bot_id workflow scenario
|
||||
botId: '',
|
||||
name,
|
||||
description: desc,
|
||||
|
||||
@@ -91,7 +91,7 @@ export const EditorWithPromptKit: FC<EditorWithPromptKitProps> = props => {
|
||||
const promptValue = useRef<string>(value || '');
|
||||
|
||||
const [FLAGS] = useFlags();
|
||||
// 即将支持,敬请期待
|
||||
// Support soon, so stay tuned.
|
||||
const isHitLLMPromptSkills = FLAGS['bot.automation.llm_prompt_skills'];
|
||||
|
||||
const { open, node: PromptLibrary } = usePromptLibraryModal({
|
||||
@@ -158,7 +158,7 @@ export const EditorWithPromptKit: FC<EditorWithPromptKitProps> = props => {
|
||||
<InputSlotWidget mode="input" />
|
||||
<LibraryBlockWidget
|
||||
{
|
||||
// 即将支持,敬请期待
|
||||
// Support soon, so stay tuned.
|
||||
...(isHitLLMPromptSkills
|
||||
? {
|
||||
librarys: libraries,
|
||||
@@ -179,7 +179,7 @@ export const EditorWithPromptKit: FC<EditorWithPromptKitProps> = props => {
|
||||
/>
|
||||
<HighlightExpressionOnActive />
|
||||
|
||||
{/* 即将支持,敬请期待 */}
|
||||
{/* Support soon, so stay tuned. */}
|
||||
{isHitLLMPromptSkills ? (
|
||||
<ContentSearchPopover
|
||||
variableTree={variableTree}
|
||||
|
||||
@@ -129,7 +129,7 @@ export const ValueExpressionInput = (props: ValueExpressionInputProps) => {
|
||||
|
||||
const keyPath = get(value, 'content.keyPath') as string[] | undefined;
|
||||
|
||||
// 监听联动变量变化,从而重新触发 effect
|
||||
// Monitor changes in linkage variables to re-trigger the effect
|
||||
useEffect(() => {
|
||||
const hasDisabledTypes =
|
||||
Array.isArray(disabledTypes) && disabledTypes.length > 0;
|
||||
@@ -141,7 +141,7 @@ export const ValueExpressionInput = (props: ValueExpressionInputProps) => {
|
||||
const listener = variableService.onListenVariableTypeChange(
|
||||
keyPath,
|
||||
v => {
|
||||
// 如果变量类型变化后,位于 disabledTypes 中,那么需要清空
|
||||
// If the variable type changes and is located in disabledTypes, it needs to be cleared
|
||||
if (v && (disabledTypes || []).includes(v.type)) {
|
||||
onChange({
|
||||
type: ValueExpressionType.REF,
|
||||
|
||||
@@ -85,7 +85,7 @@ export function ViewVariableSelect(
|
||||
return;
|
||||
}
|
||||
|
||||
// 禁用类型,清空
|
||||
// Disable type, clear
|
||||
if (disabledTypes.includes(variableMeta.type)) {
|
||||
setValidation({ status: 'error' });
|
||||
onChange({ type: ValueExpressionType.REF });
|
||||
|
||||
@@ -52,7 +52,7 @@ import {
|
||||
SUB_WORKFLOW_NODE_REGISTRY,
|
||||
VARIABLE_NODE_REGISTRY,
|
||||
JSON_STRINGIFY_NODE_REGISTRY,
|
||||
// cli 脚本插入标识(import),请勿修改/删除此行注释
|
||||
// CLI script insert ID (import), do not modify/delete this line comment
|
||||
} from '@/node-registries';
|
||||
|
||||
import {
|
||||
@@ -69,7 +69,7 @@ import {
|
||||
} from './chat';
|
||||
|
||||
export const NODES_V2 = [
|
||||
// cli 脚本插入标识(registry),请勿修改/删除此行注释
|
||||
// The cli script inserts the identifier (registry), do not modify/delete this line comment
|
||||
JSON_STRINGIFY_NODE_REGISTRY,
|
||||
IF_NODE_REGISTRY,
|
||||
INTENT_NODE_REGISTRY,
|
||||
|
||||
@@ -117,7 +117,7 @@ function findReasoningContent(
|
||||
}
|
||||
|
||||
/**
|
||||
* output 属性排序,保证 reasoning content 在最下面
|
||||
* Output attribute sort to ensure that the reasoning content is at the bottom
|
||||
*/
|
||||
export const sortOutputs = (
|
||||
value: ViewVariableTreeNode[] | undefined,
|
||||
@@ -144,7 +144,7 @@ export const sortOutputs = (
|
||||
};
|
||||
|
||||
/**
|
||||
* 根据模型类型获取输出
|
||||
* Get output based on model type
|
||||
* @param modelType
|
||||
* @param outputs
|
||||
* @param isBatch
|
||||
@@ -174,7 +174,7 @@ export function getOutputs({
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化时格式化推理内容为只读
|
||||
* Format inference content as read-only during initialization
|
||||
* @param outputs
|
||||
* @param isBatch
|
||||
* @returns
|
||||
@@ -196,7 +196,7 @@ export function formatReasoningContentOnInit({
|
||||
|
||||
let newOutputs: ViewVariableTreeNode[] | undefined = outputs;
|
||||
if (modelType && modelsService.isCoTModel(modelType)) {
|
||||
// 后端返回的没有readonly字段,需要前端处理, 取第一个类型是string的reasoning_content
|
||||
// There is no readonly field returned by the backend, which needs to be processed by the front end. Take the first type that is string reasoning_content
|
||||
const reasoningContent = findReasoningContent(
|
||||
outputs,
|
||||
isBatch,
|
||||
@@ -206,7 +206,7 @@ export function formatReasoningContentOnInit({
|
||||
reasoningContent.readonly = true;
|
||||
reasoningContent.readonlyTooltip = readonlyTooltip;
|
||||
} else {
|
||||
// 存量数据兼容,如果是推理模型,则添加推理内容字段
|
||||
// The existing data is compatible, if it is an inference model, add the inference content field
|
||||
newOutputs = addReasoningContent(outputs, isBatch);
|
||||
}
|
||||
}
|
||||
@@ -215,7 +215,7 @@ export function formatReasoningContentOnInit({
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交时格式化推理内容移除readonly
|
||||
* Format inference content on commit Remove readonly
|
||||
* @param outputs
|
||||
* @param isBatch
|
||||
* @returns
|
||||
@@ -245,19 +245,19 @@ export function formatReasoningContentOnSubmit(
|
||||
}
|
||||
|
||||
/**
|
||||
* 去除 outputs 中的 为readonly的 reasoning_content
|
||||
* Remove the reasoning_content in outputs for readonly
|
||||
*/
|
||||
export const omitSystemReasoningContent = (
|
||||
value: ViewVariableTreeNodeWithReadonly[] | undefined,
|
||||
isBatch?: boolean,
|
||||
) => {
|
||||
// 批量,去除 children 中的 为readonly的 reasoning_content
|
||||
// Batch, remove from children, for readonly reasoning_content
|
||||
if (isBatch) {
|
||||
return value?.map(v => ({
|
||||
...v,
|
||||
children: v?.children?.filter(c => !isSystemReasoningContent(c)),
|
||||
}));
|
||||
}
|
||||
// 单次,去除 value 中的 为readonly的 reasoning_content
|
||||
// Single, remove the reasoning_content in value for readonly
|
||||
return value?.filter(v => !isSystemReasoningContent(v));
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import { useForm } from '@flowgram-adapter/free-layout-editor';
|
||||
|
||||
/**
|
||||
* 获取模型type
|
||||
* Get model type
|
||||
*/
|
||||
export function useModelType() {
|
||||
const form = useForm();
|
||||
|
||||
@@ -91,7 +91,7 @@ import {
|
||||
|
||||
import styles from './index.module.less';
|
||||
|
||||
/** 默认会话轮数 */
|
||||
/** Default session rounds */
|
||||
const DEFAULT_CHAT_ROUND = 3;
|
||||
|
||||
const Render = ({ form }: FormRenderProps<FormData>) => {
|
||||
@@ -384,7 +384,7 @@ export const LLM_FORM_META: FormMetaV2<FormData> = {
|
||||
const models = modelsService.getModels();
|
||||
let llmParam = get(value, 'inputs.llmParam');
|
||||
|
||||
// 初次拖入画布时:从后端返回值里,解析出来默认值。
|
||||
// When first dragged into the canvas: Parse out the default value from the backend return value.
|
||||
if (!llmParam) {
|
||||
llmParam = getDefaultLLMParams(models);
|
||||
}
|
||||
@@ -412,14 +412,14 @@ export const LLM_FORM_META: FormMetaV2<FormData> = {
|
||||
? [{ name: 'input', input: { type: ValueExpressionType.REF } }]
|
||||
: inputParameters,
|
||||
chatHistorySetting: {
|
||||
// 是否开启会话历史
|
||||
// Whether to open session history
|
||||
enableChatHistory:
|
||||
get(
|
||||
llmParam.find(item => item.name === 'enableChatHistory'),
|
||||
'input.value.content',
|
||||
) || false,
|
||||
|
||||
// 会话轮数,默认为 3 轮
|
||||
// Number of session rounds, the default is 3 rounds
|
||||
chatHistoryRound: Number(
|
||||
get(
|
||||
llmParam.find(item => item.name === 'chatHistoryRound'),
|
||||
@@ -438,8 +438,8 @@ export const LLM_FORM_META: FormMetaV2<FormData> = {
|
||||
modelType: model.modelType as number,
|
||||
}),
|
||||
|
||||
// model 会根据 llmParam 重新填充值,此时也会将之前的 chatHistoryRound 也填充上去
|
||||
// 由于在 submit 时会重新添加一个 chatHistoryRound,这里先忽略掉,避免出现问题
|
||||
// The model will re-fill the value according to llmParam, and the previous chatHistoryRound will also be filled at this time.
|
||||
// Since a chatHistoryRound will be re-added when submitting, it will be ignored here to avoid problems.
|
||||
model: omit(model, ['chatHistoryRound']),
|
||||
$$prompt_decorator$$: {
|
||||
prompt,
|
||||
@@ -453,7 +453,7 @@ export const LLM_FORM_META: FormMetaV2<FormData> = {
|
||||
fcParam: formatFcParamOnInit(get(value, 'inputs.fcParam')),
|
||||
};
|
||||
|
||||
// 获取后端下发 version 信息
|
||||
// Get the version information sent by the backend
|
||||
const schema = JSON.parse(
|
||||
playgroundContext.globalState.info?.schema_json || '{}',
|
||||
);
|
||||
@@ -462,7 +462,7 @@ export const LLM_FORM_META: FormMetaV2<FormData> = {
|
||||
parseInt(curNode?.data?.version) >= parseInt(NEW_NODE_DEFAULT_VERSION)
|
||||
? curNode?.data?.version
|
||||
: NEW_NODE_DEFAULT_VERSION;
|
||||
// 「LLM 节点订正需求 新增节点默认为 3」
|
||||
// [LLM node revised requirements, new node defaults to 3]
|
||||
set(initValue, 'version', versionFromBackend);
|
||||
|
||||
return initValue;
|
||||
@@ -488,7 +488,7 @@ export const LLM_FORM_META: FormMetaV2<FormData> = {
|
||||
|
||||
const enableChatHistory = BlockInput.createBoolean(
|
||||
'enableChatHistory',
|
||||
// 工作流没有会话历史,需要设置成 false,会话流按照实际勾选的来
|
||||
// The workflow has no session history, it needs to be set to false, and the session flow is checked according to the actual check.
|
||||
globalState.isChatflow
|
||||
? Boolean(
|
||||
get(
|
||||
@@ -523,8 +523,8 @@ export const LLM_FORM_META: FormMetaV2<FormData> = {
|
||||
},
|
||||
outputs: formatReasoningContentOnSubmit(value.outputs, isBatch),
|
||||
/**
|
||||
* - 「LLM 节点 format优化」需求,将 outputs 内容整合到 prompt 中限制输出格式,后端需要标志位区分逻辑,版本为 2
|
||||
* - 「LLM 节点订正需求 兜底逻辑」,版本为 3
|
||||
* - "LLM node format optimization" requirement, integrate the output content into the prompt to limit the output format, the backend needs flag distinction logic, version 2
|
||||
* - "LLM node revised requirements fallback logic", version 3
|
||||
*/
|
||||
|
||||
version: NEW_NODE_DEFAULT_VERSION,
|
||||
|
||||
@@ -25,7 +25,7 @@ import { type NodeTestMeta } from '@/test-run-kit';
|
||||
export const test: NodeTestMeta = {
|
||||
generateRelatedContext(node, context) {
|
||||
const { isInProject, isChatflow } = context;
|
||||
/** 不在会话流,LLM 节点无需关联环境 */
|
||||
/** Not in session flow, LLM nodes do not need to be associated with the environment */
|
||||
const formData = node
|
||||
.getData(FlowNodeFormData)
|
||||
.formModel.getFormItemValueByPath('/');
|
||||
|
||||
@@ -36,7 +36,7 @@ interface FunctionCallParamDTO extends BoundSkills {
|
||||
type FunctionCallParamVO = BoundSkills;
|
||||
|
||||
/**
|
||||
* fc参数后端转前端
|
||||
* FC parameter backend to frontend
|
||||
* @param fcParamDTO
|
||||
* @returns
|
||||
*/
|
||||
@@ -64,7 +64,7 @@ export function formatFcParamOnInit(fcParamDTO?: FunctionCallParamDTO) {
|
||||
}
|
||||
|
||||
/**
|
||||
* fc参数前端转后端
|
||||
* FC parameter front-end to back-end
|
||||
* @param fcParamVO
|
||||
* @returns
|
||||
*/
|
||||
|
||||
@@ -106,7 +106,7 @@ export const Skills: FC<SkillsProps> = props => {
|
||||
});
|
||||
}
|
||||
|
||||
// 表单的onChange 值传递是异步,所以这里延迟下
|
||||
// The onChange value passing of the form is asynchronous, so there is a delay here
|
||||
setTimeout(() => {
|
||||
refetch();
|
||||
}, 10);
|
||||
|
||||
@@ -71,7 +71,7 @@ export const SkillModal: FC<SkillModalProps> = props => {
|
||||
SkillKnowledgeSiderCategory.Library,
|
||||
);
|
||||
|
||||
// plugin 添加弹窗
|
||||
// Plugin Add pop-up window
|
||||
const pluginModalFrom = projectId
|
||||
? From.ProjectWorkflow
|
||||
: From.WorkflowAddNode;
|
||||
|
||||
@@ -41,10 +41,10 @@ export type WorkflowFCSetting = FCWorkflowSetting;
|
||||
export interface BoundWorkflowItem {
|
||||
plugin_id: string;
|
||||
workflow_id: string;
|
||||
// 如果是project 填project version,资源库填plugin version
|
||||
// If it is a project, fill in the project version, and fill in the plugin version in the resource library.
|
||||
plugin_version: string;
|
||||
workflow_version: string;
|
||||
// 如果是project 就填true,资源库 false
|
||||
// Fill in true if it is project, false for resource library
|
||||
is_draft: boolean;
|
||||
fc_setting?: WorkflowFCSetting;
|
||||
}
|
||||
@@ -53,9 +53,9 @@ export interface BoundPluginItem {
|
||||
plugin_id: string;
|
||||
api_id: string;
|
||||
api_name: string;
|
||||
// 如果是project 填project version,资源库填plugin version
|
||||
// If it is a project, fill in the project version, and fill in the plugin version in the resource library.
|
||||
plugin_version: string;
|
||||
// 如果是project 就填true,资源库 false
|
||||
// Fill in true if it is project, false for resource library
|
||||
is_draft: boolean;
|
||||
fc_setting?: PluginFCSetting;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import { WorkflowModelsService } from '@/services';
|
||||
import { useModelType } from '../hooks/use-model-type';
|
||||
|
||||
/**
|
||||
* 判断模型是不是支持技能
|
||||
* Is the judgment model a supporting skill?
|
||||
*/
|
||||
export function useModelSkillDisabled() {
|
||||
const modelType = useModelType();
|
||||
|
||||
@@ -41,13 +41,13 @@ import {
|
||||
// sub_type: 1,
|
||||
// location: 1, // Path = 1, Query = 2, Body = 3, Header = 4,
|
||||
// is_required: false,
|
||||
// local_default: '', // 默认值
|
||||
// local_disable: false, // 是否启用
|
||||
// local_default : '', // default
|
||||
// local_disable: false,//enabled
|
||||
// assist_type: 1, //DEFAULT = 1, IMAGE = 2, DOC = 3,CODE = 4,PPT = 5, TXT = 6, EXCEL = 7, AUDIO = 8, ZIP = 9,VIDEO = 10,
|
||||
// },
|
||||
// ],
|
||||
// local_default: '', // 默认值
|
||||
// local_disable: false, // 是否启用
|
||||
// local_default : '', // default
|
||||
// local_disable: false,//enabled
|
||||
// assist_type: 1, //DEFAULT = 1, IMAGE = 2, DOC = 3,CODE = 4,PPT = 5, TXT = 6, EXCEL = 7, AUDIO = 8, ZIP = 9,VIDEO = 10,
|
||||
// },
|
||||
// ],
|
||||
@@ -65,18 +65,18 @@ import {
|
||||
// sub_type: 1,
|
||||
// location: 1, // Path = 1, Query = 2, Body = 3, Header = 4,
|
||||
// is_required: false,
|
||||
// local_default: '', // 默认值
|
||||
// local_disable: false, // 是否启用
|
||||
// local_default : '', // default
|
||||
// local_disable: false,//enabled
|
||||
// assist_type: 1, //DEFAULT = 1, IMAGE = 2, DOC = 3,CODE = 4,PPT = 5, TXT = 6, EXCEL = 7, AUDIO = 8, ZIP = 9,VIDEO = 10,
|
||||
// },
|
||||
// ],
|
||||
// local_default: '', // 默认值
|
||||
// local_disable: false, // 是否启用
|
||||
// local_default : '', // default
|
||||
// local_disable: false,//enabled
|
||||
// assist_type: 1, //DEFAULT = 1, IMAGE = 2, DOC = 3,CODE = 4,PPT = 5, TXT = 6, EXCEL = 7, AUDIO = 8, ZIP = 9,VIDEO = 10,
|
||||
// },
|
||||
// ],
|
||||
// response_style: {
|
||||
// mode: 1, // Raw = 0, // 原始输出 Card = 1, // 渲染成卡片 Template = 2, // 包含变量的模板内容,用jinja2渲染 TODO
|
||||
// Mode: 1,//Raw = 0,//Raw Output Card = 1,//Render as Card Template = 2,//Template content containing variables, render TODO with jinja2
|
||||
// },
|
||||
// },
|
||||
// workflow_fc_setting: {
|
||||
@@ -94,13 +94,13 @@ import {
|
||||
// sub_type: 1,
|
||||
// location: 1, // Path = 1, Query = 2, Body = 3, Header = 4,
|
||||
// is_required: false,
|
||||
// local_default: '', // 默认值
|
||||
// local_disable: false, // 是否启用
|
||||
// local_default : '', // default
|
||||
// local_disable: false,//enabled
|
||||
// assist_type: 1, //DEFAULT = 1, IMAGE = 2, DOC = 3,CODE = 4,PPT = 5, TXT = 6, EXCEL = 7, AUDIO = 8, ZIP = 9,VIDEO = 10,
|
||||
// },
|
||||
// ],
|
||||
// local_default: '', // 默认值
|
||||
// local_disable: false, // 是否启用
|
||||
// local_default : '', // default
|
||||
// local_disable: false,//enabled
|
||||
// assist_type: 1, //DEFAULT = 1, IMAGE = 2, DOC = 3,CODE = 4,PPT = 5, TXT = 6, EXCEL = 7, AUDIO = 8, ZIP = 9,VIDEO = 10,
|
||||
// },
|
||||
// ],
|
||||
@@ -118,30 +118,30 @@ import {
|
||||
// sub_type: 1,
|
||||
// location: 1, // Path = 1, Query = 2, Body = 3, Header = 4,
|
||||
// is_required: false,
|
||||
// local_default: '', // 默认值
|
||||
// local_disable: false, // 是否启用
|
||||
// local_default : '', // default
|
||||
// local_disable: false,//enabled
|
||||
// assist_type: 1, //DEFAULT = 1, IMAGE = 2, DOC = 3,CODE = 4,PPT = 5, TXT = 6, EXCEL = 7, AUDIO = 8, ZIP = 9,VIDEO = 10,
|
||||
// },
|
||||
// ],
|
||||
// local_default: '', // 默认值
|
||||
// local_disable: false, // 是否启用
|
||||
// local_default : '', // default
|
||||
// local_disable: false,//enabled
|
||||
// assist_type: 1, //DEFAULT = 1, IMAGE = 2, DOC = 3,CODE = 4,PPT = 5, TXT = 6, EXCEL = 7, AUDIO = 8, ZIP = 9,VIDEO = 10,
|
||||
// },
|
||||
// ],
|
||||
// response_style: {
|
||||
// mode: 1, // Raw = 0, // 原始输出 Card = 1, // 渲染成卡片 Template = 2, // 包含变量的模板内容,用jinja2渲染 TODO
|
||||
// Mode: 1,//Raw = 0,//Raw Output Card = 1,//Render as Card Template = 2,//Template content containing variables, render TODO with jinja2
|
||||
// },
|
||||
// },
|
||||
// dataset_fc_setting: {
|
||||
// top_k: 5, // 召回数量
|
||||
// min_score: 0.46, // 召回的最小相似度阈值
|
||||
// auto: true, // 是否自动召回
|
||||
// search_mode: 1, // 搜索策略
|
||||
// no_recall_reply_mode: 1, // 无召回回复mode,默认0
|
||||
// top_k: 5,//Recall Quantity
|
||||
// min_score: 0.46,//minimum similarity threshold for recall
|
||||
// Auto: true,//whether to recall automatically
|
||||
// search_mode: 1,//search strategy
|
||||
// no_recall_reply_mode: 1,//no recall reply mode, default 0
|
||||
// no_recall_reply_customize_prompt:
|
||||
// '抱歉,您的问题超出了我的知识范围,并且无法在当前阶段回答', // 无召回回复时自定义prompt,当NoRecallReplyMode=1时生效
|
||||
// show_source: true, // 是否展示来源
|
||||
// show_source_mode: 1, // 来源展示方式 默认值0 卡片列表方式
|
||||
// 'Sorry, your question is beyond my knowledge and cannot be answered at this stage ',//Custom prompt when no recall reply, takes effect when NoRecallReplyMode = 1
|
||||
// show_source: true,//whether to show the source
|
||||
// show_source_mode: 1,//source display method, default value 0 card list method
|
||||
// },
|
||||
// }
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
|
||||
import { PromiseLimiter } from '@/utils/promise-limiter';
|
||||
|
||||
// 限制并发,因为同一个流程上可能会有很多LLM节点,同时请求
|
||||
// Limit concurrency, because there may be many LLM nodes on the same process, simultaneously requesting
|
||||
const CONCURRENCY = 3;
|
||||
|
||||
const limiter = new PromiseLimiter(CONCURRENCY, true);
|
||||
|
||||
@@ -17,15 +17,15 @@
|
||||
import { type BoundSkills } from './types';
|
||||
|
||||
/**
|
||||
* 根据projectId判断是否是草稿
|
||||
* 资源库里面的插件 project_id = '0'
|
||||
* Determine whether it is a draft according to the projectId
|
||||
* Plugins in library project_id = '0'
|
||||
*/
|
||||
export function isDraftByProjectId(projectId?: string) {
|
||||
return projectId && projectId !== '0' ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 技能是否为空
|
||||
* Is the skill empty?
|
||||
* @param value
|
||||
* @returns
|
||||
*/
|
||||
@@ -38,7 +38,7 @@ export function isSkillsEmpty(value: BoundSkills) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取技能查询参数
|
||||
* Get skill query parameters
|
||||
* @param fcParam
|
||||
* @returns
|
||||
*/
|
||||
|
||||
@@ -36,7 +36,7 @@ export const UserPrompt = ({ field, fieldState }) => {
|
||||
const isUserPromptRequired = curModel?.is_up_required ?? false;
|
||||
|
||||
useEffect(() => {
|
||||
// TODO: 临时方案,待节点引擎提供新 api 后替换
|
||||
// TODO: Temporary solution, replaced after the node engine provides a new API
|
||||
field._fieldModel.validate();
|
||||
}, [isUserPromptRequired]);
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ const getDefaultModels = (modelMeta: Model): InputValueDTO[] => {
|
||||
modelMeta?.model_params?.forEach(p => {
|
||||
const k = camelCase(p.name) as string;
|
||||
const { type } = p;
|
||||
// 优先取平衡,自定义兜底
|
||||
// Priority to take the balance, custom bottom line
|
||||
const defaultValue =
|
||||
p.default_val[GenerationDiversity.Balance] ??
|
||||
p.default_val[GenerationDiversity.Customize];
|
||||
@@ -79,8 +79,8 @@ export const getDefaultLLMParams = (models: Model[]) => {
|
||||
export const reviseLLMParamPair = (d: InputValueDTO): [string, unknown] => {
|
||||
let k = d?.name || '';
|
||||
|
||||
// TODO 前端不依赖这个字段,确认后端无依赖后,可删除
|
||||
// 兼容一个历史悠久的拼写错误
|
||||
// The TODO front end does not rely on this field. After confirming that the back end does not rely on it, it can be deleted.
|
||||
// Compatible with a long-standing spelling error
|
||||
if (k === 'modleName') {
|
||||
k = 'modelName';
|
||||
}
|
||||
@@ -112,7 +112,7 @@ export const modelItemToBlockInput = (
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
let _k = k;
|
||||
// TODO 前端不依赖这个字段,确认后端无依赖后,可删除
|
||||
// The TODO front end does not rely on this field. After confirming that the back end does not rely on it, it can be deleted.
|
||||
if (_k === 'modelName') {
|
||||
_k = 'modleName';
|
||||
}
|
||||
@@ -145,7 +145,7 @@ export const addSKillFromLibrary = (
|
||||
plugin_id: detail?.plugin_id as string,
|
||||
api_id: detail?.api_id as string,
|
||||
api_name: detail?.name as string,
|
||||
plugin_version: '', // 和 @张友松 确认 不传版本
|
||||
plugin_version: '', // And @Zhang Yousong, confirm, do not send the version
|
||||
is_draft: isDraftByProjectId(detail?.project_id),
|
||||
});
|
||||
|
||||
@@ -162,7 +162,7 @@ export const addSKillFromLibrary = (
|
||||
plugin_id: detail?.plugin_id as string,
|
||||
workflow_id: detail?.workflow_id as string,
|
||||
plugin_version: '',
|
||||
workflow_version: '', // 和 @张友松 确认 不传版本
|
||||
workflow_version: '', // And @Zhang Yousong, confirm, do not send the version
|
||||
is_draft: isDraftByProjectId(detail?.project_id),
|
||||
});
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import { isVisionEqual, isVisionInput } from '../vision';
|
||||
export const llmInputNameValidator = ({ value, formValues, name }) => {
|
||||
const validatorRule = nameValidationRule;
|
||||
|
||||
/** 命名校验 */
|
||||
/** name check */
|
||||
if (!validatorRule.test(value)) {
|
||||
return I18n.t('workflow_detail_node_error_format');
|
||||
}
|
||||
@@ -43,13 +43,13 @@ export const llmInputNameValidator = ({ value, formValues, name }) => {
|
||||
item => item.name === value && isVisionEqual(item, inputValue),
|
||||
);
|
||||
|
||||
// 都是输入或者视觉理解的场景直接返回重名
|
||||
// All scenes are input or visually understood, and the same name is directly returned.
|
||||
if (sameVisionInputs.length > 1) {
|
||||
return I18n.t('workflow_detail_node_input_duplicated');
|
||||
}
|
||||
|
||||
// 输入和视觉理解参数重名的场景,返回不能和视觉理解参数重名
|
||||
// 视觉理解参数和输入重名,返回不能和输入重名
|
||||
// Scenes with the same name as the input and visual understanding parameters are returned that cannot be the same name as the visual understanding parameters
|
||||
// Visual understanding of parameters and input duplicate names, return cannot duplicate input names
|
||||
const differentVisionInputs = inputValues.filter(
|
||||
item => item.name === value && !isVisionEqual(item, inputValue),
|
||||
);
|
||||
|
||||
@@ -22,11 +22,11 @@ import { type Validate } from '@flowgram-adapter/free-layout-editor';
|
||||
|
||||
import { omitSystemReasoningContent, REASONING_CONTENT_NAME } from '../cot';
|
||||
|
||||
/** 变量命名校验规则 */
|
||||
/** Variable Naming Validation Rules */
|
||||
const outputTreeValidationRule =
|
||||
/^(?!.*\b(true|false|and|AND|or|OR|not|NOT|null|nil|If|Switch)\b)[a-zA-Z_][a-zA-Z_$0-9]*$/;
|
||||
|
||||
/** 校验逻辑 */
|
||||
/** check logic */
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
const OutputTreeMetaSchema = z.lazy(() =>
|
||||
z
|
||||
@@ -57,26 +57,26 @@ const OutputTreeMetaSchema = z.lazy(() =>
|
||||
);
|
||||
|
||||
const omitErrorBody = (value, isBatch) => {
|
||||
// 批量,去除 children 中的 errorBody
|
||||
// Batch, remove errorBody from children
|
||||
if (isBatch) {
|
||||
return value?.map(v => ({
|
||||
...v,
|
||||
children: v?.children?.filter(c => c?.name !== 'errorBody'),
|
||||
}));
|
||||
}
|
||||
// 单次,去除 value 中的 errorBody
|
||||
// Single, remove errorBody from value
|
||||
return value?.filter(v => v?.name !== 'errorBody');
|
||||
};
|
||||
|
||||
export const llmOutputTreeMetaValidator: Validate = ({ value, formValues }) => {
|
||||
/**
|
||||
* 判断错误异常处理是否打开,如果打开需要过滤掉 errorBody 后做校验
|
||||
* Determine whether the error exception handling is turned on. If it is turned on, you need to filter out the errorBody and check it.
|
||||
*/
|
||||
const { settingOnErrorIsOpen = false } = (get(formValues, 'settingOnError') ??
|
||||
{}) as { settingOnErrorIsOpen?: boolean };
|
||||
|
||||
/**
|
||||
* 根据 batch 数据判断,当前是否处于批处理状态
|
||||
* According to the batch data, whether it is currently in the batch state
|
||||
*/
|
||||
const batchValue = get(formValues, 'batchMode');
|
||||
const isBatch = batchValue === 'batch';
|
||||
|
||||
@@ -38,7 +38,7 @@ interface VisionInputFieldProps {
|
||||
}
|
||||
|
||||
/**
|
||||
* 输入字段
|
||||
* input field
|
||||
*/
|
||||
export const VisionInputField: FC<VisionInputFieldProps> = ({
|
||||
readonly,
|
||||
|
||||
@@ -40,7 +40,7 @@ interface VisionNameFieldProps {
|
||||
}
|
||||
|
||||
/**
|
||||
* 输入名称字段
|
||||
* Enter name field
|
||||
*/
|
||||
export const VisionNameField: FC<VisionNameFieldProps> = ({
|
||||
inputField,
|
||||
|
||||
@@ -33,7 +33,7 @@ interface VisionProps {
|
||||
}
|
||||
|
||||
/**
|
||||
* 输入值字段
|
||||
* input value field
|
||||
* @returns */
|
||||
export const VisionValueField: FC<VisionProps> = ({ enabledTypes, name }) => {
|
||||
const disabledTypes = ViewVariableType.getComplement([
|
||||
@@ -57,7 +57,7 @@ export const VisionValueField: FC<VisionProps> = ({ enabledTypes, name }) => {
|
||||
onChange={v => {
|
||||
const expression = v as ValueExpression;
|
||||
if (!expression) {
|
||||
// 默认值需要带raw meta不然无法区分是不是视觉理解
|
||||
// The default value needs to be accompanied by raw meta, otherwise it is impossible to distinguish whether it is visual understanding or not.
|
||||
childInputField?.onChange(DEFUALT_VISION_INPUT);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ interface VisionProps {
|
||||
}
|
||||
|
||||
/**
|
||||
* 视觉理解配置
|
||||
* Visual understanding configuration
|
||||
*/
|
||||
export const Vision: FC<VisionProps> = () => {
|
||||
const enabledTypes = useModelEnabledTypes();
|
||||
|
||||
@@ -22,7 +22,7 @@ import { WorkflowModelsService } from '@/services';
|
||||
import { useModelType } from '../../hooks/use-model-type';
|
||||
|
||||
/**
|
||||
* 模型支持的数据类型
|
||||
* Data types supported by the model
|
||||
*/
|
||||
export function useModelEnabledTypes() {
|
||||
const modelType = useModelType();
|
||||
|
||||
@@ -19,7 +19,7 @@ import { type InputValueVO } from '@coze-workflow/base';
|
||||
import { isVisionInput } from './is-vision-input';
|
||||
|
||||
/**
|
||||
* 判断是否是相同的输入类型
|
||||
* Determine if they are the same input type
|
||||
* @param value1
|
||||
* @param value2
|
||||
* @returns
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import { type InputValueVO } from '@coze-workflow/base';
|
||||
|
||||
/**
|
||||
* 是不是视觉理解的输入
|
||||
* Is it visually comprehensible input?
|
||||
*/
|
||||
export const isVisionInput = (value: InputValueVO): boolean =>
|
||||
!!value?.input?.rawMeta?.isVision;
|
||||
|
||||
@@ -19,7 +19,7 @@ import { isFunction, isBoolean } from 'lodash-es';
|
||||
import { valueExpressionValidator } from '@/form-extensions/validators';
|
||||
|
||||
interface Options {
|
||||
/** required 还支持函数形式验证 */
|
||||
/** Required also supports functional formal verification */
|
||||
required?: boolean | ((validateProps) => boolean);
|
||||
emptyErrorMessage?: string;
|
||||
skipValidate?: ({ value, formValues }) => boolean;
|
||||
|
||||
@@ -18,7 +18,7 @@ import { type Validate } from '@flowgram-adapter/free-layout-editor';
|
||||
import { nodeMetaValidator } from '@coze-workflow/nodes';
|
||||
|
||||
/**
|
||||
* node meta 校验
|
||||
* Node meta check
|
||||
* @param param0
|
||||
* @returns
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,7 @@ import { type Validate } from '@flowgram-adapter/free-layout-editor';
|
||||
import { settingOnErrorValidator } from '@coze-workflow/nodes';
|
||||
|
||||
/**
|
||||
* 异常设置校验
|
||||
* exception setting check
|
||||
* @param param0
|
||||
* @returns
|
||||
*/
|
||||
|
||||
@@ -32,7 +32,7 @@ interface Props {
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加分组按钮
|
||||
* Add group button
|
||||
* @param param0
|
||||
* @returns
|
||||
*/
|
||||
|
||||
@@ -31,7 +31,7 @@ interface Props {
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除分组按钮
|
||||
* Delete group button
|
||||
* @param param0
|
||||
* @returns
|
||||
*/
|
||||
|
||||
@@ -29,7 +29,7 @@ interface Props {
|
||||
}
|
||||
|
||||
/**
|
||||
* 分组名,支持双击编辑
|
||||
* Group name, support double-click editing
|
||||
* @param props
|
||||
* @returns
|
||||
*/
|
||||
|
||||
@@ -42,7 +42,7 @@ interface Props {
|
||||
}
|
||||
|
||||
/**
|
||||
* 分组header
|
||||
* Packet header
|
||||
* @param param0
|
||||
* @returns
|
||||
*/
|
||||
|
||||
@@ -33,7 +33,7 @@ interface Props {
|
||||
}
|
||||
|
||||
/**
|
||||
* 名称编辑
|
||||
* name edit
|
||||
* @param props
|
||||
* @returns
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,7 @@ import { getGroupTypeAlias } from '../../utils/get-group-type-alias';
|
||||
import { type MergeGroup } from '../../types';
|
||||
|
||||
/**
|
||||
* 获取分组类型别名
|
||||
* Get group type alias
|
||||
*/
|
||||
export function useGroupTypeAlias(mergeGroup: MergeGroup) {
|
||||
const variableService: WorkflowVariableService = useVariableService();
|
||||
|
||||
@@ -50,7 +50,7 @@ interface Props {
|
||||
}
|
||||
|
||||
/**
|
||||
* 分组变量Item
|
||||
* Group Variable Item
|
||||
* @param param0
|
||||
* @returns
|
||||
*/
|
||||
|
||||
@@ -40,7 +40,7 @@ interface Props {
|
||||
}
|
||||
|
||||
/**
|
||||
* 分组变量
|
||||
* grouping variables
|
||||
* @param param0
|
||||
* @returns
|
||||
*/
|
||||
@@ -108,20 +108,20 @@ export const GroupVariables: FC<Props> = ({
|
||||
onChange={v => {
|
||||
const val = v as ValueExpression;
|
||||
|
||||
// 如果是字面量或者空值,则缓存到 variableFieldCandidate
|
||||
// If it is a literal or null value, it is cached to variableFieldCandidate
|
||||
if (
|
||||
ValueExpression.isLiteral(val) ||
|
||||
ValueExpression.isEmpty(val)
|
||||
) {
|
||||
updateVariableFieldCandidate(val);
|
||||
} else {
|
||||
// 不为空的 ref 变量,append 到 variablesField 中
|
||||
// Non-empty ref variable, append to variablesField
|
||||
updateVariableFieldCandidate(undefined);
|
||||
variablesField.append(val);
|
||||
}
|
||||
}}
|
||||
onBlur={() => {
|
||||
// literal 变量,在失焦时,如果 variableFieldCandidate 有值,则 append 到 variablesField 中
|
||||
// Literal variable, when out of focus, append to variablesField if variableFieldCandidate have a value
|
||||
if (
|
||||
variableFieldCandidateRef.current &&
|
||||
ValueExpression.isLiteral(variableFieldCandidateRef.current)
|
||||
|
||||
@@ -21,7 +21,7 @@ import { useExecStateEntity } from '@/hooks';
|
||||
import { isOutputVariable } from '../../utils/is-output-variable';
|
||||
|
||||
/**
|
||||
* 判断变量是否是输出变量
|
||||
* Determine whether a variable is an output variable
|
||||
*/
|
||||
export function useIsOutputVariable(groupIndex: number, variableIndex: number) {
|
||||
const execEntity = useExecStateEntity();
|
||||
|
||||
@@ -27,7 +27,7 @@ import { type CustomFilterVar } from '@/form-extensions/components/tree-variable
|
||||
import { getVariableViewType } from '../../utils/get-variable-view-type';
|
||||
import { getMatchedVariableTypes } from '../../utils/get-matched-variable-types';
|
||||
/**
|
||||
* 变量过滤
|
||||
* variable filtering
|
||||
*/
|
||||
export const useVariablesFilter = (
|
||||
variables: ValueExpression[],
|
||||
@@ -44,7 +44,7 @@ export const useVariablesFilter = (
|
||||
node,
|
||||
);
|
||||
|
||||
// 只允许选择和第一个变量相同类型的变量
|
||||
// Only variables of the same type as the first variable are allowed to be selected
|
||||
const matchedTypes = getMatchedVariableTypes(viewType);
|
||||
const disabledTypes =
|
||||
matchedTypes.length > 0 ? ViewVariableType.getComplement(matchedTypes) : [];
|
||||
@@ -55,7 +55,7 @@ export const useVariablesFilter = (
|
||||
.filter(Boolean)
|
||||
.map(path => (path as string[]).join('.'));
|
||||
|
||||
// 已经选择的变量不允许再选择
|
||||
// Variables that have been selected are not allowed to be selected again
|
||||
const customFilterVar: CustomFilterVar = ({ meta: _meta, path }) =>
|
||||
!paths.includes((path || []).join('.'));
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ interface Props {
|
||||
}
|
||||
|
||||
/**
|
||||
* 变量聚合分组
|
||||
* variable aggregation grouping
|
||||
* @param param0
|
||||
* @returns
|
||||
*/
|
||||
|
||||
@@ -20,7 +20,7 @@ import { Select, Tooltip } from '@coze-arch/coze-design';
|
||||
import { InfoIcon } from '../info-icon';
|
||||
|
||||
/**
|
||||
* 变量聚合策略
|
||||
* Variable aggregation strategy
|
||||
* @param param0
|
||||
* @returns
|
||||
*/
|
||||
|
||||
@@ -30,7 +30,7 @@ import { MergeGroupsField } from '../merge-groups-field';
|
||||
import { type VariableMergeFormData } from '../../types';
|
||||
|
||||
/**
|
||||
* 变量聚合表单
|
||||
* variable aggregation form
|
||||
* @param param0
|
||||
* @returns
|
||||
*/
|
||||
|
||||
@@ -23,14 +23,14 @@ export const MATCHED_VARIABLE_TYPES: ViewVariableType[][] = [
|
||||
];
|
||||
|
||||
/**
|
||||
* 分组名最大数量
|
||||
* Maximum number of group names
|
||||
*/
|
||||
export const MAX_GROUP_NAME_COUNT = 20;
|
||||
/**
|
||||
* 分组最大数量
|
||||
* Maximum number of groups
|
||||
*/
|
||||
export const MAX_GROUP_COUNT = 50;
|
||||
/**
|
||||
* 分组变量最大数量
|
||||
* Maximum number of grouped variables
|
||||
*/
|
||||
export const MAX_GROUP_VARIABLE_COUNT = 50;
|
||||
|
||||
@@ -38,7 +38,7 @@ export const variablesChangeEffects = [
|
||||
return;
|
||||
}
|
||||
|
||||
// todo any类型需要sdk导出
|
||||
// Todo any type requires sdk export
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(formModel.getField(params.name) as any)?.map(child => {
|
||||
child?.validate();
|
||||
|
||||
@@ -18,7 +18,7 @@ import { type MergeGroup } from '../types';
|
||||
import { GROUP_NAME_PREFIX } from '../constants';
|
||||
|
||||
/**
|
||||
* 生成变量分组名称
|
||||
* Generate variable group name
|
||||
*/
|
||||
export function generateGroupName(mergeGroups: MergeGroup[] | undefined) {
|
||||
const groups: MergeGroup[] = mergeGroups || [];
|
||||
|
||||
@@ -21,7 +21,7 @@ import { type MergeGroup } from '../types';
|
||||
import { getVariableTypeAlias } from './get-variable-type-alias';
|
||||
|
||||
/**
|
||||
* 获取分组类型别名
|
||||
* Get group type alias
|
||||
*/
|
||||
export function getGroupTypeAlias(
|
||||
mergeGroup: MergeGroup,
|
||||
|
||||
@@ -19,7 +19,7 @@ import { type ViewVariableType } from '@coze-workflow/base';
|
||||
import { MATCHED_VARIABLE_TYPES } from '../constants';
|
||||
|
||||
/**
|
||||
* 获取匹配的类型
|
||||
* Get the matching type
|
||||
* @param viewType
|
||||
* @returns
|
||||
*/
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
import { getVariableViewType } from './get-variable-view-type';
|
||||
|
||||
/**
|
||||
* 获取变量别名
|
||||
* Get variable alias
|
||||
*/
|
||||
export function getVariableTypeAlias(
|
||||
variable: ValueExpression | undefined,
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
} from '@coze-workflow/variable';
|
||||
|
||||
/**
|
||||
* 获取变量类型
|
||||
* Get variable type
|
||||
*/
|
||||
export function getVariableViewType(
|
||||
variable: ValueExpression | undefined,
|
||||
|
||||
@@ -22,7 +22,7 @@ interface Extra {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据执行结果判断是不是输出的变量
|
||||
* Determine whether it is an output variable according to the execution result
|
||||
* @param ref
|
||||
* @param result
|
||||
* @returns
|
||||
|
||||
@@ -19,7 +19,7 @@ import { type ViewVariableType } from '@coze-workflow/base';
|
||||
import { getMatchedVariableTypes } from './get-matched-variable-types';
|
||||
|
||||
/**
|
||||
* 变量类型是否匹配
|
||||
* Does the variable type match?
|
||||
* @param viewType1
|
||||
* @param viewType2
|
||||
* @returns
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import { type FieldError } from '@flowgram-adapter/free-layout-editor';
|
||||
|
||||
/**
|
||||
* 转成Filed错误
|
||||
* Convert to Filed Error
|
||||
* @param name
|
||||
* @param message
|
||||
* @returns
|
||||
|
||||
@@ -31,7 +31,7 @@ export const groupNameValidator: Validate = ({ value, formValues }) => {
|
||||
};
|
||||
|
||||
export function validateGroupName(name: string, names: string[]) {
|
||||
/** 命名规则校验 */
|
||||
/** naming rule validation */
|
||||
if (!nameValidationRule.test(name)) {
|
||||
return I18n.t('workflow_detail_node_error_format');
|
||||
}
|
||||
@@ -40,7 +40,7 @@ export function validateGroupName(name: string, names: string[]) {
|
||||
return I18n.t('workflow_var_merge_name_lengthmax');
|
||||
}
|
||||
|
||||
// 重复名字校验
|
||||
// duplicate name verification
|
||||
if (names.filter(item => item === name).length > 1) {
|
||||
return I18n.t('workflow_var_merge_output_namedul');
|
||||
}
|
||||
|
||||
@@ -23,11 +23,11 @@ import { getVariableViewType } from '../utils/get-variable-view-type';
|
||||
import { createValueExpressionInputValidate } from '../../materials/create-value-expression-input-validate';
|
||||
|
||||
export const variableValidator: Validate = options => {
|
||||
// todo 目前表单引擎删除元素会传一个undefined, 校验先跳过,后续节点引擎修复了移除
|
||||
// Todo currently deletes the element of the form engine and will pass an undefined one. The verification is skipped first, and the subsequent node engine fixes the removal.
|
||||
if (isUndefined(options?.value)) {
|
||||
return;
|
||||
}
|
||||
// 校验表达式
|
||||
// check expression
|
||||
const validator = createValueExpressionInputValidate({
|
||||
required: true,
|
||||
});
|
||||
@@ -40,12 +40,12 @@ export const variableValidator: Validate = options => {
|
||||
const paths = get(options, 'name', '').split('.');
|
||||
const index = paths.pop();
|
||||
|
||||
// 第一项不需要校验
|
||||
// The first item does not require verification
|
||||
if (index === '0') {
|
||||
return;
|
||||
}
|
||||
|
||||
// 校验变量类型和第一项是否一致
|
||||
// Verify that the variable type is consistent with the first item
|
||||
const { node } = options.context;
|
||||
const { variableService } = options.context.playgroundContext;
|
||||
const variables = get(options.formValues, paths);
|
||||
|
||||
@@ -38,7 +38,7 @@ export const VARIABLE_MERGE_FORM_META: FormMetaV2<FormData> = {
|
||||
'inputs.mergeGroups.*.variables': variablesChangeEffects,
|
||||
},
|
||||
render: props => <VariableMergeForm {...props} />,
|
||||
// 校验
|
||||
// validation
|
||||
validateTrigger: ValidateTrigger.onChange,
|
||||
validate: {
|
||||
nodeMeta: nodeMetaValidate,
|
||||
@@ -51,8 +51,8 @@ export const VARIABLE_MERGE_FORM_META: FormMetaV2<FormData> = {
|
||||
const { playgroundContext } = context;
|
||||
const { variableService } = playgroundContext;
|
||||
|
||||
// 初始值设置
|
||||
// 不在此设置初始值不会触发表单的 onValueInit 时间
|
||||
// initial value setting
|
||||
// Failure to set the initial value here will not trigger the form's onValueInit time
|
||||
const initValue = value || {
|
||||
inputs: {
|
||||
mergeGroups: [
|
||||
|
||||
Reference in New Issue
Block a user