43 Commits

Author SHA1 Message Date
Saifeddine ALOUI
7b6233349e feat: Implement core bot management, admin routes, and model metadata CRUD
This commit introduces several related updates across the application, focusing on establishing core functionality for bot management, admin routing, and metadata handling.

Key changes include:
- Updating API routes for admin and proxy functionality.
- Refactoring the `BotManager` to handle the starting of active bots.
- Implementing necessary CRUD operations for model metadata and server information.
- Updating database migration and session management files.
- Adjusting relevant template files for the admin dashboard display.
2026-04-19 04:05:00 +02:00
Saifeddine ALOUI
3e925a3b94 Refactor and update administrative settings, data store management, and memory handling
This commit updates several core components related to administrative settings, data store management, and memory management within the application.

Specifically, it includes:
- Updates to API routes for managing data stores and proxy response wrapping.
- Refinements in the memory management system.
- Adjustments to database migration logic related to settings.
- Updates to relevant schema and template files.
2026-04-17 22:15:06 +02:00
Saifeddine ALOUI
b506c6141d feat(proxy/crud/database): Enhance context filtering, model matching, and database pooling
This commit introduces several improvements related to context handling, server/model association logic, and database connection pooling safety.

### Changes Implemented:

In `app/api/v1/routes/proxy.py`:
*   **Context Filtering with Exception**: Implemented conditional filtering of available metadata based on required context tokens. A specific exception is added to bypass this filter for system tasks (e.g., `sys_build_` requests) to prevent deadlocks during large context operations.

In `app/crud/server_crud.py`:
*   **Flexible Model Matching**: Updated the logic for matching servers to models to allow flexible matching, supporting scenarios where `model` can match `model:latest` and vice versa, and explicitly handling Ollama naming conventions.

In `app/database/session.py`:
*   **Safe Connection Pooling**: Removed specific pool configuration parameters (`pool_size`, `max_overflow`, `pool_timeout`, `pool_recycle`) from `create_async_engine` initialization to rely on safer defaults, particularly when using SQLite/aiosqlite, improving robustness in high-concurrency scenarios.
2026-04-17 20:08:44 +02:00
Saifeddine ALOUI
a27a041eeb feat(system): Improve background task handling, database pooling, and graceful shutdown
This commit addresses several areas to improve the stability, performance, and graceful shutdown procedure of the application:

### Changes:
*   **Refine Background Task Handling (`app/api/v1/routes/proxy.py`):** Enhanced the background memory processing task to include specific error handling for `asyncio.CancelledError` and general exceptions, ensuring that background tasks are suppressed gracefully during shutdown or failure.
*   **Optimize Database Connection Pooling (`app/database/session.py`):** Tuned the SQLAlchemy engine configuration for better performance and SQLite compatibility by setting explicit pool sizes (`pool_size`, `max_overflow`, `pool_recycle`) and adjusting connection arguments (`check_same_thread: False`).
*   **Implement Graceful Shutdown (`app/main.py`):** Updated the `lifespan` hook to implement a more robust shutdown sequence. This now explicitly cancels background tasks, waits for pending tasks to settle, and explicitly disposes of the database engine, preventing potential connection warnings on exit.
2026-04-17 19:29:47 +02:00
Saifeddine ALOUI
2d2bc728c0 feat: enhance system architecture, introduce space_hunter, and update admin interfaces
Summary of Changes:
- [INFRA] Added `space_hunter.py` to the project root for new system utilities.
- [CONFIG] Updated `.gitignore` to include `*.db-wal` files and exclude `docs/article` directory.
- [UI] Refreshed admin templates (`models_manager.html`, `settings.html`) to reflect new architectural capabilities.
- [CORE] Modified `architect_manager.py` to support image generation capabilities (`supports_images`).
- [CORE] Updated `memory_manager.py` to improve context formatting and category handling.
- [API] Implemented new route logic and rate limiting dependencies in `proxy.py` and `admin.py`.
- [MODELS] Updated `models.py` to support new fields and `migrations.py` to handle schema evolution.

Technical Notes:
- The `architect_manager` now manages assets including image nodes.
- Memory formatting has been streamlined to handle multiple titles per category.
- Admin settings and model management pages have been updated to visualize these new capabilities.

