From 350d709763985e7a09628b7b5a0a071b77535920 Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Tue, 3 Sep 2024 23:15:29 -0400 Subject: [PATCH] fix: handle text parts with tool_call_ids and empty text --- client/src/components/Chat/Messages/Content/Part.tsx | 8 ++++++-- client/src/hooks/SSE/useStepHandler.ts | 11 +++++++++-- packages/data-provider/src/types/agents.ts | 1 + packages/data-provider/src/types/assistants.ts | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/client/src/components/Chat/Messages/Content/Part.tsx b/client/src/components/Chat/Messages/Content/Part.tsx index 457e79b9d1..9a8c226a7f 100644 --- a/client/src/components/Chat/Messages/Content/Part.tsx +++ b/client/src/components/Chat/Messages/Content/Part.tsx @@ -31,10 +31,14 @@ const Part = memo(({ part, isSubmitting, showCursor, messageId, isCreatedByUser if (part.type === ContentTypes.ERROR) { return ; } else if (part.type === ContentTypes.TEXT) { - const text = typeof part.text === 'string' ? part.text : part.text.value; + const text = typeof part.text === 'string' ? part.text : (part.text as { value: string }).value; + if (typeof text !== 'string') { return null; } + if (part.tool_call_ids != null && !text) { + return null; + } return (