mirror of https://github.com/langgenius/dify.git
feat: assign output
This commit is contained in:
parent
db78b91ec2
commit
cb2a814296
|
|
@ -2,6 +2,7 @@ import type { CodeNodeType } from '../../../code/types'
|
|||
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 type { VariableAssignerNodeType } from '@/app/components/workflow/nodes/variable-assigner/types'
|
||||
import {
|
||||
CHAT_QUESTION_CLASSIFIER_OUTPUT_STRUCT,
|
||||
COMPLETION_QUESTION_CLASSIFIER_OUTPUT_STRUCT,
|
||||
|
|
@ -77,6 +78,18 @@ const formatItem = (item: any, isChatMode: boolean): NodeOutPutVar => {
|
|||
res.vars = HTTP_REQUEST_OUTPUT_STRUCT
|
||||
break
|
||||
}
|
||||
|
||||
case BlockEnum.VariableAssigner: {
|
||||
const {
|
||||
output_type,
|
||||
} = data as VariableAssignerNodeType
|
||||
res.vars = [
|
||||
{
|
||||
variable: 'output',
|
||||
type: output_type,
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
return res
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
import type { FC } from 'react'
|
||||
import React, { useState } from 'react'
|
||||
import cn from 'classnames'
|
||||
import { isArray } from 'lodash-es'
|
||||
import VarReferencePopup from './var-reference-popup'
|
||||
import { toNodeOutputVars } from './utils'
|
||||
import type { ValueSelector } from '@/app/components/workflow/types'
|
||||
|
|
@ -29,6 +30,9 @@ type Props = {
|
|||
}
|
||||
|
||||
export const getNodeInfoById = (nodes: any, id: string) => {
|
||||
if (!isArray(nodes))
|
||||
return
|
||||
|
||||
return nodes.find((node: any) => node.id === id)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import type { CommonNodeType, ValueSelector } from '@/app/components/workflow/types'
|
||||
import type { CommonNodeType, ValueSelector, VarType } from '@/app/components/workflow/types'
|
||||
|
||||
export type VariableAssignerNodeType = CommonNodeType & {
|
||||
output_type: string
|
||||
output_type: VarType
|
||||
variables: ValueSelector[]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue