From 08c8e8c9a4d65677de6a493446a605d70efee631 Mon Sep 17 00:00:00 2001
From: zhaoqingang <zhaoqg0118@163.com>
Date: 星期二, 10 十二月 2024 16:32:07 +0800
Subject: [PATCH] 12.10 16
---
app/task/fetch_agent.py | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/app/task/fetch_agent.py b/app/task/fetch_agent.py
index f9aed22..42aa3e0 100644
--- a/app/task/fetch_agent.py
+++ b/app/task/fetch_agent.py
@@ -1,12 +1,14 @@
from typing import Dict, List, Tuple
from sqlalchemy import create_engine, Column, String, Integer
+from sqlalchemy.dialects.postgresql import array
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm import sessionmaker
from app.config.config import settings
from app.models.agent_model import AgentModel
from app.models.base_model import SessionLocal, Base
+from app.service.v2.initialize_data import dialog_menu_sync
# 鍒涘缓鏁版嵁搴撳紩鎿庡拰浼氳瘽宸ュ巶
engine_bisheng = create_engine(settings.sgb_db_url)
@@ -108,7 +110,8 @@
try:
count = db.query(AgentModel).count()
if count > 0:
- return
+ result = db.query(AgentModel).delete()
+ db.commit() # 鎻愪氦浜嬪姟
initial_agents = [
('80ee430a-e396-48c4-a12c-7c7cdf5eda51', 1, '鎶ュ憡鐢熸垚', 'BISHENG', 'report'),
('basic_excel_merge', 2, '鎶ヨ〃鍚堝苟', 'BASIC', 'excelMerge'),
@@ -118,7 +121,8 @@
('basic_excel_talk', 6, '鏅鸿兘鏁版嵁', 'BASIC', 'excelTalk'),
('basic_question_talk', 7, '鍑洪缁勫嵎', 'BASIC', 'questionTalk'),
('9d75142a-66eb-4e23-b7d4-03efe4584915', 8, '灏忔暟缁樺浘', 'DIFY', 'imageTalk'),
- ('basic_paper_talk', 8, '鏂囨。鍑哄嵎', 'BASIC', 'paperTalk')
+ ('basic_paper_talk', 8, '鏂囨。鍑哄嵎', 'BASIC', 'paperTalk'),
+ ('basic_report_clean', 10, '鏂囨。鎶ュ憡', 'DIFY', 'reportWorkflow')
]
for agent in initial_agents:
@@ -145,3 +149,13 @@
print("Agents synchronized successfully")
except Exception as e:
print(f"Failed to sync agents: {str(e)}")
+
+
+async def sync_web_menu():
+ db = SessionLocal()
+ await dialog_menu_sync(db)
+
+
+async def sync_default_group():
+ db = SessionLocal()
+ await dialog_menu_sync(db)
\ No newline at end of file
--
Gitblit v1.8.0