- Add configuration of agents, tasks, tools, specialist in context of SPIN specialist

- correct startup of applications using gevent
- introduce startup scripts (eveai_app)
- caching manager for all configurations
This commit is contained in:
Josako
2025-01-16 20:27:00 +01:00
parent f7cd58ed2a
commit 7bddeb0ebd
69 changed files with 1991 additions and 345 deletions

View File

@@ -13,6 +13,7 @@ import common.models.interaction
import common.models.entitlements
import common.models.document
from common.utils.nginx_utils import prefixed_url_for
from common.utils.startup_eveai import perform_startup_actions
from config.logging_config import LOGGING
from common.utils.security import set_tenant_session_data
from .errors import register_error_handlers
@@ -73,6 +74,9 @@ def create_app(config_file=None):
# Register Error Handlers
register_error_handlers(app)
# Register Cache Handlers
register_cache_handlers(app)
# Debugging settings
if app.config['DEBUG'] is True:
app.logger.setLevel(logging.DEBUG)
@@ -103,7 +107,19 @@ def create_app(config_file=None):
# Register template filters
register_filters(app)
app.logger.info("EveAI App Server Started Successfully")
# Let all initialization complete before using cache
# @app.before_first_request
# def initialize_cache_data():
# # Cache testing
# agent_types = cache_manager.agent_config_cache.get_types()
# app.logger.debug(f"Agent types: {agent_types}")
# agent_config = cache_manager.agent_config_cache.get_config('RAG_AGENT')
# app.logger.debug(f"Agent config: {agent_config}")
# Perform startup actions such as cache invalidation
perform_startup_actions(app)
app.logger.info(f"EveAI App Server Started Successfully (PID: {os.getpid()})")
app.logger.info("-------------------------------------------------------------------------------------------------")
return app
@@ -123,7 +139,6 @@ def register_extensions(app):
metrics.init_app(app)
# Register Blueprints
def register_blueprints(app):
from .views.user_views import user_bp
app.register_blueprint(user_bp)
@@ -143,3 +158,13 @@ def register_blueprints(app):
app.register_blueprint(healthz_bp)
init_healtz(app)
def register_cache_handlers(app):
from common.utils.cache.config_cache import (
AgentConfigCacheHandler, TaskConfigCacheHandler, ToolConfigCacheHandler, SpecialistConfigCacheHandler)
cache_manager.register_handler(AgentConfigCacheHandler, 'eveai_config')
cache_manager.register_handler(TaskConfigCacheHandler, 'eveai_config')
cache_manager.register_handler(ToolConfigCacheHandler, 'eveai_config')
cache_manager.register_handler(SpecialistConfigCacheHandler, 'eveai_config')