diff --git a/web/app/components/app/workflow-log/list.tsx b/web/app/components/app/workflow-log/list.tsx index 5fa61644fc..ae9eac2da2 100644 --- a/web/app/components/app/workflow-log/list.tsx +++ b/web/app/components/app/workflow-log/list.tsx @@ -4,6 +4,7 @@ import React, { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { ArrowDownIcon } from '@heroicons/react/24/outline' import DetailPanel from './detail' +import TriggerByDisplay from './trigger-by-display' import type { WorkflowAppLogDetail, WorkflowLogsResponse } from '@/models/log' import type { App } from '@/types/app' import Loading from '@/app/components/base/loading' @@ -159,7 +160,11 @@ const WorkflowAppLogList: FC = ({ logs, appDetail, onRefresh }) => { {endUser} - {isWorkflow && {log.workflow_run.triggered_from}} + {isWorkflow && ( + + + + )} })} diff --git a/web/app/components/app/workflow-log/trigger-by-display.tsx b/web/app/components/app/workflow-log/trigger-by-display.tsx new file mode 100644 index 0000000000..e9355c288d --- /dev/null +++ b/web/app/components/app/workflow-log/trigger-by-display.tsx @@ -0,0 +1,106 @@ +'use client' +import type { FC } from 'react' +import React from 'react' +import { useTranslation } from 'react-i18next' +import { + Code, + KnowledgeRetrieval, + Schedule, + WebhookLine, + WindowCursor, +} from '@/app/components/base/icons/src/vender/workflow' +import BlockIcon from '@/app/components/workflow/block-icon' +import { BlockEnum } from '@/app/components/workflow/types' + +type TriggerByDisplayProps = { + triggeredFrom: string + className?: string + showText?: boolean +} + +const getTriggerDisplayName = (triggeredFrom: string, t: any) => { + const nameMap: Record = { + 'debugging': t('appLog.triggerBy.debugging'), + 'app-run': t('appLog.triggerBy.appRun'), + 'webhook': t('appLog.triggerBy.webhook'), + 'schedule': t('appLog.triggerBy.schedule'), + 'plugin': t('appLog.triggerBy.plugin'), + 'rag-pipeline-run': t('appLog.triggerBy.ragPipelineRun'), + 'rag-pipeline-debugging': t('appLog.triggerBy.ragPipelineDebugging'), + } + + return nameMap[triggeredFrom] || triggeredFrom +} + +const getTriggerIcon = (triggeredFrom: string) => { + switch (triggeredFrom) { + case 'webhook': + return ( +
+ +
+ ) + case 'schedule': + return ( +
+ +
+ ) + case 'plugin': + // For plugin triggers in logs, use a generic plugin icon since we don't have specific plugin info + // This matches the standard BlockIcon styling for TriggerPlugin + return ( + + ) + case 'debugging': + return ( +
+ +
+ ) + case 'rag-pipeline-run': + case 'rag-pipeline-debugging': + return ( +
+ +
+ ) + case 'app-run': + default: + // For user input types (app-run, etc.), use webapp icon + return ( +
+ +
+ ) + } +} + +const TriggerByDisplay: FC = ({ + triggeredFrom, + className = '', + showText = true, +}) => { + const { t } = useTranslation() + + const displayName = getTriggerDisplayName(triggeredFrom, t) + const icon = getTriggerIcon(triggeredFrom) + + return ( +
+
+ {icon} +
+ {showText && ( + + {displayName} + + )} +
+ ) +} + +export default TriggerByDisplay diff --git a/web/i18n/en-US/app-log.ts b/web/i18n/en-US/app-log.ts index 479853fd30..af23fb363f 100644 --- a/web/i18n/en-US/app-log.ts +++ b/web/i18n/en-US/app-log.ts @@ -95,6 +95,15 @@ const translation = { iteration: 'Iteration', finalProcessing: 'Final Processing', }, + triggerBy: { + debugging: 'Debugging', + appRun: 'WebApp', + webhook: 'Webhook', + schedule: 'Schedule', + plugin: 'Plugin', + ragPipelineRun: 'RAG Pipeline', + ragPipelineDebugging: 'RAG Debugging', + }, } export default translation diff --git a/web/i18n/ja-JP/app-log.ts b/web/i18n/ja-JP/app-log.ts index db42d317f4..d9134f5203 100644 --- a/web/i18n/ja-JP/app-log.ts +++ b/web/i18n/ja-JP/app-log.ts @@ -20,6 +20,7 @@ const translation = { tokens: 'トークン', user: 'エンドユーザーまたはアカウント', version: 'バージョン', + triggered_from: 'トリガー方法', }, pagination: { previous: '前へ', @@ -94,6 +95,15 @@ const translation = { iteration: '反復', finalProcessing: '最終処理', }, + triggerBy: { + debugging: 'デバッグ', + appRun: 'ウェブアプリ', + webhook: 'Webhook', + schedule: 'スケジュール', + plugin: 'プラグイン', + ragPipelineRun: 'RAGパイプライン', + ragPipelineDebugging: 'RAGデバッグ', + }, } export default translation diff --git a/web/i18n/zh-Hans/app-log.ts b/web/i18n/zh-Hans/app-log.ts index 51b7ebb1e0..4ef96afc97 100644 --- a/web/i18n/zh-Hans/app-log.ts +++ b/web/i18n/zh-Hans/app-log.ts @@ -20,6 +20,7 @@ const translation = { tokens: 'TOKENS', user: '用户或账户', version: '版本', + triggered_from: '触发方式', }, pagination: { previous: '上一页', @@ -94,6 +95,15 @@ const translation = { iteration: '迭代', finalProcessing: '最终处理', }, + triggerBy: { + debugging: '调试', + appRun: '网页应用', + webhook: 'Webhook', + schedule: '定时任务', + plugin: '插件', + ragPipelineRun: 'RAG 流水线', + ragPipelineDebugging: 'RAG 调试', + }, } export default translation