Files
egg 599802b818 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>
2025-12-08 08:20:37 +08:00

79 lines
3.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Change: Add LOT Field and Remove Room Templates
## Why
1. **模板功能未被使用**:前端 UI 未實作模板選擇功能,後端雖有完整實作但實際上無人使用。預設模板中的 email 地址(如 `maintenance_team@panjit.com.tw`)也不存在於實際 AD 系統中。
2. **需要追蹤 LOT 批號**:生產線異常事件需要記錄相關的 LOT批號資訊以便追蹤受影響的產品批次。一個事件可能涉及多個 LOT且 LOT 資訊需要在事件處理過程中可以新增或修改。
## What Changes
### 1. 移除 Room Templates 功能
**後端移除:**
- 刪除 `RoomTemplate` 模型 (`app/modules/chat_room/models.py`)
- 刪除 `template_service.py` (`app/modules/chat_room/services/template_service.py`)
- 移除 `app/main.py` 中的模板初始化代碼
- 移除 `app/modules/chat_room/router.py` 中的模板相關端點和邏輯
- 刪除 `tr_room_templates` 資料表Alembic migration
**前端移除:**
- 移除 `useRoomTemplates` hook
- 移除 `RoomTemplate` type 定義
- 移除 `roomsService.getTemplates()` 函數
### 2. 新增 LOT 欄位
**後端新增:**
-`IncidentRoom` 模型新增 `lots` 欄位JSON 陣列格式)
- 更新 `CreateRoomRequest``UpdateRoomRequest` schema 支援 lots
- 新增 `PUT /api/rooms/{room_id}/lots` 端點用於更新 LOT 清單
- Alembic migration 新增欄位
**前端新增:**
- 建立房間 modal 新增 LOT 輸入區(動態新增/刪除行)
- 房間詳情頁顯示和編輯 LOT 清單
- 更新相關 types 和 API 呼叫
### 3. UI 設計
LOT 輸入區:
```
LOT 批號(可選)
┌──────────────────────┐
│ LOT-2024-001 │ [x]
└──────────────────────┘
┌──────────────────────┐
│ LOT-2024-002 │ [x]
└──────────────────────┘
[+ 新增 LOT]
```
- 每行一個 LOT 輸入框
- 右側 [x] 按鈕可刪除該行
- 底部 [+ 新增 LOT] 按鈕新增空白行
- LOT 欄位為選填
## Impact
- **Affected specs**: `chat-room` (移除 Room Templates 需求,新增 LOT 需求)
- **Affected code**:
- `app/modules/chat_room/models.py` - 移除 RoomTemplate新增 lots 欄位
- `app/modules/chat_room/services/template_service.py` - 刪除
- `app/modules/chat_room/services/__init__.py` - 移除 template_service 匯出
- `app/modules/chat_room/router.py` - 移除模板端點,新增 LOT 端點
- `app/modules/chat_room/schemas.py` - 新增 lots 欄位
- `app/main.py` - 移除模板初始化
- `frontend/src/types/index.ts` - 移除 RoomTemplate新增 lots
- `frontend/src/hooks/useRooms.ts` - 移除 useRoomTemplates
- `frontend/src/services/rooms.ts` - 移除 getTemplates新增 updateLots
- `frontend/src/pages/RoomList.tsx` - 移除模板引用,新增 LOT 輸入
- `frontend/src/pages/RoomDetail.tsx` - 新增 LOT 顯示和編輯
- **Breaking changes**:
- 移除 `GET /api/rooms/templates` 端點
- 移除 `POST /api/rooms``template` 參數支援
- 刪除 `tr_room_templates` 資料表
- **Database migration**:
- 刪除 `tr_room_templates` 資料表
- 新增 `lots` 欄位到 `tr_incident_rooms` 資料表