diff --git a/src/renderer/src/components/native-chat/NativeChatTranscriptChrome.tsx b/src/renderer/src/components/native-chat/NativeChatTranscriptChrome.tsx index 7b50d3bc65a..ad2b2d771ed 100644 --- a/src/renderer/src/components/native-chat/NativeChatTranscriptChrome.tsx +++ b/src/renderer/src/components/native-chat/NativeChatTranscriptChrome.tsx @@ -194,11 +194,15 @@ export function NativeChatImageAttachments({ if (images.length === 0) { return null } + const imageKeyCounts = new Map() if (!enablePreview) { return (
- {images.map((image, index) => { + {images.map((image) => { const label = image.alt ?? image.path ?? image.url ?? 'Image' + const imageKeyBase = `${label}-${image.url ?? ''}-${image.path ?? ''}` + const occurrence = imageKeyCounts.get(imageKeyBase) ?? 0 + imageKeyCounts.set(imageKeyBase, occurrence + 1) const name = image.path && isNativeChatPastedImagePath(image.path) ? translate('components.native-chat.composer.pastedImageLabel', 'Pasted image') @@ -207,7 +211,7 @@ export function NativeChatImageAttachments({ : label return (
@@ -219,7 +223,6 @@ export function NativeChatImageAttachments({
) } - const imageKeyCounts = new Map() return (
{images.map((image) => {