BREAKING CHANGE: None.
2026-04-17 19:22:34 +02:00
Saifeddine ALOUI
2fa3e74f5b feat: add LoLLMs bot agent system with enhanced admin panel
Implement comprehensive bot agent framework including:
- Add agent node components (agent.js, agent.py, composition.py)
- Create LoLLMs bot agent template and specialized tools
- Enhance admin panel with server management, memory systems,
  and model playground interfaces
- Update core systems: bot manager, memory manager, workflow engine
- Extend API routes for admin, proxy, and playground functionality
- Add database migrations and server CRUD operations

Refactor playground chat and proxy routing for improved
server selection and health monitoring.
2026-04-17 02:54:38 +02:00
Saifeddine ALOUI
2eeafc6546 fix: improve error handling in token tracking streams
- Add error logging for token tracking stream failures in proxy
- Add asyncio import to datastores module for async operations
- Minor formatting and cleanup across admin, openai_proxy, and bot_manager
2026-04-16 22:31:44 +02:00
Saifeddine ALOUI
e1a8f77520 fixes 2026-04-16 09:48:10 +02:00
Saifeddine ALOUI
a10579dd9f fix: align UI datastore naming with internal SafeStore keys
Standardize naming conventions across API routes, database layer, and
templates to ensure UI labels match internal SafeStore identifiers.
Updates affect datastores, proxy authentication, migrations, and
knowledge node configuration.
2026-04-15 20:44:25 +02:00
Saifeddine ALOUI
71f34dd523 feat: Implement core API routing, proxy logic, and logging configuration
This commit updates several core components across the application to establish foundational routing, proxy handling, robust logging setup, database session management, and server CRUD operations.

Changes include:
- Updating API route definitions for conception and proxy endpoints.
- Enhancing logging configuration with rotating file handlers.
- Adjusting server CRUD logic to incorporate model filtering.
- Refinements in database session management.
- Updating the base HTML template structure.
2026-04-15 18:19:23 +02:00
Saifeddine ALOUI
ad31152e84 feat(admin: feature): Implement administrative routes, core memory management, and playground interface
This commit introduces the foundational structure and routes for the administrative interface, including necessary API endpoints, core memory management services, database models, agent node logic, and the corresponding admin dashboard templates.

Key changes include:
- Updating API routes for administration, data stores, and playground features.
- Implementing core memory management and asset handling.
- Defining database models, sessions, and migrations.
- Establishing the structure for agent components and administrative templates.
2026-04-15 17:56:36 +02:00
Saifeddine ALOUI
33699e254d feat: enhance admin monitoring, streaming, and proxy handling
- Add server nodes endpoint to admin API for infrastructure visibility
- Improve playground chat streaming with better admin controls
- Extend proxy layer with token-aware request forwarding to Ollama
- Update asset management with additional CDN resources
- Optimize bot manager chat history pruning logic
2026-04-15 01:47:20 +02:00
Saifeddine ALOUI
3a114785b0 feat: add Redis client support and enhance tool execution pipeline
- Inject redis_client into proxy backend requests for caching
- Improve universal tool execution with better error handling
- Refactor bot manager workflow processing
- Update LoLLMS system interface documentation
- Extend tools manager metadata parsing
- Sync database models and migrations
- Update admin server templates
2026-04-14 00:42:21 +02:00
Saifeddine ALOUI
849a78b763 feat(admin): add MCP server support with instance management and binary updates
- Add MCP servers configuration to VirtualAgent model (JSON field)
- Implement binary update endpoint with background task processing
- Enhance proxy routes with encryption utilities for secure data handling
- Add graceful shutdown flag to BotManager for task lifecycle control
- Update InstanceManager with pipmaster integration for dependency management
- Extend admin UI templates for instances and settings management
2026-04-13 23:47:44 +02:00
Saifeddine ALOUI
51f4557eed feat: enhance workflow engine and standardize node templates
- Update workflow engine configuration and proxy handling
- Refactor node builder API routes for improved structure
- Add CSRF protection to conception workflow endpoints
- Update database models and migration scripts
- Standardize agentic and cognitive node templates (RAG, MoE, vision)
- Refresh admin UI templates and styling
- Bump dependencies in pyproject.toml and requirements.txt
2026-04-13 02:19:10 +02:00
Saifeddine ALOUI
7c479db2ab feat(tools): add CRUD operations for admin tools management
- Implement POST/PUT/DELETE endpoints in tools API routes
- Extend ToolsManager with save, update, and delete capabilities
- Add responsive styling fixes for admin panel layout
- Update admin navigation icons in base template
- Enhance bots management UI with improved layout and functionality
2026-04-12 00:46:03 +02:00
Saifeddine ALOUI
134d63d302 feat: add DataStore configuration fields and update admin tooling
Add chunk_size and chunk_overlap fields to DataStore model for
configurable document processing. Update admin routes, tools, and
templates to support new DataStore settings management.

