File size: 1,172 Bytes
f84033a
a377469
02ccde5
 
f84033a
 
a377469
 
 
 
 
02ccde5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#planner.py
from tools.calendar_reader import get_todays_events
import json
import datetime
from smolagents import tool
@tool
def generate_daily_plan() -> str:
    """
        Generate a daily plan based on class schedule and today's calendar events.
        Returns a formatted plan string.
    """
    # 1. Ders programını oku
    with open("data/class_schedule.json", "r", encoding="utf-8") as f:
        class_schedule = json.load(f)

    # 2. Bugünün haftalık ders gününü bul
    weekday = datetime.datetime.now().strftime("%A").lower()
    today_classes = class_schedule.get(weekday, [])

    # 3. Takvimden etkinlikleri al
    calendar_events = get_todays_events()

    # 4. Birleştirip planı oluştur
    plan_lines = ["📚 Ders Programı:"]
    if today_classes:
        for cls in today_classes:
            plan_lines.append(f"- {cls}")
    else:
        plan_lines.append("Bugün ders yok.")

    plan_lines.append("\n🗓️ Takvim Etkinlikleri:")
    if calendar_events:
        for event in calendar_events:
            plan_lines.append(f"- {event}")
    else:
        plan_lines.append("Bugün etkinlik yok.")

    return "\n".join(plan_lines)