fix: many model chat backward compatibility

This commit is contained in:
Timothy J. Baek 2024-08-22 00:22:40 +02:00
parent 8843898a8c
commit bb026cdd9c

View File

@ -91,9 +91,19 @@
groupedMessages = parentMessage?.models.reduce((a, model, modelIdx) => {
// Find all messages that are children of the parent message and have the same model
const modelMessages = parentMessage?.childrenIds
let modelMessages = parentMessage?.childrenIds
.map((id) => history.messages[id])
.filter((m) => m.modelIdx === modelIdx);
.filter((m) => m?.modelIdx === modelIdx);
if (modelMessages.length === 0) {
modelMessages = parentMessage?.childrenIds
.map((id) => history.messages[id])
.filter((m) => m?.model === model);
modelMessages.forEach((m) => {
m.modelIdx = modelIdx;
});
}
return {
...a,