-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
62 lines (49 loc) · 1.57 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from init_app import init_app
from logging_config import setup_logging
# import sys
# sys.setrecursionlimit(15000) # 将递归深度限制增加到15000
init_app()
setup_logging()
from pathlib import Path
from fastapi import FastAPI
from fastapi.responses import HTMLResponse, FileResponse
from fastapi.middleware.cors import CORSMiddleware
from app.apis import (partition_router,
admin_router,
user_router,
file_router,
document_router,
rag_cache_router,
conversation_router,
response_record_router,
chunk_router,
image_router,
rag_router)
app = FastAPI()
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(rag_router)
app.include_router(partition_router)
app.include_router(admin_router)
app.include_router(user_router)
app.include_router(file_router)
app.include_router(document_router)
app.include_router(rag_cache_router)
app.include_router(conversation_router)
app.include_router(response_record_router)
app.include_router(chunk_router)
app.include_router(image_router)
@app.get("/", response_class=HTMLResponse)
def read_root():
return "Hello World"
@app.get("/robots.txt")
def get_robots_txt():
return FileResponse(Path("app/templates/robots.txt"))
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="127.0.0.1", port=8000)