Commit graph

3535 commits

Author SHA1 Message Date
9bb8b64be7 feat(llm): pass model configuration to LLM generation and streaming
Include model parameter in LLM provider calls across automation, bot, and keyword modules to ensure correct model selection based on configuration. This improves flexibility and consistency in LLM usage.
2025-11-12 08:19:21 -03:00
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
3ffc005cbd feat(automation): refactor prompt construction for summarization
Refactored the prompt construction in compact_prompt.rs to use a single formatted string instead of multiple JSON messages. The conversation is now built as a single string with clear formatting markers, and the role names are more readable (User/Bot instead of user/bot). Also removed a trailing slash from the OpenAI API endpoint URL in llm/mod.rs for consistency.

The changes improve readability of the prompt structure and ensure consistent API endpoint formatting. The summarization request is more clearly formatted for the LLM while maintaining the same functionality.
2025-11-12 00:11:16 -03:00
6a31e65842 feat: simplify system metrics collection and improve status panel
- Removed unused token parameters from get_system_metrics function
- Simplified metrics collection in BotOrchestrator by removing initial token check
- Improved StatusPanel by:
  - Removing 1-second update throttle
  - Refreshing CPU usage more efficiently
  - Separating metrics collection from rendering
  - Using direct CPU measurement from sysinfo
- Cleaned up unused imports and improved code organization

The changes make the system monitoring more straightforward and efficient while maintaining all functionality.
2025-11-11 23:12:27 -03:00
b8ba0a7d41 feat(automation): refactor compact prompt logic and remove unused code
Refactored the compact_prompt_for_bots function to use structured JSON messages instead of plain text formatting. Removed unused execute_compact_prompt method and related code from automation service as the functionality is now handled elsewhere. The changes include:
- Using serde_json to structure messages for LLM
- Improved error handling and fallback mechanism
- Cleaned up obsolete compact prompt execution code
2025-11-11 22:31:19 -03:00
be87cc82b5 feat(automation): improve prompt handling and message processing
- Add initial instruction to compact_prompt_for_bots summary request
- Store processed content separately before formatting as summary
- Save filtered content instead of formatted summary in session manager
- Remove max_tokens limit from OpenAI client request
- Refactor message parsing logic to avoid empty content messages
- Improve role-based message handling in OpenAIClient
2025-11-11 21:45:54 -03:00
035d867c2f feat(llm): add message parsing for OpenAI client
Added parse_messages method to handle structured prompt input for OpenAI API. The method converts human/bot/compact prefixes to appropriate OpenAI roles (user/assistant/system) and properly formats multi-line messages. This enables more complex conversation structures in prompts while maintaining compatibility with the OpenAI API format.

Removed the direct prompt-to-message conversion in generate and generate_stream methods, replacing it with the new parse_messages utility. Also reorganized the impl blocks for better code organization.
2025-11-11 21:13:12 -03:00
349bdd7984 feat(automation): refactor prompt compaction logic
- Remove unused imports and redundant session progress tracking
- Reorder session progress check to after initial validation
- Replace `summarize` with `generate` for LLM interaction
- Add more detailed logging for summarization process
- Improve error handling and fallback behavior
- Move session cleanup guard to end of processing
- Update log levels for better observability (trace -> info for key events)

The changes streamline the prompt compaction flow and improve reliability while maintaining the same core functionality.
2025-11-11 19:23:04 -03:00
415448088b feat: refactor prompt compaction and clean up test files
- Renamed `execute_compact_prompt` to `compact_prompt_for_bots` and simplified logic
- Removed redundant comments and empty lines in test files
- Consolidated prompt compaction threshold handling
- Cleaned up UI logging implementation by removing unnecessary whitespace
- Improved code organization in ui_tree module

