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
three.ws
nirholasfad2f01ad150
diff --git a/api/chat/config.js b/api/chat/config.jsindex e7c6954db..71653eb8d 100644--- a/api/chat/config.js+++ b/api/chat/config.js@@ -3,6 +3,21 @@ import { env } from '../_lib/env.js';import { cors, json, method, wrap, error, readJson } from '../_lib/http.js';import { z } from 'zod';+const DEFAULT_SYSTEM_PROMPT = `You are a helpful AI assistant on three.ws — a platform for 3D AI agents, Solana, and pump.fun.++You have access to real-time pump.fun and Solana tools:+- Search, analyze, and get details on any pump.fun token+- Check bonding curve progress and graduation status+- Get token trades, holders, and read-only price quotes+- Resolve Solana Name Service (.sol) domains+- Get KOL radar signals for early alpha++When a 3D agent avatar is visible in the corner, you can use animation tools:+- agent_wave — make the avatar wave+- agent_express — express an emotion (celebration, curiosity, concern, empathy, patience)++Be concise, helpful, and crypto-native.`;+const DEFAULTS = {name: 'three.ws chat',logo_url: null,@@ -10,6 +25,7 @@ const DEFAULTS = {tagline: 'Chat with any AI model',default_model: 'meta-llama/llama-3.3-70b-instruct:free',agent_id: null,+ system_prompt: DEFAULT_SYSTEM_PROMPT,};const bodySchema = z.object({@@ -19,24 +35,21 @@ const bodySchema = z.object({tagline: z.string().trim().max(200).optional(),default_model: z.string().trim().min(1).max(100).optional(),agent_id: z.string().trim().max(100).nullable().optional(),+ system_prompt: z.string().max(4000).optional(),});export default wrap(async (req, res) => {if (cors(req, res, { methods: 'GET,POST,OPTIONS' })) return;if (!method(req, res, ['GET', 'POST'])) return;- // GET — fully public, returns current brand config+ // GET — fully publicif (req.method === 'GET') {- const [row] = await sql`SELECT name, logo_url, accent_color, tagline, default_model, agent_id FROM chat_brand_config WHERE key = 'global'`;+ const [row] = await sql`SELECT name, logo_url, accent_color, tagline, default_model, agent_id, system_prompt FROM chat_brand_config WHERE key = 'global'`;return json(res, 200, { data: row ?? DEFAULTS });}- // 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;- }+ // POST — admin key required+ const adminKey = env.CHAT_ADMIN_KEY;if (!adminKey) return error(res, 503, 'not_configured', 'CHAT_ADMIN_KEY is not set');const provided = (req.headers['x-admin-key'] || '').trim();@@ -62,9 +75,10 @@ export default wrap(async (req, res) => {tagline = ${body.tagline ?? DEFAULTS.tagline},default_model = ${body.default_model ?? DEFAULTS.default_model},agent_id = ${body.agent_id ?? null},+ system_prompt = ${body.system_prompt ?? DEFAULT_SYSTEM_PROMPT},updated_at = now()WHERE key = 'global'- RETURNING name, logo_url, accent_color, tagline, default_model, agent_id, updated_at+ RETURNING name, logo_url, accent_color, tagline, default_model, agent_id, system_prompt, updated_at`;return json(res, 200, { data: row });diff --git a/chat/src/App.svelte b/chat/src/App.svelteindex 641abc758..f500d3146 100644--- a/chat/src/App.svelte+++ b/chat/src/App.svelte@@ -52,6 +52,7 @@feSquare,feTrash,feUser,+ feUsers,feX,} from './feather.js';import { defaultToolSchema, agentToolSchema, pumpToolSchema } from './tools.js';@@ -1573,7 +1574,7 @@</Modal>{/if}-{#if effectiveAgentId || true}+{#if true}<div class="fixed bottom-4 right-4 z-50 flex flex-col items-end gap-2">{#if agentPickerOpen}<div class="mb-1 w-72 rounded-xl border border-gray-200 bg-white p-3 shadow-xl">diff --git a/chat/src/Input.svelte b/chat/src/Input.svelteindex 373ed268a..8370bf2a9 100644--- a/chat/src/Input.svelte+++ b/chat/src/Input.svelte@@ -16,7 +16,7 @@import { get } from 'svelte/store';import { v4 as uuidv4 } from 'uuid';import { readFileAsDataURL } from './util.js';- import { anthropicAPIKey, controller, params, remoteServer } from './stores.js';+ import { anthropicAPIKey, controller, params, remoteServer, brandConfig } from './stores.js';import ToolPill from './ToolPill.svelte';import ToolDropdown from './ToolDropdown.svelte';import ModelSelector from './ModelSelector.svelte';@@ -113,8 +113,9 @@async function sendMessage() {if (content.length > 0) {+ const _effectiveSystemPrompt = $params.customInstructions || $brandConfig.system_prompt;if (- $params.customInstructions &&+ _effectiveSystemPrompt &&convo.messages.length === 0 &&!convo.messages.find((m) => m.role === 'system')) {@@ -122,7 +123,7 @@id: uuidv4(),role: 'system',customInstructions: true,- content: $params.customInstructions,+ content: _effectiveSystemPrompt,};convo.messages.push(systemMsg);convo.messages = convo.messages;diff --git a/chat/src/SettingsModal.svelte b/chat/src/SettingsModal.svelteindex bdd849f9c..77092cc47 100644--- a/chat/src/SettingsModal.svelte+++ b/chat/src/SettingsModal.svelte@@ -49,7 +49,7 @@let brandSaving = false;let brandSaveError = '';let brandSaveOk = false;- let brandDraft = { name: '', logo_url: '', accent_color: '#6366f1', tagline: '' };+ let brandDraft = { name: '', logo_url: '', accent_color: '#6366f1', tagline: '', system_prompt: '' };function openBrandTab() {activeTab = 'brand';@@ -60,6 +60,7 @@tagline: $brandConfig.tagline,default_model: $brandConfig.default_model,agent_id: $brandConfig.agent_id ?? '',+ system_prompt: $brandConfig.system_prompt ?? '',};}@@ -75,6 +76,7 @@...brandDraft,logo_url: brandDraft.logo_url || null,agent_id: brandDraft.agent_id || null,+ system_prompt: brandDraft.system_prompt || undefined,}),});const json = await res.json();@@ -564,6 +566,16 @@<span class="font-mono text-[12px] text-slate-500">{brandDraft.accent_color}</span></div></label>+ <label class="flex flex-col text-[10px] uppercase tracking-wide">+ <span class="mb-2 ml-[3px]">System prompt</span>+ <textarea+ bind:value={brandDraft.system_prompt}+ rows="8"+ class="rounded-lg border border-gray-200 bg-white px-3 py-2 text-[13px] leading-relaxed outline-none focus:border-indigo-400 resize-y"+ placeholder="Default AI persona and instructions for all users…"+ ></textarea>+ <span class="mt-1 ml-[3px] text-[10px] text-slate-400 normal-case">Users can override this with their own Custom instructions in settings.</span>+ </label>{#if brandSaveError}<p class="text-[12px] text-red-500">{brandSaveError}</p>{/if}diff --git a/chat/src/stores.js b/chat/src/stores.jsindex bea757f67..ab191558a 100644--- a/chat/src/stores.js+++ b/chat/src/stores.js@@ -10,6 +10,7 @@ export const brandConfig = writable({tagline: 'Chat with any AI model',default_model: 'google/gemini-2.0-flash-exp:free',agent_id: null,+ system_prompt: '',});export const controller = writable(null);diff --git a/public/chat/index.html b/public/chat/index.htmlindex 53e0257f3..df2179429 100644--- a/public/chat/index.html+++ b/public/chat/index.html@@ -31,8 +31,8 @@crossorigin="anonymous"/><title>three.ws chat</title>- <script type="module" crossorigin src="/chat/assets/index-D6_3efiB.js"></script>- <link rel="stylesheet" crossorigin href="/chat/assets/index-BIPsb8P7.css">+ <script type="module" crossorigin src="/chat/assets/index-ZPcGjlbB.js"></script>+ <link rel="stylesheet" crossorigin href="/chat/assets/index-DwU9ZgUU.css"></head><body><div id="app"></div>