diff --git a/frontend/app/generate/page.tsx b/frontend/app/generate/page.tsx index cdfd8e4..5c5200d 100644 --- a/frontend/app/generate/page.tsx +++ b/frontend/app/generate/page.tsx @@ -55,17 +55,6 @@ function GenerateContent() { console.log('✅ API分析完成:', result) if (result.success) { - console.log('🔍 [DEBUG] 完整API回應:', JSON.stringify(result.data, null, 2)); - console.log('🔍 [DEBUG] bonus詞彙完整資料:', JSON.stringify(result.data.WordAnalysis?.bonus, null, 2)); - - if (result.data.WordAnalysis?.bonus) { - console.log('🔍 [DEBUG] bonus例句檢查:'); - console.log(' - example:', result.data.WordAnalysis.bonus.example); - console.log(' - exampleTranslation:', result.data.WordAnalysis.bonus.exampleTranslation); - console.log(' - 例句型別:', typeof result.data.WordAnalysis.bonus.example); - console.log(' - 例句是否為null:', result.data.WordAnalysis.bonus.example === null); - } - setSentenceAnalysis(result.data.WordAnalysis || {}) setSentenceMeaning(result.data.SentenceMeaning?.Translation || '') setGrammarCorrection(result.data.GrammarCorrection || null) diff --git a/frontend/components/ClickableTextV2.tsx b/frontend/components/ClickableTextV2.tsx index 99aef0e..fab0e45 100644 --- a/frontend/components/ClickableTextV2.tsx +++ b/frontend/components/ClickableTextV2.tsx @@ -177,10 +177,6 @@ export function ClickableTextV2({ const cleanWord = word.toLowerCase().replace(/[.,!?;:]/g, '') const wordAnalysis = analysis?.[cleanWord] - console.log('🔍 [DEBUG] 點擊詞彙:', cleanWord); - console.log('🔍 [DEBUG] analysis物件keys:', Object.keys(analysis || {})); - console.log('🔍 [DEBUG] 該詞彙分析:', JSON.stringify(wordAnalysis, null, 2)); - console.log('🔍 [DEBUG] wordAnalysis存在?:', !!wordAnalysis); const rect = event.currentTarget.getBoundingClientRect() const viewportWidth = window.innerWidth @@ -219,7 +215,6 @@ export function ClickableTextV2({ } if (wordAnalysis) { - console.log('✅ [DEBUG] 使用預存分析資料'); // 場景A:有預存資料的詞彙 const isHighValue = getWordProperty(wordAnalysis, 'isHighValue') if (isHighValue) { @@ -234,9 +229,6 @@ export function ClickableTextV2({ onWordClick?.(cleanWord, wordAnalysis) } } else { - console.log('❌ [DEBUG] 詞彙不在analysis中,調用queryWordWithAI'); - console.log('🔍 [DEBUG] 要查找的詞彙:', cleanWord); - console.log('🔍 [DEBUG] analysis中的詞彙:', Object.keys(analysis || {})); // 場景B:無預存資料的詞彙 → 即時調用 AI 查詢 await queryWordWithAI(cleanWord, position) } @@ -470,9 +462,7 @@ export function ClickableTextV2({ {/* 例句區塊 - 藍色 */} {(() => { const example = getWordProperty(analysis[selectedWord], 'example'); - const exampleTranslation = getWordProperty(analysis[selectedWord], 'exampleTranslation'); - console.log('🔍 [DEBUG] 例句檢查:', {example, exampleTranslation}); - return example && example !== 'null'; + return example && example !== 'null' && example !== 'undefined'; })() && (

例句