The changes focus on code quality improvements, removing clutter, and making the prompt compaction logic more straightforward. Test files were cleaned up to be more concise.
2025-11-11 18:32:52 -03:00
b021540c58 feat(automation): limit compact prompt history to recent messages
Modified compact_prompt_for_bot to only include the most recent N messages (messages_since_summary + 1) when building the compacted prompt string. This prevents excessive context from being included and improves performance by
2025-11-11 15:30:52 -03:00
979b205cdb feat(bot): add trace log for LLM prompt in BotOrchestrator
Added a trace-level log statement to output the constructed LLM prompt in BotOrchestrator. This helps with debugging by making the prompt content visible in logs when trace logging is enabled. The change maintains existing functionality while improving observability.
2025-11-11 15:20:43 -03:00
ee442b1d5c feat(automation): improve prompt compaction scheduling and error handling
Refactor the compact prompt scheduler to use proper indentation and improve error logging. Added more detailed error messages for prompt compaction failures and included bot_id in error logs. The changes make the code more maintainable and debugging easier while maintaining the same functionality.
2025-11-11 15:01:57 -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
332dbe7420 fix(nvidia): remove warning log when no GPU detected
The warning log was removed from the error case in has_nvidia_gpu() function
as it was producing false positives. The function now silently returns false
when nvidia-smi is not available or no NVIDIA GPU is detected, which is the
expected behavior for the fallback case.
2025-11-07 22:51:35 -03:00
0539af9f6b feat(bot): refactor progress and warning output to use UI module
Extract progress bar rendering and warning message display from BotOrchestrator into a dedicated BotUI module. This improves code organization by separating UI concerns from core bot logic. The UI module handles both progress visualization with system metrics and warning message presentation, providing a cleaner interface for output operations.
2025-11-07 22:33:49 -03:00
7fa6ea9f6a feat(deps): add desktop UI support and update dependencies
Added new dependencies for desktop UI support including color-eyre, crossterm, and ratatui. Updated existing dependencies and modified Cargo.toml to include a new 'desktop' feature flag. Also cleaned up the contributors list and modified the add-req.sh script to focus on core bot functionality.

The desktop UI support enables better terminal-based interfaces while the dependency updates ensure compatibility and security. The script changes reflect a shift in focus areas for the project.
2025-11-07 21:31:25 -03:00
5379e21bfe feat(llm): add deepseek reasoning flag and rename GPU layers
Update the LLM server command construction to include a new `--reasoning-format deepseek` argument, enabling explicit selection of the DeepSeek reasoning format. Replace the short `-ngl` flag with the more descriptive `--n-gpu-layers` to improve readability and consistency with other CLI options. This change enhances configurability for models requiring specific reasoning formats and clarifies GPU layer configuration.
2025-11-07 17:16:58 -03:00
312503ae66 feat: add detailed logging for LLM server startup commands
Add `info!` statements that output the exact command used to launch the LLM server on both Windows and Unix platforms. This enhances observability and aids debugging by showing the constructed command line before the process is spawned.
2025-11-07 17:12:55 -03:00
c4c0a1d693 feat(llm): add configurable reasoning-format flag support
- Added retrieval of `llm-server-reasoning-format` configuration in `src/llm/local.rs`.
- When the config value is non‑empty, the server start command now includes `--reasoning-format <value>`.
- Updated argument construction to conditionally append the new flag.
- Cleaned up `src/automation/mod.rs` by removing an unused `std::sync::Arc` import, simplifying the module and eliminating a dead dependency.
2025-11-07 17:04:33 -03:00
892572843c fix: remove trailing slash from default LLM URL configuration
The default LLM service URL was changed from `http://localhost:8081/` to `http://localhost:8081`.
Both the configuration lookup default and the fallback string are updated to omit the trailing slash. This prevents accidental double‑slashes when constructing request paths and aligns the default with expected endpoint formatting.
2025-11-07 16:52:21 -03:00
67eb58cc43 feat(config): update default LLM URL to root endpoint
Changed the fallback LLM service URL from `http://localhost:8081/v1` to `http://localhost:8081/`. This aligns the default endpoint with the updated API that no longer requires the `/v1` path, ensuring the application connects correctly when no custom configuration is provided.
2025-11-07 16:45:19 -03:00
9e1370c04f refactor(bot): limit lock scope for history and tidy progress output
- Reordered imports for clarity (chrono and tokio::time::Instant).
- Fixed comment indentation around compact automation note.
- Refactored session history retrieval to acquire the mutex only briefly, then process compacted message skipping and history limiting outside the lock.
- Added explanatory comments for the new lock handling logic.
- Cleaned up token progress calculation and display formatting, improving readability of GPU/CPU/TOKENS bars.
- Minor formatting adjustments throughout the file.
2025-11-07 16:43:49 -03:00
120d06a0db chore: point LLM client and default configs to local endpoint
Updated the 6.0.4 migration to use `http://localhost:8081/v1` for the default OpenAI model configurations (gpt‑4 and gpt‑3.5‑turbo) and the local embed service. Adjusted `OpenAIClient` to default to the same localhost base URL instead of the production OpenAI API.

Reorganized imports and module ordering in `src/main.rs` (moved `mod llm`, `mod nvidia`, and `BotOrchestrator` import), cleaned up formatting, and removed unused imports. These changes streamline development by directing LLM calls to a local server and improve code readability.
2025-11-07 16:40:19 -03:00
21355df0c8 refactor(bot): disable history retrieval and simplify LLM args
Removed the conversation history loading logic in `BotOrchestrator` and replaced it with a placeholder string, commenting out related prompt construction and tracing. This change streamlines prompt generation while debugging and prevents unnecessary history processing.

