2026-02-07 08:53:37 +08:00
|
|
|
export const DEBUG = import.meta.env.DEV
|
|
|
|
|
export const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:8000/v1/completions'
|
2026-02-14 21:21:06 +08:00
|
|
|
|
|
|
|
|
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)
|