From ac9373fd6f0db53c983d87c4790cb627e82759e9 Mon Sep 17 00:00:00 2001
From: zhaoqingang <zhaoqg0118@163.com>
Date: 星期二, 25 二月 2025 17:25:39 +0800
Subject: [PATCH] merge
---
main.py | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/main.py b/main.py
index 9639f36..339fb25 100644
--- a/main.py
+++ b/main.py
@@ -15,6 +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 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 +29,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 start_sync_token_task, sync_token
init_db()
@@ -42,9 +44,10 @@
await sync_default_data()
- sync_agents_v2()
- sync_knowledge()
+ sync_agents_v2() # 鏅鸿兘浣�
+ sync_knowledge() # 鐭ヨ瘑搴�
sync_resources_from_json()
+ await sync_token() # 鍚姩鍚屾token浠诲姟
yield
# 鍦ㄥ簲鐢ㄥ叧闂椂鎵ц娓呯悊鎿嶄綔锛堝鏋滈渶瑕侊級
pass
@@ -60,7 +63,7 @@
# 璁剧疆 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=["*"], # 鍏佽鎵�鏈夊ご閮�
@@ -68,6 +71,7 @@
# 鍒涘缓璋冨害鍣�
scheduler = BackgroundScheduler()
scheduler.add_job(sync_agents_v2, 'interval', minutes=60, id="sync_resource_data")
+scheduler.add_job(start_sync_token_task, 'interval', minutes=5, id="sync_token_1")
# scheduler.add_job(delete_file_after_delay, 'interval', minutes=10, id="delete_file_after_delay")
scheduler.start()
@@ -88,6 +92,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(chat_router_v2, prefix='/api/v1', tags=["chat1"])
app.mount("/static", StaticFiles(directory="app/images"), name="static")
if __name__ == "__main__":
--
Gitblit v1.8.0