fix: update output type to ToolMessage in memory handling functions

This commit is contained in:
Danny Avila 2025-09-03 23:13:42 -04:00
parent 3784c702aa
commit 4464b333e9
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956

View file

@ -15,7 +15,7 @@ import type {
} from '@librechat/agents';
import type { TAttachment, MemoryArtifact } from 'librechat-data-provider';
import type { ObjectId, MemoryMethods } from '@librechat/data-schemas';
import type { BaseMessage } from '@langchain/core/messages';
import type { BaseMessage, ToolMessage } from '@langchain/core/messages';
import type { Response as ServerResponse } from 'express';
import { Tokenizer } from '~/utils';
@ -464,7 +464,7 @@ async function handleMemoryArtifact({
data: ToolEndData;
metadata?: ToolEndMetadata;
}) {
const output = data?.output;
const output = data?.output as ToolMessage | undefined;
if (!output) {
return null;
}
@ -507,7 +507,7 @@ export function createMemoryCallback({
artifactPromises: Promise<Partial<TAttachment> | null>[];
}): ToolEndCallback {
return async (data: ToolEndData, metadata?: Record<string, unknown>) => {
const output = data?.output;
const output = data?.output as ToolMessage | undefined;
const memoryArtifact = output?.artifact?.[Tools.memory] as MemoryArtifact;
if (memoryArtifact == null) {
return;