From b2965e1deb48f9e63aabecb1d477185d22f19e1f Mon Sep 17 00:00:00 2001 From: lloydzhou Date: Sat, 31 Aug 2024 00:16:47 +0800 Subject: [PATCH] update --- app/utils/chat.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/utils/chat.ts b/app/utils/chat.ts index 454a24771ca..d8ab5770cc2 100644 --- a/app/utils/chat.ts +++ b/app/utils/chat.ts @@ -218,6 +218,13 @@ export function stream( JSON.parse(tool.function.arguments), ), ) + .then((res) => { + const content = JSON.stringify(res.data); + if (res.status >= 300) { + return Promise.reject(content); + } + return content; + }) .then((content) => { options?.onAfterTool?.({ ...tool,