diff --git a/frontend/app/generate/page.tsx b/frontend/app/generate/page.tsx index f2689b2..5450004 100644 --- a/frontend/app/generate/page.tsx +++ b/frontend/app/generate/page.tsx @@ -8,6 +8,7 @@ import { useToast } from '@/components/shared/Toast' import { flashcardsService } from '@/lib/services/flashcards' import { compareCEFRLevels, getLevelIndex, getTargetLearningRange } from '@/lib/utils/cefrUtils' import { BluePlayButton } from '@/components/shared/BluePlayButton' +import { API_CONFIG } from '@/lib/config/api' import Link from 'next/link' // 常數定義 @@ -51,7 +52,7 @@ function GenerateContent() { setIsAnalyzing(true) try { - const response = await fetch('http://localhost:5008/api/ai/analyze-sentence', { + const response = await fetch(`${API_CONFIG.BASE_URL}/api/ai/analyze-sentence`, { method: 'POST', headers: { 'Content-Type': 'application/json' diff --git a/frontend/hooks/generate/useSentenceAnalysis.ts b/frontend/hooks/generate/useSentenceAnalysis.ts index 8d21bef..6bf967f 100644 --- a/frontend/hooks/generate/useSentenceAnalysis.ts +++ b/frontend/hooks/generate/useSentenceAnalysis.ts @@ -1,6 +1,7 @@ import { useState } from 'react' import { useToast } from '@/components/shared/Toast' import { getLevelIndex } from '@/lib/utils/cefrUtils' +import { API_CONFIG } from '@/lib/config/api' interface AnalysisResult { originalText: string @@ -19,7 +20,7 @@ export function useSentenceAnalysis() { setIsAnalyzing(true) try { - const response = await fetch('http://localhost:5008/api/ai/analyze-sentence', { + const response = await fetch(`${API_CONFIG.BASE_URL}/api/ai/analyze-sentence`, { method: 'POST', headers: { 'Content-Type': 'application/json'