Commit graph

53 commits

Author SHA1 Message Date
d1f6da70d8 feat(bootstrap): remove legacy mode and simplify bootstrap process
Removed the legacy TABLES_SERVER environment variable check and related database connection logic. Simplified the bootstrap process to always generate new credentials and write them to .env file. Also updated drive monitor log message to use "Drive" instead of "S3" for consistency. #464
2025-11-12 00:26:42 -03:00
b52e4b2737 feat(bootstrap): add secure password generation and env setup
Added functionality to generate secure passwords for database and drive server credentials during bootstrap. Removed the PostgreSQL running check and auto-start logic as it's no longer needed. Renamed `create_s3_operator` to more descriptive `get_drive_client`. The bootstrap process now automatically sets up required environment variables in .env file including database URL and drive server credentials.
2025-11-11 11:12:54 -03:00
fd73d207cc feat(s3): add timeout handling and clean up drive config
- Added 30-second timeout for S3 bucket listing operations in DriveMonitor
- Removed unused `use_ssl` flag from DriveConfig and cleaned up imports
- Improved error handling with proper logging for timeout scenarios
- Fixed syntax in AppConfig initialization (added missing commas)
- Added proper spacing between methods in BootstrapManager
2025-11-11 10:34:06 -03:00
fd45f4e0dd refactor: simplify UI panels, use pooled DB, add --noui flag
- Removed unused `id` and `app_state` fields from `ChatPanel`; updated constructor to accept but ignore the state, reducing memory footprint.
- Switched database access in `ChatPanel` from a raw `Mutex` lock to a connection pool (`app_state.conn.get()`), improving concurrency and error handling.
- Reordered and cleaned up imports in `status_panel.rs` and formatted struct fields for readability.
- Updated VS Code launch configuration to pass `--noui` argument, enabling headless mode for debugging.
- Bumped several crate versions in `Cargo.lock` (e.g., `bitflags` to 2.10.0, `syn` to 2.0.108, `cookie` to 0.16.2) and added the new `ashpd` dependency, aligning the project with latest library releases.
2025-11-11 09:42:52 -03:00
25daaa8a9e feat(bootstrap): enable bootstrap and package_manager modules
Uncommented bootstrap and package_manager directories in add-req.sh to include them in build process. Refactored bootstrap module for cleaner initialization and improved component handling logic.
2025-11-08 07:04:44 -03:00
ab7abacbe3 refactor(bootstrap): remove unused warn import from log module
Removed the unused `warn` import from the `log` module in `mod.rs` to clean up unused dependencies and improve code clarity.
2025-11-07 10:16:49 -03:00
8581927d97 refactor(logging): update component names and adjust log levels
Renamed PostgreSQL references to "Tables" for clarity in bootstrap logs, changed config sync logging from info to trace for reduced verbosity, and made session message clearing method private to limit external access.
2025-11-07 10:11:08 -03:00
3f187feccb fix: add PostgreSQL auto-start and silence unused variable warnings
Added a check in `BootstrapManager` to detect if PostgreSQL is running and attempt to start the "tables" component automatically if not. Also prefixed unused variables and struct fields with underscores in compiler, session, and model modules to suppress warnings and improve code clarity.
2025-11-07 09:37:45 -03:00
7c69284f07 feat(compiler): clean up stale schedules on script recompilation
Added tracking of previously scheduled scripts using a `HashSet` and initialized it in `BasicCompiler::new`. Updated `compile_file` and `preprocess_basic` to require mutable access, allowing schedule cleanup before processing. Implemented logic to delete existing scheduled automations for a script using Diesel queries, ensuring old schedules are removed when a script is recompiled without a `SET_SCHEDULE`. Added necessary Diesel imports and `TriggerKind` reference. This prevents duplicate or orphaned scheduled tasks.
2025-11-05 10:15:36 -03:00
1f9100d3a5 feat: refactor auth and models, update LLM fallback strategy
- Simplified auth module by removing unused imports and code
- Cleaned up shared models by removing unused structs (Organization, User, Bot, etc.)
- Updated add-req.sh to comment out unused directories
- Modified LLM fallback strategy in README with additional notes about model behaviors

The changes focus on removing unused code and improving documentation while maintaining existing functionality. The auth module was significantly reduced by removing redundant code, and similar cleanup was applied to shared models. The build script was adjusted to reflect currently used directories.
2025-11-04 23:11:33 -03:00
854292bae5 feat(ide): update code generation guidelines and improve component startup
- Refine IDE prompt to clarify identifier/character requirements in English
- Add info and debug logging for component startup process in bootstrap
- Fix PostgreSQL command formatting and improve output redirection
- Standardize Valkey command formatting and fix execution command
- Remove LLM server execution command (now handled separately)
- Clean up unused PostgreSQL status check code for tables component
2025-11-04 07:58:43 -03:00
aec4411be8 feat: check bucket existence before uploading templates
Only upload templates to Drive buckets if the bucket was just created. Skip upload if bucket already exists to avoid overwriting existing content.

