feat: add project-aware agent workspace
This commit is contained in:
+11
-1
@@ -5,6 +5,7 @@ import { fileURLToPath, URL } from "node:url";
|
||||
import { createEdgeTtsMiddleware } from "./server/edge-tts-service";
|
||||
|
||||
const RUNTIME_CONFIG_PATH = "/runtime-config.js";
|
||||
const PERIPHERAL_PROXY_PATH = "/peripheral";
|
||||
|
||||
function renderRuntimeConfig(values: Record<string, string>) {
|
||||
const config = {
|
||||
@@ -57,12 +58,21 @@ function runtimeConfigPlugin(values: Record<string, string>): Plugin {
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), "");
|
||||
const peripheralProxy = {
|
||||
[PERIPHERAL_PROXY_PATH]: {
|
||||
target: env.TJWATER_PERIPHERAL_SAMPLE_UPSTREAM || "http://127.0.0.1:8011",
|
||||
changeOrigin: false,
|
||||
rewrite: (path: string) => path.slice(PERIPHERAL_PROXY_PATH.length) || "/"
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
plugins: [runtimeConfigPlugin(env), react(), tailwindcss({ optimize: false })],
|
||||
server: {
|
||||
allowedHosts: ["next.demo.waternetwork.cn"]
|
||||
allowedHosts: ["next.demo.waternetwork.cn"],
|
||||
proxy: peripheralProxy
|
||||
},
|
||||
preview: { proxy: peripheralProxy },
|
||||
cacheDir: process.env.TJWATER_VITE_CACHE_DIR ?? "node_modules/.vite",
|
||||
resolve: {
|
||||
dedupe: ["react", "react-dom"],
|
||||
|
||||
Reference in New Issue
Block a user