This commit is contained in:
hailin 2025-05-19 00:04:58 +08:00
parent 89d1617c3b
commit 3d0c113c83
2 changed files with 12 additions and 0 deletions

View File

@ -8,6 +8,7 @@
"update": "git pull origin main && npm run db-migrate && npm run db-types",
"clean": "npm run lint:fix && npm run format:write",
"dev": "next dev -H 0.0.0.0",
"prebuild": "node scripts/generate-env.js",
"build": "next build",
"start": "next start -H 0.0.0.0 -p 3030",
"start:prod": "npm run build && pm2 start npm --name \"chatai-ui\" -- run start",

View File

@ -0,0 +1,11 @@
// scripts/generate-env.js
const fs = require("fs");
const env = {
SUPABASE_URL: process.env.SUPABASE_URL || "http://localhost:8000",
OLLAMA_URL: process.env.OLLAMA_URL || "http://localhost:11434"
};
const content = `window.RUNTIME_ENV = ${JSON.stringify(env, null, 2)};`
fs.writeFileSync("public/env.js", content);