Address PR #1214 code review feedback

- Fix template-expanded URIs not rendering: construct synthetic Resource
  from readState.uri when the URI is absent from the resources list
- Fix non-image blob content rendering raw base64: show placeholder
  message; also handle audio blobs properly
- Hide mimeType display when multiple content items to avoid confusion
- Rename ResourceControls selectedTemplate → selectedTemplateUri for
  consistency with selectedUri and selectedResourceUri

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
cliffhall 2026-04-18 18:54:48 -04:00
commit 8c9aac6df1

View file

@ -30,7 +30,13 @@ function toContentBlock(
if (mimeType.startsWith("image/")) {
return { type: "image", data: item.blob, mimeType };
}
return { type: "text", text: item.blob };
if (mimeType.startsWith("audio/")) {
return { type: "audio", data: item.blob, mimeType };
}
return {
type: "text",
text: `[Binary content (${mimeType}) — preview not supported]`,
};
}
function formatLastUpdated(date: Date): string {
@ -113,7 +119,7 @@ export function ResourcePreviewPanel({
) : (
<Spacer />
)}
<MimeText>{mimeType}</MimeText>
{contents.length <= 1 && <MimeText>{mimeType}</MimeText>}
</MetaRow>
<FooterRow>
<AnnotationGroup>