2026-04-11 15:59:14 +08:00
|
|
|
import { defineConfig } from 'vite'
|
|
|
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
|
import type { ProxyOptions } from 'vite'
|
|
|
|
|
import { resolve } from 'path'
|
|
|
|
|
|
|
|
|
|
function createProxyConfig(): ProxyOptions {
|
|
|
|
|
return {
|
2026-04-11 21:33:04 +08:00
|
|
|
target: 'http://127.0.0.1:8648',
|
2026-04-11 15:59:14 +08:00
|
|
|
changeOrigin: true,
|
|
|
|
|
configure: (proxy) => {
|
|
|
|
|
proxy.on('proxyReq', (proxyReq) => {
|
|
|
|
|
proxyReq.removeHeader('origin')
|
|
|
|
|
proxyReq.removeHeader('referer')
|
|
|
|
|
})
|
|
|
|
|
// Disable response buffering for SSE streaming
|
|
|
|
|
proxy.on('proxyRes', (proxyRes) => {
|
|
|
|
|
proxyRes.headers['cache-control'] = 'no-cache'
|
|
|
|
|
proxyRes.headers['x-accel-buffering'] = 'no'
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default defineConfig({
|
2026-04-11 21:33:04 +08:00
|
|
|
plugins: [vue()],
|
2026-04-11 15:59:14 +08:00
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
|
|
|
|
'@': resolve(__dirname, 'src'),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
server: {
|
|
|
|
|
proxy: {
|
|
|
|
|
'/api': createProxyConfig(),
|
|
|
|
|
'/v1': createProxyConfig(),
|
|
|
|
|
'/health': createProxyConfig(),
|
2026-04-11 21:33:04 +08:00
|
|
|
'/upload': createProxyConfig(),
|
|
|
|
|
'/webhook': createProxyConfig(),
|
2026-04-11 15:59:14 +08:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|