This adds a completely separate frontend based on React because I found that code gen works better with React once the application gets bigger. In particular it was getting very hard to move past add connectors and actions. The idea is to replace the standard UI with this once it has been tested. But for now it is available at /app in addition to the original at / Signed-off-by: Richard Palethorpe <io@richiejp.com>
32 lines
957 B
JavaScript
32 lines
957 B
JavaScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
|
|
// Define backend URL with port from environment variable or default to 8080
|
|
const backendUrl = `http://${process.env.BACKEND_HOST || 'localhost'}:${process.env.BACKEND_PORT || '3000'}`
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
base: '/app', // Set the base path for production builds
|
|
server: {
|
|
proxy: {
|
|
// Proxy API requests to your Go backend
|
|
'/api': backendUrl,
|
|
// Proxy SSE endpoints
|
|
'/sse': backendUrl,
|
|
// Add other endpoints as needed
|
|
'/settings': backendUrl,
|
|
'/agents': backendUrl,
|
|
'/create': backendUrl,
|
|
'/delete': backendUrl,
|
|
'/pause': backendUrl,
|
|
'/start': backendUrl,
|
|
'/talk': backendUrl,
|
|
'/notify': backendUrl,
|
|
'/chat': backendUrl,
|
|
'/status': backendUrl,
|
|
'/action': backendUrl,
|
|
'/actions': backendUrl,
|
|
}
|
|
}
|
|
}); |