diff --git a/web/app/components/app/workflow-log/detail.tsx b/web/app/components/app/workflow-log/detail.tsx index 812438c0ed..7ce701dd68 100644 --- a/web/app/components/app/workflow-log/detail.tsx +++ b/web/app/components/app/workflow-log/detail.tsx @@ -1,9 +1,11 @@ 'use client' import type { FC } from 'react' import { useTranslation } from 'react-i18next' -import { RiCloseLine } from '@remixicon/react' +import { RiCloseLine, RiPlayLargeLine } from '@remixicon/react' import Run from '@/app/components/workflow/run' import { useStore } from '@/app/components/app/store' +import TooltipPlus from '@/app/components/base/tooltip' +import { useRouter } from 'next/navigation' type ILogDetail = { runID: string @@ -13,13 +15,34 @@ type ILogDetail = { const DetailPanel: FC = ({ runID, onClose }) => { const { t } = useTranslation() const appDetail = useStore(state => state.appDetail) + const router = useRouter() + + const handleReplay = () => { + if (!appDetail?.id) return + router.push(`/app/${appDetail.id}/workflow?replayRunId=${runID}`) + } return (
-

{t('appLog.runDetail.workflowTitle')}

+
+

{t('appLog.runDetail.workflowTitle')}

+ + + +
{ const { @@ -47,6 +53,71 @@ const WorkflowAppWithAdditionalContext = () => { return [] }, [data]) + const searchParams = useSearchParams() + const workflowStore = useWorkflowStore() + const { getWorkflowRunAndTraceUrl } = useGetRunAndTraceUrl() + const replayRunId = searchParams.get('replayRunId') + + useEffect(() => { + if (!replayRunId) + return + const { runUrl } = getWorkflowRunAndTraceUrl(replayRunId) + if (!runUrl) + return + fetchRunDetail(runUrl).then((res) => { + const { setInputs, setShowInputsPanel, setShowDebugAndPreviewPanel } = workflowStore.getState() + const rawInputs = res.inputs + let parsedInputs: Record | null = null + + if (typeof rawInputs === 'string') { + try { + const maybeParsed = JSON.parse(rawInputs) as unknown + if (maybeParsed && typeof maybeParsed === 'object' && !Array.isArray(maybeParsed)) + parsedInputs = maybeParsed as Record + } + catch (error) { + console.error('Failed to parse workflow run inputs', error) + } + } + else if (rawInputs && typeof rawInputs === 'object' && !Array.isArray(rawInputs)) { + parsedInputs = rawInputs as Record + } + + if (!parsedInputs) + return + + const userInputs: Record = {} + Object.entries(parsedInputs).forEach(([key, value]) => { + if (key.startsWith('sys.')) + return + + if (value == null) { + userInputs[key] = '' + return + } + + if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { + userInputs[key] = value + return + } + + try { + userInputs[key] = JSON.stringify(value) + } + catch { + userInputs[key] = String(value) + } + }) + + if (!Object.keys(userInputs).length) + return + + setInputs(userInputs) + setShowInputsPanel(true) + setShowDebugAndPreviewPanel(true) + }) + }, [replayRunId, workflowStore, getWorkflowRunAndTraceUrl]) + if (!data || isLoading || isLoadingCurrentWorkspace || !currentWorkspace.id) { return (
diff --git a/web/app/components/workflow/store/workflow/form-slice.ts b/web/app/components/workflow/store/workflow/form-slice.ts index a6c607d2af..46391eddff 100644 --- a/web/app/components/workflow/store/workflow/form-slice.ts +++ b/web/app/components/workflow/store/workflow/form-slice.ts @@ -4,8 +4,8 @@ import type { } from '@/app/components/workflow/types' export type FormSliceShape = { - inputs: Record - setInputs: (inputs: Record) => void + inputs: Record + setInputs: (inputs: Record) => void files: RunFile[] setFiles: (files: RunFile[]) => void } diff --git a/web/i18n/de-DE/app-log.ts b/web/i18n/de-DE/app-log.ts index 9d63a58259..0fbdcca0bf 100644 --- a/web/i18n/de-DE/app-log.ts +++ b/web/i18n/de-DE/app-log.ts @@ -83,6 +83,7 @@ const translation = { workflowTitle: 'Protokolldetail', fileListLabel: 'Details zur Datei', fileListDetail: 'Detail', + testWithParams: 'Test mit Parametern', }, promptLog: 'Prompt-Protokoll', agentLog: 'Agentenprotokoll', diff --git a/web/i18n/en-US/app-log.ts b/web/i18n/en-US/app-log.ts index 97773e6efd..946d8ffcb7 100644 --- a/web/i18n/en-US/app-log.ts +++ b/web/i18n/en-US/app-log.ts @@ -83,6 +83,7 @@ const translation = { workflowTitle: 'Log Detail', fileListLabel: 'File Details', fileListDetail: 'Detail', + testWithParams: 'Test With Params', }, promptLog: 'Prompt Log', agentLog: 'Agent Log', diff --git a/web/i18n/es-ES/app-log.ts b/web/i18n/es-ES/app-log.ts index 74ebee902e..0044dee709 100644 --- a/web/i18n/es-ES/app-log.ts +++ b/web/i18n/es-ES/app-log.ts @@ -82,6 +82,7 @@ const translation = { workflowTitle: 'Detalle del Registro', fileListLabel: 'Detalles del archivo', fileListDetail: 'Detalle', + testWithParams: 'Prueba con parámetros', }, promptLog: 'Registro de Indicación', agentLog: 'Registro de Agente', diff --git a/web/i18n/fa-IR/app-log.ts b/web/i18n/fa-IR/app-log.ts index 38f7267c6e..526fa01e76 100644 --- a/web/i18n/fa-IR/app-log.ts +++ b/web/i18n/fa-IR/app-log.ts @@ -82,6 +82,7 @@ const translation = { workflowTitle: 'جزئیات لاگ', fileListLabel: 'جزئیات فایل', fileListDetail: 'جزئیات', + testWithParams: 'تست با پارامترها', }, promptLog: 'لاگ درخواست', agentLog: 'لاگ عامل', diff --git a/web/i18n/fr-FR/app-log.ts b/web/i18n/fr-FR/app-log.ts index 50f2ff358d..42e25ba21f 100644 --- a/web/i18n/fr-FR/app-log.ts +++ b/web/i18n/fr-FR/app-log.ts @@ -82,6 +82,7 @@ const translation = { workflowTitle: 'Détail du journal', fileListDetail: 'Détail', fileListLabel: 'Détails du fichier', + testWithParams: 'Test avec paramètres', }, promptLog: 'Journal de consigne', agentLog: 'Journal des agents', diff --git a/web/i18n/hi-IN/app-log.ts b/web/i18n/hi-IN/app-log.ts index bb95b46052..02e062df2e 100644 --- a/web/i18n/hi-IN/app-log.ts +++ b/web/i18n/hi-IN/app-log.ts @@ -84,6 +84,7 @@ const translation = { workflowTitle: 'लॉग विवरण', fileListDetail: 'विस्तार', fileListLabel: 'फ़ाइल विवरण', + testWithParams: 'पैरामीटर्स के साथ परीक्षण', }, promptLog: 'प्रॉम्प्ट लॉग', agentLog: 'एजेंट लॉग', diff --git a/web/i18n/id-ID/app-log.ts b/web/i18n/id-ID/app-log.ts index 1ccf8dec1e..8192e1f40d 100644 --- a/web/i18n/id-ID/app-log.ts +++ b/web/i18n/id-ID/app-log.ts @@ -74,6 +74,7 @@ const translation = { workflowTitle: 'Log Detail', title: 'Log Percakapan', fileListLabel: 'Rincian File', + testWithParams: 'Uji Dengan Param', }, agentLogDetail: { iterations: 'Iterasi', diff --git a/web/i18n/it-IT/app-log.ts b/web/i18n/it-IT/app-log.ts index 8653b765bd..98cb6afd84 100644 --- a/web/i18n/it-IT/app-log.ts +++ b/web/i18n/it-IT/app-log.ts @@ -86,6 +86,7 @@ const translation = { workflowTitle: 'Dettagli Registro', fileListDetail: 'Dettaglio', fileListLabel: 'Dettagli del file', + testWithParams: 'Test con parametri', }, promptLog: 'Registro Prompt', agentLog: 'Registro Agente', diff --git a/web/i18n/ja-JP/app-log.ts b/web/i18n/ja-JP/app-log.ts index db42d317f4..714481c8d1 100644 --- a/web/i18n/ja-JP/app-log.ts +++ b/web/i18n/ja-JP/app-log.ts @@ -83,6 +83,7 @@ const translation = { workflowTitle: 'ログの詳細', fileListLabel: 'ファイルの詳細', fileListDetail: '詳細', + testWithParams: 'パラメータ付きテスト', }, promptLog: 'プロンプトログ', agentLog: 'エージェントログ', diff --git a/web/i18n/ko-KR/app-log.ts b/web/i18n/ko-KR/app-log.ts index 366d2cc1c2..1701d588b0 100644 --- a/web/i18n/ko-KR/app-log.ts +++ b/web/i18n/ko-KR/app-log.ts @@ -83,6 +83,7 @@ const translation = { workflowTitle: '로그 세부 정보', fileListDetail: '세부', fileListLabel: '파일 세부 정보', + testWithParams: '매개변수로 테스트', }, promptLog: '프롬프트 로그', agentLog: '에이전트 로그', diff --git a/web/i18n/pl-PL/app-log.ts b/web/i18n/pl-PL/app-log.ts index 09fdb426fc..90ad14ad0c 100644 --- a/web/i18n/pl-PL/app-log.ts +++ b/web/i18n/pl-PL/app-log.ts @@ -86,6 +86,7 @@ const translation = { workflowTitle: 'Szczegół dziennika', fileListDetail: 'Detal', fileListLabel: 'Szczegóły pliku', + testWithParams: 'Test z parametrami', }, promptLog: 'Dziennik monitów', agentLog: 'Dziennik agenta', diff --git a/web/i18n/pt-BR/app-log.ts b/web/i18n/pt-BR/app-log.ts index 428291d871..9e2ff80759 100644 --- a/web/i18n/pt-BR/app-log.ts +++ b/web/i18n/pt-BR/app-log.ts @@ -82,6 +82,7 @@ const translation = { workflowTitle: 'Detalhes do Registro', fileListLabel: 'Detalhes do arquivo', fileListDetail: 'Detalhe', + testWithParams: 'Teste com parâmetros', }, promptLog: 'Registro de Prompt', agentLog: 'Registro do agente', diff --git a/web/i18n/ro-RO/app-log.ts b/web/i18n/ro-RO/app-log.ts index 3f9609d832..4a6e9bd96e 100644 --- a/web/i18n/ro-RO/app-log.ts +++ b/web/i18n/ro-RO/app-log.ts @@ -82,6 +82,7 @@ const translation = { workflowTitle: 'Detalii jurnal', fileListDetail: 'Amănunt', fileListLabel: 'Detalii fișier', + testWithParams: 'Test cu parametri', }, promptLog: 'Jurnal prompt', agentLog: 'Jurnal agent', diff --git a/web/i18n/ru-RU/app-log.ts b/web/i18n/ru-RU/app-log.ts index 4ca48e723b..f874f5f523 100644 --- a/web/i18n/ru-RU/app-log.ts +++ b/web/i18n/ru-RU/app-log.ts @@ -82,6 +82,7 @@ const translation = { workflowTitle: 'Подробная информация о журнале', fileListLabel: 'Сведения о файле', fileListDetail: 'Подробность', + testWithParams: 'Тест с параметрами', }, promptLog: 'Журнал подсказок', agentLog: 'Журнал агента', diff --git a/web/i18n/sl-SI/app-log.ts b/web/i18n/sl-SI/app-log.ts index 598f4f04c6..7f7cba0fa3 100644 --- a/web/i18n/sl-SI/app-log.ts +++ b/web/i18n/sl-SI/app-log.ts @@ -82,6 +82,7 @@ const translation = { workflowTitle: 'Podrobnosti dnevnika', fileListDetail: 'Podrobnosti', fileListLabel: 'Podrobnosti o datoteki', + testWithParams: 'Preizkus s parametri', }, promptLog: 'Dnevnik PROMPT-ov', agentLog: 'Dnevnik pomočnika', diff --git a/web/i18n/th-TH/app-log.ts b/web/i18n/th-TH/app-log.ts index a4952afeb9..8c47eaafdd 100644 --- a/web/i18n/th-TH/app-log.ts +++ b/web/i18n/th-TH/app-log.ts @@ -82,6 +82,7 @@ const translation = { workflowTitle: 'รายละเอียดบันทึก', fileListDetail: 'รายละเอียด', fileListLabel: 'รายละเอียดไฟล์', + testWithParams: 'ทดสอบด้วยพารามิเตอร์', }, promptLog: 'บันทึกพร้อมท์', agentLog: 'บันทึกตัวแทน', diff --git a/web/i18n/tr-TR/app-log.ts b/web/i18n/tr-TR/app-log.ts index dbc3c5708b..380af8fd59 100644 --- a/web/i18n/tr-TR/app-log.ts +++ b/web/i18n/tr-TR/app-log.ts @@ -82,6 +82,7 @@ const translation = { workflowTitle: 'Günlük Detayı', fileListDetail: 'Ayrıntı', fileListLabel: 'Dosya Detayları', + testWithParams: 'Parametrelerle Test', }, promptLog: 'Prompt Günlüğü', agentLog: 'Agent Günlüğü', diff --git a/web/i18n/uk-UA/app-log.ts b/web/i18n/uk-UA/app-log.ts index 1d361150db..8f8f3db5da 100644 --- a/web/i18n/uk-UA/app-log.ts +++ b/web/i18n/uk-UA/app-log.ts @@ -82,6 +82,7 @@ const translation = { workflowTitle: 'Деталі Журналу', fileListDetail: 'Деталь', fileListLabel: 'Подробиці файлу', + testWithParams: 'Тест з параметрами', }, promptLog: 'Журнал Запитань', agentLog: 'Журнал агента', diff --git a/web/i18n/vi-VN/app-log.ts b/web/i18n/vi-VN/app-log.ts index e53b98b004..167b8747e2 100644 --- a/web/i18n/vi-VN/app-log.ts +++ b/web/i18n/vi-VN/app-log.ts @@ -82,6 +82,7 @@ const translation = { workflowTitle: 'Chi tiết nhật ký', fileListDetail: 'Chi tiết', fileListLabel: 'Chi tiết tệp', + testWithParams: 'Kiểm tra với các tham số', }, promptLog: 'Nhật ký lời nhắc', viewLog: 'Xem nhật ký', diff --git a/web/i18n/zh-Hans/app-log.ts b/web/i18n/zh-Hans/app-log.ts index 51b7ebb1e0..26c5c915c5 100644 --- a/web/i18n/zh-Hans/app-log.ts +++ b/web/i18n/zh-Hans/app-log.ts @@ -83,6 +83,7 @@ const translation = { workflowTitle: '日志详情', fileListLabel: '文件详情', fileListDetail: '详情', + testWithParams: '按此参数测试', }, promptLog: 'Prompt 日志', agentLog: 'Agent 日志', diff --git a/web/i18n/zh-Hant/app-log.ts b/web/i18n/zh-Hant/app-log.ts index 9d577c682f..d24b4a1cce 100644 --- a/web/i18n/zh-Hant/app-log.ts +++ b/web/i18n/zh-Hant/app-log.ts @@ -82,6 +82,7 @@ const translation = { workflowTitle: '日誌詳情', fileListDetail: '細節', fileListLabel: '檔詳細資訊', + testWithParams: '使用參數測試', }, promptLog: 'Prompt 日誌', agentLog: 'Agent 日誌',