| | |
| | | try: |
| | | if names: |
| | | query = db.query(Dialog.id, Dialog.name, Dialog.description, Dialog.status, Dialog.tenant_id) \ |
| | | .filter( Dialog.name.in_(names)) |
| | | .filter( Dialog.name.in_(names), Dialog.status == "1") |
| | | else: |
| | | query = db.query(Dialog.id, Dialog.name, Dialog.description, Dialog.status, Dialog.tenant_id) |
| | | query = db.query(Dialog.id, Dialog.name, Dialog.description, Dialog.status, Dialog.tenant_id).filter( Dialog.status == "1") |
| | | |
| | | results = query.all() |
| | | formatted_results = [ |
| | |
| | | if existing_agent: |
| | | existing_agent.name = row["name"] |
| | | existing_agent.description = row["description"] |
| | | existing_agent.status = row["status"] |
| | | # existing_agent.status = row["status"] |
| | | existing_agent.mode = row["mode"] |
| | | # existing_agent.tenant_id = get_rag_user_id(db, row["user_id"], type_dict[dialog_type]) |
| | | else: |
| | |
| | | print("v2 Agents synchronized successfully") |
| | | except Exception as e: |
| | | print(f"v2 Failed to sync agents: {str(e)}") |
| | | finally: |
| | | db.close() |
| | | |
| | | def update_ids_in_local_knowledge(data, klg_type): |
| | | type_dict = {"1": RAGFLOW, "2": BISHENG, "4": DIFY} |
| | |
| | | print("sync knowledge successfully") |
| | | except Exception as e: |
| | | print(f"Failed to sync knowledge: {str(e)}") |
| | | finally: |
| | | db.close() |
| | | |
| | | |
| | | if __name__ == "__main__": |