完善前端

This commit is contained in:
chenxin committed 2026-09-21 11:19:07 +08:00
1 parent 7c57d27494
commit b63542add3
81 files changed
+12075 -1441

No files matched your search

+17
View File
@@ -36,6 +36,23 @@ def create_app() -> FastAPI:
)
install_error_handlers(app)
init_engine(app)
# 开发档 CORS:SSE 等流式响应不经前端代理直连本服务(代理会缓冲流)。
# 生产由反向代理同源承担,不依赖此配置。
if settings.env == "development":
from fastapi.middleware.cors import CORSMiddleware
app.add_middleware(
CORSMiddleware,
allow_origins=[
"http://localhost:3000", "http://127.0.0.1:3000",
"http://localhost:3001", "http://127.0.0.1:3001",
"http://localhost:3002", "http://127.0.0.1:3002",
],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
expose_headers=["*"],
)
app.add_middleware(RequestContextMiddleware)
app.include_router(auth_router)
app.include_router(conversations_router)