From bdc2fd307f97038c924d44278606fb4ffae4b83c Mon Sep 17 00:00:00 2001 From: Hanna Daoud <64535158+hanna-daoud@users.noreply.github.com> Date: Tue, 8 Oct 2024 09:26:03 +0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20fix(ToolCall):=20Check=20output?= =?UTF-8?q?=20string=20type=20before=20performing=20`.toLowerCase()`=20(#4?= =?UTF-8?q?324)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/Chat/Messages/Content/ToolCall.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/src/components/Chat/Messages/Content/ToolCall.tsx b/client/src/components/Chat/Messages/Content/ToolCall.tsx index d5c7456da0..64b3210981 100644 --- a/client/src/components/Chat/Messages/Content/ToolCall.tsx +++ b/client/src/components/Chat/Messages/Content/ToolCall.tsx @@ -33,7 +33,8 @@ export default function ToolCall({ const [function_name, _domain] = name.split(actionDelimiter) as [string, string | undefined]; const domain = _domain?.replaceAll(actionDomainSeparator, '.') ?? null; - const error = output?.toLowerCase()?.includes('error processing tool'); + const error = + typeof output === 'string' && output.toLowerCase().includes('error processing tool'); const args = useMemo(() => { if (typeof _args === 'string') {