-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
36 lines (26 loc) · 961 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.modules.chat.chat_controller import chat_router
from app.modules.ollama.ollama_controller import ollama_router
from app.modules.upload.upload_controller import upload_router
from app.modules.brain.brain_controller import brain_router
app = FastAPI()
origins = ["*"]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(ollama_router, tags=["ollama"])
app.include_router(upload_router, tags=["upload"])
app.include_router(chat_router, tags=["chat"])
app.include_router(brain_router, tags=["brain"])
@app.get("/live")
def read_root():
return {"Hello": "Chatbot AI Server"}
if __name__ == "__main__":
# run main.py to debug backend
import uvicorn
uvicorn.run("main:app", host="127.0.0.1", port=5050, reload=True, timeout_keep_alive=300)