Spaces:
Running
Running
update hf.js inference
Browse files- package-lock.json +15 -12
- package.json +1 -1
- server.js +3 -3
package-lock.json
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
"version": "0.0.0",
|
10 |
"dependencies": {
|
11 |
"@huggingface/hub": "^1.1.1",
|
12 |
-
"@huggingface/inference": "^
|
13 |
"@monaco-editor/react": "^4.7.0",
|
14 |
"@radix-ui/react-avatar": "^1.1.10",
|
15 |
"@radix-ui/react-dialog": "^1.1.14",
|
@@ -920,29 +920,32 @@
|
|
920 |
"integrity": "sha512-HK6JTVB/nrgjOnbe77HFSENftfAp67AI4mHMR2x64Os1hvchuTT88M8fKEiyESSvqKFKwW4lQKkHva07p05AXw=="
|
921 |
},
|
922 |
"node_modules/@huggingface/inference": {
|
923 |
-
"version": "
|
924 |
-
"resolved": "https://registry.npmjs.org/@huggingface/inference/-/inference-
|
925 |
-
"integrity": "sha512-
|
|
|
926 |
"dependencies": {
|
927 |
-
"@huggingface/jinja": "^0.
|
928 |
-
"@huggingface/tasks": "^0.
|
929 |
},
|
930 |
"engines": {
|
931 |
"node": ">=18"
|
932 |
}
|
933 |
},
|
934 |
"node_modules/@huggingface/jinja": {
|
935 |
-
"version": "0.
|
936 |
-
"resolved": "https://registry.npmjs.org/@huggingface/jinja/-/jinja-0.
|
937 |
-
"integrity": "sha512-
|
|
|
938 |
"engines": {
|
939 |
"node": ">=18"
|
940 |
}
|
941 |
},
|
942 |
"node_modules/@huggingface/tasks": {
|
943 |
-
"version": "0.
|
944 |
-
"resolved": "https://registry.npmjs.org/@huggingface/tasks/-/tasks-0.
|
945 |
-
"integrity": "sha512-
|
|
|
946 |
},
|
947 |
"node_modules/@humanfs/core": {
|
948 |
"version": "0.19.1",
|
|
|
9 |
"version": "0.0.0",
|
10 |
"dependencies": {
|
11 |
"@huggingface/hub": "^1.1.1",
|
12 |
+
"@huggingface/inference": "^4.0.2",
|
13 |
"@monaco-editor/react": "^4.7.0",
|
14 |
"@radix-ui/react-avatar": "^1.1.10",
|
15 |
"@radix-ui/react-dialog": "^1.1.14",
|
|
|
920 |
"integrity": "sha512-HK6JTVB/nrgjOnbe77HFSENftfAp67AI4mHMR2x64Os1hvchuTT88M8fKEiyESSvqKFKwW4lQKkHva07p05AXw=="
|
921 |
},
|
922 |
"node_modules/@huggingface/inference": {
|
923 |
+
"version": "4.0.2",
|
924 |
+
"resolved": "https://registry.npmjs.org/@huggingface/inference/-/inference-4.0.2.tgz",
|
925 |
+
"integrity": "sha512-XuWb8ocH7lA5kSdXrGnqshtRz3ocSBzEzxcp5xeAXLjgM1ocoIHq+RW8/Ti0xq3MeRGQWgUkYPCgDV/xgs8p4g==",
|
926 |
+
"license": "MIT",
|
927 |
"dependencies": {
|
928 |
+
"@huggingface/jinja": "^0.5.0",
|
929 |
+
"@huggingface/tasks": "^0.19.11"
|
930 |
},
|
931 |
"engines": {
|
932 |
"node": ">=18"
|
933 |
}
|
934 |
},
|
935 |
"node_modules/@huggingface/jinja": {
|
936 |
+
"version": "0.5.0",
|
937 |
+
"resolved": "https://registry.npmjs.org/@huggingface/jinja/-/jinja-0.5.0.tgz",
|
938 |
+
"integrity": "sha512-Ptc03/jGRiYRoi0bUYKZ14MkDslsBRT24oxmsvUlfYrvQMldrxCevhPnT+hfX8awKTT8/f/0ZBBWldoeAcMHdQ==",
|
939 |
+
"license": "MIT",
|
940 |
"engines": {
|
941 |
"node": ">=18"
|
942 |
}
|
943 |
},
|
944 |
"node_modules/@huggingface/tasks": {
|
945 |
+
"version": "0.19.11",
|
946 |
+
"resolved": "https://registry.npmjs.org/@huggingface/tasks/-/tasks-0.19.11.tgz",
|
947 |
+
"integrity": "sha512-oBhSgVlg7Pp643MsH8BiI3OAXIMJNxdSiMtv4mApRZV8dmAz8oasKhg6CVKIplO7vAO7F6dkmMn4bYM64I2A9w==",
|
948 |
+
"license": "MIT"
|
949 |
},
|
950 |
"node_modules/@humanfs/core": {
|
951 |
"version": "0.19.1",
|
package.json
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
},
|
13 |
"dependencies": {
|
14 |
"@huggingface/hub": "^1.1.1",
|
15 |
-
"@huggingface/inference": "^
|
16 |
"@monaco-editor/react": "^4.7.0",
|
17 |
"@radix-ui/react-avatar": "^1.1.10",
|
18 |
"@radix-ui/react-dialog": "^1.1.14",
|
|
|
12 |
},
|
13 |
"dependencies": {
|
14 |
"@huggingface/hub": "^1.1.1",
|
15 |
+
"@huggingface/inference": "^4.0.2",
|
16 |
"@monaco-editor/react": "^4.7.0",
|
17 |
"@radix-ui/react-avatar": "^1.1.10",
|
18 |
"@radix-ui/react-dialog": "^1.1.14",
|
server.js
CHANGED
@@ -298,7 +298,6 @@ app.post("/api/ask-ai", async (req, res) => {
|
|
298 |
message: `Context is too long. ${selectedProvider.name} allow ${selectedProvider.max_tokens} max tokens.`,
|
299 |
});
|
300 |
}
|
301 |
-
|
302 |
try {
|
303 |
const chatCompletion = client.chatCompletionStream(
|
304 |
{
|
@@ -316,7 +315,9 @@ app.post("/api/ask-ai", async (req, res) => {
|
|
316 |
],
|
317 |
max_tokens: selectedProvider.max_tokens,
|
318 |
},
|
319 |
-
|
|
|
|
|
320 |
);
|
321 |
|
322 |
while (true) {
|
@@ -465,7 +466,6 @@ ${REPLACE_END}
|
|
465 |
const client = new InferenceClient(token);
|
466 |
|
467 |
const selectedProvider = PROVIDERS[selectedModel.autoProvider];
|
468 |
-
|
469 |
try {
|
470 |
const response = await client.chatCompletion(
|
471 |
{
|
|
|
298 |
message: `Context is too long. ${selectedProvider.name} allow ${selectedProvider.max_tokens} max tokens.`,
|
299 |
});
|
300 |
}
|
|
|
301 |
try {
|
302 |
const chatCompletion = client.chatCompletionStream(
|
303 |
{
|
|
|
315 |
],
|
316 |
max_tokens: selectedProvider.max_tokens,
|
317 |
},
|
318 |
+
{
|
319 |
+
billTo: "huggingface",
|
320 |
+
}
|
321 |
);
|
322 |
|
323 |
while (true) {
|
|
|
466 |
const client = new InferenceClient(token);
|
467 |
|
468 |
const selectedProvider = PROVIDERS[selectedModel.autoProvider];
|
|
|
469 |
try {
|
470 |
const response = await client.chatCompletion(
|
471 |
{
|