In the local LLM server setup, eliminated the `llm-server-ctx-size` configuration and its corresponding command‑line argument, as the context size parameter is no longer required. This simplifies server initialization and avoids passing an unused flag.
2025-11-07 16:35:48 -03:00
dca836a429 fix: redirect LLM server logs to local files instead of deep path
Adjusted the command strings used to start the LLM and embedding servers on both Windows and Unix.
- Replaced the previous log redirection `../../../../logs/llm/stdout.log` with simpler local files (`llm-stdout.log` and `stdout.log`).
- Updated both normal and embedding server launch commands to use the new paths.

This change simplifies log management, ensures logs are correctly written regardless of the working directory, and resolves issues where the previous relative path could be invalid or inaccessible.
2025-11-07 16:19:48 -03:00
e7e84c6cfc refactor: inject AppState into automation & bot, drop Default impl
- Updated `execute_compact_prompt` to accept an `Arc<AppState>` instead of creating a new default state, enabling proper state sharing across tasks.
- Adjusted bot orchestration to clone and pass the existing `AppState` to the automation task, ensuring the same connection and configuration are used.
- Removed the `Default` implementation for `AppState`, preventing accidental creation of a default state with hard‑coded DB connections and services.
- Modified `BotOrchestrator::default` to panic, enforcing explicit construction via `BotOrchestrator::new(state)` for clearer dependency injection.

These changes improve testability, avoid hidden side‑effects from default state initialization, and ensure consistent use of the application state throughout the system.
2025-11-07 16:13:47 -03:00
856e2f0252 feat(bot): persist user messages and refine session handling
Add logic to save user messages to session history for better traceability and context continuity. Simplify session creation error handling and remove redundant warning on closed response channel. Update README with guidance on maintaining production-ready source code.
2025-11-07 10:26:34 -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
9c3fde5eb7 feat(bot, web): improve progress display and simplify context indicator
Use `print!` with stdout flush for smoother in-place GPU/CPU/token progress updates in the bot module. Simplify context indicator logic in the web UI by always removing visibility class to streamline behavior.
2025-11-07 10:01:05 -03:00
053e76a0a2 feat(prompt-compaction): add compacted message handling and forced compaction
Refactored prompt compaction to use a special compacted message type (9) instead of clearing old messages. Added support for forced compaction when threshold is negative and updated history retrieval to skip messages before the last compacted marker. This improves efficiency and preserves summary continuity.
2025-11-07 09:54:04 -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
1a4b56e312 feat(automation): add compaction lock and improve prompt summarization
Added `once_cell` and `scopeguard` dependencies to implement thread-safe compaction lock mechanism. Modified `compact_prompt_for_bot` to:
- Prevent concurrent compaction for the same bot using a global lock
- Add proper tracing and error handling
- Improve summarization with content filtering
- Clean up locks automatically using scopeguard
- Remove redundant threshold check and compact entire history

The changes ensure thread safety during prompt compaction and provide better observability through tracing.
2025-11-06 18:02:04 -03:00
4ce06daf75 feat(automation): improve prompt compaction with async LLM summarization
- Added initial 30s delay to compact prompt scheduler
- Implemented async LLM summarization for conversation history
- Reduced lock contention by minimizing critical sections
- Added fallback to original text if summarization fails
- Updated README with guidance for failed requirements
- Added new `summarize` method to LLMProvider trait
- Improved session manager query with proper DSL usage

The changes optimize the prompt compaction process by:
1. Reducing lock contention through better resource management
2. Adding LLM-based summarization for better conversation compression
3. Making the system more resilient with proper error handling
4. Improving documentation for development practices
2025-11-06 17:07:12 -03:00
df0536f739 feat(automation): add compact prompt scheduler and improve code formatting
Added new compact_prompt module and its scheduler initialization in AutomationService.
Refactored code for better readability:
- Improved import organization
- Fixed indentation in schedule checking logic
- Enhanced error handling with more descriptive messages
- Formatted long lines for better readability
- Added comments for clarity

