Parcourir la source

backend framework

Nivek il y a 2 ans
Parent
commit
c675355e93

BIN
.DS_Store


+ 31 - 0
SEChat-backend/main.py

@@ -0,0 +1,31 @@
+# 全局变量
+# 之后丢到env去
+PORT = 3002
+
+# 日志配置
+import logging
+logging.basicConfig(
+    level=logging.INFO,
+    format="\n[%(asctime)s - {%(module)s.py (%(lineno)d)} - %(funcName)s()]\n %(message)s\n",
+    datefmt="%Y-%m-%d,%H:%M:%S",
+)
+
+# 引入FastAPI
+from fastapi import FastAPI
+app = FastAPI()
+
+# 处理跨域
+from fastapi.middleware.cors import CORSMiddleware
+app.add_middleware(
+    CORSMiddleware,
+    allow_origins=["*"],
+    allow_methods=["*"],
+    allow_headers=["*"],
+    allow_credentials=True,
+)
+
+
+
+if __name__ == "__main__":
+    import uvicorn
+    uvicorn.run(app, host="0.0.0.0", port=PORT, workers=1)

+ 0 - 0
SEChat-backend/requirements.txt


+ 0 - 0
SEChat-backend/routers/chat.py


+ 0 - 0
SEChat-backend/routers/chat_process.py


+ 0 - 0
SEChat-backend/routers/config.py


+ 0 - 0
SEChat-backend/routers/session.py


+ 0 - 0
SEChat-backend/routers/verify.py


+ 4 - 0
SEChat-backend/utils/data.py

@@ -0,0 +1,4 @@
+# 定义所有数据模型
+
+from pydantic import BaseModel
+