tmp
zhaoqingang
2025-01-15 9f116ea7e8f7d53a22b4dce10de942d564818a01
main.py
@@ -15,7 +15,7 @@
from app.api.label import label_router
from app.api.llm import llm_router
from app.api.organization import dept_router
from app.api.v2.chat import chat1_router
from app.api.v2.chat import chat_router_v2
from app.api.v2.public_api import public_api
from app.api.report import router as report_router
from app.api.resource import menu_router
@@ -28,6 +28,7 @@
from app.task.fetch_agent import sync_agents, initialize_agents, sync_agents_v2, sync_knowledge, \
    sync_resources_from_json
from app.init_config.init_run_data import sync_default_data
from app.task.sync_account_token import sync_token
init_db()
@@ -42,11 +43,11 @@
    # await sync_default_data()
    await sync_default_data()
    #
    # sync_agents_v2()
    # sync_knowledge()
    # sync_resources_from_json()
    sync_agents_v2()
    sync_knowledge()
    sync_resources_from_json()
    yield
    # 在应用关闭时执行清理操作(如果需要)
    pass
@@ -70,6 +71,7 @@
# 创建调度器
scheduler = BackgroundScheduler()
scheduler.add_job(sync_agents_v2, 'interval', minutes=60, id="sync_resource_data")
scheduler.add_job(sync_token, 'interval', minutes=5, id="sync_token_1")
scheduler.start()
app.include_router(auth_router, prefix='/api/auth', tags=["auth"])
@@ -89,7 +91,7 @@
app.include_router(canvas_router, prefix='/api/canvas', tags=["canvas"])
app.include_router(label_router, prefix='/api/label', tags=["label"])
app.include_router(public_api, prefix='/v1/api', tags=["public_api"])
app.include_router(chat1_router, prefix='/v1/chat', tags=["chat1"])
app.include_router(chat_router_v2, prefix='/v1/chat', tags=["chat1"])
app.mount("/static", StaticFiles(directory="app/images"), name="static")
if __name__ == "__main__":