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.

feat(gallery,ar-studio): show the first clause of a spec prompt on forge cards

nirholasb9152debd59a
diff --git a/public/gallery/gallery.js b/public/gallery/gallery.js
index ec96b501b..5334d1c68 100644
--- a/public/gallery/gallery.js
+++ b/public/gallery/gallery.js
@@ -16,6 +16,10 @@
// One-click "Surprise me" instant avatar. Self-wiring on import: attaches to the
// hero's [data-surprise-avatar] button and handles ?surprise=<seed> deep links.
import './surprise.js';
+// Shared prompt→label helper: a forge row has no title, and a refined prompt is
+// a multi-clause spec, so cards show its first clause and keep the full text in
+// the tooltip.
+import { cardTitleFromPrompt } from '../../src/model-lib.js';
const els = {
search: document.querySelector('[data-role="search"]'),
@@ -896,8 +900,7 @@ function renderForgeCard(c) {
const name = document.createElement('h3');
name.className = 'gallery-card-name';
name.title = label;
- // Limit display to keep cards compact — full prompt in title attr
- name.textContent = label.length > 60 ? label.slice(0, 57) + '…' : label;
+ name.textContent = cardTitleFromPrompt(label, 60);
body.appendChild(name);
// Engine/tier tags when available
diff --git a/src/ar-studio.js b/src/ar-studio.js
index 35050a4f1..38904e568 100644
--- a/src/ar-studio.js
+++ b/src/ar-studio.js
@@ -39,6 +39,7 @@ import {
import { StudioNet } from './ar/studio-net.js';
import { MultiPlaceSession } from './ar/multi-place.js';
import { forgeStageNarration } from './shared/forge-frames.js';
+import { cardTitleFromPrompt } from './model-lib.js';
import {
createPinchState, pinchEnd, pinchMove, pinchStart, touchDist,
PINCH_SCALE_MAX, PINCH_SCALE_MIN,
@@ -1710,12 +1711,18 @@ function trayItemHTML(it) {
const img = it.poster
? `<img src="${esc(it.poster)}" alt="" loading="lazy" />`
: '<span class="ars-item-cube" aria-hidden="true">◆</span>';
+ // A forge row's "title" is the prompt it was generated from, and a refined
+ // or image-derived prompt is a multi-clause spec. Cards get the first
+ // clause; the whole prompt stays reachable as the tooltip.
+ const label = cardTitleFromPrompt(it.title);
+ const full = String(it.title || '').trim();
return `
<li class="ars-item">
- <button type="button" class="ars-item-add" data-src="${esc(it.src)}" data-title="${esc(it.title)}"
- aria-label="Add ${esc(it.title || 'model')} to your space">
+ <button type="button" class="ars-item-add" data-src="${esc(it.src)}" data-title="${esc(label)}"
+ ${full ? `title="${esc(full)}"` : ''}
+ aria-label="Add ${esc(label)} to your space">
<span class="ars-item-thumb">${img}</span>
- <span class="ars-item-title">${esc(it.title || 'Untitled model')}</span>
+ <span class="ars-item-title">${esc(label)}</span>
<span class="ars-item-cta">Add</span>
</button>
</li>`;