enzostvs HF Staff commited on
Commit
c41803c
·
1 Parent(s): 258750b
Files changed (3) hide show
  1. package-lock.json +12 -17
  2. package.json +1 -1
  3. server.js +40 -35
package-lock.json CHANGED
@@ -9,7 +9,7 @@
9
  "version": "0.0.0",
10
  "dependencies": {
11
  "@huggingface/hub": "^1.1.1",
12
- "@huggingface/inference": "^3.6.1",
13
  "@monaco-editor/react": "^4.7.0",
14
  "@tailwindcss/vite": "^4.0.15",
15
  "@xenova/transformers": "^2.17.2",
@@ -856,35 +856,30 @@
856
  "node": ">=18"
857
  }
858
  },
859
- "node_modules/@huggingface/hub/node_modules/@huggingface/tasks": {
860
- "version": "0.18.1",
861
- "resolved": "https://registry.npmjs.org/@huggingface/tasks/-/tasks-0.18.1.tgz",
862
- "integrity": "sha512-HK6JTVB/nrgjOnbe77HFSENftfAp67AI4mHMR2x64Os1hvchuTT88M8fKEiyESSvqKFKwW4lQKkHva07p05AXw=="
863
- },
864
  "node_modules/@huggingface/inference": {
865
- "version": "3.6.1",
866
- "resolved": "https://registry.npmjs.org/@huggingface/inference/-/inference-3.6.1.tgz",
867
- "integrity": "sha512-EtQlbBqcZycPe+qiTEFI+wNHOMpG0gwNTaZSvYu1juN1p/1dEgqAb2GO31dxLgNev2PzH9d+9nm8GngOsIepJg==",
868
  "dependencies": {
869
- "@huggingface/jinja": "^0.3.3",
870
- "@huggingface/tasks": "^0.17.8"
871
  },
872
  "engines": {
873
  "node": ">=18"
874
  }
875
  },
876
  "node_modules/@huggingface/jinja": {
877
- "version": "0.3.3",
878
- "resolved": "https://registry.npmjs.org/@huggingface/jinja/-/jinja-0.3.3.tgz",
879
- "integrity": "sha512-vQQr2JyWvVFba3Lj9es4q9vCl1sAc74fdgnEMoX8qHrXtswap9ge9uO3ONDzQB0cQ0PUyaKY2N6HaVbTBvSXvw==",
880
  "engines": {
881
  "node": ">=18"
882
  }
883
  },
884
  "node_modules/@huggingface/tasks": {
885
- "version": "0.17.9",
886
- "resolved": "https://registry.npmjs.org/@huggingface/tasks/-/tasks-0.17.9.tgz",
887
- "integrity": "sha512-lV6RgCJkqy3p93FFxP9H4SGJmFcHAwr1FO+Zk56q/JWsf7Tdsel1DEo1Xfd3An7ZPWpc2Y9ldRecGo9efDYghg=="
888
  },
889
  "node_modules/@humanfs/core": {
890
  "version": "0.19.1",
 
9
  "version": "0.0.0",
10
  "dependencies": {
11
  "@huggingface/hub": "^1.1.1",
12
+ "@huggingface/inference": "^3.9.2",
13
  "@monaco-editor/react": "^4.7.0",
14
  "@tailwindcss/vite": "^4.0.15",
15
  "@xenova/transformers": "^2.17.2",
 
856
  "node": ">=18"
857
  }
858
  },
 
 
 
 
 
859
  "node_modules/@huggingface/inference": {
860
+ "version": "3.9.2",
861
+ "resolved": "https://registry.npmjs.org/@huggingface/inference/-/inference-3.9.2.tgz",
862
+ "integrity": "sha512-7EpMgaELUJArqhFpinkyikO1iXza4lEBYcUF8HMDVabwI2QxCXmxb6coCgYmerHEfRRxsvqogwNrdxiUfcSvDg==",
863
  "dependencies": {
864
+ "@huggingface/jinja": "^0.3.4",
865
+ "@huggingface/tasks": "^0.18.11"
866
  },
867
  "engines": {
868
  "node": ">=18"
869
  }
870
  },
871
  "node_modules/@huggingface/jinja": {
872
+ "version": "0.3.4",
873
+ "resolved": "https://registry.npmjs.org/@huggingface/jinja/-/jinja-0.3.4.tgz",
874
+ "integrity": "sha512-kFFQWJiWwvxezKQnvH1X7GjsECcMljFx+UZK9hx6P26aVHwwidJVTB0ptLfRVZQvVkOGHoMmTGvo4nT0X9hHOA==",
875
  "engines": {
876
  "node": ">=18"
877
  }
878
  },
