Álvaro Valenzuela Valdes commited on
Commit
d410380
·
1 Parent(s): 8feafb7

fix: improve API auto-detection for lablab hackathon space

Browse files
Files changed (1) hide show
  1. frontend/lib/api.ts +9 -3
frontend/lib/api.ts CHANGED
@@ -18,9 +18,15 @@ export function getAPIBase(): string {
18
 
19
  // 2. Hugging Face Space detection (IMPROVED)
20
  if (hostname.includes('.hf.space')) {
21
- // If we are in the hackathon space or REWCHILE space
22
- // Direct point to the backend we just created
23
- const backendUrl = `https://rewchile-andesai-backend.hf.space`;
 
 
 
 
 
 
24
 
25
  console.log('[API] Hugging Face Space detected. Frontend:', hostname);
26
  console.log('[API] Connecting to Backend:', backendUrl);
 
18
 
19
  // 2. Hugging Face Space detection (IMPROVED)
20
  if (hostname.includes('.hf.space')) {
21
+ // Logic: If frontend is {user}-{space}.hf.space, backend is usually {user}-andesai-backend.hf.space
22
+ // Handle the specific lablab-ai-amd-developer-hackathon organization case
23
+ let backendUrl = `https://rewchile-andesai-backend.hf.space`;
24
+
25
+ if (hostname.includes('lablab-ai-amd-developer-hackathon')) {
26
+ backendUrl = `https://lablab-ai-amd-developer-hackathon-andesai-backend.hf.space`;
27
+ } else if (hostname.includes('satori47')) {
28
+ backendUrl = `https://satori47-andesai-backend.hf.space`;
29
+ }
30
 
31
  console.log('[API] Hugging Face Space detected. Frontend:', hostname);
32
  console.log('[API] Connecting to Backend:', backendUrl);