Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix pymysql interface error (#7295)

alulalaeead83835375
diff --git a/api/db/services/common_service.py b/api/db/services/common_service.py
index cf31a2a62c..3af19ce4b5 100644
--- a/api/db/services/common_service.py
+++ b/api/db/services/common_service.py
@@ -212,6 +212,12 @@ class CommonService:
# data: Updated field values
# Returns:
# Number of records updated
+ try:
+ if not DB.is_connection_usable():
+ DB.connect()
+ except Exception:
+ DB.close()
+ DB.connect()
data["update_time"] = current_timestamp()
data["update_date"] = datetime_format(datetime.now())
num = cls.model.update(data).where(cls.model.id == pid).execute()