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 /assistant.py | |
| 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 'assistant.py')
| -rw-r--r-- | assistant.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/assistant.py b/assistant.py index 16e6133..84f0dd8 100644 --- a/assistant.py +++ b/assistant.py @@ -275,6 +275,10 @@ def speaker(q): play.wait() play = None continue + if isinstance(item, float): # seconds of silence + if play: + play.stdin.write(bytes(int(sr * item) * 2)) + continue text, lang = item audio, sr = k.create(text, voice=voices[lang], lang=KLANG[lang]) if play is None: @@ -333,7 +337,9 @@ def reply(history, q): log(f"you ({lang}, {time.perf_counter() - t:.2f}s): {text}") history.append({"role": "user", "content": text}) # ponytail: last 20 messages, summarise if long sessions need memory - msgs = [{"role": "system", "content": CFG["system"]}] + history[-20:] + # The model has no clock: without the date it makes one up for tools. + now = time.strftime("It is %A %d %B %Y, %H:%M.") + msgs = [{"role": "system", "content": f"{CFG['system']} {now}"}] + history[-20:] t, said, voice, announced = time.perf_counter(), [], lang, False def say(s): @@ -364,6 +370,8 @@ def reply(history, q): if phrase: # The question's language: the reply has no text yet to follow. q.put((phrase, lang)) + # A beat after it: straight into the answer sounds rushed. + q.put(0.6) announced = True for c in calls.values(): result = run_tool(TOOLS, c["name"], c["arguments"]) |
