Commit graph

97 commits

Author SHA1 Message Date
148ad0cc7c Fix KB search: remove score threshold to improve results
All checks were successful
BotServer CI/CD / build (push) Successful in 2m54s
2026-04-15 14:04:11 -03:00
dd699db19e fix: improve assistant message history logging with preview
All checks were successful
BotServer CI/CD / build (push) Successful in 3m34s
2026-04-15 13:47:36 -03:00
bd6ca9439f fix: strip html/markdown from assistant messages and improve error logging
All checks were successful
BotServer CI/CD / build (push) Successful in 4m30s
2026-04-15 13:32:42 -03:00
adbf84f812 refactor: mover logs verbose de info! para trace!
All checks were successful
BotServer CI/CD / build (push) Successful in 3m25s
Move logs detalhados de LLM e DriveMonitor de info! para trace!
para reduzir poluição nos logs de produção:

- bot/mod.rs: LLM chunk logs, streaming start, abort
- llm/mod.rs: LLM Request Details, provider creation logs

Estes logs são úteis para debug mas geram muito ruído em produção.
Com trace! só aparecem quando RUST_LOG=trace está configurado.
2026-04-15 12:41:31 -03:00
dd15899ac3 fix: Use broadcast channel for LLM streaming cancellation
All checks were successful
BotServer CI/CD / build (push) Successful in 5m48s
- Broadcast channel allows multiple subscribers for cancellation
- Aborts LLM task when user sends new message
- Properly stops LLM generation when cancelled
2026-04-15 09:44:42 -03:00
9db784fd5c feat: Cancel streaming LLM when user sends new message
All checks were successful
BotServer CI/CD / build (push) Successful in 6m4s
- Add active_streams HashMap to AppState to track streaming sessions
- Create cancellation channel for each streaming session
- Cancel existing streaming when new message arrives
- Prevents overlapping responses and improves UX
2026-04-15 07:37:07 -03:00
01d4f47a93 fix: strip GPT-oSS thinking content from response chunks
All checks were successful
BotServer CI/CD / build (push) Successful in 4m18s
2026-04-14 19:57:13 -03:00
fc68b21252 fix: support flexible JSON order for GPT-oSS thinking signals
All checks were successful
BotServer CI/CD / build (push) Successful in 2m36s
2026-04-14 19:42:48 -03:00
8a6970734e fix: Extract thinking signals from anywhere in chunk to prevent leakage
All checks were successful
BotServer CI/CD / build (push) Successful in 3m47s
Thinking signals ({"type":"thinking"} and {"type":"thinking_clear"})
were leaking into the final HTML response when they appeared in the
middle or end of chunks, concatenated with regular content.

The previous check only looked at the start of chunks with
chunk.trim().starts_with('{'), which missed embedded signals.

Solution:
- Use regex to find ALL thinking signal JSON objects anywhere in the chunk
- Send each thinking signal separately to the frontend
- Remove thinking signals from the chunk before content processing
- Skip to next iteration if chunk contained only thinking signals

This prevents thinking signals from appearing in the final HTML output
and ensures they're properly handled by the frontend thinking indicator.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-04-14 18:56:24 -03:00
1f743766a8 fix: key-order agnostic signal detection in backend
All checks were successful
BotServer CI/CD / build (push) Successful in 3m11s
2026-04-14 17:57:48 -03:00
c8514eabe7 fix: restore chunk flow by refining tool detection
All checks were successful
BotServer CI/CD / build (push) Successful in 3m39s
2026-04-14 17:52:58 -03:00
fc0144c67c fix: compile errors in internal signal detection
All checks were successful
BotServer CI/CD / build (push) Successful in 3m22s
2026-04-14 17:32:58 -03:00
c7f5f95a37 fix: robust internal signal detection in orchestrator
Some checks failed
BotServer CI/CD / build (push) Failing after 4m16s
2026-04-14 17:24:17 -03:00
3d6db4b46f fix: orchestrator must not swallow thinking events into tool buffer
All checks were successful
BotServer CI/CD / build (push) Successful in 3m23s
2026-04-14 17:18:03 -03:00
44026ba073 fix: restore suggestions during direct tool execution
All checks were successful
BotServer CI/CD / build (push) Successful in 3m36s
2026-04-14 17:04:45 -03:00
73d9531563 fix: buffer HTML chunks to avoid flashing, flush on closing tags
All checks were successful
BotServer CI/CD / build (push) Successful in 8m7s
2026-04-14 14:22:07 -03:00
679bf05504 fix: Kimi K2.5 factory + LLM chunk traces
All checks were successful
BotServer CI/CD / build (push) Successful in 4m35s
- Kimi factory: add max_tokens=16384, temperature=1.0, top_p=1.0,
  and chat_template_kwargs.thinking=true for kimi models
