From aae3694b11a1cd841df6dea712cd359093cef6fc Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Fri, 19 Sep 2025 16:22:53 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20chore:=20Typing=20and?= =?UTF-8?q?=20Remove=20Comments=20(#9732)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Update documentation for formatToolContent function, remove JSDoc types and duplicate comments * chore: fix type errors due to attachment.filename in Attachment component --- .../Chat/Messages/Content/Parts/Attachment.tsx | 18 ++++++++++-------- packages/api/src/mcp/parsers.ts | 16 ++++------------ 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/client/src/components/Chat/Messages/Content/Parts/Attachment.tsx b/client/src/components/Chat/Messages/Content/Parts/Attachment.tsx index 28f3be184..1d14534e0 100644 --- a/client/src/components/Chat/Messages/Content/Parts/Attachment.tsx +++ b/client/src/components/Chat/Messages/Content/Parts/Attachment.tsx @@ -70,7 +70,7 @@ const ImageAttachment = memo(({ attachment }: { attachment: TAttachment }) => { }} > ; @@ -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); diff --git a/packages/api/src/mcp/parsers.ts b/packages/api/src/mcp/parsers.ts index 97b1efc4c..2f9ce8c06 100644 --- a/packages/api/src/mcp/parsers.ts +++ b/packages/api/src/mcp/parsers.ts @@ -81,22 +81,14 @@ function parseAsString(result: t.MCPToolCallResponse): string { return text; } -/** - * Converts MCPToolCallResponse content into recognized content block types - * Recognized types: "image", "image_url", "text", "json" - * - * @param {t.MCPToolCallResponse} result - The MCPToolCallResponse object - * @param {string} provider - The provider name (google, anthropic, openai) - * @returns {Array} Formatted content blocks - */ /** * Converts MCPToolCallResponse content into recognized content block types * First element: string or formatted content (excluding image_url) - * Second element: image_url content if any + * Second element: Recognized types - "image", "image_url", "text", "json" * - * @param {t.MCPToolCallResponse} result - The MCPToolCallResponse object - * @param {string} provider - The provider name (google, anthropic, openai) - * @returns {t.FormattedContentResult} Tuple of content and image_urls + * @param result - The MCPToolCallResponse object + * @param provider - The provider name (google, anthropic, openai) + * @returns Tuple of content and image_urls */ export function formatToolContent( result: t.MCPToolCallResponse,