From 96e205fd7fc928694c786b0413c863bdfeab9062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=84=AD=E6=B2=9B=E8=BB=92?= Date: Tue, 16 Sep 2025 01:12:34 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AF=A6=E7=8F=BE=E5=AE=8C=E6=95=B4?= =?UTF-8?q?=E6=B8=AC=E9=A9=97=E6=A8=A1=E5=BC=8F=E8=88=87=20AI=20=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E8=83=BD=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 主要更新: 1. 測驗模式重構 - 選擇題:改為英文定義選中文翻譯 - 新增填空題模式(含例句圖片顯示) - 新增聽力測試模式 - 新增口說測試模式 2. AI 生成功能更新 - 改為詞彙萃取和智能萃取兩種模式 - 實現用戶權限差異(免費/訂閱) - 例句圖改為模態視窗顯示 3. 其他改進 - 整合真實例句圖片資源 - 難度等級改用 CEFR 標準 (A1-C2) - 優化圖片顯示比例與體驗 - 移除測驗模式正確率顯示 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .claude/settings.local.json | 3 +- app/generate/page.tsx | 472 ++++++++--- app/learn/page.tsx | 423 ++++++++-- .../01_requirement/functional-requirements.md | 55 +- .../api/api-endpoints-detailed.md | 742 ++++++++++++++++++ .../backend-development-plan.md | 381 +++++++++ .../claude-code-development-sop.md | 312 ++++++++ .../database-schema-detailed.md | 465 +++++++++++ docs/03_development/simple-dev-workflow.md | 169 ++++ public/images/examples/bring_up.png | Bin 0 -> 574433 bytes public/images/examples/instinct.png | Bin 0 -> 617507 bytes public/images/examples/warrant.png | Bin 0 -> 643054 bytes 12 files changed, 2845 insertions(+), 177 deletions(-) create mode 100644 docs/03_development/api/api-endpoints-detailed.md create mode 100644 docs/03_development/backend-development-plan.md create mode 100644 docs/03_development/claude-code-development-sop.md create mode 100644 docs/03_development/database-schema-detailed.md create mode 100644 docs/03_development/simple-dev-workflow.md create mode 100644 public/images/examples/bring_up.png create mode 100644 public/images/examples/instinct.png create mode 100644 public/images/examples/warrant.png diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 43a54d6..ca85d6b 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -11,7 +11,8 @@ "Bash(xargs:*)", "Bash(npm init:*)", "Bash(npm run dev:*)", - "Bash(npm uninstall:*)" + "Bash(npm uninstall:*)", + "Bash(git push:*)" ], "deny": [], "ask": [] diff --git a/app/generate/page.tsx b/app/generate/page.tsx index f565836..55d28c5 100644 --- a/app/generate/page.tsx +++ b/app/generate/page.tsx @@ -4,57 +4,83 @@ import { useState } from 'react' import Link from 'next/link' export default function GeneratePage() { - const [mode, setMode] = useState<'text' | 'theme'>('text') + const [mode, setMode] = useState<'manual' | 'screenshot'>('manual') const [textInput, setTextInput] = useState('') - const [selectedTheme, setSelectedTheme] = useState('') - const [difficulty, setDifficulty] = useState('intermediate') + const [extractionType, setExtractionType] = useState<'vocabulary' | 'smart'>('vocabulary') const [cardCount, setCardCount] = useState(10) const [isGenerating, setIsGenerating] = useState(false) const [generatedCards, setGeneratedCards] = useState([]) const [showPreview, setShowPreview] = useState(false) - - const themes = [ - { id: 'daily', name: '日常對話', icon: '🗣️' }, - { id: 'business', name: '商務英語', icon: '💼' }, - { id: 'tv', name: '美劇經典', icon: '📺' }, - { id: 'movie', name: '電影台詞', icon: '🎬' }, - { id: 'academic', name: '學術英語', icon: '🎓' }, - { id: 'travel', name: '旅遊英語', icon: '✈️' }, - ] + const [isPremium] = useState(false) // Mock premium status + const [showImageForCard, setShowImageForCard] = useState<{ [key: number]: boolean }>({}) // Track which cards show images + const [modalImage, setModalImage] = useState(null) // Track modal image const mockGeneratedCards = [ { id: 1, - word: 'negotiate', + word: 'brought', partOfSpeech: 'verb', - pronunciation: '/nɪˈɡoʊʃieɪt/', - translation: '協商、談判', - definition: 'To discuss something with someone in order to reach an agreement', - example: 'We need to negotiate a better deal with our suppliers.', - exampleTranslation: '我們需要與供應商協商更好的交易。', - difficulty: 'intermediate' + pronunciation: { + us: '/brɔːt/', + uk: '/brɔːt/' + }, + translation: '提出、帶來', + definition: 'Past tense of bring; to mention or introduce a topic in conversation', + synonyms: ['mentioned', 'raised', 'introduced'], + antonyms: ['concealed', 'withheld'], + originalExample: 'He brought this thing up during our meeting and no one agreed.', + originalExampleTranslation: '他在我們的會議中提出了這件事,但沒有人同意。', + generatedExample: { + sentence: 'She brought up an interesting point about the budget.', + translation: '她提出了一個關於預算的有趣觀點。', + imageUrl: '/images/examples/bring_up.png', + audioUrl: '#' + }, + difficulty: 'B1' }, { id: 2, - word: 'perspective', + word: 'instincts', partOfSpeech: 'noun', - pronunciation: '/pərˈspektɪv/', - translation: '觀點、看法', - definition: 'A particular way of considering something', - example: 'From my perspective, this is the best solution.', - exampleTranslation: '從我的角度來看,這是最好的解決方案。', - difficulty: 'intermediate' + pronunciation: { + us: '/ˈɪnstɪŋkts/', + uk: '/ˈɪnstɪŋkts/' + }, + translation: '本能、直覺', + definition: 'Natural abilities that help living things survive without learning', + synonyms: ['intuition', 'impulse', 'tendency'], + antonyms: ['logic', 'reasoning'], + originalExample: 'Animals use their instincts to find food and stay safe.', + originalExampleTranslation: '動物利用本能來尋找食物並保持安全。', + generatedExample: { + sentence: 'Trust your instincts when making important decisions.', + translation: '在做重要決定時要相信你的直覺。', + imageUrl: '/images/examples/instinct.png', + audioUrl: '#' + }, + difficulty: 'B2' }, { id: 3, - word: 'accomplish', - partOfSpeech: 'verb', - pronunciation: '/əˈkɒmplɪʃ/', - translation: '完成、達成', - definition: 'To finish something successfully or to achieve something', - example: 'She accomplished her goal of running a marathon.', - exampleTranslation: '她完成了跑馬拉松的目標。', - difficulty: 'intermediate' + word: 'warrants', + partOfSpeech: 'noun', + pronunciation: { + us: '/ˈwɔːrənts/', + uk: '/ˈwɒrənts/' + }, + translation: '搜查令、授權令', + definition: 'Official documents that give police permission to do something', + synonyms: ['authorization', 'permit', 'license'], + antonyms: ['prohibition', 'ban'], + originalExample: 'The police obtained warrants to search the building.', + originalExampleTranslation: '警方取得了搜查令來搜查這棟建築物。', + generatedExample: { + sentence: 'The judge issued arrest warrants for three suspects.', + translation: '法官對三名嫌疑人發出了逮捕令。', + imageUrl: '/images/examples/warrant.png', + audioUrl: '#' + }, + difficulty: 'C1' } ] @@ -73,6 +99,13 @@ export default function GeneratePage() { alert('詞卡已保存到您的卡組!') } + const toggleImageForCard = (cardId: number) => { + setShowImageForCard(prev => ({ + ...prev, + [cardId]: !prev[cardId] + })) + } + return (
{/* Navigation */} @@ -97,42 +130,81 @@ export default function GeneratePage() {

AI 智能生成詞卡

- {/* Mode Selection */} + {/* Input Mode Selection */}
-

選擇生成模式

+

原始例句類型

+
+
+ + {/* Extraction Type Selection */} +
+

萃取方式

+
+ +
{/* Content Input */}
- {mode === 'text' ? ( + {mode === 'manual' ? (
-

輸入文本內容

+

輸入英文文本