- Add chunk count traces in stream_response so we see LLM progress
  immediately in logs: 'LLM chunk #N received (len=X)'
- Keep generic stream parser clean — model-specific logic lives in
  the request builder (Kimi factory pattern)

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-14 10:20:02 -03:00
3159d04414 fix: spawn LLM response in separate task to prevent recv_task blocking
All checks were successful
BotServer CI/CD / build (push) Successful in 5m3s
Previously the recv_task awaited stream_response() directly, which
froze the entire WebSocket message receiver while the LLM ran (30s+).
This meant a second user message couldn't be processed until the
first LLM call finished — a race condition that locked the session.

Now stream_response runs in its own tokio::spawn, keeping recv_task
free to handle new messages immediately. Also fixed borrow/lifetime
issue by cloning the response channel sender out of the lock scope.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-14 08:59:10 -03:00
dc97813614 fix: revert stream timeout that broke message processing
All checks were successful
BotServer CI/CD / build (push) Successful in 4m40s
2026-04-14 02:11:46 -03:00
301a7dda33 Add LLM stream timeout and debug logs
All checks were successful
BotServer CI/CD / build (push) Successful in 4m8s
2026-04-14 00:55:43 -03:00
6468588f58 fix: remove LLM streaming lock that caused deadlocks
All checks were successful
BotServer CI/CD / build (push) Successful in 3m40s
2026-04-13 22:51:29 -03:00
f48f87cadc debug: add processing traces
All checks were successful
BotServer CI/CD / build (push) Successful in 3m29s
2026-04-13 22:34:27 -03:00
99909de75d fix: disable thinking detection to prevent deadlock
All checks were successful
BotServer CI/CD / build (push) Successful in 3m19s
2026-04-13 22:26:31 -03:00
318d199d6c fix: clear thinking indicator on stream complete
All checks were successful
BotServer CI/CD / build (push) Successful in 3m21s
2026-04-13 22:19:10 -03:00
200b026efe fix: add thinking indicator and 30s timeout to prevent deadlock
All checks were successful
BotServer CI/CD / build (push) Successful in 3m16s
2026-04-13 21:40:50 -03:00
850db4b588 fix: add missing debug import
All checks were successful
BotServer CI/CD / build (push) Successful in 3m16s
2026-04-13 20:51:18 -03:00
650cb70961 debug: add WebSocket message tracing
Some checks failed
BotServer CI/CD / build (push) Failing after 4m10s
2026-04-13 20:46:28 -03:00
4d9d38ffda fix: enable chat_template_kwargs for GLM thinking mode, add stream traces, fix config_manager scope
All checks were successful
BotServer CI/CD / build (push) Successful in 3m55s
2026-04-13 19:23:19 -03:00
81c60ceb25 feat: add Kimi client and GLM thinking mode support, fix tool exec direct return
All checks were successful
BotServer CI/CD / build (push) Successful in 6m22s
2026-04-13 17:36:31 -03:00
f8b47d1ac2 refactor: unify BASIC compilation into BasicCompiler only, runtime uses ScriptService::run() on pre-compiled .ast
Some checks failed
BotServer CI/CD / build (push) Has been cancelled
- Move all preprocessing transforms (convert_multiword_keywords, preprocess_llm_keyword,
  convert_while_wend_syntax, predeclare_variables) into BasicCompiler::preprocess_basic
  so .ast files are fully preprocessed by Drive Monitor
