Álvaro Valenzuela Valdes commited on
Commit
b0d930e
·
1 Parent(s): 6ebf594

🚀 Fix: Frontend port 7860 and correct Backend URL

Browse files
Files changed (2) hide show
  1. frontend/Dockerfile +3 -3
  2. frontend/lib/api.ts +4 -6
frontend/Dockerfile CHANGED
@@ -39,8 +39,8 @@ USER user
39
 
40
  # Health check
41
  HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
42
- CMD wget --quiet --tries=1 --spider http://localhost:3000/ || exit 1
43
 
44
- EXPOSE 3000
45
 
46
- CMD ["npm", "start"]
 
39
 
40
  # Health check
41
  HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
42
+ CMD wget --quiet --tries=1 --spider http://localhost:7860/ || exit 1
43
 
44
+ EXPOSE 7860
45
 
46
+ CMD ["npm", "start", "--", "-p", "7860"]
frontend/lib/api.ts CHANGED
@@ -17,15 +17,13 @@ function getAPIBase(): string {
17
  const protocol = window.location.protocol;
18
 
19
  // 2. Hugging Face Space detection (IMPROVED)
20
- // Pattern: {username}-{space-name}.hf.space
21
  if (hostname.includes('.hf.space')) {
22
- // Extract the base name (everything before .hf.space)
23
- const baseName = hostname.split('.')[0]; // e.g., "lablab-ai-amd-developer-hackathon-andesops-ai"
 
24
 
25
- // Construct backend URL
26
- const backendUrl = `${protocol}//${baseName.replace('andesops-ai', 'andesops-ai-backend')}.hf.space`;
27
  console.log('[API] Hugging Face Space detected. Frontend:', hostname);
28
- console.log('[API] Auto-connecting to Backend:', backendUrl);
29
  return backendUrl;
30
  }
31
 
 
17
  const protocol = window.location.protocol;
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);
27
  return backendUrl;
28
  }
29