mirror of
https://github.com/open-webui/open-webui
synced 2025-06-04 03:37:35 +00:00
Handles undefined message case in message list creation
Prevents potential errors by returning an empty list if the specified message ID does not exist in the history. This enhancement ensures robustness in scenarios where a message ID may be missing, avoiding further processing and potential exceptions.
This commit is contained in:
parent
4461122a0e
commit
01eedd36bc
@ -1225,6 +1225,9 @@ export const createMessagesList = (history, messageId) => {
|
||||
}
|
||||
|
||||
const message = history.messages[messageId];
|
||||
if (message === undefined) {
|
||||
return [];
|
||||
}
|
||||
if (message?.parentId) {
|
||||
return [...createMessagesList(history, message.parentId), message];
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user