Commit graph

3419 commits

Author SHA1 Message Date
d0ce299b79 feat: cleanup unused imports in bootstrap module
- Remove unused diesel::Connection import
- Rename unused database_url variable to _database_url
- Mark unused config parameter in upload_templates_to_drive with underscore
- Maintain same functionality while cleaning up compiler warnings
2025-11-01 07:25:36 -03:00
1c80c026d2 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
01351f60fd feat(auth): add suggestion support and clean up code
- Added new ADD_SUGGESTION keyword handler to support sending suggestions in responses
- Removed unused env import in hear_talk module
- Simplified bot_id assignment to use static string
- Added suggestions field to BotResponse struct
- Improved SET_CONTEXT keyword to take both name and value parameters
- Fixed whitespace in auth handler
- Enhanced error handling for suggestion sending

The changes improve the suggestion system functionality while cleaning up unused code and standardizing response handling.
2025-10-31 20:55:13 -03:00
02b8f6e4cf Merge pull request #445 from ChristopherCastilho/main
Add_suggestion fix
2025-10-31 16:05:24 -03:00
5ca9cfc62a Merge branch 'main' into main 2025-10-31 16:05:14 -03:00
45eb6c99b5 feat: capture Redis RPUSH length and log HSET result for suggestions
Changed the Redis RPUSH command to return the new list length (`Result<i64, RedisError>`) and added a debug log that includes this length. Updated the HSET command to capture its result (`Result<i64, RedisError>`), logging the number of fields added on success and handling errors explicitly. Removed unnecessary `unwrap_or_else` and added comments to clarify behavior, improving observability and error handling for suggestion storage.
2025-10-31 15:58:54 -03:00
5c4245f9b2 feat(auth): refactor authentication handler and update logging
- Changed RUST_LOG level from 'trace' to 'debug' in VSCode launch config
- Simplified auth handler by removing direct bot ID lookup logic
- Added HttpRequest parameter to auth handler
- Implemented bot_from_url helper for bot identification
- Updated auth script path to use bot-specific directory structure
- Removed unused warn import
- Improved error handling for auth script reading and execution

The changes streamline the authentication process by:
1. Moving bot identification to a dedicated helper function
2. Making the auth script path dynamic based on bot name
3. Reducing log verbosity in development
4. Cleaning up unused imports and code
2025-10-31 15:40:52 -03:00
3302295538 feat: simplify bot name handling and improve logging
- Added RUST_LOG=trace to VSCode debug configurations for better debugging
- Removed unused imports (uuid, Selectable, SelectableHelper) from bootstrap module
- Simplified bot name handling by removing name formatting logic, using raw bot folder names
- Renamed check_default_gbot to check_gbot for consistency
- Improved logging format in drive monitor initialization
- Fixed S3 bucket reference in bootstrap manager (removed 'templates/' prefix)
2025-10-31 07:30:37 -03:00
3814276b31 Refactor BotOrchestrator for async bot mounting
* Introduced async mounting
2025-10-30 21:02:44 -03:00
16d2eacbad feat(bot, bootstrap): add bot mounting and improve DB handling
Introduce bot mounting logic in `BotOrchestrator` to load and manage active bots from the database. Enhance `BootstrapManager` by refining Diesel query usage and connection handling for better reliability and maintainability.
2025-10-30 18:48:16 -03:00
1f10a69644 feat: remove LLM configuration defaults migration
The migration file 6.0.6.sql was deleted as it contained default LLM server configurations that are no longer needed. The file was originally used to set up local LLM server settings including model paths and URLs, but these configurations are now handled differently in the system.
2025-10-30 17:36:15 -03:00
f8e2c3f94b feat(config): remove default server config and update database credentials
Removed the default server configuration section from migrations as these values should now be managed through environment variables. Updated default database username from 'postgres' to 'gbuser' in bootstrap and changed default database name from 'gbuser' to 'botserver' in config to align with the removed server configuration defaults.
2025-10-30 17:32:21 -03:00
dcfce44b91 feat(suggestions): enhance suggestion handling and context management in WebSocket 2025-10-30 14:53:06 -03:00
d4db358850 feat(bootstrap): add CSV config loading and improve legacy mode handling
Added functionality to load configuration from CSV files in S3 when available, with fallback to existing methods. The changes include:

