vite.config.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 -> 实际本地端口为22000) =====
  26. '/apiv1': {
  27. target: 'http://127.0.0.1:22000',
  28. changeOrigin: true,
  29. },
  30. // ===== AI对话服务 (ReportGenerator:28002) =====
  31. // /chatwithai/api/v1/xxx -> http://127.0.0.1:28002/api/v1/xxx
  32. '/api/ticket': {
  33. target: 'http://127.0.0.1:28004',
  34. changeOrigin: true,
  35. },
  36. '/api/account': {
  37. target: 'http://127.0.0.1:28004',
  38. changeOrigin: true,
  39. },
  40. '/api/auth': {
  41. target: 'http://127.0.0.1:28004',
  42. changeOrigin: true,
  43. },
  44. '/chatwithai/': {
  45. target: 'http://127.0.0.1:28002',
  46. changeOrigin: true,
  47. rewrite: (path) => path.replace(/^\/chatwithai/, ''),
  48. },
  49. // ===== 认证网关 (auth-server:28004) =====
  50. // /auth/api/xxx -> http://127.0.0.1:28004/api/xxx
  51. '/auth/': {
  52. target: 'http://127.0.0.1:28004',
  53. changeOrigin: true,
  54. rewrite: (path) => path.replace(/^\/auth/, ''),
  55. },
  56. // ===== TTS语音合成服务 =====
  57. '/tts': {
  58. target: 'http://172.16.35.50:8000',
  59. changeOrigin: true,
  60. },
  61. // ===== 语音转文字服务 =====
  62. '/audio_to_text': {
  63. target: 'http://172.16.35.50:8000',
  64. changeOrigin: true,
  65. },
  66. }
  67. }
  68. })