2023-05-21 02:20:55 +03:00
|
|
|
import os
|
|
|
|
|
2023-05-30 14:02:48 +03:00
|
|
|
import pypandoc
|
2023-06-11 00:59:16 +03:00
|
|
|
from fastapi import FastAPI
|
2023-05-30 14:02:48 +03:00
|
|
|
from logger import get_logger
|
2023-06-04 00:12:42 +03:00
|
|
|
from middlewares.cors import add_cors_middleware
|
2023-06-11 00:59:16 +03:00
|
|
|
from routes.chat_routes import chat_router
|
|
|
|
from routes.crawl_routes import crawl_router
|
|
|
|
from routes.explore_routes import explore_router
|
|
|
|
from routes.misc_routes import misc_router
|
|
|
|
from routes.upload_routes import upload_router
|
|
|
|
from routes.user_routes import user_router
|
2023-06-14 22:21:13 +03:00
|
|
|
from routes.api_key_routes import api_key_router
|
2023-05-31 14:51:23 +03:00
|
|
|
|
2023-05-22 09:39:55 +03:00
|
|
|
logger = get_logger(__name__)
|
2023-05-21 02:20:55 +03:00
|
|
|
|
|
|
|
app = FastAPI()
|
|
|
|
|
2023-06-04 00:12:42 +03:00
|
|
|
add_cors_middleware(app)
|
2023-06-10 00:20:51 +03:00
|
|
|
max_brain_size = os.getenv("MAX_BRAIN_SIZE")
|
|
|
|
max_brain_size_with_own_key = os.getenv("MAX_BRAIN_SIZE_WITH_KEY",209715200)
|
2023-05-21 09:15:31 +03:00
|
|
|
|
|
|
|
@app.on_event("startup")
|
|
|
|
async def startup_event():
|
|
|
|
pypandoc.download_pandoc()
|
|
|
|
|
2023-06-11 00:59:16 +03:00
|
|
|
app.include_router(chat_router)
|
|
|
|
app.include_router(crawl_router)
|
|
|
|
app.include_router(explore_router)
|
|
|
|
app.include_router(misc_router)
|
|
|
|
app.include_router(upload_router)
|
|
|
|
app.include_router(user_router)
|
2023-06-14 22:21:13 +03:00
|
|
|
app.include_router(api_key_router)
|