feat: 新增智慧簡報旁白生成系統 (Smart Slide Voiceover System)

- 新增 Excel 輸入模組:解析 .xlsx 格式講稿檔案
- 新增 TTS 引擎模組:整合 edge-tts 調用 Azure Neural Voice
- 新增 PyQt6 圖形介面:檔案選擇、語音選擇、進度監控
- 新增執行緒模型:QThread + Asyncio 確保 UI 響應性
- 支援 10 種 Neural Voice (中文/越南/英文)
- 支援中英混雜、越英混雜發音

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
beabigegg
2025-12-27 15:42:11 +08:00
commit 33ea22f259
25 changed files with 1943 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
架構模式: MVC (Model-View-Controller) / Producer-Consumer Pattern開發語言 Python 3.10+1. 技術堆疊 (Tech Stack)元件技術選型說明GUI FrameworkPyQt6原生編譯綁定效能優於 Electron適合單機工具。TTS Coreedge-tts (Python Lib)調用 Azure Cognitive Services 介面,獲取 SOTA 級語音。EnvironmentConda透過 environment.yml 鎖定 Python 與套件版本。Data ProcessingPandas / Openpyxl高效讀取與解析 Excel 資料。ConcurrencyQThread + Asyncio解決 PyQt 事件迴圈與非同步網路請求的衝突。2. 語音模型映射策略 (Voice Mapping Strategy)為確保輸出語音符合「專業且親切」的簡報需求,系統將強制綁定以下 Neural Voice IDPrimary Mapping (Excel Lang Column):vi $\rightarrow$ vi-VN-HoaiMyNeural特徵女性音色明亮溫柔咬字清晰適合對外簡報。zh / zh-tw $\rightarrow$ zh-TW-HsiaoChenNeural特徵女性台灣標準口音知性專業適合教育訓練與彙報。en $\rightarrow$ en-US-JennyNeural特徵女性美式標準音。3. 系統模組設計3.1 環境配置 (environment.yml)定義專案的標準運行環境確保團隊協作或換機時的一致性。YAMLname: tts_project
dependencies:
- python=3.10
- pip
- pip:
- PyQt6
- edge-tts
- pandas
- openpyxl
3.2 執行緒模型 (Threading Model)由於 edge-tts 是基於 asyncio 的非同步操作,而 PyQt 是基於 Event Loop 的同步操作,必須採用 Worker Thread 模式Main Thread (UI)負責繪製介面、接收使用者點擊、更新進度條。Worker Thread (QThread):在此執行緒內建立獨立的 asyncio Event Loop。執行 Excel 解析。序列化執行 TTS 請求。透過 pyqtSignal 將進度與 Log 傳回 Main Thread。3.3 異常處理流程網路中斷:捕獲 aiohttp 相關錯誤 $\rightarrow$ 重試 1 次 $\rightarrow$ 失敗則寫入 Log $\rightarrow$ 跳過。檔案佔用:若輸出檔案正被播放器開啟,捕獲 PermissionError $\rightarrow$ 提示使用者關閉檔案。