mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-17 12:10:22 -05:00
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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],
|
||||
|
||||
Reference in New Issue
Block a user