1. Added new `load_config_from_csv` method to handle CSV config loading
2. Improved legacy mode handling by attempting CSV load before falling back to database
3. Added new dependencies (uuid, Arc, Mutex) for config management
4. Enhanced error handling and logging for config loading scenarios

The changes maintain backward compatibility while adding the ability to load configurations from CSV files stored in S3, which provides more flexibility in configuration management.
2025-10-30 13:29:46 -03:00
f52aad931a feat: remove default config.csv upload from bootstrap
Removed the automatic upload of default config.csv to S3 during bootstrap initialization. This functionality was previously uploading a local config file to the S3 bucket 'default.gbai/default.gbot' if the file existed. The change simplifies the bootstrap process by removing this implicit behavior.
2025-10-30 13:18:23 -03:00
f18b35d5b6 feat(config): add drive config persistence to .env file
Added functionality to write drive configuration (MinIO settings) to a .env file when the AppConfig is created. The new write_drive_config_to_env function handles the file operations and logs warnings if the write fails. This change ensures drive configuration is persisted for future use while maintaining backward compatibility.
2025-10-30 13:14:06 -03:00
31d65bcfd9 refactor: clean up S3 client creation and imports in bootstrap module
- Renamed unclear function `c` to more descriptive `create_s3_operator`
- Removed duplicate `create_s3_operator` function implementation
- Consolidated imports from aws_sdk_s3 and diesel crates
- Removed unused import `aws_s3_bucket_create`
- Improved code formatting and organization

The changes make the code more maintainable by removing duplication and improving clarity while maintaining the same functionality.
2025-10-30 13:05:35 -03:00
8efe3ec9eb feat(s3): Finally improve directory upload with proper path handling
- Added bucket parameter to upload_directory_recursive for explicit bucket specification
- Improved key construction logic to handle path prefixes more robustly
- Removed redundant trace logs and added more informative upload messages
- Fixed potential issue with bucket name extraction from prefix
- Ensured consistent path separator handling in S3 keys

The changes make the S3 upload functionality more reliable and maintainable by:
1. Explicitly passing bucket names instead of extracting from prefixes
2. Properly handling path separators in S3 keys
3. Providing clearer logging for upload operations
2025-10-30 12:52:21 -03:00
cad94939c3 feat: replace opendal with AWS SDK for S3 operations
- Added AWS SDK S3 dependencies including aws-config, aws-sdk-s3, and related crates
- Removed opendal dependency and replaced with AWS SDK S3 client
- Implemented new get_file_content helper function using AWS SDK
- Updated MinIOHandler to use AWS SDK client instead of opendal Operator
- Modified file change detection to work with AWS SDK's S3 client

