Migrate to new model + proxy from server (#5)
Browse files* use fork of hf.js to support fully custom endpoints for testing purpose
* proxy textGenerationStream call to the backend to hide token from client
* migrate to patch-package instead of pnpm
* fix issue after merge conflict
* use env var instead of hardcoded value for endpoint
* fix messages not being split between assistant/user
* fix stream response sometimes not split by token
* remove PUBLIC_ from private env variables + rename ENDPOINT to MODEL_ENDPOINT
* only set hf token as private, model can stay public
* move HF_TOKEN to a dynamic env
* fix env var import typo
* remove @microsoft/fetch-event-source
* update parameters to be identical to Python demo
* small refactor to avoid typing issue
* cleanup while loop
Co-authored-by: Julien Chaumond <[email protected]>
* make comment clearer on what is happening on stream chunks split
* fix chunk spliting not being handled properly
* cleanup model tokens sometimes containing "<|endoftext|>" text
* refactor how we proxy from the server to simplify logic
* use latest version of hf.js
* use .env + .env.local instead of .env.example
* rewrite logic to trim "<|endoftext|>" artifact properly
* update to latest hf.js
* expose env var to Docker during build time for deployment
* remove patch-package
---------
Co-authored-by: Julien Chaumond <[email protected]>
- .env +7 -0
- .env.example +0 -7
- Dockerfile +2 -1
- package-lock.json +165 -125
- package.json +1 -1
- src/routes/+page.svelte +54 -48
- src/routes/api/conversation/+server.ts +14 -0
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
PUBLIC_MODEL_ENDPOINT=https://api-inference.huggingface.co/models/OpenAssistant/oasst-sft-1-pythia-12b
|
| 2 |
+
PUBLIC_MODEL_NAME=OpenAssistant/oasst-sft-1-pythia-12b
|
| 3 |
+
PUBLIC_MODEL_TAGLINE=This is the first iteration English supervised-fine-tuning (SFT) model of the <a class="underline" href="https://github.com/LAION-AI/Open-Assistant">Open-Assistant</a> project. It is based on a Pythia 12B that was fine-tuned on ~22k human demonstrations of assistant conversations collected through the <a class="underline" href="https://open-assistant.io/">https://open-assistant.io/</a> human feedback web app before March 7, 2023.
|
| 4 |
+
PUBLIC_DISABLE_INTRO_TILES=true
|
| 5 |
+
PUBLIC_USER_MESSAGE_TOKEN=<|prompter|>
|
| 6 |
+
PUBLIC_ASSISTANT_MESSAGE_TOKEN=<|assistant|>
|
| 7 |
+
PUBLIC_SEP_TOKEN=<|endoftext|>
|
|
@@ -1,7 +0,0 @@
|
|
| 1 |
-
PUBLIC_HF_TOKEN=
|
| 2 |
-
PUBLIC_ENDPOINT=https://api-inference.huggingface.co/models/OpenAssistant/oasst-sft-1-pythia-12b
|
| 3 |
-
PUBLIC_MODEL_NAME=OpenAssistant/llama_30b_oasst_latcyr_1000
|
| 4 |
-
PUBLIC_DISABLE_INTRO_TILES=true
|
| 5 |
-
PUBLIC_USER_MESSAGE_TOKEN=<|prompter|>
|
| 6 |
-
PUBLIC_ASSISTANT_MESSAGE_TOKEN=<|assistant|>
|
| 7 |
-
PUBLIC_SEP_TOKEN=<|endoftext|>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -11,7 +11,8 @@ RUN npm i
|
|
| 11 |
|
| 12 |
RUN chown -R 1000:1000 /app
|
| 13 |
|
| 14 |
-
RUN
|
|
|
|
| 15 |
|
| 16 |
ENV PORT 7860
|
| 17 |
|
|
|
|
| 11 |
|
| 12 |
RUN chown -R 1000:1000 /app
|
| 13 |
|
| 14 |
+
RUN --mount=type=secret,id=PUBLIC_MODEL_ENDPOINT,mode=0444,required=true \
|
| 15 |
+
PUBLIC_MODEL_ENDPOINT=$(cat /run/secrets/PUBLIC_MODEL_ENDPOINT) npm run build
|
| 16 |
|
| 17 |
ENV PORT 7860
|
| 18 |
|
|
@@ -8,7 +8,7 @@
|
|
| 8 |
"name": "chat-ui",
|
| 9 |
"version": "0.0.1",
|
| 10 |
"dependencies": {
|
| 11 |
-
"@
|
| 12 |
"autoprefixer": "^10.4.14",
|
| 13 |
"postcss": "^8.4.21",
|
| 14 |
"tailwind-scrollbar": "^3.0.0",
|
|
@@ -33,9 +33,9 @@
|
|
| 33 |
}
|
| 34 |
},
|
| 35 |
"node_modules/@esbuild/android-arm": {
|
| 36 |
-
"version": "0.16
|
| 37 |
-
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.16.
|
| 38 |
-
"integrity": "sha512-
|
| 39 |
"cpu": [
|
| 40 |
"arm"
|
| 41 |
],
|
|
@@ -49,9 +49,9 @@
|
|
| 49 |
}
|
| 50 |
},
|
| 51 |
"node_modules/@esbuild/android-arm64": {
|
| 52 |
-
"version": "0.16
|
| 53 |
-
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.16.
|
| 54 |
-
"integrity": "sha512-
|
| 55 |
"cpu": [
|
| 56 |
"arm64"
|
| 57 |
],
|
|
@@ -65,9 +65,9 @@
|
|
| 65 |
}
|
| 66 |
},
|
| 67 |
"node_modules/@esbuild/android-x64": {
|
| 68 |
-
"version": "0.16
|
| 69 |
-
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.16.
|
| 70 |
-
"integrity": "sha512-
|
| 71 |
"cpu": [
|
| 72 |
"x64"
|
| 73 |
],
|
|
@@ -81,9 +81,9 @@
|
|
| 81 |
}
|
| 82 |
},
|
| 83 |
"node_modules/@esbuild/darwin-arm64": {
|
| 84 |
-
"version": "0.16
|
| 85 |
-
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.16.
|
| 86 |
-
"integrity": "sha512-/
|
| 87 |
"cpu": [
|
| 88 |
"arm64"
|
| 89 |
],
|
|
@@ -97,9 +97,9 @@
|
|
| 97 |
}
|
| 98 |
},
|
| 99 |
"node_modules/@esbuild/darwin-x64": {
|
| 100 |
-
"version": "0.16
|
| 101 |
-
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.16.
|
| 102 |
-
"integrity": "sha512-
|
| 103 |
"cpu": [
|
| 104 |
"x64"
|
| 105 |
],
|
|
@@ -113,9 +113,9 @@
|
|
| 113 |
}
|
| 114 |
},
|
| 115 |
"node_modules/@esbuild/freebsd-arm64": {
|
| 116 |
-
"version": "0.16
|
| 117 |
-
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.16.
|
| 118 |
-
"integrity": "sha512-
|
| 119 |
"cpu": [
|
| 120 |
"arm64"
|
| 121 |
],
|
|
@@ -129,9 +129,9 @@
|
|
| 129 |
}
|
| 130 |
},
|
| 131 |
"node_modules/@esbuild/freebsd-x64": {
|
| 132 |
-
"version": "0.16
|
| 133 |
-
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.16.
|
| 134 |
-
"integrity": "sha512-
|
| 135 |
"cpu": [
|
| 136 |
"x64"
|
| 137 |
],
|
|
@@ -145,9 +145,9 @@
|
|
| 145 |
}
|
| 146 |
},
|
| 147 |
"node_modules/@esbuild/linux-arm": {
|
| 148 |
-
"version": "0.16
|
| 149 |
-
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.16.
|
| 150 |
-
"integrity": "sha512-
|
| 151 |
"cpu": [
|
| 152 |
"arm"
|
| 153 |
],
|
|
@@ -161,9 +161,9 @@
|
|
| 161 |
}
|
| 162 |
},
|
| 163 |
"node_modules/@esbuild/linux-arm64": {
|
| 164 |
-
"version": "0.16
|
| 165 |
-
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.16.
|
| 166 |
-
"integrity": "sha512-
|
| 167 |
"cpu": [
|
| 168 |
"arm64"
|
| 169 |
],
|
|
@@ -177,9 +177,9 @@
|
|
| 177 |
}
|
| 178 |
},
|
| 179 |
"node_modules/@esbuild/linux-ia32": {
|
| 180 |
-
"version": "0.16
|
| 181 |
-
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.16.
|
| 182 |
-
"integrity": "sha512-
|
| 183 |
"cpu": [
|
| 184 |
"ia32"
|
| 185 |
],
|
|
@@ -193,9 +193,9 @@
|
|
| 193 |
}
|
| 194 |
},
|
| 195 |
"node_modules/@esbuild/linux-loong64": {
|
| 196 |
-
"version": "0.16
|
| 197 |
-
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.16.
|
| 198 |
-
"integrity": "sha512-
|
| 199 |
"cpu": [
|
| 200 |
"loong64"
|
| 201 |
],
|
|
@@ -209,9 +209,9 @@
|
|
| 209 |
}
|
| 210 |
},
|
| 211 |
"node_modules/@esbuild/linux-mips64el": {
|
| 212 |
-
"version": "0.16
|
| 213 |
-
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.16.
|
| 214 |
-
"integrity": "sha512-
|
| 215 |
"cpu": [
|
| 216 |
"mips64el"
|
| 217 |
],
|
|
@@ -225,9 +225,9 @@
|
|
| 225 |
}
|
| 226 |
},
|
| 227 |
"node_modules/@esbuild/linux-ppc64": {
|
| 228 |
-
"version": "0.16
|
| 229 |
-
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.16.
|
| 230 |
-
"integrity": "sha512-
|
| 231 |
"cpu": [
|
| 232 |
"ppc64"
|
| 233 |
],
|
|
@@ -241,9 +241,9 @@
|
|
| 241 |
}
|
| 242 |
},
|
| 243 |
"node_modules/@esbuild/linux-riscv64": {
|
| 244 |
-
"version": "0.16
|
| 245 |
-
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.16.
|
| 246 |
-
"integrity": "sha512-
|
| 247 |
"cpu": [
|
| 248 |
"riscv64"
|
| 249 |
],
|
|
@@ -257,9 +257,9 @@
|
|
| 257 |
}
|
| 258 |
},
|
| 259 |
"node_modules/@esbuild/linux-s390x": {
|
| 260 |
-
"version": "0.16
|
| 261 |
-
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.16.
|
| 262 |
-
"integrity": "sha512-
|
| 263 |
"cpu": [
|
| 264 |
"s390x"
|
| 265 |
],
|
|
@@ -273,9 +273,9 @@
|
|
| 273 |
}
|
| 274 |
},
|
| 275 |
"node_modules/@esbuild/linux-x64": {
|
| 276 |
-
"version": "0.16
|
| 277 |
-
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.16.
|
| 278 |
-
"integrity": "sha512-
|
| 279 |
"cpu": [
|
| 280 |
"x64"
|
| 281 |
],
|
|
@@ -289,9 +289,9 @@
|
|
| 289 |
}
|
| 290 |
},
|
| 291 |
"node_modules/@esbuild/netbsd-x64": {
|
| 292 |
-
"version": "0.16
|
| 293 |
-
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.16.
|
| 294 |
-
"integrity": "sha512
|
| 295 |
"cpu": [
|
| 296 |
"x64"
|
| 297 |
],
|
|
@@ -305,9 +305,9 @@
|
|
| 305 |
}
|
| 306 |
},
|
| 307 |
"node_modules/@esbuild/openbsd-x64": {
|
| 308 |
-
"version": "0.16
|
| 309 |
-
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.16.
|
| 310 |
-
"integrity": "sha512-
|
| 311 |
"cpu": [
|
| 312 |
"x64"
|
| 313 |
],
|
|
@@ -321,9 +321,9 @@
|
|
| 321 |
}
|
| 322 |
},
|
| 323 |
"node_modules/@esbuild/sunos-x64": {
|
| 324 |
-
"version": "0.16
|
| 325 |
-
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.16.
|
| 326 |
-
"integrity": "sha512-
|
| 327 |
"cpu": [
|
| 328 |
"x64"
|
| 329 |
],
|
|
@@ -337,9 +337,9 @@
|
|
| 337 |
}
|
| 338 |
},
|
| 339 |
"node_modules/@esbuild/win32-arm64": {
|
| 340 |
-
"version": "0.16
|
| 341 |
-
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.16.
|
| 342 |
-
"integrity": "sha512-
|
| 343 |
"cpu": [
|
| 344 |
"arm64"
|
| 345 |
],
|
|
@@ -353,9 +353,9 @@
|
|
| 353 |
}
|
| 354 |
},
|
| 355 |
"node_modules/@esbuild/win32-ia32": {
|
| 356 |
-
"version": "0.16
|
| 357 |
-
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.16.
|
| 358 |
-
"integrity": "sha512-
|
| 359 |
"cpu": [
|
| 360 |
"ia32"
|
| 361 |
],
|
|
@@ -369,9 +369,9 @@
|
|
| 369 |
}
|
| 370 |
},
|
| 371 |
"node_modules/@esbuild/win32-x64": {
|
| 372 |
-
"version": "0.16
|
| 373 |
-
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.16.
|
| 374 |
-
"integrity": "sha512-
|
| 375 |
"cpu": [
|
| 376 |
"x64"
|
| 377 |
],
|
|
@@ -384,15 +384,39 @@
|
|
| 384 |
"node": ">=12"
|
| 385 |
}
|
| 386 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 387 |
"node_modules/@eslint/eslintrc": {
|
| 388 |
-
"version": "
|
| 389 |
-
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-
|
| 390 |
-
"integrity": "sha512-
|
| 391 |
"dev": true,
|
| 392 |
"dependencies": {
|
| 393 |
"ajv": "^6.12.4",
|
| 394 |
"debug": "^4.3.2",
|
| 395 |
-
"espree": "^9.
|
| 396 |
"globals": "^13.19.0",
|
| 397 |
"ignore": "^5.2.0",
|
| 398 |
"import-fresh": "^3.2.1",
|
|
@@ -407,6 +431,23 @@
|
|
| 407 |
"url": "https://opencollective.com/eslint"
|
| 408 |
}
|
| 409 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 410 |
"node_modules/@humanwhocodes/config-array": {
|
| 411 |
"version": "0.11.8",
|
| 412 |
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz",
|
|
@@ -483,11 +524,6 @@
|
|
| 483 |
"@jridgewell/sourcemap-codec": "1.4.14"
|
| 484 |
}
|
| 485 |
},
|
| 486 |
-
"node_modules/@microsoft/fetch-event-source": {
|
| 487 |
-
"version": "2.0.1",
|
| 488 |
-
"resolved": "https://registry.npmjs.org/@microsoft/fetch-event-source/-/fetch-event-source-2.0.1.tgz",
|
| 489 |
-
"integrity": "sha512-W6CLUJ2eBMw3Rec70qrsEW0jOm/3twwJv21mrmj2yORiaVmVYGS4sSS5yUwvQc1ZlDLYGPnClVWmUUMagKNsfA=="
|
| 490 |
-
},
|
| 491 |
"node_modules/@nodelib/fs.scandir": {
|
| 492 |
"version": "2.1.5",
|
| 493 |
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
|
@@ -1476,9 +1512,9 @@
|
|
| 1476 |
"dev": true
|
| 1477 |
},
|
| 1478 |
"node_modules/esbuild": {
|
| 1479 |
-
"version": "0.16
|
| 1480 |
-
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.16.
|
| 1481 |
-
"integrity": "sha512-
|
| 1482 |
"dev": true,
|
| 1483 |
"hasInstallScript": true,
|
| 1484 |
"bin": {
|
|
@@ -1488,28 +1524,28 @@
|
|
| 1488 |
"node": ">=12"
|
| 1489 |
},
|
| 1490 |
"optionalDependencies": {
|
| 1491 |
-
"@esbuild/android-arm": "0.16
|
| 1492 |
-
"@esbuild/android-arm64": "0.16
|
| 1493 |
-
"@esbuild/android-x64": "0.16
|
| 1494 |
-
"@esbuild/darwin-arm64": "0.16
|
| 1495 |
-
"@esbuild/darwin-x64": "0.16
|
| 1496 |
-
"@esbuild/freebsd-arm64": "0.16
|
| 1497 |
-
"@esbuild/freebsd-x64": "0.16
|
| 1498 |
-
"@esbuild/linux-arm": "0.16
|
| 1499 |
-
"@esbuild/linux-arm64": "0.16
|
| 1500 |
-
"@esbuild/linux-ia32": "0.16
|
| 1501 |
-
"@esbuild/linux-loong64": "0.16
|
| 1502 |
-
"@esbuild/linux-mips64el": "0.16
|
| 1503 |
-
"@esbuild/linux-ppc64": "0.16
|
| 1504 |
-
"@esbuild/linux-riscv64": "0.16
|
| 1505 |
-
"@esbuild/linux-s390x": "0.16
|
| 1506 |
-
"@esbuild/linux-x64": "0.16
|
| 1507 |
-
"@esbuild/netbsd-x64": "0.16
|
| 1508 |
-
"@esbuild/openbsd-x64": "0.16
|
| 1509 |
-
"@esbuild/sunos-x64": "0.16
|
| 1510 |
-
"@esbuild/win32-arm64": "0.16
|
| 1511 |
-
"@esbuild/win32-ia32": "0.16
|
| 1512 |
-
"@esbuild/win32-x64": "0.16
|
| 1513 |
}
|
| 1514 |
},
|
| 1515 |
"node_modules/escalade": {
|
|
@@ -1533,12 +1569,15 @@
|
|
| 1533 |
}
|
| 1534 |
},
|
| 1535 |
"node_modules/eslint": {
|
| 1536 |
-
"version": "8.
|
| 1537 |
-
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.
|
| 1538 |
-
"integrity": "sha512-
|
| 1539 |
"dev": true,
|
| 1540 |
"dependencies": {
|
| 1541 |
-
"@eslint/
|
|
|
|
|
|
|
|
|
|
| 1542 |
"@humanwhocodes/config-array": "^0.11.8",
|
| 1543 |
"@humanwhocodes/module-importer": "^1.0.1",
|
| 1544 |
"@nodelib/fs.walk": "^1.2.8",
|
|
@@ -1549,10 +1588,9 @@
|
|
| 1549 |
"doctrine": "^3.0.0",
|
| 1550 |
"escape-string-regexp": "^4.0.0",
|
| 1551 |
"eslint-scope": "^7.1.1",
|
| 1552 |
-
"eslint-
|
| 1553 |
-
"
|
| 1554 |
-
"
|
| 1555 |
-
"esquery": "^1.4.0",
|
| 1556 |
"esutils": "^2.0.2",
|
| 1557 |
"fast-deep-equal": "^3.1.3",
|
| 1558 |
"file-entry-cache": "^6.0.1",
|
|
@@ -1573,7 +1611,6 @@
|
|
| 1573 |
"minimatch": "^3.1.2",
|
| 1574 |
"natural-compare": "^1.4.0",
|
| 1575 |
"optionator": "^0.9.1",
|
| 1576 |
-
"regexpp": "^3.2.0",
|
| 1577 |
"strip-ansi": "^6.0.1",
|
| 1578 |
"strip-json-comments": "^3.1.0",
|
| 1579 |
"text-table": "^0.2.0"
|
|
@@ -1651,12 +1688,15 @@
|
|
| 1651 |
}
|
| 1652 |
},
|
| 1653 |
"node_modules/eslint-visitor-keys": {
|
| 1654 |
-
"version": "3.
|
| 1655 |
-
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.
|
| 1656 |
-
"integrity": "sha512-
|
| 1657 |
"dev": true,
|
| 1658 |
"engines": {
|
| 1659 |
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
|
|
|
|
|
|
|
|
|
| 1660 |
}
|
| 1661 |
},
|
| 1662 |
"node_modules/eslint/node_modules/eslint-scope": {
|
|
@@ -1688,14 +1728,14 @@
|
|
| 1688 |
"dev": true
|
| 1689 |
},
|
| 1690 |
"node_modules/espree": {
|
| 1691 |
-
"version": "9.
|
| 1692 |
-
"resolved": "https://registry.npmjs.org/espree/-/espree-9.
|
| 1693 |
-
"integrity": "sha512-
|
| 1694 |
"dev": true,
|
| 1695 |
"dependencies": {
|
| 1696 |
"acorn": "^8.8.0",
|
| 1697 |
"acorn-jsx": "^5.3.2",
|
| 1698 |
-
"eslint-visitor-keys": "^3.
|
| 1699 |
},
|
| 1700 |
"engines": {
|
| 1701 |
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
|
@@ -2879,9 +2919,9 @@
|
|
| 2879 |
}
|
| 2880 |
},
|
| 2881 |
"node_modules/rollup": {
|
| 2882 |
-
"version": "3.
|
| 2883 |
-
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.
|
| 2884 |
-
"integrity": "sha512-
|
| 2885 |
"dev": true,
|
| 2886 |
"bin": {
|
| 2887 |
"rollup": "dist/bin/rollup"
|
|
@@ -3494,15 +3534,15 @@
|
|
| 3494 |
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
|
| 3495 |
},
|
| 3496 |
"node_modules/vite": {
|
| 3497 |
-
"version": "4.1
|
| 3498 |
-
"resolved": "https://registry.npmjs.org/vite/-/vite-4.1.
|
| 3499 |
-
"integrity": "sha512-
|
| 3500 |
"dev": true,
|
| 3501 |
"dependencies": {
|
| 3502 |
-
"esbuild": "^0.
|
| 3503 |
"postcss": "^8.4.21",
|
| 3504 |
"resolve": "^1.22.1",
|
| 3505 |
-
"rollup": "^3.
|
| 3506 |
},
|
| 3507 |
"bin": {
|
| 3508 |
"vite": "bin/vite.js"
|
|
|
|
| 8 |
"name": "chat-ui",
|
| 9 |
"version": "0.0.1",
|
| 10 |
"dependencies": {
|
| 11 |
+
"@huggingface/inference": "^2.0.0-rc2",
|
| 12 |
"autoprefixer": "^10.4.14",
|
| 13 |
"postcss": "^8.4.21",
|
| 14 |
"tailwind-scrollbar": "^3.0.0",
|
|
|
|
| 33 |
}
|
| 34 |
},
|
| 35 |
"node_modules/@esbuild/android-arm": {
|
| 36 |
+
"version": "0.17.16",
|
| 37 |
+
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.16.tgz",
|
| 38 |
+
"integrity": "sha512-baLqRpLe4JnKrUXLJChoTN0iXZH7El/mu58GE3WIA6/H834k0XWvLRmGLG8y8arTRS9hJJibPnF0tiGhmWeZgw==",
|
| 39 |
"cpu": [
|
| 40 |
"arm"
|
| 41 |
],
|
|
|
|
| 49 |
}
|
| 50 |
},
|
| 51 |
"node_modules/@esbuild/android-arm64": {
|
| 52 |
+
"version": "0.17.16",
|
| 53 |
+
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.16.tgz",
|
| 54 |
+
"integrity": "sha512-QX48qmsEZW+gcHgTmAj+x21mwTz8MlYQBnzF6861cNdQGvj2jzzFjqH0EBabrIa/WVZ2CHolwMoqxVryqKt8+Q==",
|
| 55 |
"cpu": [
|
| 56 |
"arm64"
|
| 57 |
],
|
|
|
|
| 65 |
}
|
| 66 |
},
|
| 67 |
"node_modules/@esbuild/android-x64": {
|
| 68 |
+
"version": "0.17.16",
|
| 69 |
+
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.16.tgz",
|
| 70 |
+
"integrity": "sha512-G4wfHhrrz99XJgHnzFvB4UwwPxAWZaZBOFXh+JH1Duf1I4vIVfuYY9uVLpx4eiV2D/Jix8LJY+TAdZ3i40tDow==",
|
| 71 |
"cpu": [
|
| 72 |
"x64"
|
| 73 |
],
|
|
|
|
| 81 |
}
|
| 82 |
},
|
| 83 |
"node_modules/@esbuild/darwin-arm64": {
|
| 84 |
+
"version": "0.17.16",
|
| 85 |
+
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.16.tgz",
|
| 86 |
+
"integrity": "sha512-/Ofw8UXZxuzTLsNFmz1+lmarQI6ztMZ9XktvXedTbt3SNWDn0+ODTwxExLYQ/Hod91EZB4vZPQJLoqLF0jvEzA==",
|
| 87 |
"cpu": [
|
| 88 |
"arm64"
|
| 89 |
],
|
|
|
|
| 97 |
}
|
| 98 |
},
|
| 99 |
"node_modules/@esbuild/darwin-x64": {
|
| 100 |
+
"version": "0.17.16",
|
| 101 |
+
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.16.tgz",
|
| 102 |
+
"integrity": "sha512-SzBQtCV3Pdc9kyizh36Ol+dNVhkDyIrGb/JXZqFq8WL37LIyrXU0gUpADcNV311sCOhvY+f2ivMhb5Tuv8nMOQ==",
|
| 103 |
"cpu": [
|
| 104 |
"x64"
|
| 105 |
],
|
|
|
|
| 113 |
}
|
| 114 |
},
|
| 115 |
"node_modules/@esbuild/freebsd-arm64": {
|
| 116 |
+
"version": "0.17.16",
|
| 117 |
+
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.16.tgz",
|
| 118 |
+
"integrity": "sha512-ZqftdfS1UlLiH1DnS2u3It7l4Bc3AskKeu+paJSfk7RNOMrOxmeFDhLTMQqMxycP1C3oj8vgkAT6xfAuq7ZPRA==",
|
| 119 |
"cpu": [
|
| 120 |
"arm64"
|
| 121 |
],
|
|
|
|
| 129 |
}
|
| 130 |
},
|
| 131 |
"node_modules/@esbuild/freebsd-x64": {
|
| 132 |
+
"version": "0.17.16",
|
| 133 |
+
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.16.tgz",
|
| 134 |
+
"integrity": "sha512-rHV6zNWW1tjgsu0dKQTX9L0ByiJHHLvQKrWtnz8r0YYJI27FU3Xu48gpK2IBj1uCSYhJ+pEk6Y0Um7U3rIvV8g==",
|
| 135 |
"cpu": [
|
| 136 |
"x64"
|
| 137 |
],
|
|
|
|
| 145 |
}
|
| 146 |
},
|
| 147 |
"node_modules/@esbuild/linux-arm": {
|
| 148 |
+
"version": "0.17.16",
|
| 149 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.16.tgz",
|
| 150 |
+
"integrity": "sha512-n4O8oVxbn7nl4+m+ISb0a68/lcJClIbaGAoXwqeubj/D1/oMMuaAXmJVfFlRjJLu/ZvHkxoiFJnmbfp4n8cdSw==",
|
| 151 |
"cpu": [
|
| 152 |
"arm"
|
| 153 |
],
|
|
|
|
| 161 |
}
|
| 162 |
},
|
| 163 |
"node_modules/@esbuild/linux-arm64": {
|
| 164 |
+
"version": "0.17.16",
|
| 165 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.16.tgz",
|
| 166 |
+
"integrity": "sha512-8yoZhGkU6aHu38WpaM4HrRLTFc7/VVD9Q2SvPcmIQIipQt2I/GMTZNdEHXoypbbGao5kggLcxg0iBKjo0SQYKA==",
|
| 167 |
"cpu": [
|
| 168 |
"arm64"
|
| 169 |
],
|
|
|
|
| 177 |
}
|
| 178 |
},
|
| 179 |
"node_modules/@esbuild/linux-ia32": {
|
| 180 |
+
"version": "0.17.16",
|
| 181 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.16.tgz",
|
| 182 |
+
"integrity": "sha512-9ZBjlkdaVYxPNO8a7OmzDbOH9FMQ1a58j7Xb21UfRU29KcEEU3VTHk+Cvrft/BNv0gpWJMiiZ/f4w0TqSP0gLA==",
|
| 183 |
"cpu": [
|
| 184 |
"ia32"
|
| 185 |
],
|
|
|
|
| 193 |
}
|
| 194 |
},
|
| 195 |
"node_modules/@esbuild/linux-loong64": {
|
| 196 |
+
"version": "0.17.16",
|
| 197 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.16.tgz",
|
| 198 |
+
"integrity": "sha512-TIZTRojVBBzdgChY3UOG7BlPhqJz08AL7jdgeeu+kiObWMFzGnQD7BgBBkWRwOtKR1i2TNlO7YK6m4zxVjjPRQ==",
|
| 199 |
"cpu": [
|
| 200 |
"loong64"
|
| 201 |
],
|
|
|
|
| 209 |
}
|
| 210 |
},
|
| 211 |
"node_modules/@esbuild/linux-mips64el": {
|
| 212 |
+
"version": "0.17.16",
|
| 213 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.16.tgz",
|
| 214 |
+
"integrity": "sha512-UPeRuFKCCJYpBbIdczKyHLAIU31GEm0dZl1eMrdYeXDH+SJZh/i+2cAmD3A1Wip9pIc5Sc6Kc5cFUrPXtR0XHA==",
|
| 215 |
"cpu": [
|
| 216 |
"mips64el"
|
| 217 |
],
|
|
|
|
| 225 |
}
|
| 226 |
},
|
| 227 |
"node_modules/@esbuild/linux-ppc64": {
|
| 228 |
+
"version": "0.17.16",
|
| 229 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.16.tgz",
|
| 230 |
+
"integrity": "sha512-io6yShgIEgVUhExJejJ21xvO5QtrbiSeI7vYUnr7l+v/O9t6IowyhdiYnyivX2X5ysOVHAuyHW+Wyi7DNhdw6Q==",
|
| 231 |
"cpu": [
|
| 232 |
"ppc64"
|
| 233 |
],
|
|
|
|
| 241 |
}
|
| 242 |
},
|
| 243 |
"node_modules/@esbuild/linux-riscv64": {
|
| 244 |
+
"version": "0.17.16",
|
| 245 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.16.tgz",
|
| 246 |
+
"integrity": "sha512-WhlGeAHNbSdG/I2gqX2RK2gfgSNwyJuCiFHMc8s3GNEMMHUI109+VMBfhVqRb0ZGzEeRiibi8dItR3ws3Lk+cA==",
|
| 247 |
"cpu": [
|
| 248 |
"riscv64"
|
| 249 |
],
|
|
|
|
| 257 |
}
|
| 258 |
},
|
| 259 |
"node_modules/@esbuild/linux-s390x": {
|
| 260 |
+
"version": "0.17.16",
|
| 261 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.16.tgz",
|
| 262 |
+
"integrity": "sha512-gHRReYsJtViir63bXKoFaQ4pgTyah4ruiMRQ6im9YZuv+gp3UFJkNTY4sFA73YDynmXZA6hi45en4BGhNOJUsw==",
|
| 263 |
"cpu": [
|
| 264 |
"s390x"
|
| 265 |
],
|
|
|
|
| 273 |
}
|
| 274 |
},
|
| 275 |
"node_modules/@esbuild/linux-x64": {
|
| 276 |
+
"version": "0.17.16",
|
| 277 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.16.tgz",
|
| 278 |
+
"integrity": "sha512-mfiiBkxEbUHvi+v0P+TS7UnA9TeGXR48aK4XHkTj0ZwOijxexgMF01UDFaBX7Q6CQsB0d+MFNv9IiXbIHTNd4g==",
|
| 279 |
"cpu": [
|
| 280 |
"x64"
|
| 281 |
],
|
|
|
|
| 289 |
}
|
| 290 |
},
|
| 291 |
"node_modules/@esbuild/netbsd-x64": {
|
| 292 |
+
"version": "0.17.16",
|
| 293 |
+
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.16.tgz",
|
| 294 |
+
"integrity": "sha512-n8zK1YRDGLRZfVcswcDMDM0j2xKYLNXqei217a4GyBxHIuPMGrrVuJ+Ijfpr0Kufcm7C1k/qaIrGy6eG7wvgmA==",
|
| 295 |
"cpu": [
|
| 296 |
"x64"
|
| 297 |
],
|
|
|
|
| 305 |
}
|
| 306 |
},
|
| 307 |
"node_modules/@esbuild/openbsd-x64": {
|
| 308 |
+
"version": "0.17.16",
|
| 309 |
+
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.16.tgz",
|
| 310 |
+
"integrity": "sha512-lEEfkfsUbo0xC47eSTBqsItXDSzwzwhKUSsVaVjVji07t8+6KA5INp2rN890dHZeueXJAI8q0tEIfbwVRYf6Ew==",
|
| 311 |
"cpu": [
|
| 312 |
"x64"
|
| 313 |
],
|
|
|
|
| 321 |
}
|
| 322 |
},
|
| 323 |
"node_modules/@esbuild/sunos-x64": {
|
| 324 |
+
"version": "0.17.16",
|
| 325 |
+
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.16.tgz",
|
| 326 |
+
"integrity": "sha512-jlRjsuvG1fgGwnE8Afs7xYDnGz0dBgTNZfgCK6TlvPH3Z13/P5pi6I57vyLE8qZYLrGVtwcm9UbUx1/mZ8Ukag==",
|
| 327 |
"cpu": [
|
| 328 |
"x64"
|
| 329 |
],
|
|
|
|
| 337 |
}
|
| 338 |
},
|
| 339 |
"node_modules/@esbuild/win32-arm64": {
|
| 340 |
+
"version": "0.17.16",
|
| 341 |
+
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.16.tgz",
|
| 342 |
+
"integrity": "sha512-TzoU2qwVe2boOHl/3KNBUv2PNUc38U0TNnzqOAcgPiD/EZxT2s736xfC2dYQbszAwo4MKzzwBV0iHjhfjxMimg==",
|
| 343 |
"cpu": [
|
| 344 |
"arm64"
|
| 345 |
],
|
|
|
|
| 353 |
}
|
| 354 |
},
|
| 355 |
"node_modules/@esbuild/win32-ia32": {
|
| 356 |
+
"version": "0.17.16",
|
| 357 |
+
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.16.tgz",
|
| 358 |
+
"integrity": "sha512-B8b7W+oo2yb/3xmwk9Vc99hC9bNolvqjaTZYEfMQhzdpBsjTvZBlXQ/teUE55Ww6sg//wlcDjOaqldOKyigWdA==",
|
| 359 |
"cpu": [
|
| 360 |
"ia32"
|
| 361 |
],
|
|
|
|
| 369 |
}
|
| 370 |
},
|
| 371 |
"node_modules/@esbuild/win32-x64": {
|
| 372 |
+
"version": "0.17.16",
|
| 373 |
+
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.16.tgz",
|
| 374 |
+
"integrity": "sha512-xJ7OH/nanouJO9pf03YsL9NAFQBHd8AqfrQd7Pf5laGyyTt/gToul6QYOA/i5i/q8y9iaM5DQFNTgpi995VkOg==",
|
| 375 |
"cpu": [
|
| 376 |
"x64"
|
| 377 |
],
|
|
|
|
| 384 |
"node": ">=12"
|
| 385 |
}
|
| 386 |
},
|
| 387 |
+
"node_modules/@eslint-community/eslint-utils": {
|
| 388 |
+
"version": "4.4.0",
|
| 389 |
+
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",
|
| 390 |
+
"integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==",
|
| 391 |
+
"dev": true,
|
| 392 |
+
"dependencies": {
|
| 393 |
+
"eslint-visitor-keys": "^3.3.0"
|
| 394 |
+
},
|
| 395 |
+
"engines": {
|
| 396 |
+
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
| 397 |
+
},
|
| 398 |
+
"peerDependencies": {
|
| 399 |
+
"eslint": "^6.0.0 || ^7.0.0 || >=8.0.0"
|
| 400 |
+
}
|
| 401 |
+
},
|
| 402 |
+
"node_modules/@eslint-community/regexpp": {
|
| 403 |
+
"version": "4.5.0",
|
| 404 |
+
"resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.5.0.tgz",
|
| 405 |
+
"integrity": "sha512-vITaYzIcNmjn5tF5uxcZ/ft7/RXGrMUIS9HalWckEOF6ESiwXKoMzAQf2UW0aVd6rnOeExTJVd5hmWXucBKGXQ==",
|
| 406 |
+
"dev": true,
|
| 407 |
+
"engines": {
|
| 408 |
+
"node": "^12.0.0 || ^14.0.0 || >=16.0.0"
|
| 409 |
+
}
|
| 410 |
+
},
|
| 411 |
"node_modules/@eslint/eslintrc": {
|
| 412 |
+
"version": "2.0.2",
|
| 413 |
+
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.2.tgz",
|
| 414 |
+
"integrity": "sha512-3W4f5tDUra+pA+FzgugqL2pRimUTDJWKr7BINqOpkZrC0uYI0NIc0/JFgBROCU07HR6GieA5m3/rsPIhDmCXTQ==",
|
| 415 |
"dev": true,
|
| 416 |
"dependencies": {
|
| 417 |
"ajv": "^6.12.4",
|
| 418 |
"debug": "^4.3.2",
|
| 419 |
+
"espree": "^9.5.1",
|
| 420 |
"globals": "^13.19.0",
|
| 421 |
"ignore": "^5.2.0",
|
| 422 |
"import-fresh": "^3.2.1",
|
|
|
|
| 431 |
"url": "https://opencollective.com/eslint"
|
| 432 |
}
|
| 433 |
},
|
| 434 |
+
"node_modules/@eslint/js": {
|
| 435 |
+
"version": "8.38.0",
|
| 436 |
+
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.38.0.tgz",
|
| 437 |
+
"integrity": "sha512-IoD2MfUnOV58ghIHCiil01PcohxjbYR/qCxsoC+xNgUwh1EY8jOOrYmu3d3a71+tJJ23uscEV4X2HJWMsPJu4g==",
|
| 438 |
+
"dev": true,
|
| 439 |
+
"engines": {
|
| 440 |
+
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
| 441 |
+
}
|
| 442 |
+
},
|
| 443 |
+
"node_modules/@huggingface/inference": {
|
| 444 |
+
"version": "2.0.0-rc2",
|
| 445 |
+
"resolved": "https://registry.npmjs.org/@huggingface/inference/-/inference-2.0.0-rc2.tgz",
|
| 446 |
+
"integrity": "sha512-jCU+zl1fmbmaWbTa3P2KC1GQMwjMc9ZLcR8Nq5UeFmDbmdz0GiBHsK7F1hTHRAPeF1K3X5L3V3OQUNZ6nzEu/w==",
|
| 447 |
+
"engines": {
|
| 448 |
+
"node": ">=18"
|
| 449 |
+
}
|
| 450 |
+
},
|
| 451 |
"node_modules/@humanwhocodes/config-array": {
|
| 452 |
"version": "0.11.8",
|
| 453 |
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz",
|
|
|
|
| 524 |
"@jridgewell/sourcemap-codec": "1.4.14"
|
| 525 |
}
|
| 526 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 527 |
"node_modules/@nodelib/fs.scandir": {
|
| 528 |
"version": "2.1.5",
|
| 529 |
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
|
|
|
| 1512 |
"dev": true
|
| 1513 |
},
|
| 1514 |
"node_modules/esbuild": {
|
| 1515 |
+
"version": "0.17.16",
|
| 1516 |
+
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.16.tgz",
|
| 1517 |
+
"integrity": "sha512-aeSuUKr9aFVY9Dc8ETVELGgkj4urg5isYx8pLf4wlGgB0vTFjxJQdHnNH6Shmx4vYYrOTLCHtRI5i1XZ9l2Zcg==",
|
| 1518 |
"dev": true,
|
| 1519 |
"hasInstallScript": true,
|
| 1520 |
"bin": {
|
|
|
|
| 1524 |
"node": ">=12"
|
| 1525 |
},
|
| 1526 |
"optionalDependencies": {
|
| 1527 |
+
"@esbuild/android-arm": "0.17.16",
|
| 1528 |
+
"@esbuild/android-arm64": "0.17.16",
|
| 1529 |
+
"@esbuild/android-x64": "0.17.16",
|
| 1530 |
+
"@esbuild/darwin-arm64": "0.17.16",
|
| 1531 |
+
"@esbuild/darwin-x64": "0.17.16",
|
| 1532 |
+
"@esbuild/freebsd-arm64": "0.17.16",
|
| 1533 |
+
"@esbuild/freebsd-x64": "0.17.16",
|
| 1534 |
+
"@esbuild/linux-arm": "0.17.16",
|
| 1535 |
+
"@esbuild/linux-arm64": "0.17.16",
|
| 1536 |
+
"@esbuild/linux-ia32": "0.17.16",
|
| 1537 |
+
"@esbuild/linux-loong64": "0.17.16",
|
| 1538 |
+
"@esbuild/linux-mips64el": "0.17.16",
|
| 1539 |
+
"@esbuild/linux-ppc64": "0.17.16",
|
| 1540 |
+
"@esbuild/linux-riscv64": "0.17.16",
|
| 1541 |
+
"@esbuild/linux-s390x": "0.17.16",
|
| 1542 |
+
"@esbuild/linux-x64": "0.17.16",
|
| 1543 |
+
"@esbuild/netbsd-x64": "0.17.16",
|
| 1544 |
+
"@esbuild/openbsd-x64": "0.17.16",
|
| 1545 |
+
"@esbuild/sunos-x64": "0.17.16",
|
| 1546 |
+
"@esbuild/win32-arm64": "0.17.16",
|
| 1547 |
+
"@esbuild/win32-ia32": "0.17.16",
|
| 1548 |
+
"@esbuild/win32-x64": "0.17.16"
|
| 1549 |
}
|
| 1550 |
},
|
| 1551 |
"node_modules/escalade": {
|
|
|
|
| 1569 |
}
|
| 1570 |
},
|
| 1571 |
"node_modules/eslint": {
|
| 1572 |
+
"version": "8.38.0",
|
| 1573 |
+
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.38.0.tgz",
|
| 1574 |
+
"integrity": "sha512-pIdsD2jwlUGf/U38Jv97t8lq6HpaU/G9NKbYmpWpZGw3LdTNhZLbJePqxOXGB5+JEKfOPU/XLxYxFh03nr1KTg==",
|
| 1575 |
"dev": true,
|
| 1576 |
"dependencies": {
|
| 1577 |
+
"@eslint-community/eslint-utils": "^4.2.0",
|
| 1578 |
+
"@eslint-community/regexpp": "^4.4.0",
|
| 1579 |
+
"@eslint/eslintrc": "^2.0.2",
|
| 1580 |
+
"@eslint/js": "8.38.0",
|
| 1581 |
"@humanwhocodes/config-array": "^0.11.8",
|
| 1582 |
"@humanwhocodes/module-importer": "^1.0.1",
|
| 1583 |
"@nodelib/fs.walk": "^1.2.8",
|
|
|
|
| 1588 |
"doctrine": "^3.0.0",
|
| 1589 |
"escape-string-regexp": "^4.0.0",
|
| 1590 |
"eslint-scope": "^7.1.1",
|
| 1591 |
+
"eslint-visitor-keys": "^3.4.0",
|
| 1592 |
+
"espree": "^9.5.1",
|
| 1593 |
+
"esquery": "^1.4.2",
|
|
|
|
| 1594 |
"esutils": "^2.0.2",
|
| 1595 |
"fast-deep-equal": "^3.1.3",
|
| 1596 |
"file-entry-cache": "^6.0.1",
|
|
|
|
| 1611 |
"minimatch": "^3.1.2",
|
| 1612 |
"natural-compare": "^1.4.0",
|
| 1613 |
"optionator": "^0.9.1",
|
|
|
|
| 1614 |
"strip-ansi": "^6.0.1",
|
| 1615 |
"strip-json-comments": "^3.1.0",
|
| 1616 |
"text-table": "^0.2.0"
|
|
|
|
| 1688 |
}
|
| 1689 |
},
|
| 1690 |
"node_modules/eslint-visitor-keys": {
|
| 1691 |
+
"version": "3.4.0",
|
| 1692 |
+
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz",
|
| 1693 |
+
"integrity": "sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ==",
|
| 1694 |
"dev": true,
|
| 1695 |
"engines": {
|
| 1696 |
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
| 1697 |
+
},
|
| 1698 |
+
"funding": {
|
| 1699 |
+
"url": "https://opencollective.com/eslint"
|
| 1700 |
}
|
| 1701 |
},
|
| 1702 |
"node_modules/eslint/node_modules/eslint-scope": {
|
|
|
|
| 1728 |
"dev": true
|
| 1729 |
},
|
| 1730 |
"node_modules/espree": {
|
| 1731 |
+
"version": "9.5.1",
|
| 1732 |
+
"resolved": "https://registry.npmjs.org/espree/-/espree-9.5.1.tgz",
|
| 1733 |
+
"integrity": "sha512-5yxtHSZXRSW5pvv3hAlXM5+/Oswi1AUFqBmbibKb5s6bp3rGIDkyXU6xCoyuuLhijr4SFwPrXRoZjz0AZDN9tg==",
|
| 1734 |
"dev": true,
|
| 1735 |
"dependencies": {
|
| 1736 |
"acorn": "^8.8.0",
|
| 1737 |
"acorn-jsx": "^5.3.2",
|
| 1738 |
+
"eslint-visitor-keys": "^3.4.0"
|
| 1739 |
},
|
| 1740 |
"engines": {
|
| 1741 |
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
|
|
|
| 2919 |
}
|
| 2920 |
},
|
| 2921 |
"node_modules/rollup": {
|
| 2922 |
+
"version": "3.20.2",
|
| 2923 |
+
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.20.2.tgz",
|
| 2924 |
+
"integrity": "sha512-3zwkBQl7Ai7MFYQE0y1MeQ15+9jsi7XxfrqwTb/9EK8D9C9+//EBR4M+CuA1KODRaNbFez/lWxA5vhEGZp4MUg==",
|
| 2925 |
"dev": true,
|
| 2926 |
"bin": {
|
| 2927 |
"rollup": "dist/bin/rollup"
|
|
|
|
| 3534 |
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
|
| 3535 |
},
|
| 3536 |
"node_modules/vite": {
|
| 3537 |
+
"version": "4.2.1",
|
| 3538 |
+
"resolved": "https://registry.npmjs.org/vite/-/vite-4.2.1.tgz",
|
| 3539 |
+
"integrity": "sha512-7MKhqdy0ISo4wnvwtqZkjke6XN4taqQ2TBaTccLIpOKv7Vp2h4Y+NpmWCnGDeSvvn45KxvWgGyb0MkHvY1vgbg==",
|
| 3540 |
"dev": true,
|
| 3541 |
"dependencies": {
|
| 3542 |
+
"esbuild": "^0.17.5",
|
| 3543 |
"postcss": "^8.4.21",
|
| 3544 |
"resolve": "^1.22.1",
|
| 3545 |
+
"rollup": "^3.18.0"
|
| 3546 |
},
|
| 3547 |
"bin": {
|
| 3548 |
"vite": "bin/vite.js"
|
|
@@ -30,7 +30,7 @@
|
|
| 30 |
},
|
| 31 |
"type": "module",
|
| 32 |
"dependencies": {
|
| 33 |
-
"@
|
| 34 |
"autoprefixer": "^10.4.14",
|
| 35 |
"postcss": "^8.4.21",
|
| 36 |
"tailwind-scrollbar": "^3.0.0",
|
|
|
|
| 30 |
},
|
| 31 |
"type": "module",
|
| 32 |
"dependencies": {
|
| 33 |
+
"@huggingface/inference": "^2.0.0-rc2",
|
| 34 |
"autoprefixer": "^10.4.14",
|
| 35 |
"postcss": "^8.4.21",
|
| 36 |
"tailwind-scrollbar": "^3.0.0",
|
|
@@ -1,9 +1,8 @@
|
|
| 1 |
<script lang="ts">
|
| 2 |
-
import type { Message
|
| 3 |
|
| 4 |
import { afterUpdate } from 'svelte';
|
| 5 |
-
|
| 6 |
-
import { fetchEventSource } from '@microsoft/fetch-event-source';
|
| 7 |
|
| 8 |
import ChatMessage from '$lib/components/chat/ChatMessage.svelte';
|
| 9 |
import ChatIntroduction from '$lib/components/chat/ChatIntroduction.svelte';
|
|
@@ -11,16 +10,18 @@
|
|
| 11 |
|
| 12 |
import {
|
| 13 |
PUBLIC_ASSISTANT_MESSAGE_TOKEN,
|
| 14 |
-
PUBLIC_ENDPOINT,
|
| 15 |
-
PUBLIC_HF_TOKEN,
|
| 16 |
PUBLIC_SEP_TOKEN,
|
| 17 |
PUBLIC_USER_MESSAGE_TOKEN
|
| 18 |
} from '$env/static/public';
|
|
|
|
| 19 |
|
| 20 |
const userToken = PUBLIC_USER_MESSAGE_TOKEN || '<|prompter|>';
|
| 21 |
const assistantToken = PUBLIC_ASSISTANT_MESSAGE_TOKEN || '<|assistant|>';
|
| 22 |
const sepToken = PUBLIC_SEP_TOKEN || '<|endoftext|>';
|
| 23 |
|
|
|
|
|
|
|
|
|
|
| 24 |
let messages: Message[] = [];
|
| 25 |
let message = '';
|
| 26 |
|
|
@@ -41,6 +42,53 @@
|
|
| 41 |
}
|
| 42 |
}
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
function onWrite() {
|
| 45 |
if (!message) return;
|
| 46 |
|
|
@@ -55,49 +103,7 @@
|
|
| 55 |
)
|
| 56 |
.join('') + assistantToken;
|
| 57 |
|
| 58 |
-
|
| 59 |
-
fetchEventSource(PUBLIC_ENDPOINT, {
|
| 60 |
-
method: 'POST',
|
| 61 |
-
headers: {
|
| 62 |
-
Accept: 'text/event-stream',
|
| 63 |
-
'Content-Type': 'application/json',
|
| 64 |
-
'user-agent': 'chat-ui/0.0.1',
|
| 65 |
-
...(PUBLIC_HF_TOKEN
|
| 66 |
-
? {
|
| 67 |
-
authorization: `Bearer ${PUBLIC_HF_TOKEN}`
|
| 68 |
-
}
|
| 69 |
-
: {})
|
| 70 |
-
},
|
| 71 |
-
body: JSON.stringify({
|
| 72 |
-
inputs: inputs,
|
| 73 |
-
stream: true,
|
| 74 |
-
parameters: {
|
| 75 |
-
do_sample: false,
|
| 76 |
-
max_new_tokens: 500,
|
| 77 |
-
return_full_text: false,
|
| 78 |
-
stop: [],
|
| 79 |
-
truncate: 1000,
|
| 80 |
-
typical_p: 0.2,
|
| 81 |
-
watermark: false,
|
| 82 |
-
details: true
|
| 83 |
-
}
|
| 84 |
-
}),
|
| 85 |
-
async onopen(response) {
|
| 86 |
-
if (response.ok && response.headers.get('content-type') === 'text/event-stream') {
|
| 87 |
-
messages = [...messages, { from: 'bot', content: '' }];
|
| 88 |
-
} else {
|
| 89 |
-
console.error('error opening the SSE endpoint');
|
| 90 |
-
}
|
| 91 |
-
},
|
| 92 |
-
onmessage(msg) {
|
| 93 |
-
const data = JSON.parse(msg.data) as StreamResponse;
|
| 94 |
-
// console.log(data);
|
| 95 |
-
if (!data.token.special) {
|
| 96 |
-
messages.at(-1)!.content += data.token.text;
|
| 97 |
-
messages = messages;
|
| 98 |
-
}
|
| 99 |
-
}
|
| 100 |
-
});
|
| 101 |
}
|
| 102 |
</script>
|
| 103 |
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
+
import type { Message } from '$lib/Types';
|
| 3 |
|
| 4 |
import { afterUpdate } from 'svelte';
|
| 5 |
+
import { HfInference } from '@huggingface/inference';
|
|
|
|
| 6 |
|
| 7 |
import ChatMessage from '$lib/components/chat/ChatMessage.svelte';
|
| 8 |
import ChatIntroduction from '$lib/components/chat/ChatIntroduction.svelte';
|
|
|
|
| 10 |
|
| 11 |
import {
|
| 12 |
PUBLIC_ASSISTANT_MESSAGE_TOKEN,
|
|
|
|
|
|
|
| 13 |
PUBLIC_SEP_TOKEN,
|
| 14 |
PUBLIC_USER_MESSAGE_TOKEN
|
| 15 |
} from '$env/static/public';
|
| 16 |
+
import { page } from '$app/stores';
|
| 17 |
|
| 18 |
const userToken = PUBLIC_USER_MESSAGE_TOKEN || '<|prompter|>';
|
| 19 |
const assistantToken = PUBLIC_ASSISTANT_MESSAGE_TOKEN || '<|assistant|>';
|
| 20 |
const sepToken = PUBLIC_SEP_TOKEN || '<|endoftext|>';
|
| 21 |
|
| 22 |
+
const hf = new HfInference();
|
| 23 |
+
const model = hf.endpoint(`${$page.url.origin}/api/conversation`);
|
| 24 |
+
|
| 25 |
let messages: Message[] = [];
|
| 26 |
let message = '';
|
| 27 |
|
|
|
|
| 42 |
}
|
| 43 |
}
|
| 44 |
|
| 45 |
+
async function getTextGenerationStream(inputs: string) {
|
| 46 |
+
const response = model.textGenerationStream(
|
| 47 |
+
{
|
| 48 |
+
inputs,
|
| 49 |
+
parameters: {
|
| 50 |
+
// Taken from https://huggingface.co/spaces/huggingface/open-assistant-private-testing/blob/main/app.py#L54
|
| 51 |
+
// @ts-ignore
|
| 52 |
+
stop: ['<|endoftext|>'],
|
| 53 |
+
max_new_tokens: 1024,
|
| 54 |
+
truncate: 1024,
|
| 55 |
+
typical_p: 0.2
|
| 56 |
+
}
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
use_cache: false
|
| 60 |
+
}
|
| 61 |
+
);
|
| 62 |
+
|
| 63 |
+
// Regex to check if the text finishes by "<" but is not a piece of code like "`<img>`"
|
| 64 |
+
const endOfTextRegex = /(?<!`)<(?!`)/;
|
| 65 |
+
|
| 66 |
+
for await (const data of response) {
|
| 67 |
+
if (!data) break;
|
| 68 |
+
|
| 69 |
+
try {
|
| 70 |
+
if (!data.token.special) {
|
| 71 |
+
if (messages.at(-1)?.from !== 'bot') {
|
| 72 |
+
// First token has a space at the beginning, trim it
|
| 73 |
+
messages = [...messages, { from: 'bot', content: data.token.text.trimStart() }];
|
| 74 |
+
} else {
|
| 75 |
+
const isEndOfText = endOfTextRegex.test(data.token.text);
|
| 76 |
+
|
| 77 |
+
messages.at(-1)!.content += isEndOfText
|
| 78 |
+
? data.token.text.replace('<', '')
|
| 79 |
+
: data.token.text;
|
| 80 |
+
messages = messages;
|
| 81 |
+
|
| 82 |
+
if (isEndOfText) break;
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
} catch (error) {
|
| 86 |
+
console.error(error);
|
| 87 |
+
break;
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
function onWrite() {
|
| 93 |
if (!message) return;
|
| 94 |
|
|
|
|
| 103 |
)
|
| 104 |
.join('') + assistantToken;
|
| 105 |
|
| 106 |
+
getTextGenerationStream(inputs);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
}
|
| 108 |
</script>
|
| 109 |
|
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { env } from '$env/dynamic/private';
|
| 2 |
+
import { PUBLIC_MODEL_ENDPOINT } from '$env/static/public';
|
| 3 |
+
|
| 4 |
+
export async function POST({ request }) {
|
| 5 |
+
return await fetch(PUBLIC_MODEL_ENDPOINT, {
|
| 6 |
+
headers: {
|
| 7 |
+
...request.headers,
|
| 8 |
+
'Content-Type': 'application/json',
|
| 9 |
+
Authorization: `Basic ${env.HF_TOKEN}`
|
| 10 |
+
},
|
| 11 |
+
method: 'POST',
|
| 12 |
+
body: await request.text()
|
| 13 |
+
});
|
| 14 |
+
}
|