From ce28ad771c97d9801bcd2d95c864005d27e062f3 Mon Sep 17 00:00:00 2001 From: JzoNg Date: Fri, 10 Apr 2026 17:12:27 +0800 Subject: [PATCH] feat(web): test history of rag-pipeline evaluation --- .../evaluation/__tests__/index.spec.tsx | 2 +- .../components/layout/pipeline-evaluation.tsx | 12 +- .../pipeline/pipeline-history-table.tsx | 117 ------------------ 3 files changed, 8 insertions(+), 123 deletions(-) delete mode 100644 web/app/components/evaluation/components/pipeline/pipeline-history-table.tsx diff --git a/web/app/components/evaluation/__tests__/index.spec.tsx b/web/app/components/evaluation/__tests__/index.spec.tsx index dbcdeee247..8a1055326b 100644 --- a/web/app/components/evaluation/__tests__/index.spec.tsx +++ b/web/app/components/evaluation/__tests__/index.spec.tsx @@ -383,7 +383,7 @@ describe('Evaluation', () => { renderWithQueryClient() expect(screen.getByTestId('evaluation-model-selector')).toHaveTextContent('empty') - expect(screen.getByText('evaluation.history.title')).toBeInTheDocument() + expect(screen.getByText('evaluation.history.columns.time')).toBeInTheDocument() expect(screen.getByText('Context Precision')).toBeInTheDocument() expect(screen.getByText('Context Recall')).toBeInTheDocument() expect(screen.getByText('Context Relevance')).toBeInTheDocument() diff --git a/web/app/components/evaluation/components/layout/pipeline-evaluation.tsx b/web/app/components/evaluation/components/layout/pipeline-evaluation.tsx index 1b1f88e0d8..82aadebb06 100644 --- a/web/app/components/evaluation/components/layout/pipeline-evaluation.tsx +++ b/web/app/components/evaluation/components/layout/pipeline-evaluation.tsx @@ -8,10 +8,10 @@ import { useDocLink } from '@/context/i18n' import { useAvailableEvaluationMetrics } from '@/service/use-evaluation' import { getEvaluationMockConfig } from '../../mock' import { isEvaluationRunnable, useEvaluationResource, useEvaluationStore } from '../../store' +import HistoryTab from '../batch-test-panel/history-tab' import UploadRunPopover from '../batch-test-panel/input-fields/upload-run-popover' import { useInputFieldsActions } from '../batch-test-panel/input-fields/use-input-fields-actions' import JudgeModelSelector from '../judge-model-selector' -import PipelineHistoryTable from '../pipeline/pipeline-history-table' import PipelineMetricItem from '../pipeline/pipeline-metric-item' import PipelineResultsPanel from '../pipeline/pipeline-results-panel' import SectionHeader, { InlineSectionHeader } from '../section-header' @@ -164,10 +164,12 @@ const PipelineEvaluation = ({
- +
+ +
diff --git a/web/app/components/evaluation/components/pipeline/pipeline-history-table.tsx b/web/app/components/evaluation/components/pipeline/pipeline-history-table.tsx deleted file mode 100644 index 51769d5d75..0000000000 --- a/web/app/components/evaluation/components/pipeline/pipeline-history-table.tsx +++ /dev/null @@ -1,117 +0,0 @@ -'use client' - -import type { EvaluationResourceProps } from '../../types' -import { useMemo, useState } from 'react' -import { useTranslation } from 'react-i18next' -import Badge from '@/app/components/base/badge' -import Input from '@/app/components/base/input' -import { cn } from '@/utils/classnames' -import { useEvaluationResource } from '../../store' - -const PipelineHistoryTable = ({ - resourceType, - resourceId, -}: EvaluationResourceProps) => { - const { t } = useTranslation('evaluation') - const resource = useEvaluationResource(resourceType, resourceId) - const [query, setQuery] = useState('') - const statusLabels = { - running: t('batch.status.running'), - success: t('batch.status.success'), - failed: t('batch.status.failed'), - } - - const filteredRecords = useMemo(() => { - const keyword = query.trim().toLowerCase() - if (!keyword) - return resource.batchRecords - - return resource.batchRecords.filter(record => - record.fileName.toLowerCase().includes(keyword) - || record.summary.toLowerCase().includes(keyword), - ) - }, [query, resource.batchRecords]) - - return ( -
-
-
{t('history.title')}
-
- setQuery(event.target.value)} - /> -
-
- -
-
-
-
- {t('history.columns.time')} -
-
{t('history.columns.creator')}
-
{t('history.columns.version')}
-
{t('history.columns.status')}
-
-
- -
- {filteredRecords.length > 0 && ( -
- {filteredRecords.map(record => ( -
-
{record.startedAt}
-
{t('history.creatorYou')}
-
{t('history.latestVersion')}
-
- - {record.status === 'running' - ? ( - - - ) - : statusLabels[record.status]} - -
-
- -
-
- ))} -
- )} - - {filteredRecords.length === 0 && ( -
-
- )} -
-
-
-
- ) -} - -export default PipelineHistoryTable