05/31 Phase 5
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Cron script: generate daily AI financial insight via Groq.
|
||||
Run by systemd timer pfm-aiinsight.timer at midnight daily.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from app import create_app
|
||||
from app.services.ai_service import generate_daily_insight
|
||||
|
||||
app = create_app()
|
||||
|
||||
if __name__ == '__main__':
|
||||
with app.app_context():
|
||||
print('[ai_insight] Generating daily insight...')
|
||||
content = generate_daily_insight()
|
||||
if content:
|
||||
preview = content[:200].replace('\n', ' ')
|
||||
print(f'[ai_insight] Done: {preview}...')
|
||||
else:
|
||||
print('[ai_insight] Failed or skipped (already generated today).')
|
||||
sys.exit(1)
|
||||
Reference in New Issue
Block a user