export const isTauri = typeof window !== 'undefined' && !!(window as any).__TAURI__ export function getApiBase(): string { if (isTauri) return 'http://localhost:8888' const stored = localStorage.getItem('proxy_url') if (stored) return stored const hostname = typeof window !== 'undefined' ? window.location.hostname : '' const isLocal = hostname === 'localhost' || hostname === '127.0.0.1' if (isLocal) return '' // 走 Vite proxy → Rust proxy (8888) return window.location.origin }