Álvaro Valenzuela Valdes commited on
Commit ·
b0d930e
1
Parent(s): 6ebf594
🚀 Fix: Frontend port 7860 and correct Backend URL
Browse files- frontend/Dockerfile +3 -3
- 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:
|
| 43 |
|
| 44 |
-
EXPOSE
|
| 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 |
-
//
|
| 23 |
-
|
|
|
|
| 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]
|
| 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 |
|