From 36659d3bedc89c401da35b72ffb26a1e6ad45e28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=84=AD=E6=B2=9B=E8=BB=92?= Date: Sun, 21 Sep 2025 14:39:21 +0800 Subject: [PATCH] =?UTF-8?q?clean:=20=E6=B8=85=E7=90=86=E5=89=8D=E7=AB=AFde?= =?UTF-8?q?bug=E7=A8=8B=E5=BC=8F=E7=A2=BC=EF=BC=8C=E4=BF=9D=E6=8C=81?= =?UTF-8?q?=E7=94=9F=E7=94=A2=E4=BB=A3=E7=A2=BC=E6=95=B4=E6=BD=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🧹 清理內容: - 移除API接收階段的詳細調試資訊 - 移除詞彙點擊路由的debug輸出 - 移除例句檢查的console.log - 移除各種JSON.stringify調試 ✅ 保留功能: - 例句顯示區塊(藍色區塊) - 強化的getWordProperty函數 - 同義詞補充機制 - 所有Portal彈窗功能 🎯 代碼狀態: - 乾淨的生產代碼,無debug污染 - 功能完整且性能優化 - 準備用於後續問題修正 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- frontend/app/generate/page.tsx | 11 ----------- frontend/components/ClickableTextV2.tsx | 12 +----------- 2 files changed, 1 insertion(+), 22 deletions(-) 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'; })() && (

例句