mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-06-15 23:43:06 +03:00
🌿 fix: forking a long conversation breaks chat structure (#4778)
* fix: branching and forking sometimes break conversation structure * fix test for forking. * chore: message type issues * test: add conversation structure tests for message handling --------- Co-authored-by: xyqyear <xyqyear@gmail.com>
This commit is contained in:
@@ -104,7 +104,7 @@ describe('forkConversation', () => {
|
||||
expect(bulkSaveMessages).toHaveBeenCalledWith(
|
||||
expect.arrayContaining(
|
||||
expectedMessagesTexts.map((text) => expect.objectContaining({ text })),
|
||||
),
|
||||
), true,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -122,7 +122,7 @@ describe('forkConversation', () => {
|
||||
expect(bulkSaveMessages).toHaveBeenCalledWith(
|
||||
expect.arrayContaining(
|
||||
expectedMessagesTexts.map((text) => expect.objectContaining({ text })),
|
||||
),
|
||||
), true,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -141,7 +141,7 @@ describe('forkConversation', () => {
|
||||
expect(bulkSaveMessages).toHaveBeenCalledWith(
|
||||
expect.arrayContaining(
|
||||
expectedMessagesTexts.map((text) => expect.objectContaining({ text })),
|
||||
),
|
||||
), true,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -160,7 +160,7 @@ describe('forkConversation', () => {
|
||||
expect(bulkSaveMessages).toHaveBeenCalledWith(
|
||||
expect.arrayContaining(
|
||||
expectedMessagesTexts.map((text) => expect.objectContaining({ text })),
|
||||
),
|
||||
), true,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ class ImportBatchBuilder {
|
||||
async saveBatch() {
|
||||
try {
|
||||
await bulkSaveConvos(this.conversations);
|
||||
await bulkSaveMessages(this.messages);
|
||||
await bulkSaveMessages(this.messages, true);
|
||||
logger.debug(
|
||||
`user: ${this.requestUserId} | Added ${this.conversations.length} conversations and ${this.messages.length} messages to the DB.`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user