fix: Odoo 18 field errors, routing quality, bot presence, and add architecture docs

- expenses_tools: remove 'date' from hr.expense.sheet field lists (Odoo 18
  uses accounting_date; querying 'date' raised ValueError at runtime)
- master_system.txt: add few-shot routing examples so Llama 3.1 8B correctly
  outputs agents=[] for general questions instead of defaulting to expenses_agent
- ab_ai_bot.py: increase bot presence last_poll offset from 90s to 10min so
  the green dot stays on between cron runs (cron fires every ~5min in practice,
  not every 20s as configured)
- ARCHITECTURE.md: full system documentation covering component layout, request
  flow, LLM routing, agent registry, access control, health/presence mechanism,
  known issues fixed today, and future self-healing concept

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Carlos Garcia
2026-05-19 15:47:48 -04:00
parent b76d01b64f
commit a0fc1396a9
4 changed files with 323 additions and 7 deletions

View File

@@ -175,11 +175,11 @@ class AbAiBot(models.Model):
Presence = self.env['bus.presence']
now = fields.Datetime.now()
# bus.presence.status is a computed field — write only last_poll/last_presence.
# When online: set last_poll 90s ahead so the bot stays "online" across the
# full 60s cron cycle (Odoo DISCONNECTION_TIMER is 30s).
# When online: set last_poll 10min ahead so the bot stays "online" across
# the full cron cycle (Odoo cron scheduler fires every ~5min in practice).
# When offline: set last_poll an hour in the past to force "offline" state.
if online:
poll_time = now + timedelta(seconds=90)
poll_time = now + timedelta(minutes=10)
presence_time = now
else:
poll_time = now - timedelta(hours=1)