Spaces:
Sleeping
Sleeping
ausername-12345 commited on
Commit ·
dd4f3e7
1
Parent(s): 2140b39
Fix model defaults and HF URL format
Browse files
server.js
CHANGED
|
@@ -48,7 +48,7 @@ app.post("/api/hf", async (req, res) => {
|
|
| 48 |
return res.status(500).json({ error: "HF_TOKEN not configured" });
|
| 49 |
}
|
| 50 |
|
| 51 |
-
const model = req.body.model || "
|
| 52 |
const messages = req.body.messages || [];
|
| 53 |
const lastUserMsg = messages.filter((m) => m.role === "user").at(-1);
|
| 54 |
const userQuery = lastUserMsg?.content || "";
|
|
@@ -72,7 +72,7 @@ app.post("/api/hf", async (req, res) => {
|
|
| 72 |
};
|
| 73 |
|
| 74 |
const hfRes = await fetchWithTimeout(
|
| 75 |
-
|
| 76 |
{
|
| 77 |
method: "POST",
|
| 78 |
headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}` },
|
|
|
|
| 48 |
return res.status(500).json({ error: "HF_TOKEN not configured" });
|
| 49 |
}
|
| 50 |
|
| 51 |
+
const model = req.body.model || "HuggingFaceH4/zephyr-7b-beta";
|
| 52 |
const messages = req.body.messages || [];
|
| 53 |
const lastUserMsg = messages.filter((m) => m.role === "user").at(-1);
|
| 54 |
const userQuery = lastUserMsg?.content || "";
|
|
|
|
| 72 |
};
|
| 73 |
|
| 74 |
const hfRes = await fetchWithTimeout(
|
| 75 |
+
`https://api-inference.huggingface.co/models/${model}/v1/chat/completions`,
|
| 76 |
{
|
| 77 |
method: "POST",
|
| 78 |
headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}` },
|