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.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat: implement rate limiting handling and message animation options
nirholas66aca4e2ceca
diff --git a/api/chat/proxy.js b/api/chat/proxy.jsindex 9b62ddab0..7af38cbe5 100644--- a/api/chat/proxy.js+++ b/api/chat/proxy.js@@ -44,6 +44,15 @@ export default wrap(async (req, res) => {});}+ if (upstream.status === 429) {+ const retryAfter = upstream.headers.get('retry-after') || upstream.headers.get('x-ratelimit-reset-requests');+ return json(res, 429, {+ error: 'rate_limited',+ error_description: 'The built-in model is rate-limited. Please wait a moment and try again.',+ ...(retryAfter ? { retry_after: retryAfter } : {}),+ });+ }+res.statusCode = upstream.status;const ct = upstream.headers.get('content-type') ?? 'application/json';res.setHeader('content-type', ct);diff --git a/chat/src/App.svelte b/chat/src/App.svelteindex 80a3be18c..3cb4d4fac 100644--- a/chat/src/App.svelte+++ b/chat/src/App.svelte@@ -813,6 +813,9 @@if (err.code === 'payment_required') {const url = err.upgradeUrl || '/pricing';convo.messages[i].error = `Out of credits. [Upgrade your plan](${url}) to keep chatting.`;+ } else if (err.code === 'rate_limited') {+ const hint = err.retryAfter ? ` Try again in ${err.retryAfter}s.` : ' Please wait a moment and try again.';+ convo.messages[i].error = `The built-in model is rate-limited.${hint}`;} else if (err.code === 'tools_unsupported') {const tools = err.toolNames?.length ? err.toolNames.join(', ') : 'the enabled tools';convo.messages[i].error = `**${err.modelId}** doesn't support tool use. Disable ${tools} in the Tools panel, or switch to a tool-capable model like \`anthropic/claude-sonnet-4.5\` or \`openai/gpt-5-mini\`.`;diff --git a/chat/src/Message.svelte b/chat/src/Message.svelteindex a056a07f0..05a5b1c18 100644--- a/chat/src/Message.svelte+++ b/chat/src/Message.svelte@@ -1,5 +1,7 @@<script>import { createEventDispatcher, tick } from 'svelte';+ import { fly } from 'svelte/transition';+ import { cubicOut } from 'svelte/easing';import { v4 as uuidv4 } from 'uuid';import Button from './Button.svelte';import {@@ -28,6 +30,12 @@const dispatch = createEventDispatcher();+ function msgTransition(node, { style }) {+ if (style === 'snap') return { duration: 0 };+ if (style === 'elegant') return fly(node, { y: 6, duration: 180, easing: cubicOut });+ return fly(node, { y: 14, duration: 380, easing: cubicOut });+ }+export let message;export let i;@@ -121,9 +129,11 @@{#if (['user', 'assistant'].includes(message.role) || (message.role === 'system' && (!message.customInstructions || (message.customInstructions && message.showCustomInstructions)))) && ($config.explicitToolView || !collapsedRanges.some((r) => i >= r.starti && i < r.endi))}{@const effectiveAgentId = $localAgentId || $brandConfig?.agent_id || ''}{@const hasLogo = message.role === 'assistant'}+ {@const isLatestAssistant = message.role === 'assistant' && i === convo.messages.findLastIndex((m) => m.role === 'assistant')}<!-- svelte-ignore a11y-click-events-have-key-events a11y-no-noninteractive-element-interactions --><lidata-role={message.role}+ in:msgTransition={{ style: $config.messageAnimation ?? 'smooth' }}class="group relative flex {message.role === 'user' ? 'justify-end' : 'justify-start'} pt-4 pb-10"style="z-index: {convo.messages.length - i};"on:touchstart={(event) => {@@ -186,7 +196,7 @@? 'border border-teal-200 bg-teal-100 pb-px': ''}">- {#if message.role === 'assistant' && hasLogo}+ {#if message.role === 'assistant' && hasLogo && isLatestAssistant}<span class="w-full h-full overflow-hidden inline-block shrink-0 rounded-[inherit]"><!-- svelte-ignore custom-element-no-implicit-ns --><agent-3ddiff --git a/chat/src/SettingsModal.svelte b/chat/src/SettingsModal.svelteindex 1a6c35a80..8fca65665 100644--- a/chat/src/SettingsModal.svelte+++ b/chat/src/SettingsModal.svelte@@ -574,6 +574,20 @@<span class="ms-3 text-sm text-slate-700">Use explicit view for tool calls</span></label></div>++ <div class="mt-4">+ <p class="mb-2 text-[10px] uppercase tracking-wide text-slate-500">Message animation</p>+ <div class="flex gap-2">+ {#each [['snap', 'Snap'], ['elegant', 'Elegant'], ['smooth', 'Smooth']] as [val, label]}+ <button+ class="flex-1 rounded-lg border px-3 py-1.5 text-[13px] transition-colors {($config.messageAnimation ?? 'smooth') === val ? 'border-slate-900 bg-slate-900 text-white' : 'border-slate-200 text-slate-700 hover:border-slate-400'}"+ on:click={() => ($config.messageAnimation = val)}+ >+ {label}+ </button>+ {/each}+ </div>+ </div>{:else if activeTab === 'brand'}<div class="flex flex-col gap-y-4">{#if !adminUnlocked}diff --git a/chat/src/convo.js b/chat/src/convo.jsindex 02958d153..de4e35105 100644--- a/chat/src/convo.js+++ b/chat/src/convo.js@@ -193,6 +193,9 @@ export async function complete(convo, onupdate, onabort) {err.code = 'payment_required';err.reason = body?.reason;err.upgradeUrl = body?.upgradeUrl;+ } else if (response.status === 429) {+ err.code = 'rate_limited';+ err.retryAfter = body?.retry_after;} else if (activeSchema.length > 0 && /no endpoints?\s+(?:found|available)\s+that support tool/i.test(msg)) {err.code = 'tools_unsupported';err.modelId = model.id;diff --git a/chat/src/stores.js b/chat/src/stores.jsindex 117516663..084fb3123 100644--- a/chat/src/stores.js+++ b/chat/src/stores.js@@ -27,6 +27,7 @@ export const params = persisted('params', {export const config = persisted('config', {explicitToolView: false,+ messageAnimation: 'smooth',});export const openaiAPIKey = persisted('openaiAPIKey', '');diff --git a/scripts/animations.config.json b/scripts/animations.config.jsonindex 3afb24c10..04ac75041 100644--- a/scripts/animations.config.json+++ b/scripts/animations.config.json@@ -125,5 +125,54 @@"label": "Header","icon": "⚽","loop": false+ },+ {+ "name": "coverstand",+ "source": "Cover To Stand.fbx",+ "label": "Cover Stand",+ "icon": "🛡️",+ "loop": false+ },+ {+ "name": "goalkeeper",+ "source": "Goalkeeper Scoop.fbx",+ "label": "Goalkeeper",+ "icon": "🧤",+ "loop": false+ },+ {+ "name": "jumpdown",+ "source": "Jumping Down.fbx",+ "label": "Jump Down",+ "icon": "⬇️",+ "loop": false+ },+ {+ "name": "jumpdown2",+ "source": "Jumping Down (1).fbx",+ "label": "Jump Down 2",+ "icon": "⬇️",+ "loop": false+ },+ {+ "name": "jumpdown3",+ "source": "Jumping Down (2).fbx",+ "label": "Jump Down 3",+ "icon": "⬇️",+ "loop": false+ },+ {+ "name": "removing",+ "source": "Removing Driver.fbx",+ "label": "Removing",+ "icon": "🚗",+ "loop": false+ },+ {+ "name": "falltolanding",+ "source": "falltolanding.fbx",+ "label": "Fall to Landing",+ "icon": "🦅",+ "loop": false}]