Avatar System
System Overview
The Avatar System manages agent visual representation, voice configuration, and personality characteristics through a modular architecture built around three core components: Models, Manager, and Events.
Core Components
Models (core/avatar/models.py
)
core/avatar/models.py
)Avatar Class
Main configuration container for avatar properties:
AvatarPrompts Class
Container for different prompt types:
Manager (core/avatar/manager.py
)
core/avatar/manager.py
)The AvatarManager class handles avatar state and transitions:
Key Methods:
_load_avatars()
: Initializes avatars from configurationset_current_avatar(avatar_id)
: Changes active avatarget_current_avatar()
: Returns active avatar instanceget_next_avatar_id()
: Handles avatar rotationget_prompt(prompt_type)
: Retrieves specific prompts
Properties:
current_voice_id
: Active avatar's voice configurationcurrent_accent_color
: Active avatar's UI theme color
Events (core/avatar/events.py
)
core/avatar/events.py
)Observer pattern implementation for avatar state changes:
Configuration (config/avatar_config.py
)
config/avatar_config.py
)Avatar definitions are stored in AVATAR_CONFIGS dictionary:
Integration Points
Voice System
Links to voice_id for audio generation
Manages voice characteristic changes during avatar switches
UI Integration
Provides accent_color for theming
Manages avatar visual assets
Handles transitions between avatars
Event Handling
Notifies system components of avatar changes
Manages state synchronization across the application
Usage Example
Error Handling
The system includes comprehensive error handling:
Configuration loading failures
Missing avatar assets
Observer notification errors
Invalid avatar ID handling
Last updated