Commit graph

118 commits

Author SHA1 Message Date
4c279d2a19 feat: optimize suggestions and LLM server configuration
- Added duplicate filtering for suggestions in both backend (Rust) and frontend (JavaScript)
- Changed announcement summary schedule from every 15 minutes to hourly at :37
- Simplified LLM prompt for document summarization
- Updated LLM server configuration with reduced GPU layers and increased context size
- Removed memory mapping and lock settings for LLM server
- Improved HTML formatting and added missing newline at EOF
2025-11-03 13:38:55 -03:00
78543b5223 feat(announcements): add scheduled updates every 15 minutes
Added SET_SCHEDULE directive to run the update-summary script every 15 minutes. This ensures the announcements summary stays current by regularly fetching and processing the latest news document.
2025-11-03 13:18:40 -03:00
8aeb6f31ea feat(bot): add semantic caching and improve message handling
Enhances BotOrchestrator by integrating optional semantic caching via LangCache for faster LLM responses. Also refactors message saving to occur before and after direct mode handling, and simplifies context change logic for better clarity and flow.
2025-11-03 12:54:21 -03:00
b5e1501454 feat: add trace logging, refactor bot streaming, add config fallback
- Added `trace!` logging in `bot_memory.rs` to record retrieved memory values for easier debugging.
- Refactored `BotOrchestrator` in `bot/mod.rs`:
  - Removed duplicate session save block and consolidated message persistence.
  - Replaced low‑level LLM streaming with a structured `UserMessage` and `stream_response` workflow, improving error handling and readability.
- Updated configuration loading in `config/mod.rs`:
  - Imported `get_default_bot` and enhanced `get_config` to fall back to the default bot configuration when the primary query fails.
  - Established a fresh DB connection for the fallback path to avoid borrowing issues.
2025-11-03 10:13:39 -03:00
b033be3e64 refactor(automation, llm): simplify service init and prompt handling
- Remove `scripts_dir` from `AutomationService` and its constructor, as it was unused.
- Drop LLM and embedding server readiness checks; the service now only schedules periodic tasks.
- Increase the health‑check interval from 5 seconds to 15 seconds for reduced load.
- Streamline the LLM keyword prompt to a concise `"User: {}"` format, removing verbose boilerplate.
- Remove unnecessary logging and LLM cache handling code from the bot orchestrator, cleaning up unused environment variable checks and cache queries.
2025-11-03 08:23:03 -03:00
d2ee695d8b feat: add bot_id to system_automations and enhance schedule handling
- Introduced `bot_id` column in `system_automations` table (migration 6.0.0.sql) and updated the Diesel schema/model to include it.
- Adjusted migrations to remove the hard‑coded “Update Summary” automation and only create an index on the `name` column.
- Extended the `SET_SCHEDULE` keyword:
  - Added a second string argument for the script name.
  - Passed the invoking user's `bot_id` to the database layer.
  - Updated function signature to accept a full `UserSession` instead of discarding it.
- Modified `execute_set_schedule` to store `bot_id`, script name, and activation flag; added conflict handling on `(bot_id, param)` to update schedule and reset trigger state.
- Updated imports and logging to reflect new parameters.

These changes enable per‑bot automation management, allow specifying the script to run, and improve idempotent schedule updates.
2025-11-02 19:32:25 -03:00
87fc13b08a feat(keywords): add CLEAR_SUGGESTIONS command and implement in dialog
Added new CLEAR_SUGGESTIONS keyword command that clears user suggestions from Redis cache. Implemented the command in the announcements dialog start script to prevent duplicate suggestions. The command handles Redis connection errors gracefully and logs appropriate debug information.
2025-11-02 14:21:38 -03:00
0342e1cac9 refactor(state): rename resource clients and improve keyword syntax
Updated references from `redis_client`, `s3_client`, and `custom_conn` to unified names `cache`, `drive`, and `conn` for consistency across modules. Adjusted `add_suggestion_keyword` to use clearer parameter naming and enhanced custom syntax registration for better readability and maintainability.
2025-11-01 20:53:45 -03:00
4e781b1815 feat(drive_monitor): restart LLaMA servers on llm- config changes
Add logic to detect changes in llm-related configuration properties when syncing gbot configs. If any llm- keys differ from stored values, automatically restart LLaMA servers to apply updates. This ensures model servers stay in sync with configuration changes without unnecessary restarts.
2025-11-01 14:23:40 -03:00
6d68585c71 refactor(config): replace raw SQL with Diesel query for bot config
Updated `ConfigManager::get_config` to use Diesel query builder instead of raw SQL for improved safety and maintainability. Adjusted parameter naming and integrated schema references. Also refactored `ensure_llama_servers_running` to fetch configuration from the database using `AppState` and `ConfigManager`. Removed unused imports in bootstrap module.
2025-11-01 11:48:46 -03:00
eb647530bf feat(config): refactor AI config into separate LLM and embedding configs
- Split AIConfig into separate LLMConfig and embedding config structs
- Update create_site.rs to use config.llm instead of config.ai
- Improve config loading comments in bootstrap manager
- Add new LLM-related environment variables with defaults
- Maintain backward compatibility with existing config loading
- Clean up unused AIConfig struct and related code

