diff --git a/web/app/components/workflow/panel/run-history.tsx b/web/app/components/workflow/panel/run-history.tsx index a5c924a28f..fedd720028 100644 --- a/web/app/components/workflow/panel/run-history.tsx +++ b/web/app/components/workflow/panel/run-history.tsx @@ -1,4 +1,5 @@ import { memo } from 'react' +import cn from 'classnames' import dayjs from 'dayjs' import { useTranslation } from 'react-i18next' import useSWR from 'swr' @@ -6,7 +7,7 @@ import { WorkflowRunningStatus } from '../types' import { XClose } from '@/app/components/base/icons/src/vender/line/general' import { AlertCircle } from '@/app/components/base/icons/src/vender/line/alertsAndFeedback' import { CheckCircle } from '@/app/components/base/icons/src/vender/solid/general' -import { useStore } from '@/app/components/workflow/store' +import { useStore as useRunHistoryStore } from '@/app/components/workflow/store' import { useStore as useAppStore } from '@/app/components/app/store' import { fetchWorkflowRunHistory } from '@/service/workflow' import Loading from '@/app/components/base/loading' @@ -14,6 +15,7 @@ import Loading from '@/app/components/base/loading' const RunHistory = () => { const { t } = useTranslation() const appDetail = useAppStore(state => state.appDetail) + const workflowRunId = useRunHistoryStore(state => state.workflowRunId) const { data, isLoading } = useSWR(appDetail ? `/apps/${appDetail.id}/workflow-runs` : null, fetchWorkflowRunHistory) if (!appDetail) @@ -25,7 +27,7 @@ const RunHistory = () => { {t('workflow.common.runHistory')}
useStore.setState({ showRunHistory: false })} + onClick={() => useRunHistoryStore.setState({ showRunHistory: false })} >
@@ -42,8 +44,11 @@ const RunHistory = () => { data?.data.map(item => (
useStore.setState({ workflowRunId: item.id })} + className={cn( + 'flex mb-0.5 px-2 py-[7px] rounded-lg hover:bg-primary-50 cursor-pointer', + item.id === workflowRunId && 'bg-primary-50', + )} + onClick={() => useRunHistoryStore.setState({ workflowRunId: item.id, runningStatus: item.status as WorkflowRunningStatus })} > { appDetail?.mode === 'workflow' && item.status === WorkflowRunningStatus.Failed && ( @@ -56,7 +61,12 @@ const RunHistory = () => { ) }
-
+
Test Run#{item.sequence_number}
diff --git a/web/app/components/workflow/run/meta.tsx b/web/app/components/workflow/run/meta.tsx index a5288aac76..c4b5343aa9 100644 --- a/web/app/components/workflow/run/meta.tsx +++ b/web/app/components/workflow/run/meta.tsx @@ -11,6 +11,7 @@ type Props = { time?: number tokens?: number steps?: number + showSteps?: boolean } const MetaData: FC = ({ @@ -20,6 +21,7 @@ const MetaData: FC = ({ time, tokens, steps = 1, + showSteps = true, }) => { const { t } = useTranslation() @@ -73,7 +75,7 @@ const MetaData: FC = ({
)} {status !== 'running' && ( - {`${time}s`} + {`${time?.toFixed(3)}s`} )}
@@ -88,7 +90,7 @@ const MetaData: FC = ({ )}
- {steps > 0 && ( + {showSteps && (
{t('runLog.meta.steps')}
diff --git a/web/app/components/workflow/run/result-panel.tsx b/web/app/components/workflow/run/result-panel.tsx index bc5191efbe..8e055637ea 100644 --- a/web/app/components/workflow/run/result-panel.tsx +++ b/web/app/components/workflow/run/result-panel.tsx @@ -17,6 +17,7 @@ type ResultPanelProps = { created_by: string finished_at?: number steps: number + showSteps?: boolean } const ResultPanel: FC = ({ @@ -30,6 +31,7 @@ const ResultPanel: FC = ({ created_at, created_by, steps, + showSteps, }) => { return (
@@ -46,7 +48,7 @@ const ResultPanel: FC = ({ readOnly title={
INPUT
} language={CodeLanguage.json} - value={inputs || ''} + value={JSON.stringify(inputs)} onChange={() => {}} /> {process_data && ( @@ -54,7 +56,7 @@ const ResultPanel: FC = ({ readOnly title={
PROCESS DATA
} language={CodeLanguage.json} - value={process_data} + value={JSON.stringify(process_data)} onChange={() => {}} /> )} @@ -63,7 +65,7 @@ const ResultPanel: FC = ({ readOnly title={
OUTPUT
} language={CodeLanguage.json} - value={outputs} + value={JSON.stringify(outputs)} onChange={() => {}} /> )} @@ -79,6 +81,7 @@ const ResultPanel: FC = ({ time={elapsed_time} tokens={total_tokens} steps={steps} + showSteps={showSteps} />
diff --git a/web/app/components/workflow/run/status.tsx b/web/app/components/workflow/run/status.tsx index c2b8549c1d..019c9cf424 100644 --- a/web/app/components/workflow/run/status.tsx +++ b/web/app/components/workflow/run/status.tsx @@ -30,7 +30,7 @@ const StatusPanel: FC = ({ )} >
-
+
{t('runLog.resultPanel.status')}
= ({ )}
-
+
{t('runLog.resultPanel.time')}
{status === 'running' && (
)} {status !== 'running' && ( - {`${time}s`} + {`${time?.toFixed(3)}s`} )}
-
+
{t('runLog.resultPanel.tokens')}
{status === 'running' && (