From 36664620761f5c04def6af9d57ec32945e0bf414 Mon Sep 17 00:00:00 2001 From: Joel Date: Sun, 18 Feb 2024 14:33:44 +0800 Subject: [PATCH] feat: llm input struct --- .../(commonLayout)/workflow/nodes/page.tsx | 1 + web/app/components/workflow/index.tsx | 1 + .../workflow/nodes/_base/components/field.tsx | 20 ++++++- .../workflow/nodes/_base/components/split.tsx | 18 ++++++ .../components/workflow/nodes/llm/panel.tsx | 59 ++++++++++++++----- web/i18n/lang/workflow.en.ts | 3 + web/i18n/lang/workflow.zh.ts | 3 + 7 files changed, 87 insertions(+), 18 deletions(-) create mode 100644 web/app/components/workflow/nodes/_base/components/split.tsx diff --git a/web/app/(commonLayout)/workflow/nodes/page.tsx b/web/app/(commonLayout)/workflow/nodes/page.tsx index 22e4804ab7..4c83f79656 100644 --- a/web/app/(commonLayout)/workflow/nodes/page.tsx +++ b/web/app/(commonLayout)/workflow/nodes/page.tsx @@ -42,6 +42,7 @@ const Page: FC = () => { ) diff --git a/web/app/components/workflow/index.tsx b/web/app/components/workflow/index.tsx index 19ed9b9230..a64be7259b 100644 --- a/web/app/components/workflow/index.tsx +++ b/web/app/components/workflow/index.tsx @@ -88,6 +88,7 @@ const WorkflowWrapWithReactFlowProvider: FC = ({ }) => { return ( + {selectedNodeId} = ({ title, + tooltip, children, operations, + inline, }) => { return ( -
+
-
{title}
+
+
{title}
+ {tooltip && ( + + + + )} + +
{operations &&
{operations}
}
{children}
diff --git a/web/app/components/workflow/nodes/_base/components/split.tsx b/web/app/components/workflow/nodes/_base/components/split.tsx new file mode 100644 index 0000000000..d5b3b0079a --- /dev/null +++ b/web/app/components/workflow/nodes/_base/components/split.tsx @@ -0,0 +1,18 @@ +'use client' +import type { FC } from 'react' +import React from 'react' +import cn from 'classnames' + +type Props = { + className?: string +} + +const Split: FC = ({ + className, +}) => { + return ( +
+
+ ) +} +export default React.memo(Split) diff --git a/web/app/components/workflow/nodes/llm/panel.tsx b/web/app/components/workflow/nodes/llm/panel.tsx index 7efbd99308..7d786fd0a2 100644 --- a/web/app/components/workflow/nodes/llm/panel.tsx +++ b/web/app/components/workflow/nodes/llm/panel.tsx @@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next' import BasePanel from '../_base/panel' import Field from '@/app/components/workflow/nodes/_base/components/field' import AddButton from '@/app/components/base/button/add-button' +import Split from '@/app/components/workflow/nodes/_base/components/split' const i18nPrefix = 'workflow.nodes.llm' const Panel: FC = () => { @@ -12,21 +13,49 @@ const Panel: FC = () => { } return ( - - Model Selector - - - } - > - Var Selector - -
} + inputsElement={ +
+ + Model Selector + + + + } + > + Var Selector + + + + Context + + + Prompt + + + + Vision + + {/* This version not support function */} + {/* + Functions + */} +
+ } outputsElement={
start panel outputs
} /> ) diff --git a/web/i18n/lang/workflow.en.ts b/web/i18n/lang/workflow.en.ts index 78e2ece8cf..0d970065c6 100644 --- a/web/i18n/lang/workflow.en.ts +++ b/web/i18n/lang/workflow.en.ts @@ -3,6 +3,9 @@ const translation = { llm: { model: 'model', variables: 'variables', + context: 'context', + prompt: 'prompt', + vision: 'vision', }, }, } diff --git a/web/i18n/lang/workflow.zh.ts b/web/i18n/lang/workflow.zh.ts index b60c2a2241..e2a9466687 100644 --- a/web/i18n/lang/workflow.zh.ts +++ b/web/i18n/lang/workflow.zh.ts @@ -3,6 +3,9 @@ const translation = { llm: { model: '模型', variables: '变量', + context: '上下文', + prompt: '提示词', + vision: '视觉', }, }, }