Implement persona generation system with platform-specific adaptations

Co-authored-by: ajay.calsoft <ajay.calsoft@gmail.com>
This commit is contained in:
Cursor Agent
2025-08-31 08:26:51 +00:00
parent 1e0a13e204
commit 7dbebd45eb
19 changed files with 4417 additions and 2 deletions

View File

@@ -13,6 +13,7 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from services.database import engine
from models.enhanced_strategy_models import Base as EnhancedStrategyBase
from models.monitoring_models import Base as MonitoringBase
from models.persona_models import Base as PersonaBase
from loguru import logger
def create_all_tables():
@@ -30,6 +31,11 @@ def create_all_tables():
MonitoringBase.metadata.create_all(bind=engine)
logger.info("✅ Monitoring tables created!")
# Step 3: Create persona tables
logger.info("Step 3: Creating persona tables...")
PersonaBase.metadata.create_all(bind=engine)
logger.info("✅ Persona tables created!")
logger.info("✅ All tables created successfully!")
except Exception as e:

View File

@@ -0,0 +1,53 @@
#!/usr/bin/env python3
"""
Script to create persona database tables.
This script creates the new persona-related tables for storing writing personas.
"""
import sys
import os
# Add the backend directory to the Python path
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from services.database import engine
from models.persona_models import Base as PersonaBase
from loguru import logger
def create_persona_tables():
"""Create all persona-related tables"""
try:
logger.info("Creating persona database tables...")
# Create persona tables
logger.info("Creating persona tables...")
PersonaBase.metadata.create_all(bind=engine)
logger.info("✅ Persona tables created!")
logger.info("✅ All persona tables created successfully!")
# Verify tables were created
from sqlalchemy import inspect
inspector = inspect(engine)
tables = inspector.get_table_names()
persona_tables = [
'writing_personas',
'platform_personas',
'persona_analysis_results',
'persona_validation_results'
]
created_tables = [table for table in persona_tables if table in tables]
logger.info(f"✅ Verified tables created: {created_tables}")
if len(created_tables) != len(persona_tables):
missing = [table for table in persona_tables if table not in created_tables]
logger.warning(f"⚠️ Missing tables: {missing}")
except Exception as e:
logger.error(f"❌ Error creating persona tables: {e}")
sys.exit(1)
if __name__ == "__main__":
create_persona_tables()