🛠️ chore: Typing and Remove Comments (#9732)

* chore: Update documentation for formatToolContent function, remove JSDoc types and duplicate comments

* chore: fix type errors due to attachment.filename in Attachment component
This commit is contained in:
Danny Avila 2025-09-19 16:22:53 -04:00 committed by GitHub
parent 68c9f668c1
commit aae3694b11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 20 deletions

View file

@ -70,7 +70,7 @@ const ImageAttachment = memo(({ attachment }: { attachment: TAttachment }) => {
}}
>
<Image
altText={attachment.filename}
altText={attachment.filename || 'attachment image'}
imagePath={filepath ?? ''}
height={height ?? 0}
width={width ?? 0}
@ -89,8 +89,9 @@ export default function Attachment({ attachment }: { attachment?: TAttachment })
}
const { width, height, filepath = null } = attachment as TFile & TAttachmentMetadata;
const isImage =
imageExtRegex.test(attachment.filename) && width != null && height != null && filepath != null;
const isImage = attachment.filename
? imageExtRegex.test(attachment.filename) && width != null && height != null && filepath != null
: false;
if (isImage) {
return <ImageAttachment attachment={attachment} />;
@ -110,11 +111,12 @@ export function AttachmentGroup({ attachments }: { attachments?: TAttachment[] }
attachments.forEach((attachment) => {
const { width, height, filepath = null } = attachment as TFile & TAttachmentMetadata;
const isImage =
imageExtRegex.test(attachment.filename) &&
width != null &&
height != null &&
filepath != null;
const isImage = attachment.filename
? imageExtRegex.test(attachment.filename) &&
width != null &&
height != null &&
filepath != null
: false;
if (isImage) {
imageAttachments.push(attachment);