Recovered state: integrated TrendSurferAgent, restored frontend/backend files, and cleaned up recovery scripts

This commit is contained in:
ajaysi
2026-02-08 13:56:57 +05:30
parent 1db10ccd0f
commit e404a86502
333 changed files with 42223 additions and 10875 deletions

View File

@@ -17,15 +17,22 @@ from loguru import logger
class PersistentContentCache:
"""Database-backed cache for blog content generation results with exact parameter matching."""
def __init__(self, db_path: str = "content_cache.db", max_cache_size: int = 300, cache_ttl_hours: int = 72):
def __init__(self, db_path: str = None, max_cache_size: int = 300, cache_ttl_hours: int = 72):
"""
Initialize the persistent content cache.
Args:
db_path: Path to SQLite database file
db_path: Path to SQLite database file. Defaults to 'data/cache/content_cache.db' in project root.
max_cache_size: Maximum number of cached entries
cache_ttl_hours: Time-to-live for cache entries in hours (longer than research cache since content is expensive)
"""
if db_path is None:
# Default to root/data/cache/content_cache.db
root_dir = Path(__file__).parent.parent.parent.parent
cache_dir = root_dir / "data" / "cache"
cache_dir.mkdir(parents=True, exist_ok=True)
db_path = str(cache_dir / "content_cache.db")
self.db_path = db_path
self.max_cache_size = max_cache_size
self.cache_ttl = timedelta(hours=cache_ttl_hours)