feat: Add AI chat conversation history UI
Implemented full conversation management interface with the following features: - Conversation history sidebar (desktop) / drawer (mobile) - Load and display all user conversations - Click to load specific conversation - "New Chat" button to start fresh conversation - Delete conversation with confirmation dialog - Persist conversationId across messages in same conversation - Responsive design with Material-UI breakpoints Technical Details: - Added Conversation interface and state management (lines 107-111) - Load conversations from GET /api/v1/ai/conversations on mount - Load specific conversation from GET /api/v1/ai/conversations/:id - Delete conversation via DELETE /api/v1/ai/conversations/:id - Updated handleSend() to pass currentConversationId instead of null - Auto-update conversationId from API response for new conversations - Mobile: Hamburger menu to open drawer - Desktop: Fixed 320px sidebar with conversation list Component grew from 420 → 663 lines 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -41,6 +41,7 @@ This document identifies features specified in the documentation that are not ye
|
||||
- ✅ **LangChain Context Management** (October 2, 2025): 4000 token budget with priority weighting, automatic context pruning
|
||||
- ✅ **Conversation Memory** (October 2, 2025): Semantic search with embeddings, conversation summarization, memory retrieval
|
||||
- ✅ **Multi-Language AI** (October 2, 2025): 5 languages (en/es/fr/pt/zh) with localized prompts and safety responses
|
||||
- ✅ **AI Chat Conversation History** (October 2, 2025): Full conversation management UI with sidebar, conversation switching, deletion, and persistence
|
||||
|
||||
### Key Gaps Identified
|
||||
- **Backend**: 35 features not implemented (19 completed ✅)
|
||||
@@ -273,7 +274,45 @@ This document identifies features specified in the documentation that are not ye
|
||||
- Priority: Medium ✅ **COMPLETE**
|
||||
- Impact: International user support achieved
|
||||
|
||||
5. **Prompt Injection Protection** ✅ COMPLETED (Previously)
|
||||
5. **AI Chat Conversation History UI** ✅ COMPLETED (October 2, 2025)
|
||||
- Status: **IMPLEMENTED**
|
||||
- Current: Full conversation management interface with sidebar, switching, and deletion
|
||||
- Implemented:
|
||||
* **Conversation State Management** (AIChatInterface.tsx:107-111):
|
||||
- Tracks conversations list from API
|
||||
- Maintains currentConversationId state
|
||||
- Mobile drawer and delete dialog state
|
||||
* **Load Conversations** (AIChatInterface.tsx:157-164):
|
||||
- Fetches all user conversations on component mount
|
||||
- Displays conversation history in sidebar/drawer
|
||||
* **Load Conversation** (AIChatInterface.tsx:166-187):
|
||||
- Loads specific conversation messages by ID
|
||||
- Converts API format to Message[] format
|
||||
- Auto-closes drawer on mobile after selection
|
||||
* **New Conversation** (AIChatInterface.tsx:189-195):
|
||||
- Clears current messages
|
||||
- Resets conversationId to null for fresh chat
|
||||
* **Delete Conversation** (AIChatInterface.tsx:197-215):
|
||||
- Delete confirmation dialog
|
||||
- API call to DELETE /api/v1/ai/conversations/:id
|
||||
- Starts new conversation if deleting current one
|
||||
- Reloads conversation list after deletion
|
||||
* **Updated Chat Flow** (AIChatInterface.tsx:217-252):
|
||||
- Passes currentConversationId in POST /api/v1/ai/chat
|
||||
- Updates conversationId from API response for new chats
|
||||
- Reloads conversation list after each message
|
||||
* **Responsive UI**:
|
||||
- Desktop: 320px sidebar with conversation list
|
||||
- Mobile: Drawer with hamburger menu icon
|
||||
- Conversation list shows title, date, delete icon
|
||||
- Selected conversation highlighted
|
||||
- "New Chat" button at top of sidebar
|
||||
- Files: `maternal-web/components/features/ai-chat/AIChatInterface.tsx` (420 → 663 lines)
|
||||
- Backend APIs Used: GET /api/v1/ai/conversations, GET /api/v1/ai/conversations/:id, DELETE /api/v1/ai/conversations/:id
|
||||
- Priority: Medium ✅ **COMPLETE**
|
||||
- Impact: Users can access chat history, switch conversations, and manage past conversations
|
||||
|
||||
6. **Prompt Injection Protection** ✅ COMPLETED (Previously)
|
||||
- Status: **IMPLEMENTED**
|
||||
- Current: Comprehensive security system with 25+ regex patterns
|
||||
- Implemented: System manipulation detection, role change blocking, data exfiltration prevention, sanitizeInput() called in chat flow (ai.service.ts:193)
|
||||
|
||||
Reference in New Issue
Block a user