ALwrity version 0.5.6
This commit is contained in:
@@ -9,7 +9,7 @@ from datetime import datetime
|
||||
from loguru import logger
|
||||
|
||||
# Import route modules
|
||||
from .routes import strategies, calendar_events, gap_analysis, ai_analytics, calendar_generation, health_monitoring
|
||||
from .routes import strategies, calendar_events, gap_analysis, ai_analytics, calendar_generation, health_monitoring, monitoring
|
||||
|
||||
# Import enhanced strategy routes
|
||||
from .enhanced_strategy_routes import router as enhanced_strategy_router
|
||||
@@ -17,9 +17,6 @@ from .enhanced_strategy_routes import router as enhanced_strategy_router
|
||||
# Import content strategy routes
|
||||
from .content_strategy.routes import router as content_strategy_router
|
||||
|
||||
# Import monitoring routes
|
||||
from ..monitoring_routes import router as monitoring_router
|
||||
|
||||
# Import quality analysis routes
|
||||
from ..quality_analysis_routes import router as quality_analysis_router
|
||||
|
||||
@@ -33,6 +30,7 @@ router.include_router(gap_analysis.router)
|
||||
router.include_router(ai_analytics.router)
|
||||
router.include_router(calendar_generation.router)
|
||||
router.include_router(health_monitoring.router)
|
||||
router.include_router(monitoring.router)
|
||||
|
||||
# Include enhanced strategy routes with correct prefix
|
||||
router.include_router(enhanced_strategy_router, prefix="/enhanced-strategies")
|
||||
@@ -40,9 +38,6 @@ router.include_router(enhanced_strategy_router, prefix="/enhanced-strategies")
|
||||
# Include content strategy routes
|
||||
router.include_router(content_strategy_router)
|
||||
|
||||
# Include monitoring routes
|
||||
router.include_router(monitoring_router)
|
||||
|
||||
# Include quality analysis routes
|
||||
router.include_router(quality_analysis_router)
|
||||
|
||||
@@ -67,6 +62,7 @@ async def content_planning_health_check():
|
||||
"ai_analytics": "operational",
|
||||
"calendar_generation": "operational",
|
||||
"health_monitoring": "operational",
|
||||
"monitoring": "operational",
|
||||
"enhanced_strategies": "operational",
|
||||
"models": "operational",
|
||||
"utils": "operational"
|
||||
|
||||
@@ -9,6 +9,8 @@ from typing import Dict, Any, List, Optional
|
||||
from datetime import datetime
|
||||
from loguru import logger
|
||||
import time
|
||||
import asyncio
|
||||
import random
|
||||
|
||||
# Import database service
|
||||
from services.database import get_db_session, get_db
|
||||
@@ -32,24 +34,26 @@ from ...utils.response_builders import ResponseBuilder
|
||||
from ...utils.constants import ERROR_MESSAGES, SUCCESS_MESSAGES
|
||||
|
||||
# Import services
|
||||
from services.calendar_generator_service import CalendarGeneratorService
|
||||
from ...services.calendar_generation_service import CalendarGenerationService
|
||||
|
||||
# Initialize services
|
||||
calendar_generation_service = CalendarGenerationService()
|
||||
|
||||
# Create router
|
||||
router = APIRouter(prefix="/calendar-generation", tags=["calendar-generation"])
|
||||
|
||||
@router.post("/generate-calendar", response_model=CalendarGenerationResponse)
|
||||
async def generate_comprehensive_calendar(request: CalendarGenerationRequest):
|
||||
async def generate_comprehensive_calendar(request: CalendarGenerationRequest, db: Session = Depends(get_db)):
|
||||
"""
|
||||
Generate a comprehensive AI-powered content calendar using database insights.
|
||||
This endpoint uses advanced AI analysis and comprehensive user data.
|
||||
Now ensures Phase 1 and Phase 2 use the ACTIVE strategy with 3-tier caching.
|
||||
"""
|
||||
try:
|
||||
logger.info(f"🎯 Generating comprehensive calendar for user {request.user_id}")
|
||||
|
||||
calendar_data = await calendar_generation_service.generate_comprehensive_calendar(
|
||||
# Initialize service with database session for active strategy access
|
||||
calendar_service = CalendarGenerationService(db)
|
||||
|
||||
calendar_data = await calendar_service.generate_comprehensive_calendar(
|
||||
user_id=request.user_id,
|
||||
strategy_id=request.strategy_id,
|
||||
calendar_type=request.calendar_type,
|
||||
@@ -70,7 +74,7 @@ async def generate_comprehensive_calendar(request: CalendarGenerationRequest):
|
||||
)
|
||||
|
||||
@router.post("/optimize-content", response_model=ContentOptimizationResponse)
|
||||
async def optimize_content_for_platform(request: ContentOptimizationRequest):
|
||||
async def optimize_content_for_platform(request: ContentOptimizationRequest, db: Session = Depends(get_db)):
|
||||
"""
|
||||
Optimize content for specific platforms using database insights.
|
||||
|
||||
@@ -79,11 +83,15 @@ async def optimize_content_for_platform(request: ContentOptimizationRequest):
|
||||
- Audience preferences from onboarding data
|
||||
- Gap analysis insights for content improvement
|
||||
- Competitor analysis for differentiation
|
||||
- Active strategy data for optimal alignment
|
||||
"""
|
||||
try:
|
||||
logger.info(f"🔧 Starting content optimization for user {request.user_id}")
|
||||
|
||||
result = await calendar_generation_service.optimize_content_for_platform(
|
||||
# Initialize service with database session for active strategy access
|
||||
calendar_service = CalendarGenerationService(db)
|
||||
|
||||
result = await calendar_service.optimize_content_for_platform(
|
||||
user_id=request.user_id,
|
||||
title=request.title,
|
||||
description=request.description,
|
||||
@@ -104,7 +112,7 @@ async def optimize_content_for_platform(request: ContentOptimizationRequest):
|
||||
)
|
||||
|
||||
@router.post("/performance-predictions", response_model=PerformancePredictionResponse)
|
||||
async def predict_content_performance(request: PerformancePredictionRequest):
|
||||
async def predict_content_performance(request: PerformancePredictionRequest, db: Session = Depends(get_db)):
|
||||
"""
|
||||
Predict content performance using database insights.
|
||||
|
||||
@@ -117,7 +125,10 @@ async def predict_content_performance(request: PerformancePredictionRequest):
|
||||
try:
|
||||
logger.info(f"📊 Starting performance prediction for user {request.user_id}")
|
||||
|
||||
result = await calendar_generation_service.predict_content_performance(
|
||||
# Initialize service with database session for active strategy access
|
||||
calendar_service = CalendarGenerationService(db)
|
||||
|
||||
result = await calendar_service.predict_content_performance(
|
||||
user_id=request.user_id,
|
||||
content_type=request.content_type,
|
||||
platform=request.platform,
|
||||
@@ -135,7 +146,7 @@ async def predict_content_performance(request: PerformancePredictionRequest):
|
||||
)
|
||||
|
||||
@router.post("/repurpose-content", response_model=ContentRepurposingResponse)
|
||||
async def repurpose_content_across_platforms(request: ContentRepurposingRequest):
|
||||
async def repurpose_content_across_platforms(request: ContentRepurposingRequest, db: Session = Depends(get_db)):
|
||||
"""
|
||||
Repurpose content across different platforms using database insights.
|
||||
|
||||
@@ -148,7 +159,10 @@ async def repurpose_content_across_platforms(request: ContentRepurposingRequest)
|
||||
try:
|
||||
logger.info(f"🔄 Starting content repurposing for user {request.user_id}")
|
||||
|
||||
result = await calendar_generation_service.repurpose_content_across_platforms(
|
||||
# Initialize service with database session for active strategy access
|
||||
calendar_service = CalendarGenerationService(db)
|
||||
|
||||
result = await calendar_service.repurpose_content_across_platforms(
|
||||
user_id=request.user_id,
|
||||
original_content=request.original_content,
|
||||
target_platforms=request.target_platforms,
|
||||
@@ -168,7 +182,8 @@ async def repurpose_content_across_platforms(request: ContentRepurposingRequest)
|
||||
async def get_trending_topics(
|
||||
user_id: int = Query(..., description="User ID"),
|
||||
industry: str = Query(..., description="Industry for trending topics"),
|
||||
limit: int = Query(10, description="Number of trending topics to return")
|
||||
limit: int = Query(10, description="Number of trending topics to return"),
|
||||
db: Session = Depends(get_db)
|
||||
):
|
||||
"""
|
||||
Get trending topics relevant to the user's industry and content gaps.
|
||||
@@ -182,7 +197,10 @@ async def get_trending_topics(
|
||||
try:
|
||||
logger.info(f"📈 Getting trending topics for user {user_id} in {industry}")
|
||||
|
||||
result = await calendar_generation_service.get_trending_topics(
|
||||
# Initialize service with database session for active strategy access
|
||||
calendar_service = CalendarGenerationService(db)
|
||||
|
||||
result = await calendar_service.get_trending_topics(
|
||||
user_id=user_id,
|
||||
industry=industry,
|
||||
limit=limit
|
||||
@@ -200,18 +218,41 @@ async def get_trending_topics(
|
||||
@router.get("/comprehensive-user-data")
|
||||
async def get_comprehensive_user_data(
|
||||
user_id: int = Query(..., description="User ID"),
|
||||
force_refresh: bool = Query(False, description="Force refresh cache"),
|
||||
db: Session = Depends(get_db)
|
||||
) -> Dict[str, Any]:
|
||||
"""
|
||||
Get comprehensive user data for calendar generation.
|
||||
Get comprehensive user data for calendar generation with intelligent caching.
|
||||
This endpoint aggregates all data points needed for the calendar wizard.
|
||||
"""
|
||||
try:
|
||||
logger.info(f"Getting comprehensive user data for user_id: {user_id}")
|
||||
logger.info(f"Getting comprehensive user data for user_id: {user_id} (force_refresh={force_refresh})")
|
||||
|
||||
result = await calendar_generation_service.get_comprehensive_user_data(user_id)
|
||||
# Initialize cache service
|
||||
from services.comprehensive_user_data_cache_service import ComprehensiveUserDataCacheService
|
||||
cache_service = ComprehensiveUserDataCacheService(db)
|
||||
|
||||
logger.info(f"Successfully retrieved comprehensive user data for user_id: {user_id}")
|
||||
# Get data with caching
|
||||
data, is_cached = await cache_service.get_cached_data(
|
||||
user_id, None, force_refresh=force_refresh
|
||||
)
|
||||
|
||||
if not data:
|
||||
raise HTTPException(status_code=500, detail="Failed to retrieve user data")
|
||||
|
||||
# Add cache metadata to response
|
||||
result = {
|
||||
"status": "success",
|
||||
"data": data,
|
||||
"cache_info": {
|
||||
"is_cached": is_cached,
|
||||
"force_refresh": force_refresh,
|
||||
"timestamp": datetime.utcnow().isoformat()
|
||||
},
|
||||
"message": f"Comprehensive user data retrieved successfully (cache: {'HIT' if is_cached else 'MISS'})"
|
||||
}
|
||||
|
||||
logger.info(f"Successfully retrieved comprehensive user data for user_id: {user_id} (cache: {'HIT' if is_cached else 'MISS'})")
|
||||
return result
|
||||
|
||||
except Exception as e:
|
||||
@@ -225,14 +266,17 @@ async def get_comprehensive_user_data(
|
||||
)
|
||||
|
||||
@router.get("/health")
|
||||
async def calendar_generation_health_check():
|
||||
async def calendar_generation_health_check(db: Session = Depends(get_db)):
|
||||
"""
|
||||
Health check for calendar generation services.
|
||||
"""
|
||||
try:
|
||||
logger.info("🏥 Performing calendar generation health check")
|
||||
|
||||
result = await calendar_generation_service.health_check()
|
||||
# Initialize service with database session for active strategy access
|
||||
calendar_service = CalendarGenerationService(db)
|
||||
|
||||
result = await calendar_service.health_check()
|
||||
|
||||
logger.info("✅ Calendar generation health check completed")
|
||||
return result
|
||||
@@ -245,3 +289,150 @@ async def calendar_generation_health_check():
|
||||
"timestamp": datetime.utcnow().isoformat(),
|
||||
"error": str(e)
|
||||
}
|
||||
|
||||
@router.get("/progress/{session_id}")
|
||||
async def get_calendar_generation_progress(session_id: str, db: Session = Depends(get_db)):
|
||||
"""
|
||||
Get real-time progress of calendar generation for a specific session.
|
||||
This endpoint is polled by the frontend modal to show progress updates.
|
||||
"""
|
||||
try:
|
||||
# Initialize service with database session for active strategy access
|
||||
calendar_service = CalendarGenerationService(db)
|
||||
|
||||
# Get progress from the calendar generator service
|
||||
progress = calendar_service.calendar_generator_service.get_generation_progress(session_id)
|
||||
|
||||
if not progress:
|
||||
raise HTTPException(status_code=404, detail="Session not found")
|
||||
|
||||
return {
|
||||
"session_id": session_id,
|
||||
"status": progress.get("status", "initializing"),
|
||||
"current_step": progress.get("current_step", 0),
|
||||
"step_progress": progress.get("step_progress", 0),
|
||||
"overall_progress": progress.get("overall_progress", 0),
|
||||
"step_results": progress.get("step_results", {}),
|
||||
"quality_scores": progress.get("quality_scores", {}),
|
||||
"transparency_messages": progress.get("transparency_messages", []),
|
||||
"educational_content": progress.get("educational_content", []),
|
||||
"errors": progress.get("errors", []),
|
||||
"warnings": progress.get("warnings", []),
|
||||
"estimated_completion": progress.get("estimated_completion"),
|
||||
"last_updated": progress.get("last_updated")
|
||||
}
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting calendar generation progress: {str(e)}")
|
||||
raise HTTPException(status_code=500, detail="Failed to get progress")
|
||||
|
||||
@router.post("/start")
|
||||
async def start_calendar_generation(request: CalendarGenerationRequest, db: Session = Depends(get_db)):
|
||||
"""
|
||||
Start calendar generation and return a session ID for progress tracking.
|
||||
"""
|
||||
try:
|
||||
# Initialize service with database session for active strategy access
|
||||
calendar_service = CalendarGenerationService(db)
|
||||
|
||||
# Generate a unique session ID
|
||||
session_id = f"calendar-session-{int(time.time())}-{random.randint(1000, 9999)}"
|
||||
|
||||
# Initialize progress tracking
|
||||
calendar_service.calendar_generator_service.initialize_generation_session(session_id, request.dict())
|
||||
|
||||
# Start the generation process asynchronously
|
||||
# This will run in the background while the frontend polls for progress
|
||||
asyncio.create_task(calendar_service.calendar_generator_service.generate_calendar_async(session_id, request.dict()))
|
||||
|
||||
return {
|
||||
"session_id": session_id,
|
||||
"status": "started",
|
||||
"message": "Calendar generation started successfully",
|
||||
"estimated_duration": "2-3 minutes"
|
||||
}
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error starting calendar generation: {str(e)}")
|
||||
raise HTTPException(status_code=500, detail="Failed to start calendar generation")
|
||||
|
||||
@router.delete("/cancel/{session_id}")
|
||||
async def cancel_calendar_generation(session_id: str, db: Session = Depends(get_db)):
|
||||
"""
|
||||
Cancel an ongoing calendar generation session.
|
||||
"""
|
||||
try:
|
||||
# Initialize service with database session for active strategy access
|
||||
calendar_service = CalendarGenerationService(db)
|
||||
|
||||
success = calendar_service.calendar_generator_service.cancel_generation_session(session_id)
|
||||
|
||||
if not success:
|
||||
raise HTTPException(status_code=404, detail="Session not found")
|
||||
|
||||
return {
|
||||
"session_id": session_id,
|
||||
"status": "cancelled",
|
||||
"message": "Calendar generation cancelled successfully"
|
||||
}
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error cancelling calendar generation: {str(e)}")
|
||||
raise HTTPException(status_code=500, detail="Failed to cancel calendar generation")
|
||||
|
||||
# Cache Management Endpoints
|
||||
@router.get("/cache/stats")
|
||||
async def get_cache_stats(db: Session = Depends(get_db)) -> Dict[str, Any]:
|
||||
"""Get comprehensive user data cache statistics."""
|
||||
try:
|
||||
from services.comprehensive_user_data_cache_service import ComprehensiveUserDataCacheService
|
||||
cache_service = ComprehensiveUserDataCacheService(db)
|
||||
stats = cache_service.get_cache_stats()
|
||||
return stats
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting cache stats: {str(e)}")
|
||||
raise HTTPException(status_code=500, detail="Failed to get cache stats")
|
||||
|
||||
@router.delete("/cache/invalidate/{user_id}")
|
||||
async def invalidate_user_cache(
|
||||
user_id: int,
|
||||
strategy_id: Optional[int] = Query(None, description="Strategy ID to invalidate (optional)"),
|
||||
db: Session = Depends(get_db)
|
||||
) -> Dict[str, Any]:
|
||||
"""Invalidate cache for a specific user/strategy."""
|
||||
try:
|
||||
from services.comprehensive_user_data_cache_service import ComprehensiveUserDataCacheService
|
||||
cache_service = ComprehensiveUserDataCacheService(db)
|
||||
success = cache_service.invalidate_cache(user_id, strategy_id)
|
||||
|
||||
if success:
|
||||
return {
|
||||
"status": "success",
|
||||
"message": f"Cache invalidated for user {user_id}" + (f" and strategy {strategy_id}" if strategy_id else ""),
|
||||
"user_id": user_id,
|
||||
"strategy_id": strategy_id
|
||||
}
|
||||
else:
|
||||
raise HTTPException(status_code=500, detail="Failed to invalidate cache")
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error invalidating cache: {str(e)}")
|
||||
raise HTTPException(status_code=500, detail="Failed to invalidate cache")
|
||||
|
||||
@router.post("/cache/cleanup")
|
||||
async def cleanup_expired_cache(db: Session = Depends(get_db)) -> Dict[str, Any]:
|
||||
"""Clean up expired cache entries."""
|
||||
try:
|
||||
from services.comprehensive_user_data_cache_service import ComprehensiveUserDataCacheService
|
||||
cache_service = ComprehensiveUserDataCacheService(db)
|
||||
deleted_count = cache_service.cleanup_expired_cache()
|
||||
|
||||
return {
|
||||
"status": "success",
|
||||
"message": f"Cleaned up {deleted_count} expired cache entries",
|
||||
"deleted_count": deleted_count
|
||||
}
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error cleaning up cache: {str(e)}")
|
||||
raise HTTPException(status_code=500, detail="Failed to clean up cache")
|
||||
|
||||
109
backend/api/content_planning/api/routes/monitoring.py
Normal file
109
backend/api/content_planning/api/routes/monitoring.py
Normal file
@@ -0,0 +1,109 @@
|
||||
"""
|
||||
API Monitoring Routes
|
||||
Simple endpoints to expose API monitoring and cache statistics.
|
||||
"""
|
||||
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from typing import Dict, Any
|
||||
from loguru import logger
|
||||
|
||||
from middleware.monitoring_middleware import get_monitoring_stats, get_lightweight_stats
|
||||
from services.comprehensive_user_data_cache_service import ComprehensiveUserDataCacheService
|
||||
from services.database import get_db
|
||||
|
||||
router = APIRouter(prefix="/monitoring", tags=["monitoring"])
|
||||
|
||||
@router.get("/api-stats")
|
||||
async def get_api_statistics(minutes: int = 5) -> Dict[str, Any]:
|
||||
"""Get current API monitoring statistics."""
|
||||
try:
|
||||
stats = await get_monitoring_stats(minutes)
|
||||
return {
|
||||
"status": "success",
|
||||
"data": stats,
|
||||
"message": "API monitoring statistics retrieved successfully"
|
||||
}
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting API stats: {str(e)}")
|
||||
raise HTTPException(status_code=500, detail="Failed to get API statistics")
|
||||
|
||||
@router.get("/lightweight-stats")
|
||||
async def get_lightweight_statistics() -> Dict[str, Any]:
|
||||
"""Get lightweight stats for dashboard header."""
|
||||
try:
|
||||
stats = await get_lightweight_stats()
|
||||
return {
|
||||
"status": "success",
|
||||
"data": stats,
|
||||
"message": "Lightweight monitoring statistics retrieved successfully"
|
||||
}
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting lightweight stats: {str(e)}")
|
||||
raise HTTPException(status_code=500, detail="Failed to get lightweight statistics")
|
||||
|
||||
@router.get("/cache-stats")
|
||||
async def get_cache_statistics(db = None) -> Dict[str, Any]:
|
||||
"""Get comprehensive user data cache statistics."""
|
||||
try:
|
||||
if not db:
|
||||
db = next(get_db())
|
||||
|
||||
cache_service = ComprehensiveUserDataCacheService(db)
|
||||
cache_stats = cache_service.get_cache_stats()
|
||||
|
||||
return {
|
||||
"status": "success",
|
||||
"data": cache_stats,
|
||||
"message": "Cache statistics retrieved successfully"
|
||||
}
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting cache stats: {str(e)}")
|
||||
raise HTTPException(status_code=500, detail="Failed to get cache statistics")
|
||||
|
||||
@router.get("/health")
|
||||
async def get_system_health() -> Dict[str, Any]:
|
||||
"""Get overall system health status."""
|
||||
try:
|
||||
# Get lightweight API stats
|
||||
api_stats = await get_lightweight_stats()
|
||||
|
||||
# Get cache stats if available
|
||||
cache_stats = {}
|
||||
try:
|
||||
db = next(get_db())
|
||||
cache_service = ComprehensiveUserDataCacheService(db)
|
||||
cache_stats = cache_service.get_cache_stats()
|
||||
except:
|
||||
cache_stats = {"error": "Cache service unavailable"}
|
||||
|
||||
# Determine overall health
|
||||
system_health = api_stats['status']
|
||||
if api_stats['recent_errors'] > 10:
|
||||
system_health = "critical"
|
||||
|
||||
return {
|
||||
"status": "success",
|
||||
"data": {
|
||||
"system_health": system_health,
|
||||
"icon": api_stats['icon'],
|
||||
"api_performance": {
|
||||
"recent_requests": api_stats['recent_requests'],
|
||||
"recent_errors": api_stats['recent_errors'],
|
||||
"error_rate": api_stats['error_rate']
|
||||
},
|
||||
"cache_performance": cache_stats,
|
||||
"timestamp": api_stats['timestamp']
|
||||
},
|
||||
"message": f"System health: {system_health}"
|
||||
}
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting system health: {str(e)}")
|
||||
return {
|
||||
"status": "error",
|
||||
"data": {
|
||||
"system_health": "unknown",
|
||||
"icon": "⚪",
|
||||
"error": str(e)
|
||||
},
|
||||
"message": "Failed to get system health"
|
||||
}
|
||||
@@ -26,8 +26,8 @@ from ..utils.constants import ERROR_MESSAGES, SUCCESS_MESSAGES
|
||||
class CalendarGenerationService:
|
||||
"""Service class for calendar generation operations."""
|
||||
|
||||
def __init__(self):
|
||||
self.calendar_generator_service = CalendarGeneratorService()
|
||||
def __init__(self, db_session: Optional[Session] = None):
|
||||
self.calendar_generator_service = CalendarGeneratorService(db_session)
|
||||
|
||||
async def generate_comprehensive_calendar(self, user_id: int, strategy_id: Optional[int] = None,
|
||||
calendar_type: str = "monthly", industry: Optional[str] = None,
|
||||
@@ -337,13 +337,19 @@ class CalendarGenerationService:
|
||||
raise ContentPlanningErrorHandler.handle_general_error(e, "get_trending_topics")
|
||||
|
||||
async def get_comprehensive_user_data(self, user_id: int) -> Dict[str, Any]:
|
||||
"""Get comprehensive user data for calendar generation."""
|
||||
"""Get comprehensive user data for calendar generation with caching support."""
|
||||
try:
|
||||
logger.info(f"Getting comprehensive user data for user_id: {user_id}")
|
||||
|
||||
# Get comprehensive data using the calendar generator service
|
||||
logger.info("Calling calendar generator service...")
|
||||
comprehensive_data = await self.calendar_generator_service._get_comprehensive_user_data(user_id, None)
|
||||
# Try to use cached version if available
|
||||
try:
|
||||
comprehensive_data = await self.calendar_generator_service.get_comprehensive_user_data(
|
||||
user_id, None, force_refresh=False
|
||||
)
|
||||
except AttributeError:
|
||||
# Fallback to direct method if cached version not available
|
||||
comprehensive_data = await self.calendar_generator_service._get_comprehensive_user_data(user_id, None)
|
||||
|
||||
logger.info(f"Calendar generator service returned: {type(comprehensive_data)}")
|
||||
|
||||
logger.info(f"Successfully retrieved comprehensive user data for user_id: {user_id}")
|
||||
|
||||
Reference in New Issue
Block a user