ai chat init

This commit is contained in:
xie7654
2025-07-12 16:54:49 +08:00
parent 62bba7d23f
commit f5314efc81
10 changed files with 390 additions and 18 deletions

View File

@@ -1,5 +1,3 @@
import * as console from 'node:console';
import { defineConfig } from '@vben/vite-config';
import { loadEnv } from 'vite';
@@ -9,8 +7,8 @@ import vitePluginOss from './plugins/vite-plugin-oss.mjs';
export default defineConfig(async ({ mode }) => {
// eslint-disable-next-line n/prefer-global/process
const env = loadEnv(mode, process.cwd());
// 这样获取
const backendUrl = env.VITE_BACKEND_URL;
// 这样获取,提供默认值
const backendUrl = env.VITE_BACKEND_URL || 'http://localhost:8000';
// 判断是否为构建模式
const isBuild = mode === 'production';
@@ -28,6 +26,11 @@ export default defineConfig(async ({ mode }) => {
target: backendUrl,
changeOrigin: true,
},
'/ws': {
target: backendUrl,
changeOrigin: true,
ws: true, // 启用WebSocket代理
},
},
},
plugins: [