This commit is contained in:
2025-08-27 08:54:02 +08:00
parent d036c34396
commit 7167230e8d
11 changed files with 294 additions and 4 deletions

View File

@@ -23,6 +23,7 @@ from Routes.JiMengRoute import router as jimeng_router
from Routes.SunoRoute import router as suno_router
from Routes.XueBanRoute import router as xueban_router
from Routes.MjRoute import router as mj_router
from Routes.QWenImageRoute import router as qwen_image_router
from Util.LightRagUtil import *
from contextlib import asynccontextmanager
@@ -36,8 +37,8 @@ logger.addHandler(handler)
@asynccontextmanager
async def lifespan(_: FastAPI):
#pool = await init_postgres_pool()
#app.state.pool = pool
pool = await init_postgres_pool()
app.state.pool = pool
asyncio.create_task(train_document_task())
@@ -45,7 +46,7 @@ async def lifespan(_: FastAPI):
yield
finally:
# 应用关闭时销毁连接池
#await close_postgres_pool(pool)
await close_postgres_pool(pool)
pass
@@ -66,6 +67,8 @@ app.include_router(jimeng_router) # 即梦路由
app.include_router(suno_router) # Suno路由
app.include_router(xueban_router) # 学伴路由
app.include_router(mj_router) # Midjourney路由
app.include_router(qwen_image_router) # Qwen Image 路由
# Teaching Model 相关路由
# 登录相关(不用登录)
@@ -84,4 +87,4 @@ app.include_router(teaching_model_router, prefix="/api/teaching/model", tags=["t
app.include_router(teaching_model_router, prefix="/api/teaching/model", tags=["teacher_model"])
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8100)
uvicorn.run(app, host="0.0.0.0", port=8200)