- Add DataStore configuration columns (chunk_size, chunk_overlap)
- Update admin API routes for settings handling
- Enhance tools and conception endpoints with DataStore integration
- Refresh admin templates (base, settings, tools)
- Refine server CRUD error handling
2026-04-11 23:57:04 +02:00
Saifeddine ALOUI
7a40b31eb8 feat: major refactor across admin, conception, and proxy modules
- Refactor conception routes with improved JSON handling
- Enhance admin API with carbon tracking and system info
- Update node builder dependencies and validation
- Streamline OpenAI proxy and reverse proxy logic
- Extend CRUD operations for model metadata and servers
- Update database migrations and core models
- Improve workflow engine and node registry architecture
- Refresh admin dashboard templates and UI components
2026-04-11 02:13:27 +02:00
Saifeddine ALOUI
66fffc9b74 feat(admin): add internal system bypass and enhance admin settings
- add internal system bypass for API key validation in dependencies
- update admin routes with improved settings form handling
- extend OpenAI proxy with datetime logging capabilities
- refactor core events and database migration infrastructure
- update admin templates (base, conception, help, model playground, settings)
- sync project dependencies in pyproject.toml and requirements.txt
2026-04-10 20:00:08 +02:00
Saifeddine ALOUI
fe37354bf2 feat: enhance admin UI and improve proxy event handling
- Update admin templates (base, help, model_playground, routers, settings)
- Change default event sender from "anon" to "system" in ProxyEvent
- Improve payload normalization in proxy routes
- Refine server CRUD operations for model relationships
- Update settings schema and database models
- Upgrade dependencies in requirements.txt
2026-04-10 03:06:24 +02:00
Saifeddine ALOUI
b6d638b7b1 feat(admin): add image description extraction and enhance model management UI
- Add image description extraction for multimodal requests in proxy routing
- Update admin models manager with improved template context handling
- Reduce default retry attempts from 5 to 2 for faster failure response
- Fix deep copy issue in playground chat streaming
- Update model metadata CRUD with token pricing improvements
- Enhance admin UI templates and styling for ensembles and routers
2026-03-30 03:02:47 +02:00
Saifeddine ALOUI
cec339970f feat(servers): add encrypted API key support for Ollama servers
- Add encrypted_api_key column to OllamaServer model
- Update migrations for new database schema
- Enhance server CRUD operations to handle encrypted API keys
- Modify instance manager initialization
- Update admin edit server form and help documentation
2026-03-27 16:43:07 +01:00
Saifeddine ALOUI
abe3ace3bc feat(admin): add log rotation and retention controls
- Implement RotatingFileHandler for log management
- Add log_max_size and retention settings to AppSettingsModel
- Update admin panel UI with logging configuration controls
- Enhance proxy pool selection logic with improved error handling
- Refactor ensemble orchestrator database schema
- Update gunicorn configuration for production tuning
2026-03-24 02:29:49 +01:00
Saifeddine ALOUI
b764e78ab6 feat: add vision processor support and enhance admin ensemble management
- Add vision_processor column to database schema
- Extend playground chat with improved model filtering and streaming
- Update server pool selection logic in proxy routes
- Refactor server CRUD update operations
- Enhance admin UI templates for agents, ensembles, and server management
2026-03-22 21:56:40 +01:00
Saifeddine ALOUI
e326d65ea6 feat(routers): add rules and active status to SmartRouter model
- Extend SmartRouter with rules (JSON) and is_active fields
- Update admin API for vision enabler form handling
- Add migration for legacy model pools schema fixes
- Adjust admin routers template layout
2026-03-22 03:50:41 +01:00
Saifeddine ALOUI
d36e259f24 feat: add ensemble orchestration with parallel model routing
Implement ensemble orchestrator feature that distributes requests across
multiple models in parallel and aggregates responses. Includes:

