Skip to content

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

Refa: create new name for duplicated dialog name (#9558)

Yongteng Lei33f3e05b7532
diff --git a/api/apps/dialog_app.py b/api/apps/dialog_app.py
index ae8ac56f5a..1340f60d37 100644
--- a/api/apps/dialog_app.py
+++ b/api/apps/dialog_app.py
@@ -16,6 +16,7 @@
from flask import request
from flask_login import login_required, current_user
+from api.db.services import duplicate_name
from api.db.services.dialog_service import DialogService
from api.db import StatusEnum
from api.db.services.tenant_llm_service import TenantLLMService
@@ -42,8 +43,14 @@ def set_dialog():
if len(name.encode("utf-8")) > 255:
return get_data_error_result(message=f"Dialog name length is {len(name)} which is larger than 255")
- if DialogService.get_or_none(tenant_id=current_user.id, name=name):
- return get_data_error_result(message=f"Duplicated Dialog name {name}.")
+ if is_create and DialogService.query(tenant_id=current_user.id, name=name.strip()):
+ name = name.strip()
+ name = duplicate_name(
+ DialogService.query,
+ name=name,
+ tenant_id=current_user.id,
+ status=StatusEnum.VALID.value)
+
description = req.get("description", "A helpful dialog")
icon = req.get("icon", "")
top_n = req.get("top_n", 6)