From d0ef9e672fc6b60da00ce1c287c7d72075a812cf Mon Sep 17 00:00:00 2001 From: StyleZhang Date: Fri, 15 Mar 2024 17:57:20 +0800 Subject: [PATCH] llm mode --- web/app/components/workflow/hooks/use-workflow.ts | 7 ++++--- web/app/components/workflow/nodes/llm/panel.tsx | 1 + .../workflow/nodes/question-classifier/panel.tsx | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/web/app/components/workflow/hooks/use-workflow.ts b/web/app/components/workflow/hooks/use-workflow.ts index 3a81343c4d..d1ddaff3cd 100644 --- a/web/app/components/workflow/hooks/use-workflow.ts +++ b/web/app/components/workflow/hooks/use-workflow.ts @@ -2,6 +2,7 @@ import { useCallback, useEffect, } from 'react' +import { uniqBy } from 'lodash-es' import useSWR from 'swr' import produce from 'immer' import { @@ -100,7 +101,7 @@ export const useWorkflow = () => { list.push(...incomers) - return list.filter((item) => { + return uniqBy(list, 'id').filter((item) => { return SUPPORT_OUTPUT_VARS_NODE.includes(item.data.type) }) }, [store]) @@ -135,7 +136,7 @@ export const useWorkflow = () => { const length = list.length if (length) { - return list.reverse().filter((item) => { + return uniqBy(list, 'id').reverse().filter((item) => { return SUPPORT_OUTPUT_VARS_NODE.includes(item.data.type) }) } @@ -171,7 +172,7 @@ export const useWorkflow = () => { list.push(node) }) - return list + return uniqBy(list, 'id') }, [store]) const isValidConnection = useCallback(({ source, target }: Connection) => { diff --git a/web/app/components/workflow/nodes/llm/panel.tsx b/web/app/components/workflow/nodes/llm/panel.tsx index a30c1fb840..cff5b89c7e 100644 --- a/web/app/components/workflow/nodes/llm/panel.tsx +++ b/web/app/components/workflow/nodes/llm/panel.tsx @@ -118,6 +118,7 @@ const Panel: FC> = ({ handleModelChanged({ provider: currentProvider?.provider, modelId: currentModel?.model, + mode: currentModel?.model_properties?.mode as string, }) } }, [model.provider, currentProvider, currentModel, handleModelChanged]) diff --git a/web/app/components/workflow/nodes/question-classifier/panel.tsx b/web/app/components/workflow/nodes/question-classifier/panel.tsx index 8b643207ac..e094275ada 100644 --- a/web/app/components/workflow/nodes/question-classifier/panel.tsx +++ b/web/app/components/workflow/nodes/question-classifier/panel.tsx @@ -51,6 +51,7 @@ const Panel: FC> = ({ handleModelChanged({ provider: currentProvider?.provider, modelId: currentModel?.model, + mode: currentModel?.model_properties?.mode as string, }) } }, [model.provider, currentProvider, currentModel, handleModelChanged])