Commit graph

393 commits

Author SHA1 Message Date
352ff8b45c Lower score threshold to 0.20 and add KB result logging
All checks were successful
BotServer CI/CD / build (push) Successful in 3m32s
2026-04-15 16:28:41 -03:00
2c6ed89319 fix: add stream_exit logging to trace early loop termination
All checks were successful
BotServer CI/CD / build (push) Successful in 3m49s
2026-04-15 15:24:30 -03:00
be94e5c3ad Improve embedding config logging
All checks were successful
BotServer CI/CD / build (push) Successful in 3m43s
2026-04-15 15:01:13 -03:00
cbf8e024d3 Add logging for embedding config loading and fix KB search dedup
All checks were successful
BotServer CI/CD / build (push) Successful in 4m14s
2026-04-15 14:46:02 -03:00
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
d1cd7513d7 aumentar: limite de resultados KB de 5/10 para 20/25
All checks were successful
BotServer CI/CD / build (push) Successful in 2m50s
Aumenta a abrangência da busca em KB para capturar mais contexto
relevante, especialmente em documentos com múltiplas entidades
como listas de ramais.

- inject_kb_context: 5 -> 20 resultados
- think_kb: 10 -> 25 resultados
- search_active_websites: 5 -> 20 resultados
2026-04-15 11:02:31 -03:00
5338ffab12 fix: use continue instead of break on low-relevance KB search results
All checks were successful
BotServer CI/CD / build (push) Successful in 4m9s
Bug: Using break instead of continue when encountering low-relevance
results caused the search to stop prematurely, missing potentially
relevant chunks in subsequent results.

- Changed break to continue when score < 0.4 in search_single_collection
- Changed break to continue when score < 0.4 in search_single_kb
- Lowered threshold from 0.5 to 0.4 for consistency

This ensures all search results are evaluated, not just those before
the first low-relevance result.
2026-04-15 10:19:13 -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
09f4c876b4 Update HTML rendering: buffer chunks and render visual elements only
Some checks failed
BotServer CI/CD / build (push) Failing after 4m19s
2026-04-14 14:39:08 -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
c9fa057203 fix: TOOL_EXEC uses correct MessageType constant from botlib, not enums
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-13 18:43:14 -03:00
8a65afbfc5 feat: add [BASIC_EXEC] traces for start, tool, scheduler, webhook execution
All checks were successful
BotServer CI/CD / build (push) Successful in 3m18s
2026-04-13 18:16:01 -03:00
99572f0dc5 fix: ensure websocket_session_id and channel context are set before tool execution so TALK can route messages to frontend
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-13 18:04:02 -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
1f77d7f099 fix: skip KB re-indexing when kb_collections already has docs, prevents vector DB loop
All checks were successful
BotServer CI/CD / build (push) Successful in 4m5s
2026-04-13 09:53:25 -03:00
1148069652 fix: EmbeddingConfig::from_bot_config fallback to default bot config
All checks were successful
BotServer CI/CD / build (push) Successful in 6m9s
When a bot lacks embedding-url in its own config, from_bot_config now
falls back to the default bot's config via ConfigManager::get_config.
Previously it returned empty string, causing embedding server connection
failures for bots without explicit embedding configuration.
2026-04-13 08:19:42 -03:00
4dbc418aab fix: detect name,value header in config.csv
Header detection was only checking for key,value but the actual
CSV uses name,value as header row. Now both are detected and skipped.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-12 20:47:56 -03:00
36fdf52780 fix: sync_gbot_config now handles CSV with or without header row
All checks were successful
BotServer CI/CD / build (push) Successful in 3m32s
- Removed unconditional .skip(1) that was skipping first config line
- Added header detection: skips first line only if it looks like 'key,value' header
- Added validation to skip empty keys
- Also fixed indentation in drive_monitor gbkb file processing

This fixes the issue where config.csv changes on Drive weren't being
synced to bot_configuration database table for salesianos bot.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-12 20:32:30 -03:00
1977c4c0af fix: extract base URL for embedding health checks
All checks were successful
BotServer CI/CD / build (push) Successful in 4m2s
- Add extract_base_url() helper to parse scheme://host:port from full URLs
- Fix health check to use base URL instead of full endpoint path
- Allows embedding-url config like http://host:port/v1/embeddings to work correctly
- Health check now goes to http://host:port/health instead of http://host:port/v1/embeddings/health
2026-04-12 19:33:35 -03:00
efe45bb296 fix: use .ast files in tool_executor
All checks were successful
BotServer CI/CD / build (push) Successful in 3m14s
2026-04-12 17:56:33 -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
2f3dd957e3 fix: resolve kb_collections and kb_group_associations imports for directory feature
All checks were successful
BotServer CI/CD / build (push) Successful in 7m50s
- Extract kb_collections and kb_group_associations into dedicated schema/kb.rs module
- Gate kb module behind rbac feature (directory depends on rbac)
- Remove duplicate definitions from research.rs
- Fix import paths in directory/groups/kbs.rs
- Remove dead rbac_kb imports from settings/rbac.rs
- Gate llm::local module behind llm feature to fix missing set_embedding_server_ready

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-12 12:48:42 -03:00