Spaces:
Running
Running
billTo hf
Browse files- package-lock.json +12 -17
- package.json +1 -1
- 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.
|
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.
|
866 |
-
"resolved": "https://registry.npmjs.org/@huggingface/inference/-/inference-3.
|
867 |
-
"integrity": "sha512-
|
868 |
"dependencies": {
|
869 |
-
"@huggingface/jinja": "^0.3.
|
870 |
-
"@huggingface/tasks": "^0.
|
871 |
},
|
872 |
"engines": {
|
873 |
"node": ">=18"
|
874 |
}
|
875 |
},
|
876 |
"node_modules/@huggingface/jinja": {
|
877 |
-
"version": "0.3.
|
878 |
-
"resolved": "https://registry.npmjs.org/@huggingface/jinja/-/jinja-0.3.
|
879 |
-
"integrity": "sha512-
|
880 |
"engines": {
|
881 |
"node": ">=18"
|
882 |
}
|
883 |
},
|
884 |
"node_modules/@huggingface/tasks": {
|
885 |
-
"version": "0.
|
886 |
-
"resolved": "https://registry.npmjs.org/@huggingface/tasks/-/tasks-0.
|
887 |
-
"integrity": "sha512-
|
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.
|
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 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
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();
|