| | |
| | | from app.api.user import user_router |
| | | from app.api.group import group_router |
| | | from app.api.role import role_router |
| | | from app.models.base_model import init_db |
| | | # from app.models.base_model import init_db |
| | | from app.task.fetch_agent import sync_agents, initialize_agents, sync_agents_v2, sync_knowledge |
| | | from app.init_config.init_run_data import sync_default_data |
| | | |
| | | |
| | | init_db() |
| | | # 使用 Lifespan 事件处理程序 |
| | | @asynccontextmanager |
| | | async def lifespan(app: FastAPI): |
| | | # 初始化代理 |
| | | initialize_agents() |
| | | # 在应用启动时同步代理 |
| | | sync_agents() |
| | | # initialize_agents() |
| | | # # 在应用启动时同步代理 |
| | | # sync_agents() |
| | | await sync_default_data() |
| | | |
| | | sync_agents_v2() |
| | |
| | | # 在应用关闭时执行清理操作(如果需要) |
| | | pass |
| | | |
| | | # init_db() |
| | | |
| | | app = FastAPI( |
| | | title="basic_rag_gateway", |
| | | version="0.1", |