This commit updates several API routes, data store definitions, and related templates for the admin section.
Changes include:
- Refactoring in `admin.py`, `datastores.py`, `evaluations.py`, and `proxy.py`.
- Updates to schema settings and static assets.
- Modifications to various admin templates (`base.html`, `dashboard.html`, etc.).
- Updates to agent management logic (`agentManager.ts`, `extensionState.ts`) and UI components.
async def admin_export_run_pdf(run_id: int, request: Request, db: AsyncSession = Depends(get_db), admin_user: User = Depends(require_admin_user)):
from xhtml2pdf import pisa
import io
import os
@@ -669,9 +675,23 @@ async def admin_export_run_pdf(run_id: int, request: Request, db: AsyncSession =
# 1. Get raw context
context = await _prepare_report_context(run_id, request, db)
if not context: raise HTTPException(status_code=404)
+
+ # 1.1 Try to find the associated AI analysis for this run (if any exists)
+ # Benchmark analysis reports are saved as LogAnalysis entries with a specific format
+ # We look for the most recent one containing this run's ID or relevant summary
+ # Since they aren't explicitly linked by FK, we rely on the preparation or a fresh fetch.
+ from app.database.models import LogAnalysis
+ stmt = select(LogAnalysis).filter(LogAnalysis.content.like(f"%Benchmark Report: {context['run'].name}%")).order_by(LogAnalysis.timestamp.desc())
+ res = await db.execute(stmt)
+ latest_analysis = res.scalars().first()
+ if latest_analysis:
+ import markdown
+ md = markdown.Markdown(extensions=['fenced_code', 'tables'])
+ context["ai_analysis_html"] = md.convert(latest_analysis.content)
+
# 2. Add PDF-specific flags
context["is_pdf"] = True
- context["report_format"] = format # 'full' or 'summary'
+ context["report_format"] = format # 'full' or 'summary'
# 3. Pre-parse Markdown content for results (PDF engine needs pre-rendered HTML)
import markdown
Body:
This commit introduces the necessary logic for handling the evaluation report generation endpoint and updates the template for displaying the report.
Changes include:
- Modifying `app/api/v1/routes/evaluations.py` to handle multi-dataset generation tasks.
- Updating `app/templates/admin/evaluation_report.html` to align with the new report structure.
Implements Markdown parsing for AI-generated content before PDF export and updates CSS for better inline code styling.
Specifically:
- Updates `app/api/v1/routes/evaluations.py` to use the `markdown` library to convert AI output to HTML for PDF generation, and modifies the template to conditionally render either raw answers or HTML content based on the PDF flag.
- Updates `app/static/css/styles.css` to refine the styling for inline code blocks (`.prose code`) to provide a more modern, high-contrast look.
- Adds `markdown` to `requirements.txt` to support this functionality.
- Integrates `highlight.js` in the frontend to automatically highlight code within the rendered output.
This commit updates the core workflow engine, refactors API routes for administration, evaluation processing, and proxy handling, and updates related agent and template files.
Key changes include:
- Refactoring `workflow_engine.py` to unify workflow execution blocks.
- Updates to API routes (`admin`, `evaluations`, `importer`, `proxy`) to align with new logic.
- Adjustments to agent files (`agent.js`, `agent.py`) and associated templates for improved reporting UI.
This commit introduces two changes:
1. In `agent.py`, imports the `re` module, which is necessary for future agent logic.
2. In `conception.html`, fixes a UX issue by dynamically setting a minimum width of 280px for all graph nodes immediately after loading to ensure a consistent visual layout.
This commit updates several core components related to administration, proxy handling, bot management, and application startup sequence.
**Changes include:**
* **`app/api/v1/routes/admin.py`**: Added handling for Redis password updates in the admin settings endpoint.
* **`app/api/v1/routes/proxy.py`**: Updated the shared vectorizer function to cache model description embeddings for performance.
* **`app/core/bot_manager.py`**: Refined the logic for generating unique request IDs for bots.
* **`app/main.py`**: Adjusted the application lifespan hook to ensure necessary directories are created during startup.
This commit introduces foundational changes related to memory management for the admin system and agent interaction.
Specifically:
- Updates `memory_manager.py` to include a static method for processing tags.
- Modifies `routes/admin.py` to incorporate memory system calls within the admin route.
- Updates `dependencies.py` to ensure secure handling of API keys related to memory operations.
- Updates `main.py` to include instructions for the Lollms agent regarding context prioritization.
- Adjusts template files (`base.html`, `memory_systems.html`) to accommodate memory history display.
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.
This commit updates several components related to server management, data store handling, and bot manager permissions.
Specifically, it includes:
- Updates to routing definitions in `datastores.py` and `proxy.py`.
- Adjustments to permission handling in `bot_manager.py`.
- Modifications to server CRUD operations in `server_crud.py`.
- Schema updates in `server.py`.
- Updates to admin template views (`manage_datastore.html`, `servers.html`).
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.
This commit updates the backend routing for proxy operations, refines the CRUD logic for model metadata, and makes necessary adjustments to the admin dashboard templates.
Changes include:
- Updating the proxy route logic in `app/api/v1/routes/proxy.py`.
- Refining the metadata fetching and creation logic in `app/crud/model_metadata_crud.py`.
- Adjusting the structure and content of admin template files: `app/templates/admin/base.html`, `app/templates/admin/dashboard.html`, and `app/templates/admin/models_manager.html`.
Updates the administration interface to better reflect and manage instance and server details.
Specifically, this change involves:
- Updating `app/core/instance_manager.py` to include instance checking logic.
- Modifying `app/crud/server_crud.py` to define default server URLs.
- Refactoring `app/schema/server.py` to adjust server model definitions.
- Updating template files (`app/templates/admin/instances.html` and `app/templates/admin/servers.html`) to display new status information.
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.
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.
Updates the signature and argument passing within _reverse_proxy and _wrap_response_for_token_tracking to correctly pass the request object for improved token tracking and context handling during the reverse proxy operation.
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.
Improve auto-mode handling in playground chat, add server filtering by
type in CRUD operations, and implement better server retry tracking
in the proxy layer. Also adds Novita AI binding to bootstrap config.
- 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
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.
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.
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.
Update internal handling in admin, conception, personalities, and
skills routes for consistency in build workflows. Minor adjustments
to event emissions and parameter resolution.
Remove legacy admin HTML templates (agents, chains, ensembles, pools,
routers, vision augmenters, and edit pages) in favor of updated
administration patterns.
Streamline proxy.py by removing redundant routing logic and dead code.
Enhance vLLM translator with improved message handling for Ollama
payloads. Update playground chat and admin API routes for consistency.
Fix malformed HTML in the table of contents card header by properly
closing the h3 tag. The previous diff showed an unclosed attribute
value that would cause rendering issues in the admin help template.
Add bidirectional synchronization between the model pool and rule target dropdowns. When models are added/removed/changed in the pool, all rule target selectors automatically update to reflect only the available options. Renames `generateModelOptions` to `generateGlobalModelOptions` for clarity, distinguishing pool setup from rule targeting.
Introduce a new workflow template that combines an autonomous agent loop
with personality configuration and real-time web search capabilities.
Includes hub nodes for input, personality selection, tool selection,
system message modification, and agent execution with max 10 turns.
- 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