Add sync_default_tools function to manage system-provided tools

- Introduce a new `sync_default_tools` function in `session.py` to ensure essential reusable tools are created without overwriting existing edits.
- Update the `lifespan` context manager in `app.py` to call `sync_default_tools`, enhancing the initialization process for the application.
- This change improves the management of default tools within the system, ensuring they are available for use while preserving user modifications.
This commit is contained in:
Xin Wang
2026-07-10 13:49:35 +08:00
parent dc2a7484bb
commit 5fca14865f
2 changed files with 38 additions and 1 deletions

View File

@@ -16,7 +16,7 @@ from contextlib import asynccontextmanager
import settings
import uvicorn
from db.session import sync_interface_definitions
from db.session import sync_default_tools, sync_interface_definitions
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
@@ -36,6 +36,7 @@ from routes import (
@asynccontextmanager
async def lifespan(_app: FastAPI):
await sync_interface_definitions()
await sync_default_tools()
yield