mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-21 07:23:11 +00:00
Merge 6d847a4675 into b2244f7b53
This commit is contained in:
commit
6c69c40a2f
2 changed files with 44 additions and 1 deletions
|
|
@ -350,6 +350,47 @@ describe('assertResumeRuntimeContentAllowed', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('resolves earlier-turn checkpoint sources in a temporary chat', async () => {
|
||||
const dependencies = createDependencies();
|
||||
dependencies.getAgentCheckpointer.mockResolvedValue({
|
||||
getTuple: jest.fn().mockResolvedValue({
|
||||
checkpoint: {
|
||||
channel_values: {
|
||||
messages: [
|
||||
{
|
||||
role: 'human',
|
||||
additional_kwargs: { sourceMessageId: 'earlier-turn' },
|
||||
},
|
||||
{
|
||||
role: 'human',
|
||||
additional_kwargs: { sourceMessageId: 'paused-turn' },
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
}),
|
||||
});
|
||||
dependencies.getMessages.mockResolvedValue([
|
||||
{ messageId: 'earlier-turn', isCreatedByUser: true, role: 'user', text: 'hi' },
|
||||
{ messageId: 'paused-turn', isCreatedByUser: true, role: 'user', text: 'ask me' },
|
||||
]);
|
||||
const input = {
|
||||
...createInput({}),
|
||||
isTemporary: true,
|
||||
storedMessages: [{ messageId: 'paused-turn', isCreatedByUser: true, role: 'user' }],
|
||||
};
|
||||
|
||||
await expect(assertResumeRuntimeContentAllowed(input, dependencies)).resolves.toEqual({
|
||||
resolvedFiles: [],
|
||||
checkpointFiles: [],
|
||||
});
|
||||
expect(dependencies.getMessages).toHaveBeenCalledWith({
|
||||
conversationId: 'conversation-1',
|
||||
user: 'user-1',
|
||||
});
|
||||
expect(dependencies.getFiles).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('preserves repeated steer file injections in checkpoint projection', async () => {
|
||||
const dependencies = createDependencies();
|
||||
dependencies.getAgentCheckpointer.mockResolvedValue({
|
||||
|
|
|
|||
|
|
@ -1048,9 +1048,11 @@ export async function assertResumeRuntimeContentAllowed(
|
|||
const missingSourceMessageIds = [...checkpointSourceMessageIds].filter(
|
||||
(messageId) => !resolvedSourceMessageIds.has(messageId),
|
||||
);
|
||||
/** The preflight only carries the paused turn; earlier turns referenced by the
|
||||
* checkpoint are read back for temporary chats too, whose messages stay
|
||||
* persisted until `expiredAt`. */
|
||||
if (
|
||||
modelBoundProjection?.historyLoaded !== true &&
|
||||
!input.isTemporary &&
|
||||
missingSourceMessageIds.length > 0 &&
|
||||
input.user?.id
|
||||
) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue