From 6098dc0242c53e2904364632618581c37c99f2f0 Mon Sep 17 00:00:00 2001 From: zhsama Date: Fri, 24 Oct 2025 16:18:07 +0800 Subject: [PATCH] feat(workflow): enhance listening descriptions for plugin and webhook triggers --- .../workflow/variable-inspect/listening.tsx | 22 ++++++++++++++----- web/i18n/en-US/workflow.ts | 5 +++++ web/i18n/ja-JP/workflow.ts | 5 +++++ web/i18n/zh-Hans/workflow.ts | 5 +++++ web/i18n/zh-Hant/workflow.ts | 5 +++++ 5 files changed, 37 insertions(+), 5 deletions(-) diff --git a/web/app/components/workflow/variable-inspect/listening.tsx b/web/app/components/workflow/variable-inspect/listening.tsx index 8dbc757b9d..e325df2175 100644 --- a/web/app/components/workflow/variable-inspect/listening.tsx +++ b/web/app/components/workflow/variable-inspect/listening.tsx @@ -12,6 +12,7 @@ import type { TFunction } from 'i18next' const resolveListeningDescription = ( message: string | undefined, triggerNode: Node | undefined, + triggerType: BlockEnum, t: TFunction, ): string => { if (message) @@ -21,8 +22,19 @@ const resolveListeningDescription = ( if (nodeDescription) return nodeDescription - const nodeName = (triggerNode?.data as { title?: string })?.title - return t('workflow.debug.variableInspect.listening.tip', { nodeName }) + if (triggerType === BlockEnum.TriggerPlugin) { + const pluginName = (triggerNode?.data as { provider_name?: string; title?: string })?.provider_name + || (triggerNode?.data as { title?: string })?.title + || t('workflow.debug.variableInspect.listening.defaultPluginName') + return t('workflow.debug.variableInspect.listening.tipPlugin', { pluginName }) + } + + if (triggerType === BlockEnum.TriggerWebhook) { + const nodeName = (triggerNode?.data as { title?: string })?.title || t('workflow.debug.variableInspect.listening.defaultNodeName') + return t('workflow.debug.variableInspect.listening.tip', { nodeName }) + } + + return t('workflow.debug.variableInspect.listening.tipFallback') } const resolveMultipleListeningDescription = ( @@ -30,7 +42,7 @@ const resolveMultipleListeningDescription = ( t: TFunction, ): string => { if (!nodes.length) - return t('workflow.debug.variableInspect.listening.tip', { nodeName: t('workflow.debug.variableInspect.listening.selectedTriggers') }) + return t('workflow.debug.variableInspect.listening.tipFallback') const titles = nodes .map(node => (node.data as { title?: string })?.title) @@ -39,7 +51,7 @@ const resolveMultipleListeningDescription = ( if (titles.length) return t('workflow.debug.variableInspect.listening.tip', { nodeName: titles.join(', ') }) - return t('workflow.debug.variableInspect.listening.tip', { nodeName: t('workflow.debug.variableInspect.listening.selectedTriggers') }) + return t('workflow.debug.variableInspect.listening.tipFallback') } export type ListeningProps = { @@ -109,7 +121,7 @@ const Listening: FC = ({ const description = listeningTriggerIsAll ? resolveMultipleListeningDescription(displayNodes, t) - : resolveListeningDescription(message, triggerNode, t) + : resolveListeningDescription(message, triggerNode, triggerType, t) return (
diff --git a/web/i18n/en-US/workflow.ts b/web/i18n/en-US/workflow.ts index f28598d75a..10105c5fd1 100644 --- a/web/i18n/en-US/workflow.ts +++ b/web/i18n/en-US/workflow.ts @@ -1225,6 +1225,11 @@ const translation = { listening: { title: 'Listening for events from triggers...', tip: 'You can now simulate event triggers by sending test requests to HTTP {{nodeName}} endpoint or use it as a callback URL for live event debugging. All outputs can be viewed directly in the Variable Inspector.', + tipPlugin: 'Now you can create events in {{pluginName}}, and retrieve outputs from these events in the Variable Inspector.', + tipFallback: 'Await incoming trigger events. Outputs will appear here.', + defaultNodeName: 'this trigger', + defaultPluginName: 'this plugin trigger', + selectedTriggers: 'selected triggers', stopButton: 'Stop', }, trigger: { diff --git a/web/i18n/ja-JP/workflow.ts b/web/i18n/ja-JP/workflow.ts index c04244a2ae..97fb916b2c 100644 --- a/web/i18n/ja-JP/workflow.ts +++ b/web/i18n/ja-JP/workflow.ts @@ -1169,6 +1169,11 @@ const translation = { listening: { title: 'トリガーからのイベントを待機中…', tip: 'HTTP {{nodeName}} エンドポイントにテストリクエストを送信するか、ライブイベントデバッグ用のコールバック URL として利用してイベントトリガーをシミュレートできます。すべての出力は Variable Inspector で直接確認できます。', + tipPlugin: '{{pluginName}} でイベントを作成し、これらのイベントの出力を Variable Inspector で取得できます。', + tipFallback: 'トリガーイベントを待機しています。出力はここに表示されます。', + defaultNodeName: 'このトリガー', + defaultPluginName: 'このプラグイントリガー', + selectedTriggers: '選択したトリガー', stopButton: '停止', }, trigger: { diff --git a/web/i18n/zh-Hans/workflow.ts b/web/i18n/zh-Hans/workflow.ts index a2cb1a7c78..8ae9e07fa3 100644 --- a/web/i18n/zh-Hans/workflow.ts +++ b/web/i18n/zh-Hans/workflow.ts @@ -1198,6 +1198,11 @@ const translation = { listening: { title: '正在监听触发器事件…', tip: '您现在可以向 HTTP {{nodeName}} 端点发送测试请求以模拟事件触发,或将其用作实时事件调试的回调 URL。所有输出都可以在变量检查器中直接查看。', + tipPlugin: '现在您可以在 {{pluginName}} 中创建事件,并在变量检查器中查看这些事件的输出。', + tipFallback: '正在等待触发器事件,输出结果将在此显示。', + defaultNodeName: '此触发器', + defaultPluginName: '此插件触发器', + selectedTriggers: '所选触发器', stopButton: '停止', }, trigger: { diff --git a/web/i18n/zh-Hant/workflow.ts b/web/i18n/zh-Hant/workflow.ts index 53cf645359..98290cbfce 100644 --- a/web/i18n/zh-Hant/workflow.ts +++ b/web/i18n/zh-Hant/workflow.ts @@ -1007,6 +1007,11 @@ const translation = { listening: { title: '正在監聽觸發器事件…', tip: '您現在可以向 HTTP {{nodeName}} 端點發送測試請求來模擬事件觸發,或將其作為即時事件除錯的回呼 URL。所有輸出都可在變數檢視器中直接查看。', + tipPlugin: '您現在可以在 {{pluginName}} 中建立事件,並在變數檢視器中檢視這些事件的輸出。', + tipFallback: '正在等待觸發器事件,輸出會顯示在此處。', + defaultNodeName: '此觸發器', + defaultPluginName: '此插件觸發器', + selectedTriggers: '已選觸發器', stopButton: '停止', }, trigger: {