The change better organizes the AI-related configuration by separating LLM and embedding configurations, making the code more maintainable and flexible for future AI service integrations.
2025-11-01 08:43:14 -03:00
8bf347a9a2 feat: refactor database connection handling and add LLM component
- Replace direct database connection establishment with shared `establish_pg_connection` utility
- Add "llm" to required components list in bootstrap manager
- Lower default RUST_LOG level from debug to info in VSCode config
- Clean up imports and connection error messages
- Remove hardcoded database URL strings in favor of centralized connection handling

The changes improve code maintainability by centralizing database connection logic and adding support for the new LLM component in the bootstrap process.
2025-11-01 07:20:04 -03:00
205cd13b49 feat(bootstrap): upload default config and improve S3 setup
Add logic to automatically upload an initial `config.csv` to the default S3 bucket during bootstrap. Enhance S3 operator creation by ensuring endpoint formatting, setting default bucket and region, and enabling path style. Improve template upload flow by validating bucket existence and creating it if missing. Also include debug logging for better traceability.
2025-10-29 14:16:11 -03:00
663864cb78 refactor(config): remove unused S3 bucket configuration and setup logic
Eliminates the `s3_bucket` field from `AppConfig` and deletes related initialization code in `main.rs`. This simplifies configuration management since S3 bucket handling is no longer required or used in the application.
2025-10-29 09:54:39 -03:00
0cb16552b3 Refactor dependencies in Cargo.toml and update start.bas dialog
- Removed unused Tauri dependencies and replaced aws-sdk-s3 with opendal for S3 services.
- Cleaned up feature flags in Cargo.toml.
- Simplified the welcome message logic in start.bas and removed redundant comments.
2025-10-28 12:07:14 -03:00
a8982e5914 Add AWS SDK integration and update bot configuration management
- Introduced AWS SDK dependencies for S3 and CSV handling.
- Implemented logic to check and update the default bot configuration in S3 after component installation.
- Added a new configuration CSV template for bot settings.
- Refactored package manager to register cache component with updated download URL and binary name.
- Updated README and Cargo files to reflect new dependencies and configuration options.
2025-10-26 14:15:43 -03:00
9c36aa10fa - More automation from start to web, user sessions. 2025-10-20 23:32:49 -03:00
f8d4e8925f Add indicatif for progress bars and enhance bootstrap
----------------------------------------------------------------
2025-10-19 19:28:08 -03:00
be1e2575f9 - Refactor in bot package. 2025-10-18 12:01:39 -03:00
3761707c5c Remove sqlite support and switch auth to POST 2025-10-16 16:49:23 -03:00
e5a9752caa Enhance bot memory and Redis guards
- Derive bot_id from BOT_GUID env var
- Guard concurrent runs with Redis
- Read CACHE_URL for Redis connection
- Extend bot memory keyword to accept comma as separator
- Increase LLM timeouts to 180s (local and legacy)
- Update templates to use bot memory (GET_BOT_MEMORY/SET_BOT_MEMORY)
- Fix start script path to announcements.gbai
2025-10-16 14:22:28 -03:00
4acb9bb8f5 Migrate automations to param and sqlite
- Rename script_name to param in automation flow and DB schema
- Add BotMemory model and bot_memories table
- Remove script_name field from automation
- Enable sqlite support via rusqlite and related crates (optional)
- Update prompts and queries to use param instead of script_name
- Remove deprecated annoucements GBai templates and align add-req.sh
- Refactor main to initialize automation service and simplify startup
2025-10-16 11:43:02 -03:00
1fdf76b530 Refactor TALK keyword to use try_send
Remove unnecessary async spawn in TALK handling and use `try_send` on
the WebSocket channel. Acquire `response_channels` with `try_lock` and
spawn an async task only when falling back to the web adapter. Clean up
debug logs and add missing `env` import. Also delete an extra blank line
in the announcement start script.
2025-10-15 22:39:04 -03:00
648e7f48f9 Refactor LLM parsing and overhaul connection UI
- Strip content up to the “final<|message|>” token in OpenAI responses.
- Replace the text‑based connection‑status indicator with a small
  flashing circle.
- Simplify updateConnectionStatus to take only the status argument.
- Remove special handling of the initial assistant message and
  streamline empty‑state removal.
- Clean up stray blank lines in the announcement template.
2025-10-15 22:24:04 -03:00
ff89298e61 Refactor async GET and LLM, add connection UI
- Execute GET requests in a dedicated thread with its own Tokio runtime,
  add timeout handling and clearer error messages.
- Tighten `is_safe_path` checks and simplify HTTP/S3 logic.
- Change `llm_keyword` to accept `Arc<AppState>`, add prompt builder,
  run LLM generation in an isolated thread with timeout.
- Update keyword registration call in `basic/mod.rs`.
- Convert template script to use `let` declarations and return a
  boolean.
- Introduce connection‑status indicator in the web UI with styles,
  automatic reconnection attempts, and proper WS/WSS handling for voice.
2025-10-15 21:18:01 -03:00
cfeb024173 Refactor GET keyword with blocking execution
- Replace async task spawning with `block_in_place` to simplify GET
  handling
