Team Ai
Apppublic

Decoder2704/python-chatbot-jay

sourceHugging Faceupdated 7mo agoView on Hugging Face
0likes
vite.config.js31 linesDownload Raw Back to frontend
1import { defineConfig, loadEnv } from "vite";2import react from "@vitejs/plugin-react";3 4/**5 * Dev server proxies API routes to FastAPI so the browser uses relative URLs (no hardcoded6 * API host in the bundle). Override target with VITE_DEV_PROXY_TARGET in .env.local.7 */8export default defineConfig(({ mode }) => {9  const env = loadEnv(mode, process.cwd(), "");10  const proxyTarget = env.VITE_DEV_PROXY_TARGET || "http://127.0.0.1:8000";11 12  const proxy = {13    target: proxyTarget,14    changeOrigin: true,15  };16 17  const apiProxy = {18    "/chat": proxy,19    "/health": proxy,20    "/docs": proxy,21    "/openapi.json": proxy,22    "/redoc": proxy,23  };24 25  return {26    plugins: [react()],27    server: { proxy: apiProxy },28    preview: { proxy: apiProxy },29  };30});31