format .
This commit is contained in:
12
lifespan.py
12
lifespan.py
@@ -3,6 +3,7 @@ from contextlib import asynccontextmanager
|
||||
from fastapi import FastAPI
|
||||
from uvicorn.server import logger
|
||||
|
||||
|
||||
def init_database():
|
||||
from model import create_db_and_tables
|
||||
|
||||
@@ -10,12 +11,14 @@ def init_database():
|
||||
create_db_and_tables()
|
||||
logger.info("[数据库] 数据库初始化完成 ✅")
|
||||
|
||||
def init_scheduler(app : FastAPI):
|
||||
|
||||
def init_scheduler(app: FastAPI):
|
||||
from scheduler import init_scheduler_router
|
||||
|
||||
logger.info("[定时任务] 初始化定时任务 📦")
|
||||
init_scheduler_router(app)
|
||||
logger.info("[定时任务] 定时任务初始化完成 ✅")
|
||||
|
||||
|
||||
|
||||
def active_config():
|
||||
logger.info(f"[激活配置] 加载配置 ⚙️")
|
||||
@@ -29,12 +32,15 @@ def import_router(app: FastAPI):
|
||||
app.include_router(router)
|
||||
logger.info(f"[导入路由] 路由导入完成 ✅")
|
||||
|
||||
|
||||
async def import_mcp_server(app: FastAPI):
|
||||
logger.info(f"[导入MCP] 开始导入MCP 🛣️")
|
||||
from mcps import create_mcp_app
|
||||
app.mount("/app" , await create_mcp_app())
|
||||
|
||||
app.mount("/app", await create_mcp_app())
|
||||
logger.info(f"[导入MCP] MCP导入完成 ✅")
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
logger.info(f"[生命周期] 应用启动 🚀")
|
||||
|
||||
Reference in New Issue
Block a user