Update server.js
Browse files
server.js
CHANGED
|
@@ -45,8 +45,19 @@ app.post("/reverse-proxy-whisper", async (req, res) => {
|
|
| 45 |
}
|
| 46 |
});
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
}
|
| 46 |
});
|
| 47 |
|
| 48 |
+
function getExternalUrl(spaceId) {
|
| 49 |
+
try {
|
| 50 |
+
const [username, spacename] = spaceId.split('/');
|
| 51 |
+
return `https://${username}-${spacename.replace(/_/g, '-')}.hf.space/api/v1`;
|
| 52 |
+
} catch (e) {
|
| 53 |
+
return '';
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
app.get('/', (req, res) => {
|
| 58 |
+
res.send(`This is your OpenAI Reverse Proxy URL: ${baseUrl}`);
|
| 59 |
});
|
| 60 |
+
|
| 61 |
+
app.listen(port, () => {
|
| 62 |
+
console.log(`Reverse proxy server running on ${baseUrl}`);
|
| 63 |
+
});
|