主干Ai实验室后端项目
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
from fastapi import FastAPI
|
||||
from routers.Chat import router
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
app = FastAPI(title="BBIT_AI")
|
||||
|
||||
origins = [
|
||||
"http://localhost:5173", # Vite dev 默认端口
|
||||
"http://127.0.0.1:5173",
|
||||
"http://s1.ronsunny.cn:8089",
|
||||
"*" # ⚠️ 生产环境不要用
|
||||
]
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=origins,
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"], # 必须包含 OPTIONS、GET 等
|
||||
allow_headers=["*"],
|
||||
)
|
||||
app.include_router(router, prefix="/api/llm", tags=["chat"])
|
||||
Reference in New Issue
Block a user