- Change from always uploading to conditionally uploading based on bucket existence
- Add info log when skipping upload for existing buckets
- Maintain same upload behavior for newly created buckets
2025-11-04 07:07:39 -03:00
fea1574518 feat: enforce config load errors and add dynamic LLM model handling
- Updated `BootstrapManager` to use `AppConfig::from_env().expect(...)` and `AppConfig::from_database(...).expect(...)` ensuring failures are explicit rather than silently ignored.
- Refactored error propagation in bootstrap flow to use `?` where appropriate, improving reliability of configuration loading.
- Added import of `llm_models` in `bot` module and introduced `ConfigManager` usage to fetch the LLM model identifier at runtime.
- Integrated dynamic LLM model handler selection via `llm_models::get_handler(&model)`.
- Replaced static environment variable retrieval for embedding configuration with runtime
2025-11-02 18:36:21 -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
7170663b6f feat: remove unused bot config update logic from bootstrap
The commit removes the unused bot configuration update functionality from the bootstrap manager. This includes:
1. Removing the fallback logic in component installation that would update bot configs
2. Removing the entire update_bot_config method which was used to insert/update configuration values

The code was likely removed because this functionality is no longer needed or has been moved elsewhere in the codebase. The removal simplifies the bootstrap process by eliminating unused database operations.
2025-11-01 09:50:28 -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
a19ba2bef7 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
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
8c53161129 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
f85b19efda 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
a01c7505cb 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
17d6cd33be 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
5ec0d3d2ad 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
e93935d5a3 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
792186cf76 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
5a6e36e6c2 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
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
78d154cc7f 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
0118fd52e9 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
dba8ffe782 - Migration to Open ADAL. 2025-10-28 14:53:45 -03:00
2a2915b543 - Migration to Open ADAL. 2025-10-28 14:20:55 -03:00
f29a3c1259 - Migration to Apache OpenDAL. 2025-10-28 14:00:52 -03:00
223f6e2b5d refactor: remove unused dev-start script and clean up code formatting in mod.rs 2025-10-26 21:47:20 -03:00
f1f4531529 fix: update required components and correct exec command path in PackageManager 2025-10-26 20:50:37 -03:00
6ad29634ea - Termination procedure optional. 2025-10-26 17:13:58 -03:00
ca66f09031 Remove unused aws_config import from bootstrap module 2025-10-26 15:40:46 -03:00
a04d896b80 Refactor AWS SDK configuration in bot update logic and fix comment typos 2025-10-26 15:40:29 -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
c242aa010b Enable template bot creation and fix bot schema 2025-10-21 22:43:28 -03:00
9c36aa10fa - More automation from start to web, user sessions. 2025-10-20 23:32:49 -03:00
c595380837 Support legacy bootstrap and update installer 2025-10-20 20:21:31 -03:00
248ad08efc Add new KB and session association tables 2025-10-20 19:49:54 -03:00
de5b651b89 Refactor config loading and DB URL parsing 2025-10-20 16:52:08 -03:00
30b026585d Add include_dir dependency and use it for embedded migrations
Use include_dir to embed migration scripts and load them at runtime.
This change allows for easier management and versioning of migrations.
2025-10-20 09:42:07 -03:00
ed93f70f94 Remove tables install from bootstrap
The tables component is now installed by default. The install command no
longer installs it as part of the bootstrap process.
2025-10-20 07:34:06 -03:00
f8d4e8925f Add indicatif for progress bars and enhance bootstrap
----------------------------------------------------------------
2025-10-19 19:28:08 -03:00
2af3e3a4b8 Add method to start all components
Implement a new method `start_all` in `BootstrapManager` to start all
components using the `PackageManager`.

This method creates a new `PackageManager` instance and uses it to start
each component in a predefined list.

--- Add remove_local for PackageManager

Remove component specific code

The specific code for component 'tables' has been removed from the
`remove_local` method in `PackageManager`.

The method now simply removes the binary directory for the component.

--- Implement start for PackageManager

Add a new method `start` to `PackageManager` to start a component.

This method takes a component name as an argument and uses the
`exec_cmd` for that component to spawn a new process.

If the component is not found, it returns an error.
2025-10-19 15:03:27 -03:00
6f30517526 - Tables is installing. 2025-10-19 14:02:47 -03:00
aa69c63cee Refactor bootstrap and package manager, add ureq
- Split package manager into separate modules
- Expose only the installer API
- Simplify BootstrapManager to install components and load config
- Pin ureq to 3.1.2 and add ureq‑proto crate
- Clean up configuration code and remove legacy comments
- Update helper scripts and server start command formatting
2025-10-19 11:08:23 -03:00