Spaces:
Running
Running
| """ | |
| modules/briefing.py — F.R.I.D.A.Y OMEGA daily briefing generator | |
| Generates personalized daily briefings using analytics + memory data. | |
| """ | |
| from datetime import datetime | |
| def generate_briefing() -> str: | |
| """Generate a comprehensive daily briefing.""" | |
| parts = [] | |
| now = datetime.now() | |
| parts.append(f"Daily briefing for {now.strftime('%A, %B %d')}") | |
| # weather awareness (Phase 7) | |
| try: | |
| from modules.weather import get_current_weather | |
| wx = get_current_weather() | |
| if wx and wx.get("temp_c") is not None: | |
| city = wx.get("city") or "your area" | |
| parts.append(f"Weather in {city}: {wx.get('description','')}, {wx.get('temp_c')}°C") | |
| except Exception: | |
| pass | |
| # system health | |
| try: | |
| from modules.system_advisor import get_tips | |
| tips = get_tips() | |
| if tips: | |
| parts.extend(tips) | |
| except Exception: | |
| pass | |
| # analytics insights | |
| try: | |
| from engines.analytics_engine import generate_daily_briefing | |
| analytics = generate_daily_briefing() | |
| if analytics: | |
| parts.append(analytics) | |
| except Exception: | |
| pass | |
| # unfinished tasks | |
| try: | |
| from modules.memory import get_unfinished_tasks | |
| tasks = get_unfinished_tasks() | |
| if tasks: | |
| parts.append(f"You have {len(tasks)} unfinished tasks: {', '.join(tasks[:3])}") | |
| except Exception: | |
| pass | |
| # productivity insights | |
| try: | |
| from engines.analytics_engine import get_productivity_insights | |
| insights = get_productivity_insights() | |
| for insight in insights[:3]: | |
| parts.append(insight) | |
| except Exception: | |
| pass | |
| # mood summary | |
| try: | |
| from modules.mood import get_mood_pattern | |
| moods = get_mood_pattern() | |
| if moods: | |
| dominant = max(moods, key=moods.get) | |
| parts.append(f"Your recent mood trend: {dominant}") | |
| except Exception: | |
| pass | |
| return ". ".join(parts) + "." | |
| def get_quick_briefing() -> str: | |
| """Short version for voice delivery.""" | |
| parts = [] | |
| try: | |
| from modules.system_advisor import get_tips | |
| tips = get_tips() | |
| if tips and tips[0] != "Everything looks clean. Systems nominal.": | |
| parts.append(tips[0]) | |
| except Exception: | |
| pass | |
| try: | |
| from modules.memory import get_unfinished_tasks | |
| tasks = get_unfinished_tasks() | |
| if tasks: | |
| parts.append(f"{len(tasks)} pending tasks") | |
| except Exception: | |
| pass | |
| if not parts: | |
| return "All clear. No pressing matters." | |
| return ". ".join(parts) + "." | |