From 62611809e0d83f2261bdaf73cd5af8a386c8465f Mon Sep 17 00:00:00 2001 From: Stephen Hu Date: Fri, 30 May 2025 13:11:41 +0800 Subject: [PATCH] Fix: Add user_id when create Conversation (#7960) ### What problem does this PR solve? https://github.com/infiniflow/ragflow/issues/7940 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/apps/conversation_app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/apps/conversation_app.py b/api/apps/conversation_app.py index 23fb3b704..29f3fa96c 100644 --- a/api/apps/conversation_app.py +++ b/api/apps/conversation_app.py @@ -42,6 +42,7 @@ def set_conversation(): conv_id = req.get("conversation_id") is_new = req.get("is_new") name = req.get("name", "New conversation") + req["user_id"] = current_user.id if len(name) > 255: name = name[0:255] @@ -64,7 +65,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": name, "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"]}],"user_id": current_user.id} ConversationService.save(**conv) return get_json_result(data=conv) except Exception as e: