zhaoqingang
2024-12-31 6b4093952e555e1eb2713bd85133a5f697cda1e0
app/task/fetch_agent.py
@@ -106,12 +106,23 @@
def initialize_agents():
    db = SessionLocal()
    try:
        count = db.query(AgentModel).count()
        if count > 0:
            # 删除表中的所有数据
            result = db.query(AgentModel).delete()
            db.commit()  # 提交事务
        initial_agents = [
            ('80ee430a-e396-48c4-a12c-7c7cdf5eda51', 1, '报告生成', 'BISHENG', 'report'),
            # ('80ee430a-e396-48c4-a12c-7c7cdf5eda51', 1, '报告生成', 'BISHENG', 'report'),
            ('basic_excel_merge', 2, '报表合并', 'BASIC', 'excelMerge'),
            ('bfd090d589d811efb3630242ac190006', 4, '文档智能', 'RAGFLOW', 'documentChat'),
            ('7638f006-38a2-4c21-a68e-c6c49b304a35', 4, '文档智能', 'DIFY', 'documentIa'),
            ('da3451da89d911efb9490242ac190006', 3, '知识问答', 'RAGFLOW', 'knowledgeQA'),
            ('e96eb7a589db11ef87d20242ac190006', 5, '智能问答', 'RAGFLOW', 'chat')
            ('e96eb7a589db11ef87d20242ac190006', 5, '智能问答', 'RAGFLOW', 'chat'),
            ('basic_report_clean', 6, '报告生成', 'DIFY', 'reportWorkflow'),
            # ('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')
        ]
        for agent in initial_agents:
@@ -129,10 +140,10 @@
def sync_agents():
    try:
        bisheng_data = get_data_from_bisheng(BISHENG_NAMES_TO_SYNC)
        # bisheng_data = get_data_from_bisheng(BISHENG_NAMES_TO_SYNC)
        ragflow_data = get_data_from_ragflow(RAGFLOW_NAMES_TO_SYNC)
        update_ids_in_local(bisheng_data)
        # update_ids_in_local(bisheng_data)
        update_ids_in_local(ragflow_data)
        print("Agents synchronized successfully")