From 1482ef9cf31c63b8afe81105f5a37a800f651d84 Mon Sep 17 00:00:00 2001 From: sp mac bookpro 2605 Date: Mon, 27 Jul 2026 19:41:32 +0800 Subject: [PATCH] feat: upgrade global API prefix from /api to /api/v1 --- src/api/http.ts | 2 +- vite.config.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/api/http.ts b/src/api/http.ts index f122e46..c022667 100644 --- a/src/api/http.ts +++ b/src/api/http.ts @@ -1,7 +1,7 @@ import axios from 'axios'; import { clearUserStorage } from '../utils/storage'; -export const API_BASE_URL = import.meta.env.DEV ? '/api/' : 'https://www.tianchaoai.cc/api/v1/'; +export const API_BASE_URL = import.meta.env.DEV ? '/api/v1/' : 'https://www.tianchaoai.cc/api/v1/'; const APP_BASE = (import.meta.env.BASE_URL || '/').replace(/\/$/, ''); export const withAppBase = (path: string) => `${APP_BASE}${path.startsWith('/') ? path : `/${path}`}`; export const withApiBase = (path: string) => `${API_BASE_URL}${path.replace(/^\//, '')}`; diff --git a/vite.config.ts b/vite.config.ts index 471caa3..6fac94e 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -13,10 +13,9 @@ export default defineConfig(({ command, mode }) => { server: { port: 3001, proxy: { - '/api': { + '/api/v1': { target, changeOrigin: true, - rewrite: (path) => path.replace(/^\/api/, '/api/v1'), // SSE 不要被压缩;保持长连接 configure: (proxy) => { proxy.on('proxyReq', (proxyReq) => {