RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Fix session deletion leaking chat-upload blobs (#14969)
Idriss Sbaaouie98f3e5c0d81
diff --git a/api/apps/restful_apis/chat_api.py b/api/apps/restful_apis/chat_api.pyindex 9a4d5b1418..baba98ae28 100644--- a/api/apps/restful_apis/chat_api.py+++ b/api/apps/restful_apis/chat_api.py@@ -47,6 +47,7 @@ from api.utils.api_utils import ()from api.utils.tenant_utils import ensure_tenant_model_id_for_paramsfrom common.constants import LLMType, RetCode, StatusEnum+from common import settingsfrom common.misc_utils import get_uuid, thread_pool_execfrom rag.prompts.generator import chunks_formatfrom rag.prompts.template import load_prompt@@ -794,6 +795,17 @@ async def delete_sessions(chat_id):if not ConversationService.query(id=sid, dialog_id=chat_id):errors.append(f"The chat doesn't own the session {sid}")continue+ ok, conv = ConversationService.get_by_id(sid)+ if ok:+ for msg in conv.message or []:+ for file in msg.get("files") or []:+ file_id = file.get("id")+ if not file_id:+ continue+ try:+ settings.STORAGE_IMPL.rm(f"{current_user.id}-downloads", file_id)+ except Exception:+ logging.warning("Failed to delete chat upload blob %s/%s", current_user.id, file_id)ConversationService.delete_by_id(sid)success_count += 1all_errors = errors + duplicate_messages