James Ketrenos 9ce3d1b670 Implement comprehensive chat integration for voicebot system
Features added:
- WebSocket chat message handling in WebRTC signaling client
- Bot chat handler discovery and automatic setup
- Chat message sending/receiving capabilities
- Example chatbot with conversation features
- Enhanced whisper bot with chat commands
- Comprehensive error handling and logging
- Full integration with existing WebRTC infrastructure

Bots can now:
- Receive chat messages from lobby participants
- Send responses back through WebSocket
- Process commands and keywords
- Integrate seamlessly with voice/video functionality

Files modified:
- voicebot/webrtc_signaling.py: Added chat message handling
- voicebot/bot_orchestrator.py: Enhanced bot discovery for chat
- voicebot/bots/whisper.py: Added chat command processing
- voicebot/bots/chatbot.py: New conversational bot
- voicebot/bots/__init__.py: Added chatbot module
- CHAT_INTEGRATION.md: Comprehensive documentation
- README.md: Updated with chat functionality info
2025-09-03 16:28:32 -07:00
..

Shared Models

This directory contains shared Pydantic models used for API communication between the voicebot and server components.

Structure

  • models.py: Contains all shared Pydantic models organized into logical sections:
    • Core Data Models (persistence and API communication)
    • HTTP API Request/Response Models
    • WebSocket Message Models
    • WebRTC Signaling Models (specific to voicebot)
    • Data Persistence Models

Usage

Both the server/ and voicebot/ components import these shared models to ensure consistent data validation and type safety across the entire application.

In Server (server/main.py):

from shared.models import (
    SessionModel,
    LobbyCreateResponse,
    AdminActionResponse,
    # ... other models
)

In Voicebot (voicebot/main.py):

from shared.models import (
    WebSocketMessageModel,
    JoinStatusModel,
    LobbyStateModel,
    AddPeerModel,
    # ... other models
)

Benefits

  1. Consistency: Both components use the same data structures
  2. Type Safety: Pydantic validation prevents runtime errors
  3. Documentation: Models serve as living documentation of the API
  4. Maintainability: Changes to data structures only need to be made in one place
  5. Validation: Automatic validation of incoming/outgoing data

Model Categories

Core Data Models

  • LobbyModel: Core lobby structure
  • SessionModel: Core session structure
  • ParticipantModel: Participant information

HTTP API Models

  • AdminNamesResponse, AdminActionResponse: Admin endpoints
  • LobbiesResponse, SessionResponse: Lobby/session endpoints
  • LobbyCreateRequest, LobbyCreateResponse: Lobby creation

WebSocket Models

  • WebSocketMessageModel: Base WebSocket message structure
  • JoinStatusModel, UserJoinedModel: User events
  • LobbyStateModel: Lobby state updates
  • UpdateModel: Generic updates

WebRTC Signaling Models

  • AddPeerModel, RemovePeerModel: Peer management
  • SessionDescriptionModel: WebRTC session descriptions
  • IceCandidateModel: ICE candidate exchange