Commit graph

4741 commits

Author SHA1 Message Date
6083beb248 Fix debug log format
Some checks are pending
Botlib CI / build (push) Waiting to run
BotServer CI / build (push) Waiting to run
Bottest CI / build (push) Waiting to run
BotUI CI / build (push) Waiting to run
2026-04-27 21:11:15 -03:00
6636f376f2 Fix: as_deref -> as_ref for String
Some checks are pending
Botlib CI / build (push) Waiting to run
BotServer CI / build (push) Waiting to run
Bottest CI / build (push) Waiting to run
BotUI CI / build (push) Waiting to run
2026-04-27 21:03:23 -03:00
12e4d1bd21 Use debug! macro for switcher logging (no file logging)
Some checks are pending
Botlib CI / build (push) Waiting to run
BotServer CI / build (push) Waiting to run
Bottest CI / build (push) Waiting to run
BotUI CI / build (push) Waiting to run
2026-04-27 20:59:29 -03:00
1ad2f7e528 Fix: use OpenOptions for file logging instead of non-existent append_to_file
Some checks are pending
Botlib CI / build (push) Waiting to run
BotServer CI / build (push) Waiting to run
Bottest CI / build (push) Waiting to run
BotUI CI / build (push) Waiting to run
2026-04-27 20:53:16 -03:00
8d82efa4e6 Add file-based debug logging to trace switcher storage/retrieval
Some checks are pending
Botlib CI / build (push) Waiting to run
BotServer CI / build (push) Waiting to run
Bottest CI / build (push) Waiting to run
BotUI CI / build (push) Waiting to run
Write to /tmp/switcher_debug.log when add_switcher() and
get_switchers() are called to debug why switchers aren't
rendering on stage.
2026-04-27 20:47:16 -03:00
47988eff92 Add debug logging to trace switcher storage/retrieval
Some checks are pending
Botlib CI / build (push) Waiting to run
BotServer CI / build (push) Waiting to run
Bottest CI / build (push) Waiting to run
BotUI CI / build (push) Waiting to run
Added info! logs to add_switcher() and get_switchers() to debug
why switchers are not rendering on stage.
2026-04-27 20:30:38 -03:00
2cc4fa65df Remove Redis flag - start.bas now runs on every WebSocket connection/message
Some checks are pending
Botlib CI / build (push) Waiting to run
BotServer CI / build (push) Waiting to run
Bottest CI / build (push) Waiting to run
BotUI CI / build (push) Waiting to run
Previously start.bas was prevented from re-running via a Redis flag
(set for 24h). This prevented switchers from being re-sent when
users reloaded the page. Now start.bas executes unconditionally
on every WebSocket connection and every first message.
2026-04-27 20:15:52 -03:00
ce0bb3791a Fix switcher Redis key mismatch: use DB session ID instead of WebSocket session ID
Some checks are pending
Botlib CI / build (push) Waiting to run
BotServer CI / build (push) Waiting to run
Bottest CI / build (push) Waiting to run
BotUI CI / build (push) Waiting to run
The switchers were stored in Redis with the DB session ID (session.id)
but retrieved using the WebSocket session ID, causing switchers to
never be found. Fix by saving session.id before the move into
spawn_blocking closure.
2026-04-27 19:52:37 -03:00
d723974410 fix(drive-monitor): sync bas files when not yet indexed + INFRA.md MinIO docs
Some checks failed
Botlib CI / build (push) Failing after 1s
BotServer CI / build (push) Failing after 1s
Bottest CI / build (push) Failing after 0s
BotUI CI / build (push) Failing after 1s
- Fix DriveMonitor skipping .bas files that exist but have indexed=false
  and same ETag (needs_reindex was computed but not used for bas sync)