879
  "node_modules/@huggingface/tasks": {
880
+ "version": "0.18.11",
881
+ "resolved": "https://registry.npmjs.org/@huggingface/tasks/-/tasks-0.18.11.tgz",
882
+ "integrity": "sha512-KSGMkOi86Ap2xTWGxwnSj8cE+glYhhwyHMdGDJn4dsOz1LzWq8kQF0epeZRkjBgwdTSBFpCk3+3FGdi6tXch7A=="
883
  },
884
  "node_modules/@humanfs/core": {
885
  "version": "0.19.1",
package.json CHANGED
@@ -12,7 +12,7 @@
12
  },
13
  "dependencies": {
14
  "@huggingface/hub": "^1.1.1",
15
- "@huggingface/inference": "^3.6.1",
16
  "@monaco-editor/react": "^4.7.0",
17
  "@tailwindcss/vite": "^4.0.15",
18
  "@xenova/transformers": "^2.17.2",
 
12
  },
13
  "dependencies": {
14
  "@huggingface/hub": "^1.1.1",
15
+ "@huggingface/inference": "^3.9.2",
16
  "@monaco-editor/react": "^4.7.0",
17
  "@tailwindcss/vite": "^4.0.15",
18
  "@xenova/transformers": "^2.17.2",
server.js CHANGED
@@ -275,41 +275,46 @@ app.post("/api/ask-ai", async (req, res) => {
275
  }
276
 
277
  try {
278
- const chatCompletion = client.chatCompletionStream({
279
- model: MODEL_ID,
280
- provider: selectedProvider.id,
281
- messages: [
282
- {
283
- role: "system",
284
- content: `ONLY USE HTML, CSS AND JAVASCRIPT. If you want to use ICON make sure to import the library first. Try to create the best UI possible by using only HTML, CSS and JAVASCRIPT. Use as much as you can TailwindCSS for the CSS, if you can't do something with TailwindCSS, then use custom CSS (make sure to import <script src="https://cdn.tailwindcss.com"></script> in the head). Also, try to ellaborate as much as you can, to create something unique. ALWAYS GIVE THE RESPONSE INTO A SINGLE HTML FILE`,
285
- },
286
- ...(previousPrompt
287
- ? [
288
- {
289
- role: "user",
290
- content: previousPrompt,
291
- },
292
- ]
293
- : []),
294
- ...(html
295
- ? [
296
- {
297
- role: "assistant",
298
- content: `The current code is: ${html}.`,
299
- },
300
- ]
301
- : []),
302
- {
303
- role: "user",
304
- content: prompt,
305
- },
306
- ],
307
- ...(selectedProvider.id !== "sambanova"
308
- ? {
309
- max_tokens: selectedProvider.max_tokens,
310
- }
311
- : {}),
312
- });
 
 
 
 
 
313
 
314
  while (true) {
315
  const { done, value } = await chatCompletion.next();
 
275
  }
276
 
277
  try {
278
+ const chatCompletion = client.chatCompletionStream(
279
+ {
280
+ model: MODEL_ID,
281
+ provider: selectedProvider.id,
282
+ messages: [
283
+ {
284
+ role: "system",
285
+ content: `ONLY USE HTML, CSS AND JAVASCRIPT. If you want to use ICON make sure to import the library first. Try to create the best UI possible by using only HTML, CSS and JAVASCRIPT. Use as much as you can TailwindCSS for the CSS, if you can't do something with TailwindCSS, then use custom CSS (make sure to import <script src="https://cdn.tailwindcss.com"></script> in the head). Also, try to ellaborate as much as you can, to create something unique. ALWAYS GIVE THE RESPONSE INTO A SINGLE HTML FILE`,
286
+ },
287
+ ...(previousPrompt
288
+ ? [
289
+ {
290
+ role: "user",
291
+ content: previousPrompt,
292
+ },
293
+ ]
294
+ : []),
295
+ ...(html
296
+ ? [
297
+ {
298
+ role: "assistant",
299
+ content: `The current code is: ${html}.`,
300
+ },
301
+ ]
302
+ : []),
303
+ {
304
+ role: "user",
305
+ content: prompt,
306
+ },
307
+ ],
308
+ ...(selectedProvider.id !== "sambanova"
309
+ ? {
310
+ max_tokens: selectedProvider.max_tokens,
311
+ }
312
+ : {}),
313
+ },
314
+ {
315
+ billTo: "huggingface",
316
+ }
317
+ );
318
 
319
  while (true) {
320
  const { done, value } = await chatCompletion.next();