| | |
| | | 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 |
| | |
| | | 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() |