The changes maintain existing functionality while making the code more maintainable.
2025-11-06 16:15:54 -03:00
b997548cf3 docs(readme): add platform overview and simplify setup steps
Expanded README with detailed feature matrix and enterprise capabilities for the self-host AI automation platform. Simplified setup instructions by removing redundant configuration and build steps to improve clarity and onboarding experience.
2025-11-06 11:49:52 -03:00
f2317d16c9 feat: update logging config and enable automation modules
- Update RUST_LOG configuration in launch.json to include trace level and additional module filters
- Uncomment and enable multiple directories in add-req.sh script
- Add execute_compact_prompt function to automation module
- Extend BasicCompiler comment detection to handle single quotes
- Modify BotOrchestrator system message prefix from "SYSTEM" to "SYS"
- Add placeholder for compact prompt automation in BotOrchestrator initialization

Changes improve debugging capabilities and enable previously commented-out automation features while maintaining existing functionality.
2025-11-05 22:48:55 -03:00
b614d2650a feat: add cron dependency and theme broadcast functionality
Add the `cron` crate (v0.15.0) to Cargo.toml and Cargo.lock to enable scheduling capabilities.
Introduce a new `broadcast_theme_change` helper in `src/automation/mod.rs` that parses CSV theme data and pushes JSON theme update events to all active response channels.
Clean up unused imports in the automation module and add `ConfigManager` import for future configuration handling.
Update `add-req.sh` to adjust the list of processed directories (comment out `auth`, enable `basic`, `config`, `context`, and `drive_monitor`).
These changes lay groundwork for scheduled tasks and dynamic theme updates across the application.
2025-11-05 21:10:03 -03:00
04c2d0d0ce feat: update botserver to v6.0.7 and adjust authors list
- Updated botserver version from 6.0.5 to 6.0.7 in Cargo.toml and Cargo.lock
- Removed old Rodrigo Rodriguez entry from authors list
- Added new Rodrigo Rodriguez entry with updated email
- Maintained all other existing authors in the list
2025-11-05 20:33:17 -03:00
9cc1c11d66 feat(bot): add configurable history limit for conversation prompts
Added support for configurable conversation history limits through bot configuration. The bot now reads 'prompt-history' from config (defaulting to -1 for unlimited) and trims the conversation history accordingly before generating prompts. Updated announcements bot template to use history limit of 2 messages instead of the previous compact setting.
2025-11-05 20:18:34 -03:00
b2760113af fix(migrations, ui): remove redundant constraint check and logo click handler
Removed `IF NOT EXISTS` from the unique constraint in `system_automations` to ensure proper enforcement, and deleted the unused `floatLogo` click event listener to clean up UI behavior.
2025-11-05 15:29:01 -03:00
7493c69fec feat(announcements): add theme colors and custom logo config
Added new configuration options for theme colors (green, yellow) and a custom logo URL to enhance branding and visual customization in announcement templates.
2025-11-05 15:23:02 -03:00
741d736715 feat: update deepseek_r3 regex and add test case
Updated the regex pattern in DeepseekR3Handler to use (?s) flag for dot-matches-newline behavior when removing <think> tags. Added comprehensive test case that verifies the handler correctly processes content with multiline think tags. Also made styling changes to the web interface, though the full diff was truncated.
2025-11-05 14:28:14 -03:00
cc741b378e feat: simplify LLM prompt and add debug logging
- Simplified build_llm_prompt by removing redundant formatting
- Added info logging for LLM model and processed content
- Updated README with development philosophy note
- Adjusted announcement schedule timing from 55 to 59 minutes past the hour
2025-11-05 14:15:12 -03:00
aac36afaba feat(nvidia): mark unused params in get_system_metrics
Mark current_tokens and max_tokens parameters as unused in get_system_metrics function by prefixing them with underscores. This change clarifies that these parameters are intentionally unused in the function implementation while maintaining the function signature for potential future use.
2025-11-05 13:47:19 -03:00
c7fbb46e49 feat: remove unused dependencies and clean up Cargo.lock
Removed several unused dependencies from Cargo.lock including:
- auto_generate_cdp
- headless_chrome
- scraper
- cssparser and related crates
- dtoa and dtoa-short
- string_cache and related crates
- tendril
- tungstenite 0.27.0

Also updated ureq dependency to single version (removed duplicate entry). This cleanup reduces the dependency tree and removes unused code.
2025-11-05 13:46:03 -03:00
45e4a5e735 feat: improve prompt formatting and system metrics
- Update prompt formatting in BotOrchestrator to use clearer labels (SYSTEM/CONTEXT) with emphasis markers
- Remove unused token_ratio field from SystemMetrics struct
- Increase default context size (2048->4096) and prediction length (512->1024) in config
- Clean up metrics calculation by removing redundant token ratio computation

The changes improve readability of system prompts and simplify metrics collection while increasing default model capacity.
2025-11-05 12:46:08 -03:00