mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 20:35:19 +00:00
refac: chat history data structure
This commit is contained in:
parent
86cdcda29a
commit
ff4b1b9824
2 changed files with 5 additions and 0 deletions
|
|
@ -1577,6 +1577,7 @@ async def chat_completion(
|
||||||
"user_id": user.id,
|
"user_id": user.id,
|
||||||
"chat_id": form_data.pop("chat_id", None),
|
"chat_id": form_data.pop("chat_id", None),
|
||||||
"message_id": form_data.pop("id", None),
|
"message_id": form_data.pop("id", None),
|
||||||
|
"parent_message_id": form_data.pop("parent_id", None),
|
||||||
"session_id": form_data.pop("session_id", None),
|
"session_id": form_data.pop("session_id", None),
|
||||||
"filter_ids": form_data.pop("filter_ids", []),
|
"filter_ids": form_data.pop("filter_ids", []),
|
||||||
"tool_ids": form_data.get("tool_ids", None),
|
"tool_ids": form_data.get("tool_ids", None),
|
||||||
|
|
@ -1633,6 +1634,7 @@ async def chat_completion(
|
||||||
metadata["chat_id"],
|
metadata["chat_id"],
|
||||||
metadata["message_id"],
|
metadata["message_id"],
|
||||||
{
|
{
|
||||||
|
"parentId": metadata.get("parent_message_id", None),
|
||||||
"model": model_id,
|
"model": model_id,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
@ -1665,6 +1667,7 @@ async def chat_completion(
|
||||||
metadata["chat_id"],
|
metadata["chat_id"],
|
||||||
metadata["message_id"],
|
metadata["message_id"],
|
||||||
{
|
{
|
||||||
|
"parentId": metadata.get("parent_message_id", None),
|
||||||
"error": {"content": str(e)},
|
"error": {"content": str(e)},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1955,7 +1955,9 @@
|
||||||
|
|
||||||
session_id: $socket?.id,
|
session_id: $socket?.id,
|
||||||
chat_id: $chatId,
|
chat_id: $chatId,
|
||||||
|
|
||||||
id: responseMessageId,
|
id: responseMessageId,
|
||||||
|
parent_id: userMessage?.id ?? null,
|
||||||
|
|
||||||
background_tasks: {
|
background_tasks: {
|
||||||
...(!$temporaryChatEnabled &&
|
...(!$temporaryChatEnabled &&
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue