diff --git a/web/app/components/base/chat/chat/answer/human-input-content/index.tsx b/web/app/components/base/chat/chat/answer/human-input-content/index.tsx index 141c952912..8ad655413a 100644 --- a/web/app/components/base/chat/chat/answer/human-input-content/index.tsx +++ b/web/app/components/base/chat/chat/answer/human-input-content/index.tsx @@ -1,14 +1,20 @@ import type { HumanInputContentProps } from './type' +import { Trans, useTranslation } from 'react-i18next' import Divider from '@/app/components/base/divider' +import { useSelector as useAppSelector } from '@/context/app-context' import HumanInputForm from './human-input-form' const HumanInputContent = ({ formData, showEmailTip = false, + isEmailDebugMode = false, showDebugModeTip = false, showTimeout = false, onSubmit, }: HumanInputContentProps) => { + const { t } = useTranslation() + const email = useAppSelector(s => s.userProfile.email) + return ( <>
- {showEmailTip &&
humanInputEmailTip
} - {showDebugModeTip &&
humanInputWebappTip
} + {showEmailTip && !isEmailDebugMode && ( +
{t('workflow.common.humanInputEmailTip')}
+ )} + {showEmailTip && isEmailDebugMode && ( +
+ }} + values={{ email }} + /> +
+ )} + {showDebugModeTip &&
{t('workflow.common.humanInputWebappTip')}
}
)} diff --git a/web/app/components/base/chat/chat/answer/human-input-content/type.ts b/web/app/components/base/chat/chat/answer/human-input-content/type.ts index 563b24c005..14528005be 100644 --- a/web/app/components/base/chat/chat/answer/human-input-content/type.ts +++ b/web/app/components/base/chat/chat/answer/human-input-content/type.ts @@ -10,6 +10,7 @@ export type HumanInputContentProps = { formData: HumanInputFormData executedAction?: ExecutedAction showEmailTip?: boolean + isEmailDebugMode?: boolean showDebugModeTip?: boolean showTimeout?: boolean expirationTime?: number diff --git a/web/app/components/base/chat/chat/answer/index.tsx b/web/app/components/base/chat/chat/answer/index.tsx index 9ea342a780..f5b86ee76f 100644 --- a/web/app/components/base/chat/chat/answer/index.tsx +++ b/web/app/components/base/chat/chat/answer/index.tsx @@ -87,13 +87,16 @@ const Answer: FC = ({ if (!deliveryMethodsConfig.length) { return { showEmailTip: false, + isEmailDebugMode: false, showDebugModeTip: false, } } const isWebappEnabled = deliveryMethodsConfig.some((method: DeliveryMethod) => method.type === DeliveryMethodType.WebApp && method.enabled) const isEmailEnabled = deliveryMethodsConfig.some((method: DeliveryMethod) => method.type === DeliveryMethodType.Email && method.enabled) + const isEmailDebugMode = deliveryMethodsConfig.some((method: DeliveryMethod) => method.type === DeliveryMethodType.Email && method.config?.debug_mode) return { showEmailTip: isEmailEnabled, + isEmailDebugMode, showDebugModeTip: !isWebappEnabled, } }, [getHumanInputNodeData, humanInputFormData?.node_id]) @@ -201,6 +204,7 @@ const Answer: FC = ({ 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 a58874f5d8..1277993b04 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 @@ -76,7 +76,6 @@ const MethodSelector: FC = ({ id: uuid4(), type: DeliveryMethodType.WebApp, enabled: true, - config: {}, }) }} > @@ -100,7 +99,6 @@ const MethodSelector: FC = ({ id: uuid4(), type: DeliveryMethodType.Email, enabled: false, - config: null, }) }} > diff --git a/web/app/components/workflow/nodes/human-input/types.ts b/web/app/components/workflow/nodes/human-input/types.ts index 0c7029f071..0d7cace7b1 100644 --- a/web/app/components/workflow/nodes/human-input/types.ts +++ b/web/app/components/workflow/nodes/human-input/types.ts @@ -43,7 +43,7 @@ export type DeliveryMethod = { id: string type: DeliveryMethodType enabled: boolean - config?: EmailConfig | {} | null + config?: EmailConfig } export enum UserActionButtonType { diff --git a/web/i18n/en-US/workflow.ts b/web/i18n/en-US/workflow.ts index c0ffdc1a6b..c896f8b2fb 100644 --- a/web/i18n/en-US/workflow.ts +++ b/web/i18n/en-US/workflow.ts @@ -124,6 +124,7 @@ const translation = { tagBound: 'Number of apps using this tag', humanInputWebappTip: 'Debug preview only, user will not see this in web app.', humanInputEmailTip: 'Email (Delivery Method) sent to your configured recipients', + humanInputEmailTipInDebugMode: 'Email (Delivery Method) sent to {{email}}', }, publishLimit: { startNodeTitlePrefix: 'Upgrade to', diff --git a/web/i18n/zh-Hans/workflow.ts b/web/i18n/zh-Hans/workflow.ts index bbb8357d9e..5342b23bdb 100644 --- a/web/i18n/zh-Hans/workflow.ts +++ b/web/i18n/zh-Hans/workflow.ts @@ -124,6 +124,7 @@ const translation = { tagBound: '使用此标签的应用数量', humanInputWebappTip: '仅调试预览,用户在 Web 应用中看不到此内容。', humanInputEmailTip: '电子邮件(传递方式)发送到您配置的收件人。', + humanInputEmailTipInDebugMode: '电子邮件(传递方式)发送到 {{email}}', }, publishLimit: { startNodeTitlePrefix: '升级以',