chore: update submodules
This commit is contained in:
parent
30ceb24903
commit
08c05eb894
6 changed files with 127 additions and 46 deletions
5
PROD.md
5
PROD.md
|
|
@ -100,6 +100,9 @@ HashiCorp Vault is the single source of truth for all secrets. Botserver reads `
|
|||
|
||||
**Vault troubleshooting — cannot connect:** Check that the vault container's systemd unit is running, verify the token in `.env` is not expired with `vault token lookup`, confirm the CA cert path in `.env` matches the actual file location, and test network connectivity from system to vault container. To generate a new token: `vault token create -policy="botserver" -ttl="8760h" -format=json` then update `.env` and restart botserver.
|
||||
|
||||
# Get database credentials from Vault v2 API
|
||||
$ ssh user@ip"sudo incus exec system -- curl -s --cacert /opt/gbo/conf/system/certificates/ca/ca.crt -H 'X-Vault-Token: hvs...' https://ip:8200/v1/secret/data/gbo/tables 2>/dev/null"
|
||||
|
||||
**Vault troubleshooting — secrets missing:** Run `vault kv get secret/gbo/tables` (and other paths) to check if secrets exist. If a path returns NOT FOUND, add secrets with `vault kv put secret/gbo/tables host=<ip> port=5432 database=botserver username=gbuser password=<pw>` and similar for other paths.
|
||||
|
||||
**Vault sealed after restart:** Run `vault operator unseal <key1>`, repeat with key2 and key3 (3 of 5 keys from init.json), then verify with `vault status`.
|
||||
|
|
@ -206,4 +209,4 @@ The `.ast` file has all transforms applied: `USE KB "cartas"` becomes `USE_KB("c
|
|||
|
||||
**Tools (TOOL_EXEC) load `.ast` only** — there is no `.bas` fallback. If an `.ast` file is missing, the tool fails with "Failed to read tool .ast file". DriveMonitor must have compiled it first.
|
||||
|
||||
**Suggestion deduplication** uses Redis `SADD` (set) instead of `RPUSH` (list). This prevents duplicate suggestion buttons when `start.bas` runs multiple times per session. The key format is `suggestions:{bot_id}:{session_id}` and `get_suggestions` uses `SMEMBERS` to read it.
|
||||
**Suggestion deduplication** uses Redis `SADD` (set) instead of `RPUSH` (list). This prevents duplicate suggestion buttons when `start.bas` runs multiple times per session. The key format is `suggestions:{bot_id}:{session_id}` and `get_suggestions` uses `SMEMBERS` to read it.
|
||||
|
|
|
|||
2
botui
2
botui
|
|
@ -1 +1 @@
|
|||
Subproject commit 91e9701c3ec47e8b5ecebddcc89ac108dd708197
|
||||
Subproject commit 90dc21ef3a4f0c8acaf990b83de8a2d323bc5719
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
# v6.2 — Make KB "cartas" work end-to-end
|
||||
|
||||
## What we want
|
||||
|
||||
User clicks "Cartas" → `cartas.bas` runs → `USE KB "cartas"` → searches Qdrant → bot answers with KB content. No restarts.
|
||||
|
||||
## 3 Bugs we found
|
||||
|
||||
### Bug 1: KB files re-indexed every 10s (wasteful) ✅ FIXED
|
||||
|
||||
Every cycle, `check_gbkb_changes` replaces file_states with `indexed: false`, so DriveMonitor re-downloads and re-indexes all PDFs every 10 seconds.
|
||||
|
||||
**Fix:** Preserve `indexed: true` when etag hasn't changed.
|
||||
**File:** `botserver/src/drive/drive_monitor/mod.rs:1376`
|
||||
|
||||
### Bug 2: USE KB looks for wrong collection name ✅ FIXED
|
||||
|
||||
When `kb_collections` has no entry for "cartas", `USE KB` creates a collection name using a random UUID (`salesianos_<random>_cartas`). But Qdrant has `salesianos_6deedba8_cartas`. They never match → search returns nothing.
|
||||
|
||||
**Fix:** Use `bot_id_short` (first 8 chars of bot UUID) consistently. Also changed `ON CONFLICT DO NOTHING` to `DO UPDATE` so stale entries get corrected.
|
||||
**File:** `botserver/src/basic/keywords/use_kb.rs:221-244`
|
||||
|
||||
### Bug 3: KB indexing never writes to kb_collections table ✅ FIXED
|
||||
|
||||
`index_kb_folder` creates a Qdrant collection and indexes documents, but never writes a row to `kb_collections`. So when `USE KB "cartas"` runs, it queries `kb_collections` → empty → hits Bug 2's fallback path.
|
||||
|
||||
**Fix:** After indexing, upsert into `kb_collections` with correct collection name.
|
||||
**File:** `botserver/src/core/kb/mod.rs:167-220`
|
||||
|
||||
Also changed `process_gbkb_folder` return type from `Result<()>` to `Result<IndexingResult>` so `handle_gbkb_change` can use `collection_name` and `documents_processed`.
|
||||
|
||||
## Checklist
|
||||
|
||||
- [x] Bug 1 code fix (file_states indexed flag)
|
||||
- [x] Bug 2 code fix (USE KB collection name)
|
||||
- [x] Bug 3 code fix (kb_collections upsert after indexing)
|
||||
- [x] `cargo check -p botserver` passes
|
||||
- [ ] Push botserver → origin + ALM
|
||||
- [ ] Push main repo → origin + ALM
|
||||
- [ ] Deploy to production (ask user first)
|
||||
- [ ] Restart botserver (one-time for new binary)
|
||||
- [ ] Test: click "Cartas" → verify KB search works
|
||||
- [ ] Test: click "Procedimentos" → verify KB search works
|
||||
- [ ] Verify PROMPT.md injection
|
||||
31
snapshot_chat_ready.yml
Normal file
31
snapshot_chat_ready.yml
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
- generic [ref=e5]:
|
||||
- generic [ref=e6]:
|
||||
- generic [ref=e7]: Chat
|
||||
- generic [ref=e8]:
|
||||
- button [ref=e9] [cursor=pointer]:
|
||||
- img [ref=e10]
|
||||
- button [ref=e11] [cursor=pointer]:
|
||||
- img [ref=e12]
|
||||
- button [ref=e14] [cursor=pointer]:
|
||||
- img [ref=e15]
|
||||
- generic [ref=e18]:
|
||||
- generic [ref=e19]:
|
||||
- main [ref=e20]:
|
||||
- paragraph [ref=e23]: Olá! Bem-vinda(o) ao assistente virtual do Salesianos.
|
||||
- generic [ref=e25]: oi
|
||||
- contentinfo [ref=e29]:
|
||||
- generic [ref=e30]:
|
||||
- button "Cartas" [ref=e31] [cursor=pointer]
|
||||
- button "Procedimentos" [ref=e32] [cursor=pointer]
|
||||
- button "Tabelas" [ref=e33] [cursor=pointer]
|
||||
- generic [ref=e34]:
|
||||
- generic [ref=e35]:
|
||||
- button "Agent" [ref=e36] [cursor=pointer]
|
||||
- button "Chat" [ref=e37] [cursor=pointer]
|
||||
- textbox "Message... (type @ to mention)" [active] [ref=e38]
|
||||
- button "↑" [ref=e39] [cursor=pointer]
|
||||
- button "Scroll to bottom":
|
||||
- img
|
||||
- generic:
|
||||
- generic:
|
||||
- button "View"
|
||||
30
snapshot_initial.yml
Normal file
30
snapshot_initial.yml
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
- generic [ref=e106]:
|
||||
- generic [ref=e107]:
|
||||
- generic [ref=e108]: Chat
|
||||
- generic [ref=e109]:
|
||||
- button [ref=e110] [cursor=pointer]:
|
||||
- img [ref=e111]
|
||||
- button [ref=e112] [cursor=pointer]:
|
||||
- img [ref=e113]
|
||||
- button [ref=e115] [cursor=pointer]:
|
||||
- img [ref=e116]
|
||||
- generic [ref=e119]:
|
||||
- generic [ref=e120]:
|
||||
- main [ref=e194]:
|
||||
- paragraph [ref=e197]: Olá! Bem-vinda(o) ao assistente virtual do Salesianos.
|
||||
- contentinfo [ref=e166]:
|
||||
- generic [ref=e198]:
|
||||
- button "Cartas" [ref=e199] [cursor=pointer]
|
||||
- button "Procedimentos" [ref=e200] [cursor=pointer]
|
||||
- button "Tabelas" [ref=e201] [cursor=pointer]
|
||||
- generic [ref=e169]:
|
||||
- generic [ref=e170]:
|
||||
- button "Agent" [ref=e171] [cursor=pointer]
|
||||
- button "Chat" [ref=e172] [cursor=pointer]
|
||||
- textbox "Message... (type @ to mention)" [active] [ref=e173]
|
||||
- button "↑" [ref=e174] [cursor=pointer]
|
||||
- button "Scroll to bottom":
|
||||
- img
|
||||
- generic:
|
||||
- generic:
|
||||
- button "View"
|
||||
61
snapshot_response.yml
Normal file
61
snapshot_response.yml
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
- generic [ref=e106]:
|
||||
- generic [ref=e107]:
|
||||
- generic [ref=e108]: Chat
|
||||
- generic [ref=e109]:
|
||||
- button [ref=e110] [cursor=pointer]:
|
||||
- img [ref=e111]
|
||||
- button [ref=e112] [cursor=pointer]:
|
||||
- img [ref=e113]
|
||||
- button [ref=e115] [cursor=pointer]:
|
||||
- img [ref=e116]
|
||||
- generic [ref=e119]:
|
||||
- generic [ref=e120]:
|
||||
- main [ref=e194]:
|
||||
- paragraph [ref=e197]: Olá! Bem-vinda(o) ao assistente virtual do Salesianos.
|
||||
- generic [ref=e203]: oi
|
||||
- generic [ref=e326]:
|
||||
- generic [ref=e327]:
|
||||
- heading "Olá! Seja bem-vindo(a)!" [level=1] [ref=e330]
|
||||
- heading "Sou o assistente virtual da Escola Salesiana" [level=2] [ref=e331]
|
||||
- paragraph [ref=e332]:
|
||||
- text: É uma grande alegria recebê-lo aqui! Meu nome é o Assistente Virtual Salesiano, criado para ser ponte entre você e toda a riqueza da nossa instituição, fundamentada nos ideais de Dom Bosco e na
|
||||
- strong [ref=e333]: Pedagogia Preventiva
|
||||
- text: .
|
||||
- paragraph [ref=e334]: Baseado nas cartas inspiradoras de Dom Bosco e no modo salesiano de educar, estou aqui para ajudá-lo com informações, orientações e todo o suporte que precisar sobre nossa escola.
|
||||
- generic [ref=e335]:
|
||||
- paragraph [ref=e336]:
|
||||
- strong [ref=e337]: Como posso ser útil hoje?
|
||||
- paragraph [ref=e338]:
|
||||
- text: Posso orientá-lo sobre
|
||||
- strong [ref=e339]: matrículas
|
||||
- text: ","
|
||||
- strong [ref=e340]: protocolos escolares
|
||||
- text: ","
|
||||
- strong [ref=e341]: eventos
|
||||
- text: ","
|
||||
- strong [ref=e342]: calendário acadêmico
|
||||
- text: ","
|
||||
- strong [ref=e343]: projetos pedagógicos
|
||||
- text: e muito mais. Sinta-se à vontade para perguntar sobre qualquer aspecto da nossa comunidade educativa!
|
||||
- generic [ref=e344]:
|
||||
- generic [ref=e345]:
|
||||
- img [ref=e346]
|
||||
- heading "Calendário" [level=3] [ref=e348]
|
||||
- paragraph [ref=e349]: Datas importantes, feriados, eventos e prazos do ano letivo.
|
||||
- img [ref=e351]
|
||||
- contentinfo [ref=e166]:
|
||||
- generic [ref=e198]:
|
||||
- button "Cartas" [ref=e199] [cursor=pointer]
|
||||
- button "Procedimentos" [ref=e200] [cursor=pointer]
|
||||
- button "Tabelas" [ref=e201] [cursor=pointer]
|
||||
- generic [ref=e169]:
|
||||
- generic [ref=e170]:
|
||||
- button "Agent" [ref=e171] [cursor=pointer]
|
||||
- button "Chat" [ref=e172] [cursor=pointer]
|
||||
- textbox "Message... (type @ to mention)" [active] [ref=e173]
|
||||
- button "↑" [ref=e174] [cursor=pointer]
|
||||
- button "Scroll to bottom":
|
||||
- img
|
||||
- generic:
|
||||
- generic:
|
||||
- button "View"
|
||||
Loading…
Add table
Reference in a new issue