diff --git a/web/app/components/workflow/nodes/_base/components/output-vars.tsx b/web/app/components/workflow/nodes/_base/components/output-vars.tsx index b4dfadc678..1fa0cd4e91 100644 --- a/web/app/components/workflow/nodes/_base/components/output-vars.tsx +++ b/web/app/components/workflow/nodes/_base/components/output-vars.tsx @@ -6,11 +6,13 @@ import cn from 'classnames' type Props = { className?: string + title?: string children: JSX.Element } const OutputVars: FC = ({ className, + title, children, }) => { const { t } = useTranslation() @@ -18,7 +20,7 @@ const OutputVars: FC = ({ return (
- {t('workflow.nodes.common.outputVars')} + {title || t('workflow.nodes.common.outputVars')}
{children} @@ -30,12 +32,18 @@ type VarItemProps = { name: string type: string description: string + subItems?: { + name: string + type: string + description: string + }[] } export const VarItem: FC = ({ name, type, description, + subItems, }) => { return (
@@ -43,7 +51,21 @@ export const VarItem: FC = ({
{name}
{type}
-
{description}
+
+ {description} + {subItems && ( +
+ {subItems.map((item, index) => ( + + ))} +
+ )} +
) } diff --git a/web/app/components/workflow/nodes/start/panel.tsx b/web/app/components/workflow/nodes/start/panel.tsx index 6e401a9a4e..8ff6d148b9 100644 --- a/web/app/components/workflow/nodes/start/panel.tsx +++ b/web/app/components/workflow/nodes/start/panel.tsx @@ -1,8 +1,59 @@ import type { FC } from 'react' +import { useTranslation } from 'react-i18next' +import Split from '@/app/components/workflow/nodes/_base/components/split' +import Field from '@/app/components/workflow/nodes/_base/components/field' +import OutputVars, { VarItem } from '@/app/components/workflow/nodes/_base/components/output-vars' + +const i18nPrefix = 'workflow.nodes.start' const Panel: FC = () => { + const { t } = useTranslation() + return ( -
start panel inputs
+
+
+ + ss + +
+ + +
+ + <> + + + + + +
+
) } diff --git a/web/app/components/workflow/nodes/start/use-config.ts b/web/app/components/workflow/nodes/start/use-config.ts new file mode 100644 index 0000000000..96da6e3cfa --- /dev/null +++ b/web/app/components/workflow/nodes/start/use-config.ts @@ -0,0 +1,12 @@ +import { useState } from 'react' +import type { StartNodeType } from './types' + +const useConfig = (initInputs: StartNodeType) => { + const [inputs, setInputs] = useState(initInputs) + + return { + inputs, + } +} + +export default useConfig diff --git a/web/i18n/lang/workflow.en.ts b/web/i18n/lang/workflow.en.ts index 1a15363ec0..7b9b8f9258 100644 --- a/web/i18n/lang/workflow.en.ts +++ b/web/i18n/lang/workflow.en.ts @@ -6,6 +6,16 @@ const translation = { }, start: { required: 'required', + builtInVar: 'Built-in Variables', + outputVars: { + query: 'User input', + memories: { + des: 'Conversation history', + type: 'message type', + content: 'message content', + }, + files: 'File list', + }, }, end: { outputs: 'Outputs', diff --git a/web/i18n/lang/workflow.zh.ts b/web/i18n/lang/workflow.zh.ts index 8f0deafe3a..5ecd764db7 100644 --- a/web/i18n/lang/workflow.zh.ts +++ b/web/i18n/lang/workflow.zh.ts @@ -6,6 +6,16 @@ const translation = { }, start: { required: '必填', + builtInVar: '内置变量', + outputVars: { + query: '用户输入', + memories: { + des: '会话历史', + type: '消息类型', + content: '消息内容', + }, + files: '文件列表', + }, }, end: { outputs: '输出',