Core Features: - Full autonomous AI character ecosystem with multi-personality support - Advanced RAG system with personal, community, and creative memory layers - MCP integration for character self-modification and file system access - PostgreSQL database with comprehensive character relationship tracking - Redis caching and ChromaDB vector storage for semantic memory retrieval - Dynamic personality evolution based on interactions and self-reflection - Community knowledge management with tradition and norm identification - Sophisticated conversation engine with natural scheduling and topic management - Docker containerization and production-ready deployment configuration Architecture: - Multi-layer vector databases for personal, community, and creative knowledge - Character file systems with personal and shared digital spaces - Autonomous self-modification with safety validation and audit trails - Memory importance scoring with time-based decay and consolidation - Community health monitoring and cultural evolution tracking - RAG-powered conversation context and relationship optimization Characters can: - Develop authentic personalities through experience-based learning - Create and build upon original creative works and philosophical insights - Form complex relationships with memory of past interactions - Modify their own personality traits through self-reflection cycles - Contribute to and learn from shared community knowledge - Manage personal digital spaces with diaries, creative works, and reflections - Engage in collaborative projects and community decision-making System supports indefinite autonomous operation with continuous character development, community culture evolution, and creative collaboration.
78 lines
2.6 KiB
Python
78 lines
2.6 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Initialize characters in the database from configuration
|
|
"""
|
|
|
|
import asyncio
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
# Add src to Python path
|
|
sys.path.insert(0, str(Path(__file__).parent.parent / "src"))
|
|
|
|
from database.connection import init_database, get_db_session
|
|
from database.models import Character
|
|
from utils.config import get_character_settings
|
|
from utils.logging import setup_logging
|
|
from sqlalchemy import select
|
|
import logging
|
|
|
|
logger = setup_logging()
|
|
|
|
async def init_characters():
|
|
"""Initialize characters from configuration"""
|
|
try:
|
|
logger.info("Initializing database connection...")
|
|
await init_database()
|
|
|
|
logger.info("Loading character configuration...")
|
|
character_settings = get_character_settings()
|
|
|
|
async with get_db_session() as session:
|
|
for char_config in character_settings.characters:
|
|
# Check if character already exists
|
|
query = select(Character).where(Character.name == char_config.name)
|
|
existing = await session.scalar(query)
|
|
|
|
if existing:
|
|
logger.info(f"Character '{char_config.name}' already exists, skipping...")
|
|
continue
|
|
|
|
# Create system prompt
|
|
system_prompt = f"""You are {char_config.name}.
|
|
|
|
Personality: {char_config.personality}
|
|
|
|
Speaking Style: {char_config.speaking_style}
|
|
|
|
Background: {char_config.background}
|
|
|
|
Interests: {', '.join(char_config.interests)}
|
|
|
|
Always respond as {char_config.name}, staying true to your personality and speaking style.
|
|
Be natural, engaging, and authentic in all your interactions."""
|
|
|
|
# Create character
|
|
character = Character(
|
|
name=char_config.name,
|
|
personality=char_config.personality,
|
|
system_prompt=system_prompt,
|
|
interests=char_config.interests,
|
|
speaking_style=char_config.speaking_style,
|
|
background=char_config.background,
|
|
avatar_url=char_config.avatar_url or "",
|
|
is_active=True
|
|
)
|
|
|
|
session.add(character)
|
|
logger.info(f"Created character: {char_config.name}")
|
|
|
|
await session.commit()
|
|
logger.info("✅ Character initialization completed successfully!")
|
|
|
|
except Exception as e:
|
|
logger.error(f"Failed to initialize characters: {e}")
|
|
raise
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(init_characters()) |