diff --git a/web/app/components/base/prompt-editor/constants.tsx b/web/app/components/base/prompt-editor/constants.tsx
index 2dcc62706a..b316297800 100644
--- a/web/app/components/base/prompt-editor/constants.tsx
+++ b/web/app/components/base/prompt-editor/constants.tsx
@@ -1,4 +1,5 @@
import type { ValueSelector } from '../../workflow/types'
+import { uniqBy } from 'es-toolkit/compat'
import { SupportUploadFileTypes } from '../../workflow/types'
export const CONTEXT_PLACEHOLDER_TEXT = '{{#context#}}'
@@ -57,7 +58,8 @@ export const getInputVars = (text: string): ValueSelector[] => {
return valueSelector
})
- return inputVars
+ const uniqueInputVars = uniqBy(inputVars, item => item.join('.'))
+ return uniqueInputVars
}
return []
}
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx
index d85de6233f..4259cf53fd 100644
--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx
@@ -1,4 +1,8 @@
import type { EmailConfig } from '../../types'
+import type {
+ Node,
+ NodeOutPutVar,
+} from '@/app/components/workflow/types'
import { RiBugLine, RiCloseLine } from '@remixicon/react'
import { noop } from 'es-toolkit/compat'
import { memo, useCallback, useState } from 'react'
@@ -20,6 +24,8 @@ type EmailConfigureModalProps = {
onClose: () => void
onConfirm: (data: EmailConfig) => void
config?: EmailConfig
+ nodesOutputVars?: NodeOutPutVar[]
+ availableNodes?: Node[]
}
const EmailConfigureModal = ({
@@ -27,6 +33,8 @@ const EmailConfigureModal = ({
onClose,
onConfirm,
config,
+ nodesOutputVars = [],
+ availableNodes = [],
}: EmailConfigureModalProps) => {
const { t } = useTranslation()
const email = useAppContextWithSelector(s => s.userProfile.email)
@@ -110,6 +118,8 @@ const EmailConfigureModal = ({
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/mail-body-input.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/mail-body-input.tsx
index ced2579b50..8e127d932e 100644
--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/mail-body-input.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/mail-body-input.tsx
@@ -1,18 +1,30 @@
+import type {
+ Node,
+ NodeOutPutVar,
+} from '@/app/components/workflow/types'
+import { useTranslation } from 'react-i18next'
import PromptEditor from '@/app/components/base/prompt-editor'
import Placeholder from '@/app/components/workflow/nodes/tool/components/mixed-variable-text-input/placeholder'
+import { BlockEnum } from '@/app/components/workflow/types'
import { cn } from '@/utils/classnames'
type MailBodyInputProps = {
readOnly?: boolean
+ nodesOutputVars?: NodeOutPutVar[]
+ availableNodes?: Node[]
value?: string
onChange?: (text: string) => void
}
const MailBodyInput = ({
readOnly = false,
+ nodesOutputVars,
+ availableNodes = [],
value = '',
onChange,
}: MailBodyInputProps) => {
+ const { t } = useTranslation()
+
return (
{
+ acc[node.id] = {
+ title: node.data.title,
+ type: node.data.type,
+ }
+ if (node.data.type === BlockEnum.Start) {
+ acc.sys = {
+ title: t('blocks.start', { ns: 'workflow' }),
+ type: BlockEnum.Start,
+ }
+ }
+ return acc
+ }, {} as Record>),
+ }}
placeholder={}
onChange={onChange}
/>
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/method-item.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/method-item.tsx
index 31199df67c..07daccca17 100644
--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/method-item.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/method-item.tsx
@@ -110,6 +110,7 @@ const DeliveryMethodItem: FC = ({
setShowTestEmailModal(true)}>
@@ -118,6 +119,7 @@ const DeliveryMethodItem: FC = ({
setShowEmailModal(true)}>
@@ -129,6 +131,7 @@ const DeliveryMethodItem: FC = ({
setIsHovering(true)}
@@ -168,6 +171,8 @@ const DeliveryMethodItem: FC = ({
setShowEmailModal(false)}
onConfirm={(data) => {
handleConfigChange(data)
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/method-selector.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/method-selector.tsx
index 2827b972c9..ea1b69184c 100644
--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/method-selector.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/method-selector.tsx
@@ -117,6 +117,15 @@ const MethodSelector: FC = ({
id: uuid4(),
type: DeliveryMethodType.Email,
enabled: false,
+ config: {
+ body: '{{#url#}}',
+ recipients: {
+ whole_workspace: false,
+ items: [],
+ },
+ subject: '',
+ debug_mode: false,
+ },
})
}}
>
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/test-email-sender.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/test-email-sender.tsx
index 6cfe877b19..7f7632a3a7 100644
--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/test-email-sender.tsx
+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/test-email-sender.tsx
@@ -86,7 +86,7 @@ const EmailSenderModal = ({
const accounts = members?.accounts || []
const generatedInputs = useMemo(() => {
- const valueSelectors = doGetInputVars(formContent || '')
+ const valueSelectors = doGetInputVars((formContent || '') + (config?.body || ''))
const variables = unionBy(valueSelectors, item => item.join('.')).map((item) => {
const varInfo = getNodeInfoById(availableNodes, item[0])?.data
@@ -120,7 +120,7 @@ const EmailSenderModal = ({
}
})
return varInputs
- }, [availableNodes, formContent, nodesOutputVars])
+ }, [availableNodes, config?.body, formContent, nodesOutputVars])
const [inputs, setInputs] = useState>({})
const [collapsed, setCollapsed] = useState(true)
diff --git a/web/eslint-suppressions.json b/web/eslint-suppressions.json
index 30d44be8bb..89cd38d5ed 100644
--- a/web/eslint-suppressions.json
+++ b/web/eslint-suppressions.json
@@ -3395,16 +3395,6 @@
"count": 5
}
},
- "app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx": {
- "ts/no-explicit-any": {
- "count": 1
- }
- },
- "app/components/workflow/nodes/human-input/components/delivery-method/method-item.tsx": {
- "ts/no-explicit-any": {
- "count": 1
- }
- },
"app/components/workflow/nodes/human-input/components/delivery-method/recipient/email-input.tsx": {
"ts/no-explicit-any": {
"count": 2