mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 09:58:04 +08:00
feat: var assigner node struct
This commit is contained in:
@ -22,6 +22,8 @@ import HttpNode from './http/node'
|
||||
import HttpPanel from './http/panel'
|
||||
import ToolNode from './tool/node'
|
||||
import ToolPanel from './tool/panel'
|
||||
import VariableAssignerNode from './variable-assigner/node'
|
||||
import VariableAssignerPanel from './variable-assigner/panel'
|
||||
|
||||
export const NodeComponentMap: Record<string, ComponentType> = {
|
||||
[BlockEnum.Start]: StartNode,
|
||||
@ -35,6 +37,7 @@ export const NodeComponentMap: Record<string, ComponentType> = {
|
||||
[BlockEnum.TemplateTransform]: TemplateTransformNode,
|
||||
[BlockEnum.HttpRequest]: HttpNode,
|
||||
[BlockEnum.Tool]: ToolNode,
|
||||
[BlockEnum.VariableAssigner]: VariableAssignerNode,
|
||||
}
|
||||
|
||||
export const PanelComponentMap: Record<string, ComponentType> = {
|
||||
@ -49,4 +52,5 @@ export const PanelComponentMap: Record<string, ComponentType> = {
|
||||
[BlockEnum.TemplateTransform]: TemplateTransformPanel,
|
||||
[BlockEnum.HttpRequest]: HttpPanel,
|
||||
[BlockEnum.Tool]: ToolPanel,
|
||||
[BlockEnum.VariableAssigner]: VariableAssignerPanel,
|
||||
}
|
||||
|
||||
12
web/app/components/workflow/nodes/variable-assigner/mock.ts
Normal file
12
web/app/components/workflow/nodes/variable-assigner/mock.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import type { VariableAssignerNodeType } from './types'
|
||||
|
||||
export const mockData: VariableAssignerNodeType = {
|
||||
title: 'Test',
|
||||
desc: 'Test',
|
||||
type: 'Test',
|
||||
output_type: 'string',
|
||||
variables: [
|
||||
['aaa', 'name'],
|
||||
['bbb', 'b', 'c'],
|
||||
],
|
||||
}
|
||||
16
web/app/components/workflow/nodes/variable-assigner/node.tsx
Normal file
16
web/app/components/workflow/nodes/variable-assigner/node.tsx
Normal file
@ -0,0 +1,16 @@
|
||||
import type { FC } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
// import { mockData } from './mock'
|
||||
const i18nPrefix = 'workflow.nodes.variableAssigner'
|
||||
|
||||
const Node: FC = () => {
|
||||
const { t } = useTranslation()
|
||||
// const { variables } = mockData
|
||||
return (
|
||||
<div className='px-3'>
|
||||
<div className='leading-4 text-xs font-medium text-gray-500 uppercase'>{t(`${i18nPrefix}.title`)}</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Node
|
||||
@ -0,0 +1,9 @@
|
||||
import type { FC } from 'react'
|
||||
|
||||
const Panel: FC = () => {
|
||||
return (
|
||||
<div>start panel inputs</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Panel
|
||||
@ -0,0 +1,6 @@
|
||||
import type { CommonNodeType, ValueSelector } from '@/app/components/workflow/types'
|
||||
|
||||
export type VariableAssignerNodeType = CommonNodeType & {
|
||||
output_type: string
|
||||
variables: ValueSelector[]
|
||||
}
|
||||
Reference in New Issue
Block a user