mirror of
https://github.com/langgenius/dify.git
synced 2026-04-15 01:38:19 +08:00
feat(workflow): enhance listening descriptions for plugin and webhook triggers
This commit is contained in:
parent
29ec3c7d5c
commit
6098dc0242
@ -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<ListeningProps> = ({
|
||||
|
||||
const description = listeningTriggerIsAll
|
||||
? resolveMultipleListeningDescription(displayNodes, t)
|
||||
: resolveListeningDescription(message, triggerNode, t)
|
||||
: resolveListeningDescription(message, triggerNode, triggerType, t)
|
||||
|
||||
return (
|
||||
<div className='flex h-full flex-col gap-4 rounded-xl bg-background-section p-8'>
|
||||
|
||||
@ -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: {
|
||||
|
||||
@ -1169,6 +1169,11 @@ const translation = {
|
||||
listening: {
|
||||
title: 'トリガーからのイベントを待機中…',
|
||||
tip: 'HTTP {{nodeName}} エンドポイントにテストリクエストを送信するか、ライブイベントデバッグ用のコールバック URL として利用してイベントトリガーをシミュレートできます。すべての出力は Variable Inspector で直接確認できます。',
|
||||
tipPlugin: '{{pluginName}} でイベントを作成し、これらのイベントの出力を Variable Inspector で取得できます。',
|
||||
tipFallback: 'トリガーイベントを待機しています。出力はここに表示されます。',
|
||||
defaultNodeName: 'このトリガー',
|
||||
defaultPluginName: 'このプラグイントリガー',
|
||||
selectedTriggers: '選択したトリガー',
|
||||
stopButton: '停止',
|
||||
},
|
||||
trigger: {
|
||||
|
||||
@ -1198,6 +1198,11 @@ const translation = {
|
||||
listening: {
|
||||
title: '正在监听触发器事件…',
|
||||
tip: '您现在可以向 HTTP {{nodeName}} 端点发送测试请求以模拟事件触发,或将其用作实时事件调试的回调 URL。所有输出都可以在变量检查器中直接查看。',
|
||||
tipPlugin: '现在您可以在 {{pluginName}} 中创建事件,并在变量检查器中查看这些事件的输出。',
|
||||
tipFallback: '正在等待触发器事件,输出结果将在此显示。',
|
||||
defaultNodeName: '此触发器',
|
||||
defaultPluginName: '此插件触发器',
|
||||
selectedTriggers: '所选触发器',
|
||||
stopButton: '停止',
|
||||
},
|
||||
trigger: {
|
||||
|
||||
@ -1007,6 +1007,11 @@ const translation = {
|
||||
listening: {
|
||||
title: '正在監聽觸發器事件…',
|
||||
tip: '您現在可以向 HTTP {{nodeName}} 端點發送測試請求來模擬事件觸發,或將其作為即時事件除錯的回呼 URL。所有輸出都可在變數檢視器中直接查看。',
|
||||
tipPlugin: '您現在可以在 {{pluginName}} 中建立事件,並在變數檢視器中檢視這些事件的輸出。',
|
||||
tipFallback: '正在等待觸發器事件,輸出會顯示在此處。',
|
||||
defaultNodeName: '此觸發器',
|
||||
defaultPluginName: '此插件觸發器',
|
||||
selectedTriggers: '已選觸發器',
|
||||
stopButton: '停止',
|
||||
},
|
||||
trigger: {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user