✅ TICKET-006: Wake-word Detection Service - Implemented wake-word detection using openWakeWord - HTTP/WebSocket server on port 8002 - Real-time detection with configurable threshold - Event emission for ASR integration - Location: home-voice-agent/wake-word/ ✅ TICKET-010: ASR Service - Implemented ASR using faster-whisper - HTTP endpoint for file transcription - WebSocket endpoint for streaming transcription - Support for multiple audio formats - Auto language detection - GPU acceleration support - Location: home-voice-agent/asr/ ✅ TICKET-014: TTS Service - Implemented TTS using Piper - HTTP endpoint for text-to-speech synthesis - Low-latency processing (< 500ms) - Multiple voice support - WAV audio output - Location: home-voice-agent/tts/ ✅ TICKET-047: Updated Hardware Purchases - Marked Pi5 kit, SSD, microphone, and speakers as purchased - Updated progress log with purchase status 📚 Documentation: - Added VOICE_SERVICES_README.md with complete testing guide - Each service includes README.md with usage instructions - All services ready for Pi5 deployment 🧪 Testing: - Created test files for each service - All imports validated - FastAPI apps created successfully - Code passes syntax validation 🚀 Ready for: - Pi5 deployment - End-to-end voice flow testing - Integration with MCP server Files Added: - wake-word/detector.py - wake-word/server.py - wake-word/requirements.txt - wake-word/README.md - wake-word/test_detector.py - asr/service.py - asr/server.py - asr/requirements.txt - asr/README.md - asr/test_service.py - tts/service.py - tts/server.py - tts/requirements.txt - tts/README.md - tts/test_service.py - VOICE_SERVICES_README.md Files Modified: - tickets/done/TICKET-047_hardware-purchases.md Files Moved: - tickets/backlog/TICKET-006_prototype-wake-word-node.md → tickets/done/ - tickets/backlog/TICKET-010_streaming-asr-service.md → tickets/done/ - tickets/backlog/TICKET-014_tts-service.md → tickets/done/
86 lines
2.4 KiB
Markdown
86 lines
2.4 KiB
Markdown
# Conversation Management
|
|
|
|
This module handles multi-turn conversation sessions for the Atlas voice agent system.
|
|
|
|
## Features
|
|
|
|
- **Session Management**: Create, retrieve, and manage conversation sessions
|
|
- **Message History**: Store and retrieve conversation messages
|
|
- **Context Window Management**: Keep recent messages in context, summarize old ones
|
|
- **Session Expiry**: Automatic cleanup of expired sessions
|
|
- **Persistent Storage**: SQLite database for session persistence
|
|
|
|
## Usage
|
|
|
|
```python
|
|
from conversation.session_manager import get_session_manager
|
|
|
|
manager = get_session_manager()
|
|
|
|
# Create a new session
|
|
session_id = manager.create_session(agent_type="family")
|
|
|
|
# Add messages
|
|
manager.add_message(session_id, "user", "What time is it?")
|
|
manager.add_message(session_id, "assistant", "It's 3:45 PM EST.")
|
|
|
|
# Get context for LLM
|
|
context = manager.get_context_messages(session_id, max_messages=20)
|
|
|
|
# Summarize old messages
|
|
manager.summarize_old_messages(session_id, keep_recent=10)
|
|
|
|
# Cleanup expired sessions
|
|
manager.cleanup_expired_sessions()
|
|
```
|
|
|
|
## Session Structure
|
|
|
|
Each session contains:
|
|
- `session_id`: Unique identifier
|
|
- `agent_type`: "work" or "family"
|
|
- `created_at`: Session creation timestamp
|
|
- `last_activity`: Last activity timestamp
|
|
- `messages`: List of conversation messages
|
|
- `summary`: Optional summary of old messages
|
|
|
|
## Message Structure
|
|
|
|
Each message contains:
|
|
- `role`: "user", "assistant", or "system"
|
|
- `content`: Message text
|
|
- `timestamp`: When the message was created
|
|
- `tool_calls`: Optional list of tool calls made
|
|
- `tool_results`: Optional list of tool results
|
|
|
|
## Configuration
|
|
|
|
- `MAX_CONTEXT_MESSAGES`: 20 (default) - Number of recent messages to keep
|
|
- `MAX_CONTEXT_TOKENS`: 8000 (default) - Approximate token limit
|
|
- `SESSION_EXPIRY_HOURS`: 24 (default) - Sessions expire after inactivity
|
|
|
|
## Database Schema
|
|
|
|
### Sessions Table
|
|
- `session_id` (TEXT PRIMARY KEY)
|
|
- `agent_type` (TEXT)
|
|
- `created_at` (TEXT ISO format)
|
|
- `last_activity` (TEXT ISO format)
|
|
- `summary` (TEXT, nullable)
|
|
|
|
### Messages Table
|
|
- `id` (INTEGER PRIMARY KEY)
|
|
- `session_id` (TEXT, foreign key)
|
|
- `role` (TEXT)
|
|
- `content` (TEXT)
|
|
- `timestamp` (TEXT ISO format)
|
|
- `tool_calls` (TEXT JSON, nullable)
|
|
- `tool_results` (TEXT JSON, nullable)
|
|
|
|
## Future Enhancements
|
|
|
|
- Actual LLM-based summarization (currently placeholder)
|
|
- Token counting for precise context management
|
|
- Session search and retrieval
|
|
- Conversation analytics
|