mirror of
https://github.com/open-webui/open-webui
synced 2024-11-06 08:56:39 +00:00
check if deleted message response has sibling responses for multi model chats
This commit is contained in:
parent
8c01197483
commit
03907f9a8a
@ -228,10 +228,12 @@
|
|||||||
const messageParentId = messageToDelete.parentId;
|
const messageParentId = messageToDelete.parentId;
|
||||||
const messageChildrenIds = messageToDelete.childrenIds ?? [];
|
const messageChildrenIds = messageToDelete.childrenIds ?? [];
|
||||||
|
|
||||||
|
const hasSibling = messageChildrenIds.some(childId => history.messages[childId]?.childrenIds?.length > 0);
|
||||||
|
|
||||||
messageChildrenIds.forEach((childId) => {
|
messageChildrenIds.forEach((childId) => {
|
||||||
const child = history.messages[childId];
|
const child = history.messages[childId];
|
||||||
if (child && child.childrenIds) {
|
if (child && child.childrenIds) {
|
||||||
if (child.childrenIds.length == 0) { // if last prompt/response pair
|
if (child.childrenIds.length === 0 && !hasSibling) { // if last prompt/response pair
|
||||||
history.messages[messageParentId].childrenIds = []
|
history.messages[messageParentId].childrenIds = []
|
||||||
history.currentId = messageParentId;
|
history.currentId = messageParentId;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user