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 admin key fallback mechanism and add migration for CHAT_ADMIN_KEY in DB
nirholas0d476b8541a3
diff --git a/api/_lib/migrations/2026-04-30-chat-admin-key.sql b/api/_lib/migrations/2026-04-30-chat-admin-key.sqlnew file mode 100644index 000000000..d93a2b91c--- /dev/null+++ b/api/_lib/migrations/2026-04-30-chat-admin-key.sql@@ -0,0 +1,5 @@+-- Migration: store CHAT_ADMIN_KEY in DB so it can be updated without redeploy.+-- Apply: psql "$DATABASE_URL" -f api/_lib/migrations/2026-04-30-chat-admin-key.sql+-- Idempotent.++ALTER TABLE chat_brand_config ADD COLUMN IF NOT EXISTS admin_key TEXT;diff --git a/api/chat/config.js b/api/chat/config.jsindex 18c0c59a0..e7c6954db 100644--- a/api/chat/config.js+++ b/api/chat/config.js@@ -31,8 +31,12 @@ export default wrap(async (req, res) => {return json(res, 200, { data: row ?? DEFAULTS });}- // POST — admin key required- const adminKey = env.CHAT_ADMIN_KEY;+ // POST — admin key required (env var takes precedence, DB is fallback)+ let adminKey = env.CHAT_ADMIN_KEY;+ if (!adminKey) {+ const [cfg] = await sql`SELECT admin_key FROM chat_brand_config WHERE key = 'global'`;+ adminKey = cfg?.admin_key ?? null;+ }if (!adminKey) return error(res, 503, 'not_configured', 'CHAT_ADMIN_KEY is not set');const provided = (req.headers['x-admin-key'] || '').trim();diff --git a/chat/src/App.svelte b/chat/src/App.svelteindex 6006bd732..641abc758 100644--- a/chat/src/App.svelte+++ b/chat/src/App.svelte@@ -48,6 +48,7 @@feSettings,feShare,feSidebar,+ feSpeaker,feSquare,feTrash,feUser,