| | |
| | | from sqlalchemy.orm import sessionmaker, Session |
| | | |
| | | from app.config.config import settings |
| | | from app.config.const import RAGFLOW, BISHENG, DIFY, ENV_CONF_PATH |
| | | from app.config.const import RAGFLOW, BISHENG, DIFY, ENV_CONF_PATH, Dialog_STATSU_DELETE, Dialog_STATSU_ON |
| | | from app.models import KnowledgeModel |
| | | from app.models.dialog_model import DialogModel |
| | | from app.models.user_model import UserAppModel |
| | |
| | | ('basic_excel_talk', 6, '智能数据', 'BASIC', 'excelTalk'), |
| | | ('basic_question_talk', 7, '出题组卷', 'BASIC', 'questionTalk'), |
| | | ('9d75142a-66eb-4e23-b7d4-03efe4584915', 8, '小数绘图', 'DIFY', 'imageTalk'), |
| | | ('basic_paper_talk', 9, '文档出卷', 'BASIC', 'paperTalk'), |
| | | ('2f6ddf93-7ba6-4b2d-b991-d96421404600', 9, '文档出卷', 'DIFY', 'paperTalk'), |
| | | ('basic_report_clean', 10, '文档报告', 'DIFY', 'reportWorkflow') |
| | | ] |
| | | |
| | |
| | | existing_agent.name = row["name"] |
| | | existing_agent.description = row["description"] |
| | | existing_agent.mode = row["mode"] |
| | | if existing_agent.status == Dialog_STATSU_DELETE: |
| | | existing_agent.status = Dialog_STATSU_ON |
| | | if row["parameters"]: |
| | | existing_agent.parameters = json.dumps(row["parameters"]) |
| | | else: |
| | | existing = DialogModel(id=row["id"], status=row["status"], name=row["name"], |
| | | description=row["description"], |
| | |
| | | for dialog in db.query(DialogModel).filter_by(dialog_type=dialog_type).all(): |
| | | if dialog.id not in agent_id_list: |
| | | # print(dialog.id) |
| | | db.query(DialogModel).filter_by(id=dialog.id).update({"status": "2"}) |
| | | db.query(DialogModel).filter_by(id=dialog.id).update({"status": Dialog_STATSU_DELETE}) |
| | | db.commit() |
| | | except IntegrityError: |
| | | db.rollback() |
| | |
| | | import_type_table(db, node) |
| | | print("add resourceType record successfully") |
| | | else: |
| | | print("sync resources successfully") |
| | | print("sync resourcesType successfully") |
| | | if db.query(ResourceModel).count() == 0: |
| | | with open(os.path.join(ENV_CONF_PATH, "resource.json"), 'r', encoding='utf-8') as file: |
| | | json_data = json.load(file) |