refactor(config): use Vite proxy for API requests and change backend port
- Configure Vite dev server to proxy /v1 requests to backend - Change backend port from 8000 to 8001 - Simplify API URLs to relative paths instead of absolute localhost URLs - Increase debounce delay from 500ms to 1000ms for better stability - Update README documentation to reflect all changes
This commit is contained in:
+2
-17
@@ -1,18 +1,3 @@
|
||||
export const DEBUG = import.meta.env.DEV
|
||||
export const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:8000/v1/completions'
|
||||
|
||||
const buildDefaultOcrUrl = (apiUrl) => {
|
||||
if (typeof window === 'undefined') {
|
||||
return 'http://localhost:8000/v1/ocr'
|
||||
}
|
||||
|
||||
try {
|
||||
const url = new URL(apiUrl, window.location.origin)
|
||||
url.pathname = '/v1/ocr'
|
||||
return url.toString()
|
||||
} catch {
|
||||
return 'http://localhost:8000/v1/ocr'
|
||||
}
|
||||
}
|
||||
|
||||
export const OCR_URL = import.meta.env.VITE_OCR_URL || buildDefaultOcrUrl(API_URL)
|
||||
export const API_URL = import.meta.env.VITE_API_URL || '/v1/completions'
|
||||
export const OCR_URL = import.meta.env.VITE_OCR_URL || '/v1/ocr'
|
||||
|
||||
Reference in New Issue
Block a user