update cacheValue to capture other outputs object

This commit is contained in:
Henry Heng
2023-10-09 16:44:04 +01:00
committed by GitHub
parent 644bd09ef2
commit 303e5653dd
+1 -1
View File
@@ -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) => {