- Move from OpenAI to Mistral Embeddings
- Move embedding model settings from tenant to catalog - BUG: error processing configuration for chunking patterns in HTML_PROCESSOR - Removed eveai_chat from docker-files and nginx configuration, as it is now obsolete - BUG: error in Library Operations when creating a new default RAG library - BUG: Added public type in migration scripts - Removed SocketIO from all code and requirements.txt
This commit is contained in:
@@ -5,7 +5,7 @@ from flask_jwt_extended import get_jwt_identity, verify_jwt_in_request
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
from werkzeug.exceptions import HTTPException
|
||||
|
||||
from common.extensions import db, api_rest, jwt, minio_client, simple_encryption, cors
|
||||
from common.extensions import db, api_rest, jwt, minio_client, simple_encryption, cors, cache_manager
|
||||
import os
|
||||
import logging.config
|
||||
|
||||
@@ -31,7 +31,7 @@ def create_app(config_file=None):
|
||||
case 'development':
|
||||
app.config.from_object(get_config('dev'))
|
||||
case 'production':
|
||||
app.config.from_object(get_config('prod'))
|
||||
app.config.from_object(get_config('prod'))
|
||||
case _:
|
||||
app.config.from_object(get_config('dev'))
|
||||
|
||||
@@ -60,6 +60,9 @@ def create_app(config_file=None):
|
||||
# Register Request Debugger
|
||||
register_request_debugger(app)
|
||||
|
||||
# Register Cache Handlers
|
||||
register_cache_handlers(app)
|
||||
|
||||
@app.before_request
|
||||
def check_cors():
|
||||
if request.method == 'OPTIONS':
|
||||
@@ -120,6 +123,7 @@ def register_extensions(app):
|
||||
jwt.init_app(app)
|
||||
minio_client.init_app(app)
|
||||
simple_encryption.init_app(app)
|
||||
cache_manager.init_app(app)
|
||||
cors.init_app(app, resources={
|
||||
r"/api/v1/*": {
|
||||
"origins": "*",
|
||||
@@ -201,3 +205,8 @@ def register_error_handlers(app):
|
||||
"message": str(e),
|
||||
"type": "BadRequestError"
|
||||
}), 400
|
||||
|
||||
|
||||
def register_cache_handlers(app):
|
||||
from common.utils.cache.config_cache import register_config_cache_handlers
|
||||
register_config_cache_handlers(cache_manager)
|
||||
|
||||
@@ -5,9 +5,11 @@ from flask import Response, stream_with_context, current_app
|
||||
from flask_restx import Namespace, Resource, fields
|
||||
from flask_jwt_extended import jwt_required, get_jwt_identity
|
||||
|
||||
from common.extensions import cache_manager
|
||||
from common.utils.celery_utils import current_celery
|
||||
from common.utils.execution_progress import ExecutionProgressTracker
|
||||
from eveai_api.api.auth import requires_service
|
||||
from common.models.interaction import Specialist
|
||||
|
||||
specialist_execution_ns = Namespace('specialist-execution', description='Specialist execution operations')
|
||||
|
||||
@@ -87,3 +89,47 @@ class ExecutionStream(Resource):
|
||||
'Connection': 'keep-alive'
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
specialist_arguments_input = specialist_execution_ns.model('SpecialistArgumentsInput', {
|
||||
'specialist_id': fields.Integer(required=True, description='ID of the specialist to use'),
|
||||
})
|
||||
|
||||
specialist_arguments_response = specialist_execution_ns.model('SpecialistArgumentsResponse', {
|
||||
'arguments': fields.Raw(description='Dynamic list of attributes for the specialist.'),
|
||||
})
|
||||
|
||||
|
||||
@specialist_execution_ns.route('/specialist_arguments', methods=['GET'])
|
||||
class SpecialistArgument(Resource):
|
||||
@jwt_required()
|
||||
@requires_service('SPECIALIST_API')
|
||||
@specialist_execution_ns.expect(specialist_arguments_input)
|
||||
@specialist_execution_ns.response(200, 'Specialist configuration fetched.', specialist_arguments_response)
|
||||
@specialist_execution_ns.response(404, 'Specialist configuration not found.')
|
||||
@specialist_execution_ns.response(500, 'Internal Server Error')
|
||||
def get(self):
|
||||
"""Start execution of a specialist"""
|
||||
tenant_id = get_jwt_identity()
|
||||
data = specialist_execution_ns.payload
|
||||
specialist_id = data['specialist_id']
|
||||
try:
|
||||
specialist = Specialist.query.get(specialist_id)
|
||||
if specialist:
|
||||
configuration = cache_manager.specialists_config_cache.get_config(specialist.type,
|
||||
specialist.type_version)
|
||||
current_app.logger.debug(f"Configuration returned: {configuration}")
|
||||
if configuration:
|
||||
if 'arguments' in configuration:
|
||||
return {
|
||||
'arguments': configuration['arguments'],
|
||||
}, 200
|
||||
else:
|
||||
specialist_execution_ns.abort(404, 'No arguments found in specialist configuration.')
|
||||
else:
|
||||
specialist_execution_ns.abort(404, 'Error fetching Specialist configuration.')
|
||||
else:
|
||||
specialist_execution_ns.abort(404, 'Error fetching Specialist')
|
||||
except Exception as e:
|
||||
current_app.logger.error(f"Error while retrieving Specialist configuration: {str(e)}")
|
||||
specialist_execution_ns.abort(500, 'Unexpected Error while fetching Specialist configuration.')
|
||||
|
||||
Reference in New Issue
Block a user