From 7a5859e424f0fa5ba5a5861f81bd74d4b3a5cde6 Mon Sep 17 00:00:00 2001 From: imeepos Date: Fri, 25 Jul 2025 17:09:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=89=8D=E7=AB=AFAiCl?= =?UTF-8?q?assificationService=E6=96=B9=E6=B3=95=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将getAllAiClassifications()调用修正为getAllClassifications() - 修复导入路径从ai-classification改为aiClassification - 更新所有相关组件和测试文件 - 解决'AiClassificationService.getAllAiClassifications is not a function'错误 --- .../integration/template-weight-config.e2e.test.tsx | 2 +- .../src/components/template/BatchWeightConfigModal.tsx | 4 ++-- .../src/components/template/TemplateSegmentWeightEditor.tsx | 6 +++--- .../template/__tests__/TemplateSegmentWeightEditor.test.tsx | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/desktop/src/__tests__/integration/template-weight-config.e2e.test.tsx b/apps/desktop/src/__tests__/integration/template-weight-config.e2e.test.tsx index 1172720..b5d3365 100644 --- a/apps/desktop/src/__tests__/integration/template-weight-config.e2e.test.tsx +++ b/apps/desktop/src/__tests__/integration/template-weight-config.e2e.test.tsx @@ -119,7 +119,7 @@ describe('Template Weight Configuration E2E Tests', () => { jest.clearAllMocks(); // Setup default mock implementations - mockAiClassificationService.getAllAiClassifications.mockResolvedValue(mockAiClassifications); + mockAiClassificationService.getAllClassifications.mockResolvedValue(mockAiClassifications); mockTemplateSegmentWeightService.getSegmentWeightsWithDefaults.mockResolvedValue({ classification_1: 80, classification_2: 60, diff --git a/apps/desktop/src/components/template/BatchWeightConfigModal.tsx b/apps/desktop/src/components/template/BatchWeightConfigModal.tsx index 2d154af..5f4aff7 100644 --- a/apps/desktop/src/components/template/BatchWeightConfigModal.tsx +++ b/apps/desktop/src/components/template/BatchWeightConfigModal.tsx @@ -6,7 +6,7 @@ import { CheckIcon, ExclamationTriangleIcon, } from '@heroicons/react/24/outline'; -import { AiClassification } from '../../types/ai-classification'; +import { AiClassification } from '../../types/aiClassification'; import { TemplateSegmentWeightHelper } from '../../types/template'; import { TemplateSegmentWeightService } from '../../services/templateSegmentWeightService'; import { AiClassificationService } from '../../services/aiClassificationService'; @@ -60,7 +60,7 @@ export const BatchWeightConfigModal: React.FC = ({ const loadAiClassifications = async () => { try { - const classifications = await AiClassificationService.getAllAiClassifications(); + const classifications = await AiClassificationService.getAllClassifications(); const activeClassifications = classifications.filter(c => c.is_active); setAiClassifications(activeClassifications); diff --git a/apps/desktop/src/components/template/TemplateSegmentWeightEditor.tsx b/apps/desktop/src/components/template/TemplateSegmentWeightEditor.tsx index cc958b4..e853a78 100644 --- a/apps/desktop/src/components/template/TemplateSegmentWeightEditor.tsx +++ b/apps/desktop/src/components/template/TemplateSegmentWeightEditor.tsx @@ -6,8 +6,8 @@ import { XMarkIcon, InformationCircleIcon } from '@heroicons/react/24/outline'; -import { AiClassification } from '../../types/ai-classification'; -import { TemplateSegmentWeight, TemplateSegmentWeightHelper } from '../../types/template'; +import { AiClassification } from '../../types/aiClassification'; +import { TemplateSegmentWeightHelper } from '../../types/template'; import { TemplateSegmentWeightService } from '../../services/templateSegmentWeightService'; import { AiClassificationService } from '../../services/aiClassificationService'; @@ -57,7 +57,7 @@ export const TemplateSegmentWeightEditor: React.FC { jest.clearAllMocks(); // Setup default mock implementations - mockAiClassificationService.getAllAiClassifications.mockResolvedValue(mockAiClassifications); + mockAiClassificationService.getAllClassifications.mockResolvedValue(mockAiClassifications); mockTemplateSegmentWeightService.getSegmentWeightsWithDefaults.mockResolvedValue(mockCurrentWeights); mockTemplateSegmentWeightService.hasCustomSegmentWeights.mockResolvedValue(false); }); @@ -264,7 +264,7 @@ describe('TemplateSegmentWeightEditor', () => { it('handles loading state', () => { // Mock loading state - mockAiClassificationService.getAllAiClassifications.mockImplementation( + mockAiClassificationService.getAllClassifications.mockImplementation( () => new Promise(() => {}) // Never resolves ); @@ -274,7 +274,7 @@ describe('TemplateSegmentWeightEditor', () => { }); it('handles error state', async () => { - mockAiClassificationService.getAllAiClassifications.mockRejectedValue( + mockAiClassificationService.getAllClassifications.mockRejectedValue( new Error('Failed to load classifications') );