Files
eveAI/eveai_chat_workers/__init__.py
Josako 1807435339 - Introduction of dynamic Retrievers & Specialists
- Introduction of dynamic Processors
- Introduction of caching system
- Introduction of a better template manager
- Adaptation of ModelVariables to support dynamic Processors / Retrievers / Specialists
- Start adaptation of chat client
2024-11-15 10:00:53 +01:00

50 lines
1.2 KiB
Python

import logging
import logging.config
from flask import Flask
import os
from common.langchain.templates.template_manager import TemplateManager
from common.utils.celery_utils import make_celery, init_celery
from common.extensions import db, template_manager, cache_manager
from config.logging_config import LOGGING
from config.config import get_config
from . import specialists, retrievers
def create_app(config_file=None):
app = Flask(__name__)
environment = os.getenv('FLASK_ENV', 'development')
match environment:
case 'development':
app.config.from_object(get_config('dev'))
case 'production':
app.config.from_object(get_config('prod'))
case _:
app.config.from_object(get_config('dev'))
logging.config.dictConfig(LOGGING)
app.logger.info('Starting up eveai_chat_workers...')
register_extensions(app)
celery = make_celery(app.name, app.config)
init_celery(celery, app)
from eveai_chat_workers import tasks
print(tasks.tasks_ping())
return app, celery
def register_extensions(app):
db.init_app(app)
cache_manager.init_app(app)
template_manager.init_app(app)
app, celery = create_app()