ausername-12345 commited on
Commit
dd4f3e7
·
1 Parent(s): 2140b39

Fix model defaults and HF URL format

Browse files
Files changed (1) hide show
  1. server.js +2 -2
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 || "microsoft/Phi-3-mini-4k-instruct";
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
- "https://api-inference.huggingface.co/v1/chat/completions",
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}` },