Files
email_alerts_v2/reset_analysis.py
T

41 lines
838 B
Python
Raw Normal View History

#!/usr/bin/env python3
"""
Reset AI analysis data for testing purposes.
"""
import os
import sys
# Add the src directory to the path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "src"))
from database import SessionLocal, Thread
def main():
"""Reset analysis data for all threads."""
db = SessionLocal()
try:
# Reset analysis data
threads = db.query(Thread).all()
for thread in threads:
thread.actionable = False
thread.ai_summary = None
thread.ai_confidence = None
thread.last_analyzed_at = None
db.commit()
print(f"Reset analysis data for {len(threads)} threads")
except Exception as e:
print(f"Error: {e}")
db.rollback()
finally:
db.close()
if __name__ == "__main__":
main()