refactor: improve typing of Text part

This commit is contained in:
Danny Avila 2024-09-04 00:33:01 -04:00
parent a1cd9983e8
commit 89eeb71373
No known key found for this signature in database
GPG key ID: 2DD9CC89B9B50364
2 changed files with 2 additions and 2 deletions

View file

@ -31,7 +31,7 @@ const Part = memo(({ part, isSubmitting, showCursor, messageId, isCreatedByUser
if (part.type === ContentTypes.ERROR) {
return <ErrorMessage text={part[ContentTypes.TEXT].value} className="my-2" />;
} 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;