From 89eeb713737443ae5ab0ffdeee3e0682c1c29a71 Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Wed, 4 Sep 2024 00:33:01 -0400 Subject: [PATCH] refactor: improve typing of Text part --- client/src/components/Chat/Messages/Content/Part.tsx | 2 +- packages/data-provider/src/types/assistants.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/components/Chat/Messages/Content/Part.tsx b/client/src/components/Chat/Messages/Content/Part.tsx index 9a8c226a7f..ca0469cbfd 100644 --- a/client/src/components/Chat/Messages/Content/Part.tsx +++ b/client/src/components/Chat/Messages/Content/Part.tsx @@ -31,7 +31,7 @@ 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 as { value: string }).value; + const text = typeof part.text === 'string' ? part.text : part.text.value; if (typeof text !== 'string') { return null; diff --git a/packages/data-provider/src/types/assistants.ts b/packages/data-provider/src/types/assistants.ts index ec66fa8b48..b0a7e8eea3 100644 --- a/packages/data-provider/src/types/assistants.ts +++ b/packages/data-provider/src/types/assistants.ts @@ -381,7 +381,7 @@ export type ContentPart = ( export type TMessageContentParts = | { type: ContentTypes.ERROR; text: Text & PartMetadata } - | { type: ContentTypes.TEXT; text: string; tool_call_ids?: string[] | (Text & PartMetadata) } + | { type: ContentTypes.TEXT; text: string | (Text & PartMetadata); tool_call_ids?: string[] } | { type: ContentTypes.TOOL_CALL; tool_call: (