Przeglądaj źródła

阅读优化增加指标

luojunhui 1 dzień temu
rodzic
commit
33f703ac77
1 zmienionych plików z 6 dodań i 3 usunięć
  1. 6 3
      vite.config.ts

+ 6 - 3
vite.config.ts

@@ -2,6 +2,9 @@ import { defineConfig } from 'vite'
 import react from '@vitejs/plugin-react'
 
 // 后端运行在 8080,前端开发期通过代理避免跨域
+// const PROXY_TARGET = 'http://localhost:8080'
+const PROXY_TARGET = 'https://api-internal.piaoquantv.com'
+
 export default defineConfig({
   plugins: [react()],
   base: '/content-similarity-recall/', // CDN 部署路径
@@ -10,8 +13,7 @@ export default defineConfig({
     host: true,
     proxy: {
       '/videoVector': {
-        target: 'https://api-internal.piaoquantv.com',
-        // target: 'http://localhost:8080',
+        target: PROXY_TARGET,
         changeOrigin: true,
         secure: false,
         configure: (proxy) => {
@@ -20,6 +22,7 @@ export default defineConfig({
             const inner = (err as any)?.errors
             // eslint-disable-next-line no-console
             console.error('[proxy error]', req?.method, req?.url,
+              '\n  host:', PROXY_TARGET,
               '\n  name:', err?.name,
               '\n  code:', (err as any)?.code,
               '\n  msg:', err?.message,
@@ -29,7 +32,7 @@ export default defineConfig({
           })
           proxy.on('proxyReq', (_pReq, req) => {
             // eslint-disable-next-line no-console
-            console.log('[proxy req]', req?.method, req?.url)
+            console.log('[proxy req]', req?.method, req?.url, '→', PROXY_TARGET)
           })
         },
       },