Álvaro Valenzuela Valdes commited on
Commit
4aa8855
·
1 Parent(s): 38d972c

feat: link all spaces to REWCHILE/andesai-backend central cerebro

Browse files
Files changed (1) hide show
  1. frontend/lib/api.ts +8 -2
frontend/lib/api.ts CHANGED
@@ -16,8 +16,14 @@ export function getAPIBase(): string {
16
  return 'http://localhost:8000';
17
  }
18
 
19
- // 3. For HF Spaces and production, we use relative paths handled by Nginx proxy
20
- // This is the most robust way to handle both internal and external traffic
 
 
 
 
 
 
21
  return '';
22
  }
23
 
 
16
  return 'http://localhost:8000';
17
  }
18
 
19
+ // 3. Hugging Face Space detection (FORCED CENTRALIZED BACKEND)
20
+ if (hostname.includes('.hf.space')) {
21
+ // The user explicitly wants to use their personal backend space
22
+ const backendUrl = 'https://rewchile-andesai-backend.hf.space';
23
+ console.log('[API] Hugging Face Space detected. Connecting to Central Backend:', backendUrl);
24
+ return backendUrl;
25
+ }
26
+
27
  return '';
28
  }
29