feat: knowledge output var

This commit is contained in:
Joel 2024-03-13 14:52:32 +08:00
parent b13345ceb2
commit 0d2366b432
3 changed files with 14 additions and 1 deletions

View File

@ -249,3 +249,10 @@ export const LLM_OUTPUT_STRUCT: Var[] = [
],
},
]
export const KNOWLEDGE_RETRIEVAL_OUTPUT_STRUCT: Var[] = [
{
variable: 'result',
type: VarType.arrayObject,
},
]

View File

@ -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

View File

@ -126,6 +126,7 @@ export enum VarType {
array = 'Array',
arrayString = 'Array[string]',
arrayNumber = 'Array[number]',
arrayObject = 'Array[object]',
}
export type Var = {