From b87fded47337edea995cbb1798b69be2ccd56bd2 Mon Sep 17 00:00:00 2001 From: goulustis Date: Thu, 5 Mar 2026 14:49:47 +0800 Subject: [PATCH] combined.py --- fastapi_server/combined.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 fastapi_server/combined.py diff --git a/fastapi_server/combined.py b/fastapi_server/combined.py new file mode 100644 index 0000000..09b4420 --- /dev/null +++ b/fastapi_server/combined.py @@ -0,0 +1,30 @@ +from fastapi import FastAPI +from fastapi.middleware.cors import CORSMiddleware + +from lang_agent.fastapi_server.front_apis import app as front_app +from lang_agent.fastapi_server.server_dashscope import create_dashscope_router + + +app = FastAPI( + title="Combined Front + DashScope APIs", + description=( + "Single-process app exposing front_apis control endpoints and " + "DashScope-compatible chat endpoints." + ), +) + +app.add_middleware( + CORSMiddleware, + allow_origins=["*"], + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], +) + +# Keep existing /v1/... admin APIs unchanged. +app.include_router(front_app.router) + +# Add DashScope endpoints at their existing URLs. We intentionally skip +# DashScope's root/health routes to avoid clashing with front_apis. +app.include_router(create_dashscope_router(include_meta_routes=False)) +