- Add detailed safety checks for file paths and organization prefixes
- Introduce timeout and keep‑alive settings for HTTP client
- Improve S3 bucket access with existence check, timeouts, and richer
  logging
- Switch tracing logs to debug and add warning logs where appropriate
- Update announcement template to retrieve a PDF, generate a resume via
  LLM, and set context for subsequent queries.
2025-10-15 13:13:27 -03:00
f401c170d4 - GET ketyowrd for buckets. 2025-10-15 12:45:15 -03:00
a293c0e083 - Fix on the web presentation. 2025-10-15 10:37:04 -03:00
f626793d77 Refactor LLM flow, add prompts, fix UI streaming
- Extract LLM generation into `execute_llm_generation` and simplify
  keyword handling.
- Prepend system prompt and session context to LLM prompts in
  `BotOrchestrator`.
- Parse incoming WebSocket messages as JSON and use the `content` field.
- Add async `get_session_context` and stop injecting Redis context into
  conversation history.
- Change default LLM URL to `http://48.217.66.81:8080` throughout the
  project.
- Use the existing DB pool instead of creating a separate custom
  connection.
- Update `start.bas` to call LLM and set a new context string.
- Refactor web client message handling: separate event processing,
  improve streaming logic, reset streaming state on thinking end, and
  remove unused test functions.
2025-10-15 01:14:37 -03:00
e144e013d7 Add async Redis context storage and session fetch
- Use `tokio::spawn` to run Redis SET for `SET_CONTEXT` in a background
  task with detailed tracing.
- Move context retrieval from `BotOrchestrator` to `SessionManager`,
  inserting it as a system message in conversation history.
- Remove redundant Redis fetch logic from `BotOrchestrator`.
- Update `DEV.md` to install `valkey-cli`, reorder cargo tools, and
  adjust apt commands.
- Add a `SET_CONTEXT "azul bolinha"` example to the announcements
  template.
2025-10-15 00:01:48 -03:00
573437cb6f - Database schema added. 2025-10-14 16:34:34 -03:00
37d8fab617 Refactor session handling and auth flow 2025-10-14 14:51:49 -03:00
51c9aea63b Add botserver prompt, auth template, and CSS 2025-10-14 13:51:54 -03:00
8f96cd1015 Refactor server code and add auth API fixes 2025-10-14 13:51:27 -03:00
3aeb3ebc70 - New features for start.bas 2025-10-13 17:43:03 -03:00
283774aa0f - Remove all compilation errors. 2025-10-11 12:29:03 -03:00
1bb97ebee9 Migration to Rust removal of Azure. 2025-10-06 10:29:14 -03:00
023b83aacf - Warning removal.
Some checks failed
GBCI / build (push) Failing after 11s
2025-09-24 15:20:32 -03:00
4ab7467a2f -New PARAMS for LLM Embedding.
Some checks are pending
GBCI / build (push) Waiting to run
2025-09-11 17:03:29 -03:00
d7d6afa5cc - LocalLLM Embedded.
Some checks failed
GBCI / build (push) Has been cancelled
2025-09-10 11:11:32 -03:00
300b5dc258 Update templates/edu.gbai/edu.gbdialog/enrollment.bas
Some checks failed
GBCI / build (push) Failing after 24m25s
2025-08-10 20:59:06 +00:00
f245de43b2 fix: update Puppeteer launch options to use environment variables for headless mode and enhance enrollment confirmation messages
Some checks failed
GBCI / build (push) Failing after 8m24s
2025-06-27 12:46:15 -03:00
2b2ab3a42e fix(KBService): standardize formatting and improve code readability
All checks were successful
GBCI / build (push) Successful in 1m13s
2025-05-22 20:32:30 -03:00
1ef6cbb032 feat(KeywordsExpressions): add support for posting to Instagram with parameters
All checks were successful
GBCI / build (push) Successful in 2m2s
refactor(GBAdminService): improve folder name extraction logic
refactor(ImageProcessingServices): clean up whitespace and enhance image generation options
refactor(SystemKeywords): simplify rewrite prompt and logging
fix(ChatServices): correct spacing in model invocation
delete(marketing.gbai): remove outdated marketing poster template
add(marketing.gbai): create new marketing poster template with Instagram posting functionality
2025-05-09 21:19:14 -03:00
4d850362d2 chore: remove unused image assets and update API URL in configuration 2025-04-25 01:46:35 -03:00
31b7d5d59e fix(GBMinService): comment out file writing to prevent overwriting bot manifest
Some checks failed
GBCI / build (push) Failing after 1h26m41s
2025-04-17 16:21:02 -03:00
6d75b4997b fix: update URLs and email addresses to reflect new domain 2025-04-15 12:49:05 -03:00
5e8e3cbea3 fix(llm.gblib): Talk to data local db use fix. 2024-11-28 11:13:01 -03:00
878f10245f fix(kb.gbapp): Auto Logo generation fixed. 2024-11-26 09:35:15 -03:00
5b69a12d74 fix(llm.gblib): Talk to data local db use fix. 2024-11-24 12:43:58 -03:00