Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(cosmos): replace a dead avatar thumbnail with its initial tile

nirholas5478775c811e
diff --git a/src/cosmos.js b/src/cosmos.js
index 1044049da..0ad09bdd8 100644
--- a/src/cosmos.js
+++ b/src/cosmos.js
@@ -130,17 +130,24 @@ function avatarTile({ name, url, image }) {
btn.title = name;
btn.setAttribute('aria-label', `Use avatar ${name}`);
btn.setAttribute('aria-pressed', 'false');
+ const placeholder = () => {
+ const ph = document.createElement('span');
+ ph.className = 'ph';
+ ph.textContent = (name || '?').trim().charAt(0).toUpperCase();
+ return ph;
+ };
if (image) {
const img = document.createElement('img');
img.src = image;
img.alt = '';
img.loading = 'lazy';
+ // Community previews outlive their stored object: the gallery still lists a
+ // thumbnail URL after the bytes are gone. Swap a dead one for the initial
+ // tile so the picker never shows a broken image.
+ img.addEventListener('error', () => img.replaceWith(placeholder()), { once: true });
btn.appendChild(img);
} else {
- const ph = document.createElement('span');
- ph.className = 'ph';
- ph.textContent = (name || '?').trim().charAt(0).toUpperCase();
- btn.appendChild(ph);
+ btn.appendChild(placeholder());
}
btn.addEventListener('click', () => selectAvatar(url));
return btn;