- Mark bas files as indexed after successful sync to work dir
- Update INFRA.md: MinIO connection setup (port 9100, creds from drive.service)
- Remove erroneously created bottemplates start.bas (bots live in MinIO)
2026-04-27 17:27:00 -03:00
2eebbe9b0d Issue #495: Add switchers to default template and fix infra paths
Some checks failed
Botlib CI / build (push) Failing after 1s
Bottest CI / build (push) Failing after 0s
BotUI CI / build (push) Failing after 1s
- Add start.bas with ADD SWITCHER keywords (tables, list, cards)
- Remove /opt/gbo/data references from AGENTS.md and INFRA.md
- Bots are stored in MinIO drive, not in /opt/gbo/data
- Update infrastructure paths documentation
2026-04-27 17:44:58 +00:00
091ba6f71c Issue #498: KB indexing fix - add continuation notes
Some checks failed
Botlib CI / build (push) Failing after 1s
Bottest CI / build (push) Failing after 1s
BotUI CI / build (push) Failing after 1s
- Fixed KB indexing logic that skipped re-index when DB showed docs but Qdrant was empty
- Added Qdrant collection validation before skipping indexing
- Updated AGENTS.md with correct log locations for staging/production
- Deployed to staging, awaiting CI completion
- Next: monitor chat.stage for KB search functionality

Continuation instructions:
1. Check CI status on ALM (action_run table in PROD-ALM DB)
2. Verify botserver binary updated on staging system container
3. Test KB search: ask question about PDF content in bot
4. Check /opt/gbo/logs/out.log for DriveMonitor indexing activity
5. Verify Qdrant collection has indexed_vectors_count > 0

Root cause: handle_gbkb_change() only checked DB document_count, not Qdrant state
Fix: Added get_collection_info() call to validate Qdrant has points before skipping
2026-04-27 17:23:59 +00:00
9d82aaa804 docs: Update log locations for staging/production in AGENTS.md
Some checks failed
Botlib CI / build (push) Failing after 3s
Bottest CI / build (push) Failing after 1s
BotUI CI / build (push) Failing after 2s
- Add note to check err.log and out.log in /opt/gbo/logs/ on staging/production
- botserver.log is only for dev environment
2026-04-27 17:15:28 +00:00
e9c5d2442e ci: trigger botserver CI for #495 stage deploy 2026-04-27 17:15:28 +00:00
d33349e4bc ci: re-trigger CI for #495 switcher testing on stage 2026-04-27 17:15:27 +00:00
52dc10c867 ci: trigger botserver CI for #495 stage deploy 2026-04-27 17:15:27 +00:00
b3e5938978 ci: re-trigger CI for #495 switcher testing on stage 2026-04-27 17:15:27 +00:00
50977b5fa7 fix: KB indexing fails when Qdrant collection exists but has no vectors
- Check Qdrant collection exists and has points before skipping re-index
- Previously only checked database document_count, causing issues when:
  * Qdrant collection was deleted but DB still showed docs
  * Vectors were not properly indexed (indexed_vectors_count = 0)
  * New PDFs added to existing KB folder
- Now validates both DB and Qdrant state before deciding to skip indexing
- Logs warning when DB and Qdrant are out of sync

Fixes issue where KB from PDF files in drive were not being indexed to Qdrant
2026-04-27 16:49:38 +00:00
602a7da1dd fix: ADD SWITCHER keyword - compiler early normalization broke Rhai custom syntax
- Remove 'ADD SWITCHER' → 'ADD_SWITCHER' early replacement in preprocess_basic
  which prevented convert_multiword_keywords from properly handling the AS keyword
- Add ADD_SWITCHER (underscore) pattern alongside ADD SWITCHER (space) pattern
  so both forms are correctly converted to Rhai custom syntax
- Fix skip condition: only skip ADD_SWITCHER lines when 'as' is lowercase
  (already properly converted), not when AS is uppercase (needs conversion)
- Fix ADD\s+MEMBER double-escaped regex → ADD_MEMBER + ADD\s+MEMBER patterns
- Add CLEAR SWITCHERS pattern to convert_multiword_keywords
- Add CLEAR_SWITCHERS() skip condition

