| | |
| | | from app.api.group import group_router |
| | | from app.api.role import role_router |
| | | from app.models.base_model import init_db |
| | | from app.task.delete_execl_file import delete_file_after_delay |
| | | # from app.models.base_model import init_db |
| | | from app.task.fetch_agent import sync_agents, initialize_agents, sync_agents_v2, sync_knowledge, \ |
| | | sync_resources_from_json |
| | |
| | | # sync_agents() |
| | | |
| | | |
| | | |
| | | await sync_default_data() |
| | | # |
| | | sync_agents_v2() |
| | | sync_knowledge() |
| | | sync_resources_from_json() |
| | |
| | | # 设置 CORS 中间件 |
| | | # app.add_middleware( |
| | | # CORSMiddleware, |
| | | # allow_origins=["http://192.168.20.119:9303", "http://192.168.20.119:9301", "http://smartai.com:8293","http://localhost:9303", "http://127.0.0.1:9303","http://localhost:5173","http://192.168.20.158:5173"], |
| | | # allow_origins=["*"], |
| | | # allow_credentials=True, |
| | | # allow_methods=["*"], # 允许所有方法 |
| | | # allow_headers=["*"], # 允许所有头部 |
| | |
| | | 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.add_job(delete_file_after_delay, 'interval', minutes=10, id="delete_file_after_delay") |
| | | scheduler.start() |
| | | |
| | | app.include_router(auth_router, prefix='/api/auth', tags=["auth"]) |