From 303e5653dd403f408dbac04011b49af7ff5fb972 Mon Sep 17 00:00:00 2001 From: Henry Heng Date: Mon, 9 Oct 2023 16:44:04 +0100 Subject: [PATCH] update cacheValue to capture other outputs object --- packages/components/src/handler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/src/handler.ts b/packages/components/src/handler.ts index a102b473..1ae16050 100644 --- a/packages/components/src/handler.ts +++ b/packages/components/src/handler.ts @@ -191,7 +191,7 @@ export class CustomChainHandler extends BaseCallbackHandler { Callback Order is "Chain Start -> Chain End" for cached responses. */ if (this.cachedResponse) { - const cachedValue = outputs.text as string + const cachedValue: string = outputs.text ?? outputs.response ?? outputs.output ?? '' //split at whitespace, and keep the whitespace. This is to preserve the original formatting. const result = cachedValue.split(/(\s+)/) result.forEach((token: string, index: number) => {