diff --git a/web/app/components/workflow/block-selector/constants.tsx b/web/app/components/workflow/block-selector/constants.tsx index 589115d4b4..65f1a3f61b 100644 --- a/web/app/components/workflow/block-selector/constants.tsx +++ b/web/app/components/workflow/block-selector/constants.tsx @@ -101,7 +101,7 @@ export const BLOCKS: Block[] = [ title: 'Agent', }, { - classification: BlockClassificationEnum.Default, + classification: BlockClassificationEnum.Logic, type: BlockEnum.HumanInput, title: 'Human Input', }, diff --git a/web/app/components/workflow/nodes/human-input/default.ts b/web/app/components/workflow/nodes/human-input/default.ts index a82bc066a2..30f21de9e1 100644 --- a/web/app/components/workflow/nodes/human-input/default.ts +++ b/web/app/components/workflow/nodes/human-input/default.ts @@ -1,10 +1,20 @@ import type { NodeDefault } from '../../types' import type { HumanInputNodeType } from './types' +import { DeliveryMethodType } from './types' import { ALL_CHAT_AVAILABLE_BLOCKS } from '@/app/components/workflow/blocks' const nodeDefault: NodeDefault = { defaultValue: { - deliveryMethod: [], + deliveryMethod: [ + { + type: DeliveryMethodType.WebApp, + enabled: true, + }, + { + type: DeliveryMethodType.Email, + enabled: false, + }, + ], userActions: [], }, getAvailablePrevNodes(isChatMode: boolean) { diff --git a/web/app/components/workflow/nodes/human-input/node.tsx b/web/app/components/workflow/nodes/human-input/node.tsx index 7681df594a..6ab9604879 100644 --- a/web/app/components/workflow/nodes/human-input/node.tsx +++ b/web/app/components/workflow/nodes/human-input/node.tsx @@ -1,32 +1,38 @@ import type { FC } from 'react' import React from 'react' +import { + RiMailSendFill, + RiRobot2Fill, +} from '@remixicon/react' import type { HumanInputNodeType } from './types' import type { NodeProps } from '@/app/components/workflow/types' -// import { isConversationVar, isENV, isSystemVar } from '@/app/components/workflow/nodes/_base/components/variable/utils' -import { - useIsChatMode, - useWorkflow, - useWorkflowVariables, -} from '@/app/components/workflow/hooks' -// import { VarBlockIcon } from '@/app/components/workflow/block-icon' -// import { Line3 } from '@/app/components/base/icons/src/public/common' -// import { Variable02 } from '@/app/components/base/icons/src/vender/solid/development' -// import { BubbleX, Env } from '@/app/components/base/icons/src/vender/line/others' -// import { BlockEnum } from '@/app/components/workflow/types' -// import cn from 'classnames' +import { DeliveryMethodType } from './types' const Node: FC> = ({ - id, data, }) => { - const { getBeforeNodesInSameBranch } = useWorkflow() - const availableNodes = getBeforeNodesInSameBranch(id) - const { getCurrentVariableType } = useWorkflowVariables() - const isChatMode = useIsChatMode() + const deliveryMethods = data.deliveryMethod || [] return ( -
- TODO +
+
delivery method
+
+ {deliveryMethods.map(method => ( +
+ {method.type === DeliveryMethodType.WebApp && ( +
+ +
+ )} + {method.type === DeliveryMethodType.Email && ( +
+ +
+ )} + {method.type} +
+ ))} +
) } diff --git a/web/app/components/workflow/nodes/human-input/types.ts b/web/app/components/workflow/nodes/human-input/types.ts index e846e3ff85..0e06c8509d 100644 --- a/web/app/components/workflow/nodes/human-input/types.ts +++ b/web/app/components/workflow/nodes/human-input/types.ts @@ -1,9 +1,39 @@ import type { CommonNodeType, Variable } from '@/app/components/workflow/types' export type HumanInputNodeType = CommonNodeType & { - deliveryMethod: any[] + deliveryMethod: DeliveryMethod[] formContent: any - userActions: any[] + userActions: UserAction[] timeout: any outputs: Variable[] } + +export type Timeout = { + value: number + unit: 'hours' | 'days' +} + +export enum DeliveryMethodType { + WebApp = 'webapp', + Email = 'email', + Slack = 'slack', +} + +export type DeliveryMethod = { + type: DeliveryMethodType + enabled: boolean + configure?: Record +} + +export enum UserActionButtonType { + Primary = 'primary', + Default = 'default', + Accent = 'accent', + Ghost = 'ghost', +} + +export type UserAction = { + name: string + text: string + type: UserActionButtonType +}