From e6c5e89f09637b8d9ebca6895d781663f12646d6 Mon Sep 17 00:00:00 2001
From: zhaoqingang <zhaoqg0118@163.com>
Date: 星期二, 17 十二月 2024 16:43:55 +0800
Subject: [PATCH] dify 文档智能
---
main.py | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/main.py b/main.py
index 9c00b97..21dad54 100644
--- a/main.py
+++ b/main.py
@@ -12,6 +12,7 @@
from app.api.excel import router as excel_router
from app.api.files import router as files_router
from app.api.knowledge import knowledge_router
+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.public_api import public_api
@@ -21,7 +22,8 @@
from app.api.user import user_router
from app.api.group import group_router
from app.api.role import role_router
-from app.task.fetch_agent import sync_agents, initialize_agents, sync_web_menu, sync_default_data
+from app.task.fetch_agent import sync_agents, initialize_agents, sync_agents_v2
+from app.init_config.init_run_data import sync_default_data
# 浣跨敤 Lifespan 浜嬩欢澶勭悊绋嬪簭
@@ -32,7 +34,8 @@
# 鍦ㄥ簲鐢ㄥ惎鍔ㄦ椂鍚屾浠g悊
sync_agents()
await sync_default_data()
- await sync_web_menu()
+
+ sync_agents_v2()
yield
# 鍦ㄥ簲鐢ㄥ叧闂椂鎵ц娓呯悊鎿嶄綔锛堝鏋滈渶瑕侊級
pass
@@ -46,13 +49,13 @@
)
# 璁剧疆 CORS 涓棿浠�
-app.add_middleware(
- CORSMiddleware,
- allow_origins=["*"], # 鍏佽鎵�鏈夊煙鍚嶈法鍩熻闂�
- allow_credentials=True,
- allow_methods=["*"], # 鍏佽鎵�鏈夋柟娉�
- allow_headers=["*"], # 鍏佽鎵�鏈夊ご閮�
-)
+# 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_credentials=True,
+# allow_methods=["*"], # 鍏佽鎵�鏈夋柟娉�
+# allow_headers=["*"], # 鍏佽鎵�鏈夊ご閮�
+# )
# 鍒涘缓璋冨害鍣�
# scheduler = BackgroundScheduler()
# scheduler.add_job(sync_resource, 'interval', minutes=1, id="sync_resource_data")
@@ -74,7 +77,7 @@
app.include_router(llm_router, prefix='/api/llm', tags=["llm"])
app.include_router(dialog_router, prefix='/api/dialog', tags=["dialog"])
app.include_router(canvas_router, prefix='/api/canvas', tags=["canvas"])
-# app.include_router(sync_router, prefix='/api/sync', tags=["sync"])
+app.include_router(label_router, prefix='/api/label', tags=["label"])
app.include_router(public_api, prefix='/v1/api', tags=["public_api"])
app.mount("/static", StaticFiles(directory="app/images"), name="static")
--
Gitblit v1.8.0