microsoft/vscode-extension-samples

Can't show image in vscode chat markdown panel

Opened this issue · 1 comments

Extension sample

chat-sample

VS Code version

1.91 - VS Code Remote

What went wrong?

I've tried many ways to load the image file with no luck:

 const markdownStr = new vscode.MarkdownString();
        markdownStr.supportHtml = true;
        markdownStr.value='![image](https://westusdallestore.blob.core.windows.net/public/b52b7f8ff97ba775ff1f92587485c8d62d2cc0bb.png)';
		stream.markdown(markdownStr);

        const markdownStr1 = new vscode.MarkdownString();
        markdownStr1.supportHtml = true;
        const imagePath = vscode.Uri.from({ scheme: 'https://', path: "westusdallestore.blob.core.windows.net/public/b52b7f8ff97ba775ff1f92587485c8d62d2cc0bb.png" });
        markdownStr1.value=`![image](${imagePath})`;
        stream.markdown(markdownStr1)
        stream.markdown(`![image](https://westusdallestore.blob.core.windows.net/public/b52b7f8ff97ba775ff1f92587485c8d62d2cc0bb.png)`)
        stream.markdown(`![image](file:///tmp/chat-agent-dalle/9fa80e2015fac7bdb84d1e4248e15b9469c348be.png-small.png)`)

image image

Images from remote domains are only rendered if the user has added that domain to their trusted domain list- run the command "Manage Trusted Domains" to configure this. In the future I'd like to render something more helpful, like a button to load the image.

The local image should work though. My "dall-e" chat participant actually does this. Rendering as vscode-file is expected. Maybe you can get a clue from the network tab? Maybe it works as an absolute path instead of a file URI?