mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Fix: fix mismatch of assitant message and its reference (#9233)
### What problem does this PR solve? #9232 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) 1. When creating a new session, initialize an empty reference that includes both the app api and sdk API. 2. Fix the logic when retrieving references for historical messages: the number of dialogue messages and reference messages may differ, but it should match the number of assistant messages. Co-authored-by: Li Ye <liye@unittec.com>
This commit is contained in:
@ -66,7 +66,8 @@ 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"]}],"user_id": current_user.id}
|
||||
conv = {"id": conv_id, "dialog_id": req["dialog_id"], "name": name, "message": [{"role": "assistant", "content": dia.prompt_config["prologue"]}],"user_id": current_user.id,
|
||||
"reference":[{}],}
|
||||
ConversationService.save(**conv)
|
||||
return get_json_result(data=conv)
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user