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:
@@ -262,3 +262,91 @@ The system SHALL track report generation status and notify users of completion v
|
||||
```
|
||||
- **AND** the error message SHALL be user-friendly (no technical details)
|
||||
|
||||
### Requirement: DIFY Service Health Check
|
||||
|
||||
The system SHALL provide a health check mechanism to verify DIFY AI service connectivity and configuration.
|
||||
|
||||
#### Scenario: Check DIFY configuration on startup
|
||||
- **WHEN** the application starts
|
||||
- **AND** `DIFY_API_KEY` is not configured
|
||||
- **THEN** the system SHALL log a warning message: "DIFY_API_KEY not configured - AI report generation will be unavailable"
|
||||
|
||||
#### Scenario: DIFY health check endpoint
|
||||
- **WHEN** a user sends `GET /api/reports/health`
|
||||
- **AND** `DIFY_API_KEY` is not configured
|
||||
- **THEN** the system SHALL return:
|
||||
```json
|
||||
{
|
||||
"status": "error",
|
||||
"message": "DIFY_API_KEY 未設定,請聯繫系統管理員"
|
||||
}
|
||||
```
|
||||
|
||||
#### Scenario: DIFY service unreachable
|
||||
- **WHEN** a user sends `GET /api/reports/health`
|
||||
- **AND** `DIFY_API_KEY` is configured
|
||||
- **BUT** the DIFY service cannot be reached
|
||||
- **THEN** the system SHALL return:
|
||||
```json
|
||||
{
|
||||
"status": "error",
|
||||
"message": "無法連接 AI 服務,請稍後再試"
|
||||
}
|
||||
```
|
||||
|
||||
### Requirement: Report Generation Status Polling
|
||||
|
||||
The frontend SHALL implement polling mechanism to ensure report status updates are received even if WebSocket connection is unstable.
|
||||
|
||||
#### Scenario: Poll report status after generation trigger
|
||||
- **WHEN** a user triggers report generation
|
||||
- **AND** receives the initial `report_id`
|
||||
- **THEN** the frontend SHALL poll `GET /api/rooms/{room_id}/reports/{report_id}` every 2 seconds
|
||||
- **AND** continue polling until status is "completed" or "failed"
|
||||
- **AND** timeout after 120 seconds with user-friendly error message
|
||||
|
||||
#### Scenario: Display generation progress
|
||||
- **WHEN** polling returns status "collecting_data"
|
||||
- **THEN** the UI SHALL display "正在收集聊天室資料..."
|
||||
- **WHEN** polling returns status "generating_content"
|
||||
- **THEN** the UI SHALL display "AI 正在分析並生成報告內容..."
|
||||
- **WHEN** polling returns status "assembling_document"
|
||||
- **THEN** the UI SHALL display "正在組裝報告文件..."
|
||||
|
||||
#### Scenario: Display generation error
|
||||
- **WHEN** polling returns status "failed"
|
||||
- **THEN** the UI SHALL display the `error_message` from the response
|
||||
- **AND** provide option to retry generation
|
||||
|
||||
### Requirement: Markdown Report Output
|
||||
The report generation system SHALL provide reports in Markdown format for in-page preview.
|
||||
|
||||
#### Scenario: Get report as Markdown
|
||||
- **WHEN** user requests `GET /api/rooms/{room_id}/reports/{report_id}/markdown`
|
||||
- **AND** the report status is `completed`
|
||||
- **THEN** the system returns the report content in Markdown format
|
||||
- **AND** the Markdown includes all report sections (summary, timeline, participants, etc.)
|
||||
|
||||
#### Scenario: Markdown includes metadata
|
||||
- **WHEN** generating Markdown output
|
||||
- **THEN** the output includes a metadata header with room info, LOT numbers, dates
|
||||
- **AND** the format is suitable for copy-paste to other platforms
|
||||
|
||||
### Requirement: In-Page Report Preview
|
||||
The frontend SHALL display a preview of the generated report within the chat room interface.
|
||||
|
||||
#### Scenario: Display report preview
|
||||
- **WHEN** user clicks on a completed report
|
||||
- **THEN** a modal or drawer opens showing the Markdown-rendered report
|
||||
- **AND** the preview includes proper formatting (headers, tables, lists)
|
||||
|
||||
#### Scenario: Copy Markdown content
|
||||
- **WHEN** user clicks "Copy Markdown" in the preview
|
||||
- **THEN** the raw Markdown text is copied to clipboard
|
||||
- **AND** a success toast notification is shown
|
||||
|
||||
#### Scenario: Download Word from preview
|
||||
- **WHEN** user clicks "Download Word" in the preview
|
||||
- **THEN** the .docx file is downloaded
|
||||
- **AND** the filename uses the report title
|
||||
|
||||
|
||||
Reference in New Issue
Block a user