fix: 修复前端AiClassificationService方法调用错误

- 将getAllAiClassifications()调用修正为getAllClassifications()
- 修复导入路径从ai-classification改为aiClassification
- 更新所有相关组件和测试文件
- 解决'AiClassificationService.getAllAiClassifications is not a function'错误
This commit is contained in:
imeepos 2025-07-25 17:09:09 +08:00
parent 30ecaf56ec
commit 7a5859e424
4 changed files with 9 additions and 9 deletions

View File

@ -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,

View File

@ -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<BatchWeightConfigModalProps> = ({
const loadAiClassifications = async () => {
try {
const classifications = await AiClassificationService.getAllAiClassifications();
const classifications = await AiClassificationService.getAllClassifications();
const activeClassifications = classifications.filter(c => c.is_active);
setAiClassifications(activeClassifications);

View File

@ -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<TemplateSegmentWeightEditorPr
setError(null);
const [classifications, weights, hasCustom] = await Promise.all([
AiClassificationService.getAllAiClassifications(),
AiClassificationService.getAllClassifications(),
TemplateSegmentWeightService.getSegmentWeightsWithDefaults(templateId, trackSegmentId),
TemplateSegmentWeightService.hasCustomSegmentWeights(templateId, trackSegmentId),
]);

View File

@ -63,7 +63,7 @@ describe('TemplateSegmentWeightEditor', () => {
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')
);