feat: consolidate env config and add deployment files
- Add debug_font_path, demo_docs_dir, e2e_api_base_url to config.py - Fix hardcoded paths in pp_structure_debug.py, create_demo_images.py - Fix hardcoded paths in test files - Update .env.example with new configuration options - Update .gitignore to exclude AI development files (.claude/, openspec/, AGENTS.md, CLAUDE.md) - Add production startup script (start-prod.sh) - Add README.md with project documentation - Add 1panel Docker deployment files (docker-compose.yml, Dockerfiles, nginx.conf) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,3 +5,7 @@
|
||||
# For local development: http://localhost:8000
|
||||
# For WSL2: Use the WSL2 IP address (get with: hostname -I | awk '{print $1}')
|
||||
VITE_API_BASE_URL=http://localhost:8000
|
||||
|
||||
# Dev server configuration (used by `vite.config.ts`)
|
||||
FRONTEND_HOST=0.0.0.0
|
||||
FRONTEND_PORT=5173
|
||||
|
||||
@@ -30,7 +30,7 @@ export default function ResultsPage() {
|
||||
|
||||
// Construct PDF URL for preview - memoize to prevent unnecessary reloads
|
||||
// Must be called unconditionally before any early returns (React hooks rule)
|
||||
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:8000'
|
||||
const API_BASE_URL = (import.meta.env.VITE_API_BASE_URL || '').replace(/\/$/, '')
|
||||
const pdfUrl = useMemo(() => {
|
||||
return taskId ? `${API_BASE_URL}/api/v2/tasks/${taskId}/download/pdf` : ''
|
||||
}, [taskId, API_BASE_URL])
|
||||
|
||||
@@ -147,7 +147,7 @@ export default function TaskDetailPage() {
|
||||
|
||||
// Construct PDF URL for preview - memoize to prevent unnecessary reloads
|
||||
// Must be called unconditionally before any early returns (React hooks rule)
|
||||
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:8000'
|
||||
const API_BASE_URL = (import.meta.env.VITE_API_BASE_URL || '').replace(/\/$/, '')
|
||||
const pdfUrl = useMemo(() => {
|
||||
return taskId ? `${API_BASE_URL}/api/v2/tasks/${taskId}/download/pdf` : ''
|
||||
}, [taskId, API_BASE_URL])
|
||||
|
||||
@@ -47,10 +47,10 @@ import type {
|
||||
/**
|
||||
* API Client Configuration
|
||||
* - In Docker: VITE_API_BASE_URL is empty string, use relative path
|
||||
* - In development: Use VITE_API_BASE_URL from .env or default to localhost:8000
|
||||
* - In development: Prefer relative path + Vite proxy; optionally set VITE_API_BASE_URL for non-proxied setups
|
||||
*/
|
||||
const envApiBaseUrl = import.meta.env.VITE_API_BASE_URL
|
||||
const API_BASE_URL = envApiBaseUrl !== undefined ? envApiBaseUrl : 'http://localhost:8000'
|
||||
const API_BASE_URL = envApiBaseUrl !== undefined ? envApiBaseUrl : ''
|
||||
const API_VERSION = 'v2'
|
||||
|
||||
class ApiClientV2 {
|
||||
|
||||
@@ -1,23 +1,33 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import path from 'path'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
port: 5173,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: process.env.VITE_API_URL || 'http://localhost:8000',
|
||||
changeOrigin: true,
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), '')
|
||||
|
||||
const backendPort = env.BACKEND_PORT || '8000'
|
||||
const backendBaseUrl = (env.VITE_API_BASE_URL || env.VITE_API_URL || `http://localhost:${backendPort}`).replace(/\/$/, '')
|
||||
|
||||
const frontendPort = Number.parseInt(env.FRONTEND_PORT || env.VITE_PORT || '5173', 10)
|
||||
const frontendHost = env.FRONTEND_HOST || '0.0.0.0'
|
||||
|
||||
return {
|
||||
plugins: [react()],
|
||||
server: {
|
||||
host: frontendHost,
|
||||
port: Number.isFinite(frontendPort) ? frontendPort : 5173,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: backendBaseUrl,
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, './src'),
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, './src'),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user