140 lines
4.1 KiB
Python
140 lines
4.1 KiB
Python
"""Example: Using the Admin Control Panel for FusionAGI management."""
|
|
|
|
from fusionagi import Orchestrator, EventBus, StateManager
|
|
from fusionagi.interfaces.admin_panel import AdminControlPanel
|
|
from fusionagi.interfaces.voice import VoiceLibrary, VoiceProfile
|
|
from fusionagi.interfaces.conversation import ConversationTuner, ConversationStyle
|
|
|
|
|
|
def main() -> None:
|
|
"""Demonstrate admin control panel usage."""
|
|
|
|
# Initialize core FusionAGI components
|
|
bus = EventBus()
|
|
state = StateManager()
|
|
orch = Orchestrator(event_bus=bus, state_manager=state)
|
|
|
|
# Create admin control panel
|
|
admin = AdminControlPanel(
|
|
orchestrator=orch,
|
|
event_bus=bus,
|
|
state_manager=state,
|
|
voice_library=VoiceLibrary(),
|
|
conversation_tuner=ConversationTuner(),
|
|
)
|
|
|
|
print("=== FusionAGI Admin Control Panel ===\n")
|
|
|
|
# ========== Voice Library Management ==========
|
|
print("1. Adding Voice Profiles...")
|
|
|
|
voices = [
|
|
VoiceProfile(
|
|
name="Professional Assistant",
|
|
language="en-US",
|
|
gender="neutral",
|
|
style="professional",
|
|
pitch=1.0,
|
|
speed=1.0,
|
|
),
|
|
VoiceProfile(
|
|
name="Friendly Guide",
|
|
language="en-US",
|
|
gender="female",
|
|
style="friendly",
|
|
pitch=1.1,
|
|
speed=1.05,
|
|
),
|
|
VoiceProfile(
|
|
name="Technical Expert",
|
|
language="en-US",
|
|
gender="male",
|
|
style="technical",
|
|
pitch=0.9,
|
|
speed=0.95,
|
|
),
|
|
]
|
|
|
|
for voice in voices:
|
|
voice_id = admin.add_voice_profile(voice)
|
|
print(f" ✓ Added voice: {voice.name} (ID: {voice_id[:8]}...)")
|
|
|
|
# Set default voice
|
|
admin.set_default_voice(voices[0].id)
|
|
print(f" ✓ Default voice set to: {voices[0].name}\n")
|
|
|
|
# List voices
|
|
all_voices = admin.list_voices()
|
|
print(f"Total voices in library: {len(all_voices)}\n")
|
|
|
|
# ========== Conversation Style Configuration ==========
|
|
print("2. Configuring Conversation Styles...")
|
|
|
|
styles = {
|
|
"customer_support": ConversationStyle(
|
|
formality="neutral",
|
|
verbosity="balanced",
|
|
empathy_level=0.9,
|
|
proactivity=0.8,
|
|
technical_depth=0.4,
|
|
humor_level=0.3,
|
|
),
|
|
"technical_expert": ConversationStyle(
|
|
formality="formal",
|
|
verbosity="detailed",
|
|
empathy_level=0.5,
|
|
proactivity=0.6,
|
|
technical_depth=0.9,
|
|
humor_level=0.1,
|
|
),
|
|
"casual_chat": ConversationStyle(
|
|
formality="casual",
|
|
verbosity="balanced",
|
|
empathy_level=0.8,
|
|
proactivity=0.5,
|
|
technical_depth=0.3,
|
|
humor_level=0.7,
|
|
),
|
|
}
|
|
|
|
for name, style in styles.items():
|
|
admin.register_conversation_style(name, style)
|
|
print(f" ✓ Registered style: {name}")
|
|
|
|
print()
|
|
|
|
# ========== System Monitoring ==========
|
|
print("3. System Status...")
|
|
|
|
status = admin.get_system_status()
|
|
print(f" Status: {status.status}")
|
|
print(f" Uptime: {status.uptime_seconds:.1f} seconds")
|
|
print(f" Active tasks: {status.active_tasks}")
|
|
print(f" Active agents: {status.active_agents}")
|
|
print()
|
|
|
|
# ========== Configuration Export ==========
|
|
print("4. Exporting Configuration...")
|
|
|
|
config = admin.export_configuration()
|
|
print(f" ✓ Exported configuration with:")
|
|
print(f" - {len(config['voices'])} voice profiles")
|
|
print(f" - {len(config['conversation_styles'])} conversation styles")
|
|
print(f" - {len(config['agent_configs'])} agent configurations")
|
|
print()
|
|
|
|
# ========== Task Statistics ==========
|
|
print("5. Task Statistics...")
|
|
|
|
stats = admin.get_task_statistics()
|
|
print(f" Total tasks: {stats['total_tasks']}")
|
|
print(f" By state: {stats['by_state']}")
|
|
print(f" By priority: {stats['by_priority']}")
|
|
print()
|
|
|
|
print("=== Admin Panel Demo Complete ===")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|