feat: add translation billing stats and remove Export/Settings pages
- Add TranslationLog model to track translation API usage per task - Integrate Dify API actual price (total_price) into translation stats - Display translation statistics in admin dashboard with per-task costs - Remove unused Export and Settings pages to simplify frontend - Add GET /api/v2/admin/translation-stats endpoint 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
39
openspec/changes/simplify-frontend-add-billing/tasks.md
Normal file
39
openspec/changes/simplify-frontend-add-billing/tasks.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# Tasks: 簡化前端頁面並新增翻譯計費功能
|
||||
|
||||
## 1. 移除 Export 頁面
|
||||
|
||||
- [x] 1.1 從 App.tsx 移除 `/export` 路由
|
||||
- [x] 1.2 從 Layout.tsx 導航選單移除 Export 連結
|
||||
- [x] 1.3 刪除 `frontend/src/pages/ExportPage.tsx`
|
||||
|
||||
## 2. 移除 Settings 頁面
|
||||
|
||||
- [x] 2.1 從 App.tsx 移除 `/settings` 路由
|
||||
- [x] 2.2 從 Layout.tsx 導航選單移除 Settings 連結
|
||||
- [x] 2.3 刪除 `frontend/src/pages/SettingsPage.tsx`
|
||||
|
||||
## 3. 後端翻譯統計 API
|
||||
|
||||
- [x] 3.1 新增 `TranslationLog` model 和 migration
|
||||
- [x] 3.2 在 `admin_service.py` 新增 `get_translation_statistics()` 方法
|
||||
- [x] 3.3 在 `admin.py` router 新增 `GET /admin/translation-stats` 端點
|
||||
- [x] 3.4 修改翻譯流程在完成時寫入統計到資料庫
|
||||
|
||||
## 4. 前端翻譯統計顯示
|
||||
|
||||
- [x] 4.1 在 `apiV2.ts` 新增 `getTranslationStats()` API 呼叫
|
||||
- [x] 4.2 在 `types/apiV2.ts` 新增翻譯統計類型定義
|
||||
- [x] 4.3 在 `AdminDashboardPage.tsx` 新增翻譯統計卡片
|
||||
|
||||
## 5. i18n 翻譯
|
||||
|
||||
- [ ] 5.1 新增翻譯統計相關中文翻譯 (暫時使用硬編碼)
|
||||
- [ ] 5.2 新增翻譯統計相關英文翻譯 (暫時使用硬編碼)
|
||||
|
||||
## 6. 測試與驗證
|
||||
|
||||
- [x] 6.1 驗證 Export/Settings 頁面路由已移除
|
||||
- [x] 6.2 驗證導航選單已更新
|
||||
- [x] 6.3 驗證 TypeScript 編譯通過
|
||||
- [ ] 6.4 測試翻譯統計 API 回傳正確資料 (需要實際翻譯測試)
|
||||
- [ ] 6.5 測試管理員儀表板顯示翻譯統計 (需要實際測試)
|
||||
Reference in New Issue
Block a user