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(mcp): give the clip-loading code samples a deadline

nirholas4ea2efa4cc28
diff --git a/api/_lib/asset-snippets.js b/api/_lib/asset-snippets.js
index 045a08d08..44bd857d8 100644
--- a/api/_lib/asset-snippets.js
+++ b/api/_lib/asset-snippets.js
@@ -187,8 +187,10 @@ function clipSnippets(item, origin) {
language: 'javascript',
code: `import * as THREE from "three";
-// three.ws motion clips are plain THREE.AnimationClip JSON.
-const json = await fetch(${jsString(url)}).then((r) => r.json());
+// three.ws motion clips are plain THREE.AnimationClip JSON. The deadline
+// matters: without one a stalled connection hangs your loader forever
+// rather than failing, because fetch has no timeout of its own.
+const json = await fetch(${jsString(url)}, { signal: AbortSignal.timeout(10000) }).then((r) => r.json());
const clip = THREE.AnimationClip.parse(json);
// Track names use the canonical (Mixamo) bone names. Any avatar whose rig maps
@@ -221,7 +223,10 @@ export function use${componentName(item)}(avatar) {
let cancelled = false;
const clock = new THREE.Clock();
- fetch(CLIP_URL)
+ // A deadline as well as the cancelled flag: the flag stops a late response
+ // touching an unmounted component, but only the signal ends a request that
+ // never answers at all.
+ fetch(CLIP_URL, { signal: AbortSignal.timeout(10000) })
.then((r) => r.json())
.then((json) => {
if (cancelled) return;