clean: 清理前端debug程式碼,保持生產代碼整潔
🧹 清理內容: - 移除API接收階段的詳細調試資訊 - 移除詞彙點擊路由的debug輸出 - 移除例句檢查的console.log - 移除各種JSON.stringify調試 ✅ 保留功能: - 例句顯示區塊(藍色區塊) - 強化的getWordProperty函數 - 同義詞補充機制 - 所有Portal彈窗功能 🎯 代碼狀態: - 乾淨的生產代碼,無debug污染 - 功能完整且性能優化 - 準備用於後續問題修正 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
3b61cf8ce4
commit
36659d3bed
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
})() && (
|
||||
<div className="bg-blue-50 rounded-lg p-3 border border-blue-200">
|
||||
<h4 className="font-semibold text-blue-900 mb-2 text-left text-sm">例句</h4>
|
||||
|
|
|
|||
Loading…
Reference in New Issue