enzostvs HF Staff commited on
Commit
37fdb0e
·
1 Parent(s): 72358e0

use nebius

Browse files
Files changed (2) hide show
  1. server.js +8 -23
  2. src/components/tabs/tabs.tsx +1 -1
server.js CHANGED
@@ -189,12 +189,10 @@ app.post("/api/ask-ai", async (req, res) => {
189
  const client = new InferenceClient(token);
190
  let completeResponse = "";
191
 
192
- const useNebius = html?.length > 2_500;
193
-
194
  try {
195
  const chatCompletion = client.chatCompletionStream({
196
  model: MODEL_ID,
197
- provider: useNebius ? "nebius" : "sambanova",
198
  messages: [
199
  {
200
  role: "system",
@@ -222,7 +220,7 @@ app.post("/api/ask-ai", async (req, res) => {
222
  content: prompt,
223
  },
224
  ],
225
- max_tokens: useNebius ? 8_192 : 6_000,
226
  });
227
 
228
  while (true) {
@@ -232,25 +230,12 @@ app.post("/api/ask-ai", async (req, res) => {
232
  }
233
  const chunk = value.choices[0]?.delta?.content;
234
  if (chunk) {
235
- if (useNebius) {
236
- res.write(chunk);
237
- completeResponse += chunk;
238
-
239
- // Break when HTML is complete
240
- if (completeResponse.includes("</html>")) {
241
- break;
242
- }
243
- } else {
244
- let newChunk = chunk;
245
- if (chunk.includes("</html>")) {
246
- // Replace everything after the last </html> tag with an empty string
247
- newChunk = newChunk.replace(/<\/html>[\s\S]*/, "</html>");
248
- }
249
- completeResponse += newChunk;
250
- res.write(newChunk);
251
- if (newChunk.includes("</html>")) {
252
- break;
253
- }
254
  }
255
  }
256
  }
 
189
  const client = new InferenceClient(token);
190
  let completeResponse = "";
191
 
 
 
192
  try {
193
  const chatCompletion = client.chatCompletionStream({
194
  model: MODEL_ID,
195
+ provider: "nebius",
196
  messages: [
197
  {
198
  role: "system",
 
220
  content: prompt,
221
  },
222
  ],
223
+ max_tokens: 12_000,
224
  });
225
 
226
  while (true) {
 
230
  }
231
  const chunk = value.choices[0]?.delta?.content;
232
  if (chunk) {
233
+ res.write(chunk);
234
+ completeResponse += chunk;
235
+
236
+ // Break when HTML is complete
237
+ if (completeResponse.includes("</html>")) {
238
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
 
239
  }
240
  }
241
  }
src/components/tabs/tabs.tsx CHANGED
@@ -14,7 +14,7 @@ function Tabs({ children }: { children?: React.ReactNode }) {
14
  </div>
15
  <div className="flex items-center justify-end gap-3">
16
  <a
17
- href="https://huggingface.co/deepseek-ai/DeepSeek-V3-0324?inference_provider=sambanova"
18
  target="_blank"
19
  className="text-[12px] text-gray-300 hover:brightness-120 flex items-center gap-1 font-code"
20
  >
 
14
  </div>
15
  <div className="flex items-center justify-end gap-3">
16
  <a
17
+ href="https://huggingface.co/deepseek-ai/DeepSeek-V3-0324?inference_provider=nebius"
18
  target="_blank"
19
  className="text-[12px] text-gray-300 hover:brightness-120 flex items-center gap-1 font-code"
20
  >