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(ui): surface popular gallery searches and stop an unreachable RPC reading as an empty wallet

nirholas545598622b28
diff --git a/pages/avatar-wallet-chat.html b/pages/avatar-wallet-chat.html
index 62dfefe87..8c238579a 100644
--- a/pages/avatar-wallet-chat.html
+++ b/pages/avatar-wallet-chat.html
@@ -550,7 +550,10 @@
const net = el('net');
net.classList.toggle('mainnet', wallet.network === 'mainnet');
el('net-label').textContent = wallet.network;
- el('bal-amt').textContent = `${fmtSol(wallet.sol)} SOL`;
+ // The API reports an unreadable balance as null rather than failing the
+ // whole response, so the address and explorer link survive an RPC blip.
+ const balanceKnown = wallet.balanceAvailable !== false && wallet.sol != null;
+ el('bal-amt').textContent = balanceKnown ? `${fmtSol(wallet.sol)} SOL` : 'balance unavailable';
el('bal-usd').textContent = wallet.usd != null ? `$${wallet.usd.toFixed(2)}` : '';
el('addr-short').textContent = short(wallet.address);
el('addr-link').href = wallet.explorer;
@@ -564,6 +567,12 @@
function renderFundHint() {
const hint = el('fund-hint');
if (!hint || !wallet) return;
+ // An unknown balance is not a zero balance: never tell someone their
+ // funded wallet is empty because the RPC was unreachable this poll.
+ if (wallet.balanceAvailable === false || wallet.sol == null) {
+ hint.classList.remove('show');
+ return;
+ }
const sol = Number(wallet.sol) || 0;
const price = Number(wallet.solPriceUsd) || 0;
// Smallest send the avatar offers is $1; need that in SOL + a fee buffer.
diff --git a/public/gallery/gallery.css b/public/gallery/gallery.css
index 76e03bca8..3ac663be0 100644
--- a/public/gallery/gallery.css
+++ b/public/gallery/gallery.css
@@ -320,6 +320,37 @@ body.gallery-page {
border-color: rgba(165, 180, 252, 0.6);
color: #fff;
}
+.gallery-tag:focus-visible {
+ outline: 2px solid rgba(165, 180, 252, 0.9);
+ outline-offset: 2px;
+}
+
+/* Popular-search chips: a tag chip that also previews the query's top result. */
+.gallery-pop {
+ display: inline-flex;
+ align-items: center;
+ gap: 7px;
+ padding: 4px 12px;
+}
+/* Pull the thumbnail into the chip's left padding so a chip with imagery and one
+ without still line up on the same baseline grid. */
+.gallery-pop-thumb {
+ width: 22px;
+ height: 22px;
+ margin-left: -7px;
+ border-radius: 99px;
+ object-fit: cover;
+ background: rgba(255, 255, 255, 0.06);
+ flex: none;
+}
+.gallery-pop-count {
+ font-size: 11px;
+ font-variant-numeric: tabular-nums;
+ color: rgba(255, 255, 255, 0.45);
+}
+.gallery-pop.is-active .gallery-pop-count {
+ color: rgba(255, 255, 255, 0.75);
+}
/* ── Grid ────────────────────────────────────────────────────────────── */
.gallery-grid-wrap {
diff --git a/public/gallery/gallery.js b/public/gallery/gallery.js
index 2d3e768ad..5e095bb20 100644
--- a/public/gallery/gallery.js
+++ b/public/gallery/gallery.js
@@ -25,6 +25,8 @@ const els = {
cats: document.querySelector('[data-role="cats"]'),
rigWrap: document.querySelector('[data-role="rig-wrap"]'),
rigs: document.querySelector('[data-role="rigs"]'),
+ popWrap: document.querySelector('[data-role="pop-wrap"]'),
+ pops: document.querySelector('[data-role="pops"]'),
tagWrap: document.querySelector('[data-role="tag-wrap"]'),
tags: document.querySelector('[data-role="tags"]'),
grid: document.querySelector('[data-role="grid"]'),
@@ -86,6 +88,7 @@ els.search.addEventListener('input', () => {
clearTimeout(searchDebounce);
searchDebounce = setTimeout(() => {
state.query = els.search.value.trim();
+ renderPopular();
syncUrl();
resetAndLoad();
}, 250);
@@ -95,6 +98,7 @@ els.searchClear.addEventListener('click', () => {
els.search.value = '';
state.query = '';
updateSearchClearVisibility();
+ renderPopular();
syncUrl();
resetAndLoad();
els.search.focus();
@@ -140,6 +144,20 @@ els.rigs?.addEventListener('click', (e) => {
resetAndLoad();
});
+els.pops?.addEventListener('click', (e) => {
+ const btn = e.target.closest('[data-pop]');
+ if (!btn) return;
+ // A second click on the active chip clears it, matching the tag/category chips.
+ const next = btn.dataset.pop === state.query ? '' : btn.dataset.pop;
+ state.query = next;
+ els.search.value = next;
+ clearTimeout(searchDebounce);
+ updateSearchClearVisibility();
+ renderPopular();
+ syncUrl();
+ resetAndLoad();
+});
+
els.loadMore.addEventListener('click', () => loadPage());
els.status.addEventListener('click', (e) => {
@@ -198,6 +216,7 @@ function clearAllFilters() {
renderTags();
renderCats();
renderRigs();
+ renderPopular();
syncUrl();
resetAndLoad();
}
@@ -386,6 +405,55 @@ function renderRigs() {
).join('');
}
+// ── Popular searches ───────────────────────────────────────────────────────
+// Chips for the queries that surface the most public inventory, served by
+// GET /api/avatars/popular-searches off the warm cache the Avatar Search Index
+// Warmup pipeline fills. Each chip carries a sample thumbnail from that query's
+// real top result, so the row previews what the search will return.
+let popularSearches = [];
+
+function renderPopular() {
+ if (!els.pops || !els.popWrap) return;
+ if (!popularSearches.length) {
+ els.popWrap.hidden = true;
+ els.pops.innerHTML = '';
+ return;
+ }
+ els.popWrap.hidden = false;
+ els.pops.innerHTML = popularSearches
+ .map((s) => {
+ const active = s.query === state.query;
+ const thumb = s.sample_thumbnail
+ ? `<img class="gallery-pop-thumb" src="${escapeAttr(s.sample_thumbnail)}" alt="" loading="lazy" decoding="async" />`
+ : '';
+ const count = s.result_count > 0 ? `<span class="gallery-pop-count">${s.result_count}</span>` : '';
+ const label = active ? `Clear the ${s.query} search` : `Search for ${s.query}`;
+ return `<button type="button" class="gallery-tag gallery-pop${active ? ' is-active' : ''}" data-pop="${escapeAttr(
+ s.query,
+ )}" aria-pressed="${active}" aria-label="${escapeAttr(label)}">${thumb}<span>${escapeHtml(
+ s.query,
+ )}</span>${count}</button>`;
+ })
+ .join('');
+}
+
+async function loadPopularSearches() {
+ try {
+ const res = await fetch('/api/avatars/popular-searches?limit=10');
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
+ const data = await res.json();
+ popularSearches = Array.isArray(data?.searches) ? data.searches.filter((s) => s?.query) : [];
+ renderPopular();
+ } catch {
+ // Additive row: if the warm cache is unreachable the gallery loses a
+ // shortcut, never a capability, so leave the row hidden and stay silent.
+ popularSearches = [];
+ renderPopular();
+ }
+}
+
+loadPopularSearches();
+
// Classify a card's rig state via the shared classifier (window.twsRig bridge),
// degrading to source_meta inspection if the module hasn't loaded yet.
function isRigged(a) {
diff --git a/public/gallery/index.html b/public/gallery/index.html
index a18f0fa2d..2bceeb449 100644
--- a/public/gallery/index.html
+++ b/public/gallery/index.html
@@ -123,6 +123,10 @@
</select>
</div>
</div>
+ <div class="gallery-cat-wrap" data-role="pop-wrap" hidden>
+ <div class="gallery-tag-label" data-i18n="gallery_index.popular_searches">Popular searches</div>
+ <div class="gallery-cats gallery-pops" data-role="pops"></div>
+ </div>
<div class="gallery-cat-wrap" data-role="cat-wrap">
<div class="gallery-tag-label">Category</div>
<div class="gallery-cats" data-role="cats"></div>
diff --git a/src/game/npc/npc-aixbt.js b/src/game/npc/npc-aixbt.js
index 8ebda2255..88c82f938 100644
--- a/src/game/npc/npc-aixbt.js
+++ b/src/game/npc/npc-aixbt.js
@@ -545,12 +545,15 @@ export function openAixbtTerminal(npc, { ui } = {}) {
if (err.setup) body.appendChild(el('div', { class: 'aixbt-setup', text: err.setup }));
npc?.say?.("My feed isn't wired up here yet.");
} else if (err?.code === 'aixbt_unauthorized') {
+ // Covers both halves of the rejection: a key that expired or was
+ // revoked, and a key on a plan below what this read needs.
body.appendChild(
el('div', {
class: 'aixbt-error',
- text: 'That read needs a higher aixbt plan than this key has.',
+ text: "This deployment's aixbt key was rejected. It has expired, been revoked, or sits below the plan this read needs.",
}),
);
+ if (err.setup) body.appendChild(el('div', { class: 'aixbt-setup', text: err.setup }));
npc?.say?.("My key can't reach that one.");
} else {
body.appendChild(