Add S3 storage client and API routes for document management: - Implement s3_routes.py with file upload, download, delete endpoints - Enhance s3_client.py with improved error handling and operations - Add S3 browser UI component with file viewing and management - Implement FileViewer and PDFViewer components for storage preview - Add Resizable and Sheet UI components for layout control Update backend infrastructure: - Add bulk operations and parameterized queries to postgres_impl.py - Enhance document routes with improved type hints - Update API server registration for new S3 routes - Refine upload routes and utility functions Modernize web UI: - Integrate S3 browser into main application layout - Update localization files for storage UI strings - Add storage settings to application configuration - Sync package dependencies and lock files Remove obsolete reproduction script: - Delete reproduce_citation.py (replaced by test suite) Update configuration: - Enhance pyrightconfig.json for stricter type checking
52 lines
1.8 KiB
TypeScript
52 lines
1.8 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import path from 'path'
|
|
import { webuiPrefix } from '@/lib/constants'
|
|
import react from '@vitejs/plugin-react-swc'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react(), tailwindcss()],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src')
|
|
},
|
|
// Force all modules to use the same React and katex instances
|
|
// This prevents "Invalid hook call" errors from duplicate React copies
|
|
dedupe: ['react', 'react-dom', 'katex']
|
|
},
|
|
// base: import.meta.env.VITE_BASE_URL || '/webui/',
|
|
base: webuiPrefix,
|
|
build: {
|
|
outDir: path.resolve(__dirname, '../lightrag/api/webui'),
|
|
emptyOutDir: true,
|
|
chunkSizeWarningLimit: 3800,
|
|
rollupOptions: {
|
|
// Let Vite handle chunking automatically to avoid circular dependency issues
|
|
output: {
|
|
// Ensure consistent chunk naming format
|
|
chunkFileNames: 'assets/[name]-[hash].js',
|
|
// Entry file naming format
|
|
entryFileNames: 'assets/[name]-[hash].js',
|
|
// Asset file naming format
|
|
assetFileNames: 'assets/[name]-[hash].[ext]'
|
|
}
|
|
}
|
|
},
|
|
server: {
|
|
proxy: import.meta.env.VITE_API_PROXY === 'true' && import.meta.env.VITE_API_ENDPOINTS ?
|
|
Object.fromEntries(
|
|
import.meta.env.VITE_API_ENDPOINTS.split(',').map(endpoint => [
|
|
endpoint,
|
|
{
|
|
target: import.meta.env.VITE_BACKEND_URL || 'http://localhost:9621',
|
|
changeOrigin: true,
|
|
rewrite: endpoint === '/api' ?
|
|
(path) => path.replace(/^\/api/, '') :
|
|
endpoint === '/docs' || endpoint === '/redoc' || endpoint === '/openapi.json' || endpoint === '/static' ?
|
|
(path) => path : undefined
|
|
}
|
|
])
|
|
) : {}
|
|
}
|
|
})
|