* fix #304202.

* resolve comments.
This commit is contained in:
Peng Lyu
2026-04-06 23:03:28 -07:00
committed by GitHub
parent 7c4cbc79dc
commit 2ecf0370de
3 changed files with 5 additions and 5 deletions

View File

@@ -443,7 +443,7 @@ export class ImageAttachmentWidget extends AbstractChatAttachmentWidget {
const imageData = coerceImageBuffer(attachment.value);
const clickHandler = async () => {
if ((resource || imageData) && configurationService.getValue<boolean>(ChatConfiguration.ImageCarouselEnabled)) {
await this.openInCarousel(attachment.name, imageData, resource);
await this.openInCarousel(attachment.id, attachment.name, imageData, resource);
} else if (resource) {
await this.openResource(resource, { editorOptions: { preserveFocus: true } }, false, undefined);
}
@@ -471,8 +471,8 @@ export class ImageAttachmentWidget extends AbstractChatAttachmentWidget {
}
}
private async openInCarousel(name: string, data: Uint8Array | undefined, referenceUri: URI | undefined): Promise<void> {
const resource = referenceUri ?? URI.from({ scheme: 'data', path: name });
private async openInCarousel(id: string, name: string, data: Uint8Array | undefined, referenceUri: URI | undefined): Promise<void> {
const resource = referenceUri ?? URI.from({ scheme: 'data', path: `${id}/${encodeURIComponent(name)}` });
await this.chatImageCarouselService.openCarouselAtResource(resource, data);
}
}

View File

@@ -219,7 +219,7 @@ export function extractImagesFromChatRequest(
}
const mimeType = variable.mimeType ?? getMediaMime(variable.name) ?? 'image/png';
const uri = variable.references?.[0]?.reference;
const imageUri = URI.isUri(uri) ? uri : URI.from({ scheme: 'data', path: variable.name });
const imageUri = URI.isUri(uri) ? uri : URI.from({ scheme: 'data', path: `${variable.id}/${encodeURIComponent(variable.name)}` });
images.push({
id: imageUri.toString(),
uri: imageUri,

View File

@@ -204,7 +204,7 @@ suite('ChatImageCarouselService helpers', () => {
mimeType: result[0].images[0].mimeType,
data: [...result[0].images[0].data],
}, {
id: URI.from({ scheme: 'data', path: 'cat.png' }).toString(),
id: URI.from({ scheme: 'data', path: 'img-1/cat.png' }).toString(),
name: 'cat.png',
mimeType: 'image/png',
data: [1, 2, 3],