Commit
•
9726499
1
Parent(s):
1eb0e2e
⬆️ @huggingface/inference 2.2.0
Browse files- package-lock.json +4 -4
- package.json +1 -1
- src/routes/conversation/[id]/+server.ts +7 -1
package-lock.json
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
"name": "chat-ui",
|
9 |
"version": "0.0.1",
|
10 |
"dependencies": {
|
11 |
-
"@huggingface/inference": "^2.
|
12 |
"autoprefixer": "^10.4.14",
|
13 |
"date-fns": "^2.29.3",
|
14 |
"dotenv": "^16.0.3",
|
@@ -474,9 +474,9 @@
|
|
474 |
}
|
475 |
},
|
476 |
"node_modules/@huggingface/inference": {
|
477 |
-
"version": "2.
|
478 |
-
"resolved": "https://registry.npmjs.org/@huggingface/inference/-/inference-2.
|
479 |
-
"integrity": "sha512-
|
480 |
"engines": {
|
481 |
"node": ">=18"
|
482 |
}
|
|
|
8 |
"name": "chat-ui",
|
9 |
"version": "0.0.1",
|
10 |
"dependencies": {
|
11 |
+
"@huggingface/inference": "^2.2.0",
|
12 |
"autoprefixer": "^10.4.14",
|
13 |
"date-fns": "^2.29.3",
|
14 |
"dotenv": "^16.0.3",
|
|
|
474 |
}
|
475 |
},
|
476 |
"node_modules/@huggingface/inference": {
|
477 |
+
"version": "2.2.0",
|
478 |
+
"resolved": "https://registry.npmjs.org/@huggingface/inference/-/inference-2.2.0.tgz",
|
479 |
+
"integrity": "sha512-26YhLzkms4JvzDnoR72O8LjTk1oFMNe2M3YbrSlrpfCjAa0B26bLfvQj/J/xUOek05CO1bapc5V428mo/uq6rQ==",
|
480 |
"engines": {
|
481 |
"node": ">=18"
|
482 |
}
|
package.json
CHANGED
@@ -34,7 +34,7 @@
|
|
34 |
},
|
35 |
"type": "module",
|
36 |
"dependencies": {
|
37 |
-
"@huggingface/inference": "^2.
|
38 |
"autoprefixer": "^10.4.14",
|
39 |
"date-fns": "^2.29.3",
|
40 |
"dotenv": "^16.0.3",
|
|
|
34 |
},
|
35 |
"type": "module",
|
36 |
"dependencies": {
|
37 |
+
"@huggingface/inference": "^2.2.0",
|
38 |
"autoprefixer": "^10.4.14",
|
39 |
"date-fns": "^2.29.3",
|
40 |
"dotenv": "^16.0.3",
|
src/routes/conversation/[id]/+server.ts
CHANGED
@@ -190,7 +190,13 @@ async function parseGeneratedText(
|
|
190 |
lastMessage = lastMessage.slice(0, lastMessage.indexOf("\n"));
|
191 |
}
|
192 |
|
193 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
|
195 |
if (typeof res !== "string") {
|
196 |
throw new Error("Could not parse generated text");
|
|
|
190 |
lastMessage = lastMessage.slice(0, lastMessage.indexOf("\n"));
|
191 |
}
|
192 |
|
193 |
+
const lastMessageJSON = JSON.parse(lastMessage);
|
194 |
+
|
195 |
+
if (lastMessageJSON.error) {
|
196 |
+
throw new Error(lastMessageJSON.error);
|
197 |
+
}
|
198 |
+
|
199 |
+
const res = lastMessageJSON.generated_text;
|
200 |
|
201 |
if (typeof res !== "string") {
|
202 |
throw new Error("Could not parse generated text");
|