Skip to content

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

Fix: value too long error for chat name (#7697)

Song Fuchangb0275b84837d
diff --git a/api/apps/conversation_app.py b/api/apps/conversation_app.py
index 574cf8421e..23fb3b704e 100644
--- a/api/apps/conversation_app.py
+++ b/api/apps/conversation_app.py
@@ -41,6 +41,11 @@ def set_conversation():
req = request.json
conv_id = req.get("conversation_id")
is_new = req.get("is_new")
+ name = req.get("name", "New conversation")
+
+ if len(name) > 255:
+ name = name[0:255]
+
del req["is_new"]
if not is_new:
del req["conversation_id"]
@@ -59,7 +64,7 @@ def set_conversation():
e, dia = DialogService.get_by_id(req["dialog_id"])
if not e:
return get_data_error_result(message="Dialog not found")
- conv = {"id": conv_id, "dialog_id": req["dialog_id"], "name": req.get("name", "New conversation"), "message": [{"role": "assistant", "content": dia.prompt_config["prologue"]}]}
+ conv = {"id": conv_id, "dialog_id": req["dialog_id"], "name": name, "message": [{"role": "assistant", "content": dia.prompt_config["prologue"]}]}
ConversationService.save(**conv)
return get_json_result(data=conv)
except Exception as e: