diff --git a/web/app/components/workflow/nodes/human-input/default.ts b/web/app/components/workflow/nodes/human-input/default.ts index 30f21de9e1..773f142b59 100644 --- a/web/app/components/workflow/nodes/human-input/default.ts +++ b/web/app/components/workflow/nodes/human-input/default.ts @@ -1,6 +1,6 @@ import type { NodeDefault } from '../../types' import type { HumanInputNodeType } from './types' -import { DeliveryMethodType } from './types' +import { DeliveryMethodType, UserActionButtonType } from './types' import { ALL_CHAT_AVAILABLE_BLOCKS } from '@/app/components/workflow/blocks' const nodeDefault: NodeDefault = { @@ -15,7 +15,28 @@ const nodeDefault: NodeDefault = { enabled: false, }, ], - userActions: [], + userActions: [ + { + name: 'approve', + text: 'Post to X', + type: UserActionButtonType.Primary, + }, + { + name: 'regenerate', + text: 'regenerate', + type: UserActionButtonType.Default, + }, + { + name: 'thinking', + text: 'think more', + type: UserActionButtonType.Accent, + }, + { + name: 'cancel', + text: 'cancel', + type: UserActionButtonType.Ghost, + }, + ], }, getAvailablePrevNodes(isChatMode: boolean) { const nodes = isChatMode diff --git a/web/app/components/workflow/nodes/human-input/node.tsx b/web/app/components/workflow/nodes/human-input/node.tsx index 6ab9604879..f52d238759 100644 --- a/web/app/components/workflow/nodes/human-input/node.tsx +++ b/web/app/components/workflow/nodes/human-input/node.tsx @@ -4,36 +4,55 @@ import { RiMailSendFill, RiRobot2Fill, } from '@remixicon/react' +import { NodeSourceHandle } from '../_base/components/node-handle' import type { HumanInputNodeType } from './types' import type { NodeProps } from '@/app/components/workflow/types' import { DeliveryMethodType } from './types' -const Node: FC> = ({ - data, -}) => { - const deliveryMethods = data.deliveryMethod || [] +const Node: FC> = (props) => { + const { data } = props + const deliveryMethods = data.deliveryMethod + const userActions = data.userActions return ( -
-
delivery method
-
- {deliveryMethods.map(method => ( -
- {method.type === DeliveryMethodType.WebApp && ( -
- + <> + {deliveryMethods.length > 0 && ( +
+
delivery method
+
+ {deliveryMethods.map(method => ( +
+ {method.type === DeliveryMethodType.WebApp && ( +
+ +
+ )} + {method.type === DeliveryMethodType.Email && ( +
+ +
+ )} + {method.type}
- )} - {method.type === DeliveryMethodType.Email && ( -
- -
- )} - {method.type} + ))}
- ))} -
-
+
+ )} + {userActions.length > 0 && ( +
+ {userActions.map(userAction => ( +
+ {userAction.name} + +
+ ))} +
+ )} + ) }