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(dev): chat sub-app proxy and trailing-slash redirect

nirholasf51e3cb2e776
diff --git a/.gitignore b/.gitignore
index 76d82dd19..f8b3c3888 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,6 +31,7 @@ xspace-agent/start-demo.sh
# Chat build artifacts
public/chat/assets/
+public/chat/index.html
public/chat/index.html.gz
# Animation build cache
diff --git a/package.json b/package.json
index e35e0ba4b..a5ea29dcc 100644
--- a/package.json
+++ b/package.json
@@ -49,7 +49,7 @@
"build:lib:full": "TARGET=lib LIB_FORMATS=es,umd vite build",
"build:artifact": "vite build --config vite.config.artifact.js",
"publish:lib": "node scripts/publish-lib.mjs",
- "build:chat": "cd chat && node scripts/ensure-deps.mjs && npm run build",
+ "build:chat": "cd chat && node scripts/ensure-deps.mjs && npm run build && cd .. && mkdir -p dist/chat && cp -rf public/chat/. dist/chat/",
"build:rider": "mkdir -p dist/rider && cp rider/index.html dist/rider/ && cp -rf rider/assets dist/rider/ && cp -rf rider/build dist/rider/ && cp -rf rider/vendor dist/rider/",
"build:rider:full": "cd rider && npm ci --prefer-offline --no-audit --no-fund --ignore-engines && npm run build && cd .. && npm run build:rider",
"build:fast": "npm run build",
diff --git a/public/chat/index.html b/public/chat/index.html
deleted file mode 100644
index 4daaa95b3..000000000
--- a/public/chat/index.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="UTF-8" />
- <link rel="icon" type="image/svg+xml" href="/chat/three.svg" />
- <link rel="icon" type="image/png" href="/chat/ios/180.png" />
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
- <link rel="manifest" href="/chat/manifest.json">
- <meta name="theme-color" content="#FFFFFF"/>
-
- <meta name="description" content="Chat with any AI model — Claude, GPT, Gemini, Ollama and more. Powered by three.ws." />
-
- <!-- Open Graph -->
- <meta property="og:type" content="website" />
- <meta property="og:url" content="https://three.ws/chat" />
- <meta property="og:title" content="three.ws chat" />
- <meta property="og:description" content="Chat with any AI model — Claude, GPT, Gemini, Ollama and more." />
- <meta property="og:image" content="https://three.ws/og-image.png" />
-
- <!-- Twitter -->
- <meta name="twitter:card" content="summary_large_image" />
- <meta name="twitter:site" content="@three_ws" />
- <meta name="twitter:title" content="three.ws chat" />
- <meta name="twitter:description" content="Chat with any AI model — Claude, GPT, Gemini, Ollama and more." />
- <meta name="twitter:image" content="https://three.ws/og-image.png" />
-
- <link rel="preconnect" href="https://fonts.googleapis.com">
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
- <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Lora:ital,wght@0,500;0,600;0,700;1,500&display=swap" rel="stylesheet">
- <link
- rel="stylesheet"
- href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css"
- integrity="sha384-GvrOXuhMATgEsSwCs4smul74iXGOixntILdUW9XmUC6+HX0sLNAK3q71HotJqlAn"
- crossorigin="anonymous"
- />
- <title>three.ws chat</title>
- <link rel="stylesheet" href="/footer.css" />
-
- <script type="importmap">
- {
- "imports": {
- "three": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js",
- "three/addons/": "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/"
- }
- }
- </script>
- <script type="module" crossorigin src="/chat/assets/index-D7E0BVgq.js"></script>
- <link rel="stylesheet" crossorigin href="/chat/assets/index-BS8U8RZM.css">
- </head>
- <body>
- <div id="app"></div>
- </body>
-</html>
diff --git a/vite.config.js b/vite.config.js
index 99a6bca49..55e82ef75 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -18,7 +18,6 @@ const appConfig = {
proxy: {
'/chat': {
target: 'http://localhost:5174',
- rewrite: (path) => path.replace(/^\/chat/, ''),
changeOrigin: true,
},
},
@@ -159,6 +158,14 @@ const appConfig = {
res.setHeader('Location', '/discover/');
return res.end();
}
+ // Chat sub-app is proxied to its own Vite dev server at :5174
+ // which serves under /chat/. Redirect /chat → /chat/ so the
+ // proxy can forward the trailing-slash form upstream.
+ if (path === '/chat') {
+ res.statusCode = 301;
+ res.setHeader('Location', '/chat/');
+ return res.end();
+ }
let filePath = fileMap[path];
if (!filePath && /^\/marketplace\/agents\/[^/]+\/?$/.test(path))
filePath = resolve(root, 'marketplace.html');