- Replace ScriptService compile/compile_preprocessed/compile_tool_script with
  single run(ast_content) that does engine.compile() + eval_ast_with_scope()
- Remove .bas fallback in tool_executor and start.bas paths - .ast only
- Remove dead code: preprocess_basic_script, normalize_variables_to_lowercase,
  convert_save_for_tools, parse_save_parts, normalize_word
- Fix: USE KB 'cartas' in tool .ast now correctly converted to USE_KB('cartas')
  during compilation, ensuring KB context injection works after tool execution
- Fix: add trace import in llm/mod.rs
2026-04-13 14:05:55 -03:00
326305d55e debug: add LLM output traces to diagnose blank HTML rendering issue
All checks were successful
BotServer CI/CD / build (push) Successful in 4m0s
- Log full LLM response preview (500 chars) with has_html detection
- Log WebSocket send with message type, completeness, and content preview
- Use clone() for chunk in BotResponse to ensure accurate logging

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-13 11:57:43 -03:00
e98dc47ea1 fix: TOOL_EXEC with USE KB now falls through to LLM pipeline for KB-injected response
All checks were successful
BotServer CI/CD / build (push) Successful in 3m50s
When a tool button like Cartas activates a KB via USE KB, instead of
returning just the tool result (empty/label), the handler now checks
if session has active KBs. If so and result is empty/trivial,
falls through to the full LLM pipeline which injects KB context.
2026-04-13 10:02:47 -03:00
20af25e9e2 fix: use compile_preprocessed for .ast files
All checks were successful
BotServer CI/CD / build (push) Successful in 3m29s
2026-04-12 17:48:41 -03:00
12988b637d Fix KB indexing: single file streaming, dedup tracking, .ast cache
All checks were successful
BotServer CI/CD / build (push) Successful in 12m31s
2026-04-11 13:10:09 -03:00
514427c7cc Fix PROMPT.md loading: use get_work_path instead of get_stack_path
All checks were successful
BotServer CI/CD / build (push) Successful in 5m46s
2026-04-10 13:11:45 -03:00
13fee4d079 Use bot-specific llm-endpoint-path from config
All checks were successful
BotServer CI/CD / build (push) Successful in 5m27s
2026-04-09 22:11:54 -03:00
61f4353dbb fix: UTF-8 char boundary panics in log truncation
Some checks failed
BotServer CI/CD / build (push) Failing after 6m45s
2026-04-09 01:37:48 -03:00
b4a82b6c06 Disable local file monitoring, use drive (MinIO) as sole bot source
Some checks failed
BotServer CI/CD / build (push) Failing after 13m5s
- Disable LocalFileMonitor and ConfigWatcher - use S3/MinIO only
- Filter S3 buckets to gbo-*.gbai prefix
- Auto-create bots in database when new S3 buckets discovered
- Change file paths to use work directory instead of /opt/gbo/data
- Add RunQueryDsl import for Diesel queries
2026-04-08 17:47:44 -03:00
9e799dd6b1 Disable /opt/gbo/data loading, use drive (MinIO) only for bot sources
Some checks failed
BotServer CI/CD / build (push) Failing after 8m28s
- Remove LocalFileMonitor and ConfigWatcher for /opt/gbo/data
- Remove /opt/gbo/data from mount_all_bots() scanning
- Change start.bas, tables.bas, and tool paths to use work directory
- Filter drive buckets to only gbo-* prefix
- Remove unused create_bot_simple method
- Fix all warnings (unused imports, variables, dead code)
2026-04-08 16:55:50 -03:00
73002b36cc Update botserver: various fixes and improvements
All checks were successful
BotServer CI/CD / build (push) Successful in 9m59s
2026-04-07 13:33:50 -03:00
86bb4cad8e fix(botserver): Handle TOOL_EXEC message type for direct tool execution without KB/LLM
Some checks failed
BotServer CI/CD / build (push) Failing after 5m40s
2026-04-05 19:11:04 -03:00
7d8f141fc2 refactor: Replace all hardcoded ./botserver-stack paths with get_stack_path()/get_work_path()
Some checks failed
BotServer CI/CD / build (push) Failing after 1m28s
- Adds get_stack_path() helper: returns /opt/gbo in production (.env without botserver-stack), ./botserver-stack in dev
- Adds get_work_path() helper: returns /opt/gbo/work in production, ./botserver-stack/data/system/work in dev
- Updated 35+ files to use dynamic path resolution
- Production system container no longer needs botserver-stack directory
- Work files go to /opt/gbo/work instead of /opt/gbo/bin/botserver-stack
2026-04-04 09:24:44 -03:00
4d7297243e Fix clippy warnings: reduce 17 warnings to 0
All checks were successful
BotServer CI/CD / build (push) Successful in 6m58s
- Fix double_ended_iterator_last: use next_back() instead of last()
- Fix manual_clamp: use .clamp() instead of min().max()
- Fix too_many_arguments: create KbInjectionContext struct
- Fix needless_borrow: remove unnecessary & reference
- Fix let_and_return: return value directly
- Fix await_holding_lock: drop guard before await
- Fix collapsible_else_if: collapse nested if-else

