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(forge): keep a fresh example prompt only when it does not rewrap the row

nirholas5996b4ef7e5c
diff --git a/src/forge-prompt-studio.js b/src/forge-prompt-studio.js
index 41d343aab..d375d7bff 100644
--- a/src/forge-prompt-studio.js
+++ b/src/forge-prompt-studio.js
@@ -272,12 +272,25 @@ function seedChips() {
if (!container) continue;
const chips = [...container.querySelectorAll('.chip:not(.chip--festive)')];
if (!chips.length) continue;
+ // The height the row already occupies on screen. The character budget
+ // below aims to keep a swap inside it, but characters are not pixels in a
+ // proportional font, so one label that renders a few pixels wider still
+ // wrapped the row onto another line and pushed the rest of the page down:
+ // 0.20 of /forge's CLS, on every load, because this runs after first paint.
+ const baseline = container.getBoundingClientRect().height;
pinRowHeight(container);
const fresh = generateChipSet(chips, used);
chips.forEach((chip, i) => {
if (!fresh[i]) return;
- used.add(fresh[i]);
+ const previous = chip.textContent;
setChipPrompt(chip, fresh[i]);
+ // Measured, not predicted: keep the fresh label only when the row is
+ // still the height it was. One reflow per chip, once, on a single row.
+ if (container.getBoundingClientRect().height > baseline + 0.5) {
+ setChipPrompt(chip, previous);
+ return;
+ }
+ used.add(fresh[i]);
});
}
}