diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-26 08:18:58 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-26 08:18:58 +0200 |
| commit | f44feb7d6ed65fde69f29e92c8f673fc8a641674 (patch) | |
| tree | 70b8a5f342a2a984f5b7b7a28f61f51272474f4f /examples/tools | |
| parent | 0c834c81365ee6e2259c4a93009ac241941aecdb (diff) | |
| download | desktop-assistant-f44feb7d6ed65fde69f29e92c8f673fc8a641674.tar.gz desktop-assistant-f44feb7d6ed65fde69f29e92c8f673fc8a641674.zip | |
Fix issues found testing the tools live
- The model has no clock and invented a 2025 start date for the
calendar; the system prompt now carries the current date and time.
- It also derived a wrong weekday from a date; agenda.py prints the
weekday itself.
- An announcement ran straight into the answer; a 0.6 s pause follows it.
- The calendar days hint asks for 30 or more when looking for the next
event.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'examples/tools')
| -rwxr-xr-x | examples/tools/agenda.py | 11 | ||||
| -rw-r--r-- | examples/tools/calendar.toml | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/examples/tools/agenda.py b/examples/tools/agenda.py index 44bc34b..6c5bfca 100755 --- a/examples/tools/agenda.py +++ b/examples/tools/agenda.py @@ -77,6 +77,7 @@ def when(line): def agenda(d, start, days): # ponytail: naive local times, so a recurring event in a zone other than # ours drifts by an hour across DST; multi-day events show on day one only. + # The weekday is printed because the model gets it wrong from a date. lo = dt.datetime.fromisoformat(start) hi = lo + dt.timedelta(days=days) evs = [] @@ -106,7 +107,7 @@ def agenda(d, start, days): occ = [first] if lo <= first < hi else [] summary = e.get("SUMMARY", "SUMMARY:(no title)").split(":", 1)[1] summary = summary.replace("\\,", ",").replace("\\;", ";").replace("\\n", " ") - out += [(t, f"{t:%Y-%m-%d} {'all day' if allday else f'{t:%H:%M}'} {summary}") + out += [(t, f"{t:%A %Y-%m-%d} {'all day' if allday else f'{t:%H:%M}'} {summary}") for t in occ] return [line for _, line in sorted(out)] @@ -140,11 +141,11 @@ def test(): with open(os.path.join(d, "cal", name), "w", newline="") as f: f.write(text) assert agenda(d, "2026-09-01", 30) == [ - "2026-09-01 18:00 Gym", "2026-09-16 19:00 Gym moved", - "2026-09-22 18:00 Gym", "2026-09-29 18:00 Gym"], agenda(d, "2026-09-01", 30) - assert agenda(d, "2026-03-10", 5) == ["2026-03-12 all day Birthday"] + "Tuesday 2026-09-01 18:00 Gym", "Wednesday 2026-09-16 19:00 Gym moved", + "Tuesday 2026-09-22 18:00 Gym", "Tuesday 2026-09-29 18:00 Gym"], agenda(d, "2026-09-01", 30) + assert agenda(d, "2026-03-10", 5) == ["Thursday 2026-03-12 all day Birthday"] assert agenda(d, "2026-10-01", 1) == [ - "2026-10-01 10:00 Dentist, checkup", "2026-10-01 18:00 Call"] # 16Z = 18 local + "Thursday 2026-10-01 10:00 Dentist, checkup", "Thursday 2026-10-01 18:00 Call"] # 16Z = 18 local assert agenda(d, "2026-10-02", 1) == [] print("ok") diff --git a/examples/tools/calendar.toml b/examples/tools/calendar.toml index 75e4898..50b578c 100644 --- a/examples/tools/calendar.toml +++ b/examples/tools/calendar.toml @@ -8,4 +8,4 @@ description = "First day, YYYY-MM-DD. Empty for today." [params.days] type = "integer" -description = "How many days, 1 for a single day. Empty for 1." +description = "How many days, 1 for a single day, 30 or more for the next event. Empty for 1." |
