From 0d2366b432520ad5c1374bb0ca5b5f9c85a8b918 Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 13 Mar 2024 14:52:32 +0800 Subject: [PATCH] feat: knowledge output var --- web/app/components/workflow/constants.ts | 7 +++++++ .../workflow/nodes/_base/components/variable/utils.ts | 7 ++++++- web/app/components/workflow/types.ts | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/web/app/components/workflow/constants.ts b/web/app/components/workflow/constants.ts index bc652a22b3..c2bba4b40b 100644 --- a/web/app/components/workflow/constants.ts +++ b/web/app/components/workflow/constants.ts @@ -249,3 +249,10 @@ export const LLM_OUTPUT_STRUCT: Var[] = [ ], }, ] + +export const KNOWLEDGE_RETRIEVAL_OUTPUT_STRUCT: Var[] = [ + { + variable: 'result', + type: VarType.arrayObject, + }, +] diff --git a/web/app/components/workflow/nodes/_base/components/variable/utils.ts b/web/app/components/workflow/nodes/_base/components/variable/utils.ts index c449d38964..24be9ec027 100644 --- a/web/app/components/workflow/nodes/_base/components/variable/utils.ts +++ b/web/app/components/workflow/nodes/_base/components/variable/utils.ts @@ -1,7 +1,7 @@ import { BlockEnum, InputVarType, VarType } from '@/app/components/workflow/types' import type { StartNodeType } from '@/app/components/workflow/nodes/start/types' import type { NodeOutPutVar } from '@/app/components/workflow/types' -import { LLM_OUTPUT_STRUCT, SUPPORT_OUTPUT_VARS_NODE } from '@/app/components/workflow/constants' +import { KNOWLEDGE_RETRIEVAL_OUTPUT_STRUCT, LLM_OUTPUT_STRUCT, SUPPORT_OUTPUT_VARS_NODE } from '@/app/components/workflow/constants' const inputVarTypeToVarType = (type: InputVarType): VarType => { if (type === InputVarType.number) @@ -35,6 +35,11 @@ const formatItem = (item: any): NodeOutPutVar => { res.vars = LLM_OUTPUT_STRUCT break } + + case BlockEnum.KnowledgeRetrieval: { + res.vars = KNOWLEDGE_RETRIEVAL_OUTPUT_STRUCT + break + } } return res diff --git a/web/app/components/workflow/types.ts b/web/app/components/workflow/types.ts index 38dbf85780..0ae12c48c8 100644 --- a/web/app/components/workflow/types.ts +++ b/web/app/components/workflow/types.ts @@ -126,6 +126,7 @@ export enum VarType { array = 'Array', arrayString = 'Array[string]', arrayNumber = 'Array[number]', + arrayObject = 'Array[object]', } export type Var = {