feat: Add Chat UX improvements with notifications and @mention support

- Add ActionBar component with expandable toolbar for mobile
- Add @mention functionality with autocomplete dropdown
- Add browser notification system (push, sound, vibration)
- Add NotificationSettings modal for user preferences
- Add mention badges on room list cards
- Add ReportPreview with Markdown rendering and copy/download
- Add message copy functionality with hover actions
- Add backend mentions field to messages with Alembic migration
- Add lots field to rooms, remove templates
- Optimize WebSocket database session handling
- Various UX polish (animations, accessibility)

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
egg
2025-12-08 08:20:37 +08:00
parent 92834dbe0e
commit 599802b818
72 changed files with 6810 additions and 702 deletions

View File

@@ -0,0 +1,37 @@
# Proposal: Fix Chat UX Issues
## Status: DRAFT
## Why
使用者回報三個影響使用體驗的問題:
1. **聊天室無法辨識發文者**:訊息只顯示 email (sender_id),無法快速識別是誰發的,不像 LINE 等通訊軟體會顯示使用者名稱。
2. **時間顯示錯誤**:系統使用 UTC 時間,但使用者期望看到 GMT+8 (台灣時間)。目前前端依賴瀏覽器 locale可能導致不同使用者看到不同時區的時間。
3. **AI 報告生成卡住**:點擊生成報告後一直停在「準備中」狀態,沒有進一步的回應或錯誤訊息。
## What Changes
### 1. 發文者顯示名稱
- 後端 API 在回傳訊息時加入 `sender_display_name` 欄位
-`tr_users` 表格 JOIN 取得 display_name
- 前端顯示 display_name 而非 sender_id
### 2. 統一時區為 GMT+8
- 前端建立時間格式化工具函數,統一轉換為 GMT+8
- 所有時間顯示使用該工具函數
- 後端維持 UTC 儲存(國際標準做法)
### 3. AI 報告生成問題修復
- 新增 DIFY API 連線測試端點
- 啟動時檢查 DIFY_API_KEY 是否設定
- 改善錯誤訊息顯示
- 前端新增輪詢機制確保狀態更新
## Impact
- **低風險**:不影響現有資料結構,僅新增欄位和修改顯示邏輯
- **向後相容**sender_display_name 為選填欄位,舊訊息會 fallback 顯示 sender_id
- **效能影響極小**:只增加一個 LEFT JOIN 查詢