vite.config.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import { fileURLToPath, URL } from 'node:url'
  2. import { defineConfig } from 'vite'
  3. import vue from '@vitejs/plugin-vue'
  4. import vueJsx from '@vitejs/plugin-vue-jsx'
  5. // https://vite.dev/config/
  6. // 本地开发代理配置 - 与生产环境nginx路径保持一致
  7. export default defineConfig({
  8. plugins: [
  9. vue(),
  10. vueJsx(),
  11. ],
  12. css: {
  13. postcss: './postcss.config.js'
  14. },
  15. resolve: {
  16. alias: {
  17. '@': fileURLToPath(new URL('./src', import.meta.url))
  18. },
  19. },
  20. server: {
  21. fs: {
  22. allow: ['..']
  23. },
  24. proxy: {
  25. // ===== 系统后端 (shudao-go-backend:22001) =====
  26. '/apiv1': {
  27. target: 'http://127.0.0.1:22001',
  28. changeOrigin: true,
  29. },
  30. // ===== AI对话服务 (ReportGenerator:28002) =====
  31. // /chatwithai/api/v1/xxx -> http://127.0.0.1:28002/api/v1/xxx
  32. '/chatwithai/': {
  33. target: 'http://127.0.0.1:28002',
  34. changeOrigin: true,
  35. rewrite: (path) => path.replace(/^\/chatwithai/, ''),
  36. },
  37. // ===== 认证网关 (auth-server:28004) =====
  38. // /auth/api/xxx -> http://127.0.0.1:28004/api/xxx
  39. '/auth/': {
  40. target: 'http://127.0.0.1:28004',
  41. changeOrigin: true,
  42. rewrite: (path) => path.replace(/^\/auth/, ''),
  43. },
  44. // ===== TTS语音合成服务 =====
  45. '/tts': {
  46. target: 'http://172.16.35.50:8000',
  47. changeOrigin: true,
  48. },
  49. // ===== 语音转文字服务 =====
  50. '/audio_to_text': {
  51. target: 'http://172.16.35.50:8000',
  52. changeOrigin: true,
  53. },
  54. }
  55. }
  56. })