The change was made to standardize on AWS's official SDK for S3 operations, which provides better maintenance and feature support compared to the opendal crate. This also aligns with AWS best practices for interacting with S3 services.
2025-10-30 12:35:25 -03:00
7a0241019d Merge branch 'main' of https://github.com/ChristopherCastilho/botserver 2025-10-30 09:09:42 -03:00
866fe9049f feat(keywords): add suggestion keyword to ScriptService initialization 2025-10-30 09:09:15 -03:00
859ab83aa5 Merge branch 'GeneralBots:main' into main 2025-10-29 18:55:20 -03:00
414575a1ec feat(keywords, ui): add suggestion module and UI for context switching
Added new `add_suggestion` module to support suggestion handling logic.
Updated `index.html` to include a dynamic suggestions container that fetches and displays context suggestions.
This improves user experience by enabling quick context changes through interactive suggestion buttons.
2025-10-29 18:54:33 -03:00
5de056a353 feat(bootstrap): improve bucket creation and error handling logic
Enhance the bucket creation process in `BootstrapManager` to handle existing buckets gracefully. Adds logic to reuse the default template when a bucket already exists and ensures proper path formatting before creation. This improves reliability and prevents redundant bucket creation errors.
2025-10-29 14:49:25 -03:00
122e455909 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
b617659b74 Merge branch 'main' of https://github.com/ChristopherCastilho/botserver 2025-10-29 10:25:45 -03:00
7b4e7bc800 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
4d14131acf feat(storage): add S3 bucket existence check during startup
Introduces an async helper function to verify and create the configured S3 bucket if missing. This ensures the application has a valid storage target before initializing the drive, improving reliability in environments with dynamic bucket provisioning.
2025-10-28 21:33:09 -03:00
149f537485 fix(installer): update MinIO setup to use admin user creation
Replaces hardcoded alias setup with commands that create and configure a MinIO admin user, ensuring proper authentication and permissions during installation.
2025-10-28 21:16:25 -03:00
37c03fa55c feat(bootstrap): add env check and improve config update logic
Introduce environment existence check to prevent redundant bootstrap runs and ensure smoother startup. Refactor `update_bot_config` to use globally unique config keys and atomic updates for better data consistency.
2025-10-28 21:06:31 -03:00
d39e25e524 feat(config): refresh environment before establishing DB connection
Reload configuration from environment to ensure latest DATABASE_URL and credentials are used before creating the database connection. This prevents stale config values when environment variables change.
2025-10-28 20:48:28 -03:00
5d32bb13b8 feat(bootstrap): associate bot configuration updates with bot ID
Add logic to retrieve a default bot ID from the database and pass it to `update_bot_config`, ensuring configuration entries are linked to a specific bot. Updated SQL queries to include `bot_id` and `id` fields for consistency and improved data integrity.
2025-10-28 20:41:21 -03:00
eb4907e93b Fix installer: write DATABASE_URL after DB creation and append drive credentials later; update drive credentials only after DB ready 2025-10-28 20:39:14 -03:00
ab8a8b3263 - Docs updated. 2025-10-28 19:47:29 -03:00
930c47f705 - Migration to Open ADAL. 2025-10-28 14:53:45 -03:00
b7449f45fb - Migration to Open ADAL. 2025-10-28 14:20:55 -03:00
e517dfec48 - Migration to Apache OpenDAL. 2025-10-28 14:00:52 -03:00
4bba9cb268 refactor: update building instructions to include additional dependencies for improved compatibility 2025-10-28 13:04:04 -03:00
978d7c3e3a refactor: remove aws-config dependency from Cargo.toml 2025-10-28 12:45:28 -03:00
5d381df0ea refactor: update directory inclusion in add-req.sh and fix-errors.sh for clarity 2025-10-28 12:44:28 -03:00
ff770e593f 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
d32c78abd0 refactor: comment out unused directories in add-req.sh for clarity 2025-10-28 11:35:25 -03:00
f46131599e Merge branch 'main' into main 2025-10-28 07:18:56 -03:00
f6385d0218 refactor: update configuration prefix to 'pragmatismo-' and add CLI example format 2025-10-27 18:32:36 -03:00
4aeea51c0a refactor: remove unused dev-start script and clean up code formatting in mod.rs 2025-10-26 21:47:20 -03:00
ca87e5e896 fix: update required components and correct exec command path in PackageManager 2025-10-26 20:50:37 -03:00
00cf19b195 fix: update file paths to use correct directory for HTML files 2025-10-26 18:49:11 -03:00
17918ba41b refactor: remove unnecessary post-install commands for Linux in PackageManager 2025-10-26 18:42:34 -03:00
4180c5412b feat: add data download list to ComponentConfig and implement file downloading
- Added `data_download_list` field to `ComponentConfig` struct in `component.rs`.
- Implemented processing of `data_download_list` in the `PackageManager` to download files asynchronously in `facade.rs`.
- Updated `installer.rs` to initialize `data_download_list` for various components.
- Refactored `download_file` function in `utils.rs` to return `anyhow::Error` for better error handling.
2025-10-26 18:26:19 -03:00
10b7beeae1 - Termination procedure optional. 2025-10-26 17:13:58 -03:00