All changes verified with cargo clippy (0 warnings, 0 errors)
Note: Local botserver crashes with existing panic during LocalFileMonitor initialization
This panic exists in original code too, not caused by these changes
2026-04-03 22:34:43 -03:00
fb2e5242da fix: Vault seeding, service health checks, and restart idempotency
All checks were successful
BotServer CI/CD / build (push) Successful in 55m52s
- Replace hardcoded passwords with generate_random_string() for all Vault-seeded services
- Add valkey-cli, nc to SafeCommand allowlist; fix PATH in all 4 execution methods
- Fix empty Vault KV values ('none' placeholder) preventing 'Failed to parse K=V' errors
- Fix special chars in generated passwords triggering shell injection false positives
- Add ALM app.ini creation with absolute paths for Forgejo CLI
- Increase Qdrant timeout 15s→45s, ALM wait 5s→20s
- Persist file_states and kb_states to disk for .bas/KB idempotency across restarts
- Add duplicate check to use_website registration (debug log for existing)
- Remove dead code (SERVER_START_EPOCH, server_epoch)
- Add generate_random_string() to shared mod.rs, remove duplicates
2026-04-01 12:22:57 -03:00
b83b4ffc4d fix: Remove server_epoch() from start_bas_executed Redis key
The epoch caused a new key to be created every second, bypassing
the 'already executed' check and running start.bas multiple times,
resulting in triplicated suggestions.
2026-03-21 20:40:25 -03:00
622f1222dc fix(websocket): force start.bas execution on connection to restore chat on page reload while preventing duplicate execution 2026-03-21 16:38:03 -03:00
3bb115266b feat: Add GUID prefix to Qdrant collection names for KB security isolation 2026-03-19 19:51:28 -03:00
d6ebd0cf6e fix: send suggestions separately from TALK, clear Redis keys for refresh
- Remove suggestions fetching from TALK function
- WebSocket handler now fetches and sends suggestions after start.bas executes
- Clear suggestions and start_bas_executed keys to allow re-run on refresh
- Decouple TALK from suggestions handling
2026-03-19 09:53:39 -03:00
6e594d68dd Fix: Wait for send_task to be ready before executing start.bas 2026-03-18 14:38:46 -03:00
8f073a15fd Fix: Wait for send_task to be ready before executing start.bas so TALK messages work 2026-03-18 14:18:05 -03:00