diff --git a/docs/02_design/AI句子分析規格/AI句子分析功能產品需求規格.md b/docs/02_design/AI句子分析規格/AI句子分析功能產品需求規格.md index 33061d6..fc22c74 100644 --- a/docs/02_design/AI句子分析規格/AI句子分析功能產品需求規格.md +++ b/docs/02_design/AI句子分析規格/AI句子分析功能產品需求規格.md @@ -273,7 +273,7 @@ API回應格式: - 語音資訊: IPA發音標記、音頻播放功能 - 學習輔助: 同義詞、例句、例句翻譯 - 個人化: CEFR等級、學習狀態 - - 使用頻率: 當詞彙為常用時,於詞彙框線內右上角顯示星星 + - 使用頻率: 除了簡單詞彙「學習者的CEFR>詞彙CEFR」以外,當詞彙為常用時,於詞彙框線內右上角顯示星星 前端渲染邏輯: - 條件渲染: 檢查 isCommon 欄位存在且為 true 時顯示 ⭐ @@ -302,7 +302,7 @@ API回應格式: - 基礎定義: 慣用語、中英文解釋、發音 - 學習輔助: 同義表達、實用例句 - 難度標記: CEFR等級 - - 使用頻率: 當慣用語為常用時,於慣用語框線內右上角顯示星星 + - 使用頻率: 除了簡單慣用語「學習者的CEFR>慣用語CEFR」以外,當慣用語為常用時,於慣用語框線內右上角顯示星星 前端渲染邏輯: - 條件渲染: 檢查 isCommon 欄位存在且為 true 時顯示 ⭐ diff --git a/frontend/app/generate/page.tsx b/frontend/app/generate/page.tsx index b71570a..b124919 100644 --- a/frontend/app/generate/page.tsx +++ b/frontend/app/generate/page.tsx @@ -466,14 +466,22 @@ function GenerateContent() { title={`${idiom.idiom}: ${idiom.translation}`} > {idiom.idiom} - {idiom?.frequency === 'high' && ( - - ⭐ - - )} + {(() => { + // 只有當慣用語為常用且不是簡單慣用語時才顯示星星 + // 簡單慣用語定義:學習者CEFR > 慣用語CEFR + const isHighFrequency = idiom?.frequency === 'high' + const idiomCefr = idiom?.cefrLevel || 'A1' + const isNotSimpleIdiom = !compareCEFRLevels(userLevel, idiomCefr, '>') + + return isHighFrequency && isNotSimpleIdiom ? ( + + ⭐ + + ) : null + })()} ))} diff --git a/frontend/components/ClickableTextV2.tsx b/frontend/components/ClickableTextV2.tsx index 3208a9d..a8ea58f 100644 --- a/frontend/components/ClickableTextV2.tsx +++ b/frontend/components/ClickableTextV2.tsx @@ -149,12 +149,19 @@ export function ClickableTextV2({ if (!wordAnalysis) return false const frequency = getWordProperty(wordAnalysis, 'frequency') - return frequency === 'high' + const wordCefr = getWordProperty(wordAnalysis, 'cefrLevel') + + // 只有當詞彙為常用且不是簡單詞彙時才顯示星星 + // 簡單詞彙定義:學習者CEFR > 詞彙CEFR + const isHighFrequency = frequency === 'high' + const isNotSimpleWord = !compareCEFRLevels(userLevel, wordCefr, '>') + + return isHighFrequency && isNotSimpleWord } catch (error) { console.warn('Error checking word frequency for star display:', error) return false } - }, [findWordAnalysis, getWordProperty]) + }, [findWordAnalysis, getWordProperty, userLevel]) const words = useMemo(() => text.split(/(\s+|[.,!?;:])/g), [text])