mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-01 21:37:33 +08:00
Fix: multiple model chat pass-in session_id, and do not save session. (#17581)
This commit is contained in:
@@ -182,7 +182,7 @@ def _build_default_completion_dialog():
|
||||
)
|
||||
|
||||
|
||||
async def _create_session_for_completion(chat_id, dialog, user_id):
|
||||
async def _create_session_for_completion(chat_id, dialog, user_id, save_session=True):
|
||||
conv = {
|
||||
"id": get_uuid(),
|
||||
"dialog_id": chat_id,
|
||||
@@ -191,6 +191,9 @@ async def _create_session_for_completion(chat_id, dialog, user_id):
|
||||
"user_id": user_id,
|
||||
"reference": [],
|
||||
}
|
||||
if not save_session:
|
||||
conv["id"] = None
|
||||
return SimpleNamespace(**conv)
|
||||
await thread_pool_exec(ConversationService.save, **conv)
|
||||
ok, conv_obj = await thread_pool_exec(ConversationService.get_by_id, conv["id"])
|
||||
if not ok:
|
||||
@@ -1224,7 +1227,7 @@ async def session_completion(chat_id_in_arg=""):
|
||||
if conv.dialog_id != chat_id:
|
||||
return get_data_error_result(message="Session does not belong to this chat!")
|
||||
else:
|
||||
conv = await _create_session_for_completion(chat_id, dia, current_user.id)
|
||||
conv = await _create_session_for_completion(chat_id, dia, current_user.id, save_session=store_history_messages)
|
||||
session_id = conv.id
|
||||
|
||||
if pass_all_history_messages:
|
||||
|
||||
Reference in New Issue
Block a user