Spaces:
Running on Zero
Running on Zero
Commit History
-
fix: stop an open activity draft from swallowing unrelated messages Running
Reported from a screenshot: the user had an activity draft open, then typed "hitungin kalor sate 10 tusuk dan lontong", "ginchie" and "aku makan sate 10 tusuk dan lontong" -- and the bot answered all three with "masih kurang: judulnya apa nih?, hari apa tanggal berapa?, jam berapa?". Root cause: the draft was only dropped when the router returned a different action AND `_looks_like_slot_answer()` was false. That helper counts any message of eight words or fewer as a slot answer, so a seven-word food-log request kept the draft alive forever and the food was never logged. - Draft continuation now requires the router to still see the same action, or the text to be a pure schedule answer (`_is_pure_schedule_answer`, which needs an actual date/time token). "aku makan sate 10 tusuk dan lontong" and "ginchie" no longer keep a draft alive. - `_merge_draft` is only used for ADD_ACTIVITY drafts; other actions go through `_merge_generic_draft`, which previously would have been rewritten…908edbb -
fix: make creating and viewing activities work like a conversation
Reported: scheduling only happened when the user typed "masukkan ke kegiatan", the double-confirmation felt awkward, the agenda could not be checked, and old activity titles leaked into brand new ones. Routing - "ingetin aku", "jangan lupa aku", "pengingat" and stated plans ("aku ada X besok jam 10", "aku mau X jam 2 sore") now always produce ADD_ACTIVITY, even with no details yet, instead of falling through to CHAT. The model previously replied "siap, nanti aku ingetin" and saved nothing, which is worse than not replying at all. - Word order no longer matters ("jam 2 sore ... aku mau ngechat pacar" and "aku mau ngechat pacar ... jam 2 sore" both work). - Agenda/view phrasings broadened. Draft filling - Dates and times are now parsed locally as well as by the model. The model answered CHAT for a plain "Hari Minggu, 11 Oktober 2026" while a draft was open, which stranded the user mid-flow; a bare instruction followed by a date and a time now completes correctly. - Aski…3f49a5f
-
feat: switch to Postgres, add intent router and a warmer persona
Database - Replace SQLite (aiosqlite) with PostgreSQL via asyncpg. All state lived on the container's ephemeral filesystem, which is why every redeploy wiped it. - Add versioned migrations (database/migrations/NNN_*.sql) recorded in schema_migrations with checksums. The old CREATE-IF-NOT-EXISTS approach could not evolve the schema, and the live DB had drifted (orphaned google_calendar_tokens table). - Drop write-only daily_nutrition cache; totals recompute from food_logs so edits stay consistent. - connection.py keeps the small subset of the aiosqlite API the services use (`await db.execute`, `async with db.execute as cursor`, fetchone/fetchall) and translates ? placeholders to $n, so call sites were left untouched. - Store activity_dt as TIMESTAMPTZ and drop the string-comparison reminder query; reminders are now correct for WIB/WITA/WIT users. - Add scripts/migrate_sqlite_to_postgres.py to move the existing 4 users, 26 food logs and 160 conversations across with ids…1fcc069