- API endpoints for ensemble CRUD operations and request handling
- Database models and migrations for ensemble configuration
- Enhanced server CRUD with model-aware filtering
- Admin UI for creating, editing, and managing ensemble configurations

Ensembles support configurable master/parallel models, routing strategies,
and response aggregation methods.
2026-03-22 03:41:03 +01:00
Saifeddine ALOUI
a0d43d1ea8 feat: add comprehensive settings management and enhance instance operations
- Extend admin API with settings endpoints and metadata controls
- Update proxy routing for improved request handling
- Refactor instance manager with async networking capabilities
- Enhance server CRUD for active model queries across all servers
- Update database migrations and models schema
- Refresh admin UI templates (agents, pools, ensembles, routers, models, instances, dashboard, settings, help)
2026-03-22 00:25:46 +01:00
Saifeddine ALOUI
e47c47ed3f feat(routers): add model pool support and ensemble field compatibility
Update migrations for model_pools config, add parallel_models field mapping
in EnsembleOrchestrator, enhance admin router UI, and improve proxy target
resolution logic.
2026-03-20 14:34:15 +01:00
Saifeddine ALOUI
58772823b2 feat: add instance manager with real-time performance metrics
- Implement instance management routes in admin API
- Add TTFT/TPS tracking to ProxyEvent telemetry
- Update admin templates (base, bundles, help, live_status, playground)
- Fix server CRUD safe name truncation and migration imports
2026-03-19 13:58:35 +01:00
Saifeddine ALOUI
8c56eae841 feat: add proxy performance metrics and model categorization flags
- Add TTFT, TPS, and token_count fields to ProxyEvent tracking
- Add is_code_model and is_chat_model flags to ModelMetadata
- Create database migration for total_tokens column
- Update admin API routes and templates for new metadata fields
2026-03-18 09:03:10 +01:00
Saifeddine ALOUI
92a404d073 feat(admin): add TTFT metrics and instance management features
- Track Time To First Token (TTFT) in ProxyEvent for performance monitoring
- Enhance token tracking stream handling in proxy routes
- Add instance management database model and settings schema
- Update admin templates for live status and settings management
2026-03-17 23:56:39 +01:00
Saifeddine ALOUI
f6d7292f88 feat(statistics): add token usage tracking to admin dashboard
- Add token_usage columns to usage_logs table via migration
- Implement token aggregation queries in log_crud.py
- Update admin stats endpoint and statistics template
- Clean up proxy.py imports and formatting
2026-02-08 20:35:33 +01:00
Saifeddine ALOUI
f2fddf6a69 feat(api): add security hardening and retry configuration updates
- Add cryptographic imports to dependencies for enhanced security
- Implement content type validation in admin routes
- Update proxy router with dependency injection improvements
- Tune retry configuration defaults for better reliability
- Enhance database migrations with regex support and expanded logic
2026-02-08 16:38:40 +01:00
Saifeddine ALOUI
6bcb7e2983 Upgraded ui 2025-11-11 18:43:36 +01:00
Saifeddine ALOUI
5eb1dcb63b enhanced 2025-11-10 03:11:51 +01:00
Saifeddine ALOUI
e13c057e43 Added embeddinf models testing 2025-11-09 19:31:03 +01:00
Daniel Mas Montserrat
54ef98aeb6 improving migration 2025-10-16 00:21:18 -04:00
Daniel Mas Montserrat
cee151fd94 adding backward compatibility of database through migration and adding retry to improve robustness 2025-10-15 23:40:56 -04:00
Saifeddine ALOUI
9802a62644 Added settings section and redis information 2025-10-15 19:22:03 +02:00
Daniel Mas Montserrat
75add7f379 adding per-model features: model-based usage, model-based routing 2025-10-10 08:48:21 -06:00
Saifeddine ALOUI
32dd72309f Refactor API usage statistics page to include charts and export options; enhance user details page with rate limit settings; remove Alembic dependency from requirements; update run scripts for simplified setup and reset processes; add comprehensive reset scripts for Windows and Linux. 2025-09-06 22:59:09 +02:00
Saifeddine ALOUI
0dbb3edf0a enhanced ui 2025-09-05 01:33:22 +02:00
Saifeddine ALOUI
dee5ebba29 Revamped version 2025-09-04 22:05:18 +02:00