Closes #495
2026-04-27 11:19:59 +00:00
173418a141 ci: trigger botserver workflow for #495 stage deploy 2026-04-27 11:19:59 +00:00
a41f4cfbf5 ci: trigger botserver CI for #495 stage deploy 2026-04-27 11:19:58 +00:00
e7475125b7 ci: re-trigger CI for #495 switcher testing on stage 2026-04-27 11:19:58 +00:00
75ca8cf513 Update botserver: Add bot access control with org membership check (#499) 2026-04-26 19:53:03 -03:00
7d2d8a5674 feat: Add bot access control with org membership check (#499)
All checks were successful
Botlib CI / build (push) Successful in 53s
BotServer CI / build (push) Successful in 19m23s
Bottest CI / build (push) Successful in 45s
BotUI CI / build (push) Successful in 58s
- Add is_public column to bots table (migration 6.3.2-01)
- Add user_organizations to Diesel schema for org membership lookup
- Implement check_bot_access(): public bots allow all users, private bots
  require user membership in the bot's organization via user_organizations
- Wire access check into websocket_handler before WS upgrade
- Read is_public from bots table instead of bot_configuration
- Add database_name field to Bot model
2026-04-26 19:45:30 -03:00
0911448548 feat: Add switcher toggle functionality
- Added SWITCHER_TOGGLE message type (8) for reprocessing last user message with active switchers
- Backend: Handler fetches last user question from DB, mutates message in-place, injects switcher prompts into system_prompt
- Backend: Switcher replays skip message_history save to avoid duplication
- Frontend: toggleSwitcher() sends SWITCHER_TOGGLE when input empty, sendMessage() when text present
- Frontend: Added TOOL_EXEC and SWITCHER_TOGGLE to MessageType constants
- Fixed session_id shadowing bug in DB query (used session_id_for_query)
- Preserves conversation history for LLM context when reprocessing with switchers
2026-04-26 16:36:03 -03:00
6a64756bfd ci: re-trigger deploy for #495 ADD SWITCHER fix
Some checks failed
Botlib CI / build (push) Successful in 5s
Bottest CI / build (push) Successful in 37s
BotUI CI / build (push) Failing after 20s
2026-04-25 21:45:59 +00:00
bd113323c7 fix: ADD SWITCHER parse_parameters handles AS keyword split (3-param case)
Some checks failed
Botlib CI / build (push) Successful in 24s
BotServer CI / build (push) Failing after 3m42s
Bottest CI / build (push) Successful in 41s
BotUI CI / build (push) Failing after 27s
2026-04-25 21:24:14 +00:00
f7a7b111ff ci: add path filters to botserver workflow for auto-trigger
All checks were successful
Botlib CI / build (push) Successful in 21s
BotServer CI / build (push) Successful in 7m21s
Bottest CI / build (push) Successful in 34s
BotUI CI / build (push) Successful in 15s
2026-04-25 15:09:38 +00:00
8a7792a984 ci: trigger CI for #495 ADD SWITCHER fix 2026-04-25 14:30:51 +00:00
c93cc69f2f ci: trigger CI for #495 ADD SWITCHER fix 2026-04-25 14:20:55 +00:00
867c5c5be4 fix: ADD SWITCHER keyword - use register_custom_syntax instead of register_fn
The compiler outputs ADD_SWITCHER "x" as "y" format but the keyword
was registered as a plain Rhai function expecting add_switcher(x, y).
Changed to register_custom_syntax matching the output format, consistent
with ADD_SUGGESTION and CLEAR SWITCHERS patterns.

Fixes #495
2026-04-25 13:15:24 +00:00
28c48eeabf feat: Split chat.html into modular JS modules for #495 switcher support
- Split partials/chat.html (1513→70 lines) into 8 JS modules:
  chat-state.js, chat-switchers.js, chat-mentions.js,
  chat-messages.js, chat-suggestions.js, chat-theme.js,
  chat-websocket.js, chat-init.js
- Centralized state in ChatState global object
- Switcher chips auto-activate on switch_context suggestion action
- active_switchers sent in every WS message payload
- Removed old chat-main.js (merged into modules)
- Split vibe.html into vibe/ module directory with CSS extraction
- Updated standalone chat/chat.html to use same modules
2026-04-25 07:03:26 -03:00
1bb96f1923 fix: Add switcher support to chat page - render switcher chips from BotResponse, auto-activate on switch_context suggestion click, include active_switchers in WS payload (#495)
All checks were successful
Botlib CI / build (push) Successful in 6s
BotServer CI / build (push) Successful in 3m11s
Bottest CI / build (push) Successful in 29s
BotUI CI / build (push) Successful in 1m30s
2026-04-24 18:17:29 -03:00
c34b719515 Fix: remove .expect() from register_fn call in add_switcher_keyword
All checks were successful
Botlib CI / build (push) Successful in 2s
BotServer CI / build (push) Successful in 5m56s
Bottest CI / build (push) Successful in 29s
BotUI CI / build (push) Successful in 13s
2026-04-24 16:48:35 -03:00
21bcde15a6 Merge remote changes
Some checks failed
Botlib CI / build (push) Successful in 10s
BotServer CI / build (push) Failing after 1m25s
Bottest CI / build (push) Successful in 27s
BotUI CI / build (push) Successful in 16s
2026-04-24 16:45:26 -03:00
3e885d63b8 Fix: Correct YAML indentation in botserver.yaml workflow - Fix line 27 syntax error for CI 2026-04-24 16:43:55 -03:00
ab97e2da5d Fix: ADD SWITCHER keyword registration - Change from custom_syntax to register_fn to match multiword conversion pattern - Allows ADD SWITCHER "x" as "y" to convert to add_switcher("x", "y") 2026-04-24 16:42:08 -03:00
9f7da0a291 fix: ADD_SWITCHER keyword syntax - special handling for 'as' keyword format
All checks were successful
Botlib CI / build (push) Successful in 7s
Bottest CI / build (push) Successful in 31s
BotUI CI / build (push) Successful in 18s
The ADD_SWITCHER keyword was generating comma-separated params (ADD_SWITCHER(id, label))
instead of the expected Rhai custom syntax (ADD_SWITCHER id as label).

This fix adds special handling in the multiword processor to output the correct
format when processing ADD_SWITCHER with 2 parameters.

Fixes #495
2026-04-24 18:53:20 +00:00
3048832a2d feat: Add simple form of ADD SWITCHER keyword without AS clause
All checks were successful
Botlib CI / build (push) Successful in 13s
Bottest CI / build (push) Successful in 31s
BotUI CI / build (push) Successful in 15s
- ADD_SWITCHER "tables" now works (label defaults to switcher ID)
- ADD_SWITCHER "tables" AS "Tabelas" still works (custom label)
- Follows same pattern as ADD_SUGGESTION simple/AS forms
- Fixes #495
2026-04-24 18:22:17 +00:00
8a97c0517f Fix: Correct YAML syntax in botserver workflow - Remove blank line in multi-line block (line 27) - Fix indentation for all run commands - Use proper tar extraction syntax for deployment
All checks were successful
Botlib CI / build (push) Successful in 8s
Bottest CI / build (push) Successful in 33s
BotUI CI / build (push) Successful in 11s
2026-04-24 17:12:56 +00:00
d453eef57d fix: Use event delegation for switcher clicks
All checks were successful
Botlib CI / build (push) Successful in 7s
BotServer / build (push) Successful in 3m56s
Bottest CI / build (push) Successful in 35s
BotUI CI / build (push) Successful in 45s
- Event listeners were lost when renderSwitchers() re-created DOM
- Now using event delegation on parent container
- Listener attached once, persists across re-renders
- Added logging to verify active_switchers payload

Fixes switcher toggle not persisting and LLM modifier not being sent.
2026-04-24 16:57:30 +00:00
840175d540 fix: Correct YAML indentation in botserver workflow
All checks were successful
Botlib CI / build (push) Successful in 8s
BotServer / build (push) Successful in 5m49s
Bottest CI / build (push) Successful in 35s
BotUI CI / build (push) Successful in 16s
2026-04-24 16:40:50 +00:00
2d715b2650 refactor: Split chat.html into modular JS files
All checks were successful
Botlib CI / build (push) Successful in 12s
Bottest CI / build (push) Successful in 32s
BotUI CI / build (push) Successful in 44s
- chat.html reduced from 1623 lines to 59 lines
- Created chat-switchers.js for switcher state management
- Created chat-messages.js for message rendering
- Created chat-main.js for initialization and coordination
- Added console logging to debug switcher toggle functionality
- Follows AGENTS.md 450-line limit rule
2026-04-24 16:22:08 +00:00
6ad3ebff00 debug: Add logging for switcher prompt injection
All checks were successful
Botlib CI / build (push) Successful in 9s
Bottest CI / build (push) Successful in 34s
BotUI CI / build (push) Successful in 17s
2026-04-24 15:46:26 +00:00
02aaf528a9 Merge branch 'main' of https://alm.pragmatismo.com.br/GeneralBots/generalbots
All checks were successful
Botlib CI / build (push) Successful in 18s
Bottest CI / build (push) Successful in 40s
BotUI CI / build (push) Successful in 20s
2026-04-24 15:37:47 +00:00
6f9fdf5edb fix: Change DriveMonitor logging to trace level - Only log to info when actual changes occur in gbdialog, gbkb, or gbot - Reduces log noise from每秒 scans 2026-04-24 15:37:11 +00:00
9f250e7428 Remove incorrect UI sync step from botserver workflow
All checks were successful
Botlib CI / build (push) Successful in 9s
Bottest CI / build (push) Successful in 26s
BotUI CI / build (push) Successful in 15s
- BotUI has its own CI/CD pipeline
- BotServer should not deploy BotUI files
- UI files are managed by botui workflow only
2026-04-24 10:55:35 -03:00
6211e51d28 Fix: Remove invalid DriveConfig::from_vault() call
Some checks are pending
Bottest CI / build (push) Waiting to run
BotUI CI / build (push) Waiting to run
Botlib CI / build (push) Successful in 5s
BotServer CI / build (push) Successful in 6m4s
- DriveConfig::default() already loads from Vault
- No need for separate from_vault() method
- CI should compile now
2026-04-24 10:51:25 -03:00
85d93fd88b Merge branch 'main' of github.com:generalbots/generalbots 2026-04-24 10:44:28 -03:00
3c5c0949c3 Fix: Remove hardcoded defaults, require Vault for production config
Some checks failed
Botlib CI / build (push) Successful in 12s
BotServer CI / build (push) Failing after 1m49s
Bottest CI / build (push) Successful in 35s
BotUI CI / build (push) Successful in 16s
- AppConfig::default() and from_env() now read PORT from environment
- DriveConfig loads from Vault first, falls back to env vars for development
- DATABASE_URL must be set (from Vault via .env in production)
- No more hardcoded 8080 - reads from PORT env var
- Removed hardcoded paths like /opt/gbo/data, now from env or reasonable defaults
- Development still works with defaults, production requires Vault via .env
2026-04-24 10:43:34 -03:00
53867a3ef6 Fix: Read PORT from environment variable instead of hardcoded 8080
- Changed AppConfig::from_env() to read PORT from std::env
- Falls back to 8080 if PORT not set
- Also reads HOST, SITE_PATH, DATA_DIR from environment
- Fixes issue where botserver ignored .env PORT=5858 setting
2026-04-24 10:36:33 -03:00