Spaces:
Build error
Build error
Commit
•
da1e5da
1
Parent(s):
a3c1540
👷 Add CI to check types (#161)
Browse files- .eslintrc.cjs +2 -0
- .github/workflows/lint-and-test.yml +27 -0
- package-lock.json +59 -68
- package.json +4 -4
- src/lib/actions/snapScrollToBottom.ts +1 -1
- src/lib/buildPrompt.ts +1 -1
- src/lib/components/CopyToClipBoardBtn.svelte +1 -1
- src/lib/components/EthicsModal.svelte +1 -1
- src/lib/components/ScrollToBottomBtn.svelte +1 -1
- src/lib/components/StopGeneratingBtn.svelte +1 -1
- src/lib/components/chat/ChatMessage.svelte +3 -3
- src/lib/components/chat/ChatWindow.svelte +3 -3
- src/lib/components/icons/IconChevron.svelte +1 -1
- src/lib/components/icons/IconLoading.svelte +1 -1
- src/lib/components/icons/Logo.svelte +1 -1
- src/routes/+layout.svelte +1 -1
- src/routes/conversation/[id]/+page.svelte +8 -8
- src/routes/conversation/[id]/+server.ts +5 -1
.eslintrc.cjs
CHANGED
@@ -14,6 +14,8 @@ module.exports = {
|
|
14 |
},
|
15 |
rules: {
|
16 |
"no-shadow": ["error"],
|
|
|
|
|
17 |
},
|
18 |
env: {
|
19 |
browser: true,
|
|
|
14 |
},
|
15 |
rules: {
|
16 |
"no-shadow": ["error"],
|
17 |
+
"@typescript-eslint/no-explicit-any": "error",
|
18 |
+
"@typescript-eslint/no-non-null-assertion": "error",
|
19 |
},
|
20 |
env: {
|
21 |
browser: true,
|
.github/workflows/lint-and-test.yml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Lint and test
|
2 |
+
on:
|
3 |
+
pull_request:
|
4 |
+
push:
|
5 |
+
branches:
|
6 |
+
- main
|
7 |
+
|
8 |
+
jobs:
|
9 |
+
lint:
|
10 |
+
runs-on: ubuntu-latest
|
11 |
+
timeout-minutes: 10
|
12 |
+
|
13 |
+
steps:
|
14 |
+
- uses: actions/checkout@v3
|
15 |
+
|
16 |
+
- uses: actions/setup-node@v3
|
17 |
+
with:
|
18 |
+
node-version: "18"
|
19 |
+
cache: "npm"
|
20 |
+
- run: |
|
21 |
+
npm install ci
|
22 |
+
- name: "Checking lint/format errors"
|
23 |
+
run: |
|
24 |
+
npm run lint
|
25 |
+
- name: "Checking type errors"
|
26 |
+
run: |
|
27 |
+
npm run check
|
package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
{
|
2 |
"name": "chat-ui",
|
3 |
-
"version": "0.0
|
4 |
"lockfileVersion": 3,
|
5 |
"requires": true,
|
6 |
"packages": {
|
7 |
"": {
|
8 |
"name": "chat-ui",
|
9 |
-
"version": "0.0
|
10 |
"dependencies": {
|
11 |
"@huggingface/inference": "^2.2.0",
|
12 |
"autoprefixer": "^10.4.14",
|
@@ -23,8 +23,8 @@
|
|
23 |
},
|
24 |
"devDependencies": {
|
25 |
"@iconify-json/carbon": "^1.1.16",
|
26 |
-
"@sveltejs/adapter-node": "^1.2.
|
27 |
-
"@sveltejs/kit": "^1.
|
28 |
"@tailwindcss/typography": "^0.5.9",
|
29 |
"@types/marked": "^4.0.8",
|
30 |
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
@@ -35,8 +35,8 @@
|
|
35 |
"prettier": "^2.8.0",
|
36 |
"prettier-plugin-svelte": "^2.8.1",
|
37 |
"prettier-plugin-tailwindcss": "^0.2.7",
|
38 |
-
"svelte": "^3.
|
39 |
-
"svelte-check": "^3.0
|
40 |
"tslib": "^2.4.1",
|
41 |
"typescript": "^4.9.3",
|
42 |
"unplugin-icons": "^0.16.1",
|
@@ -769,9 +769,9 @@
|
|
769 |
}
|
770 |
},
|
771 |
"node_modules/@sveltejs/adapter-node": {
|
772 |
-
"version": "1.2.
|
773 |
-
"resolved": "https://registry.npmjs.org/@sveltejs/adapter-node/-/adapter-node-1.2.
|
774 |
-
"integrity": "sha512-
|
775 |
"dev": true,
|
776 |
"dependencies": {
|
777 |
"@rollup/plugin-commonjs": "^24.0.0",
|
@@ -784,13 +784,13 @@
|
|
784 |
}
|
785 |
},
|
786 |
"node_modules/@sveltejs/kit": {
|
787 |
-
"version": "1.15.
|
788 |
-
"resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-1.15.
|
789 |
-
"integrity": "sha512-
|
790 |
"dev": true,
|
791 |
"hasInstallScript": true,
|
792 |
"dependencies": {
|
793 |
-
"@sveltejs/vite-plugin-svelte": "^2.
|
794 |
"@types/cookie": "^0.5.1",
|
795 |
"cookie": "^0.5.0",
|
796 |
"devalue": "^4.3.0",
|
@@ -799,10 +799,10 @@
|
|
799 |
"magic-string": "^0.30.0",
|
800 |
"mime": "^3.0.0",
|
801 |
"sade": "^1.8.1",
|
802 |
-
"set-cookie-parser": "^2.
|
803 |
"sirv": "^2.0.2",
|
804 |
"tiny-glob": "^0.2.9",
|
805 |
-
"undici": "5.
|
806 |
},
|
807 |
"bin": {
|
808 |
"svelte-kit": "svelte-kit.js"
|
@@ -816,17 +816,17 @@
|
|
816 |
}
|
817 |
},
|
818 |
"node_modules/@sveltejs/vite-plugin-svelte": {
|
819 |
-
"version": "2.
|
820 |
-
"resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-2.
|
821 |
-
"integrity": "sha512-
|
822 |
"dev": true,
|
823 |
"dependencies": {
|
824 |
"debug": "^4.3.4",
|
825 |
-
"deepmerge": "^4.
|
826 |
"kleur": "^4.1.5",
|
827 |
-
"magic-string": "^0.
|
828 |
"svelte-hmr": "^0.15.1",
|
829 |
-
"vitefu": "^0.2.
|
830 |
},
|
831 |
"engines": {
|
832 |
"node": "^14.18.0 || >= 16"
|
@@ -836,18 +836,6 @@
|
|
836 |
"vite": "^4.0.0"
|
837 |
}
|
838 |
},
|
839 |
-
"node_modules/@sveltejs/vite-plugin-svelte/node_modules/magic-string": {
|
840 |
-
"version": "0.27.0",
|
841 |
-
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.27.0.tgz",
|
842 |
-
"integrity": "sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA==",
|
843 |
-
"dev": true,
|
844 |
-
"dependencies": {
|
845 |
-
"@jridgewell/sourcemap-codec": "^1.4.13"
|
846 |
-
},
|
847 |
-
"engines": {
|
848 |
-
"node": ">=12"
|
849 |
-
}
|
850 |
-
},
|
851 |
"node_modules/@tailwindcss/typography": {
|
852 |
"version": "0.5.9",
|
853 |
"resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.9.tgz",
|
@@ -917,15 +905,6 @@
|
|
917 |
"integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==",
|
918 |
"dev": true
|
919 |
},
|
920 |
-
"node_modules/@types/sass": {
|
921 |
-
"version": "1.43.1",
|
922 |
-
"resolved": "https://registry.npmjs.org/@types/sass/-/sass-1.43.1.tgz",
|
923 |
-
"integrity": "sha512-BPdoIt1lfJ6B7rw35ncdwBZrAssjcwzI5LByIrYs+tpXlj/CAkuVdRsgZDdP4lq5EjyWzwxZCqAoFyHKFwp32g==",
|
924 |
-
"dev": true,
|
925 |
-
"dependencies": {
|
926 |
-
"@types/node": "*"
|
927 |
-
}
|
928 |
-
},
|
929 |
"node_modules/@types/semver": {
|
930 |
"version": "7.3.13",
|
931 |
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz",
|
@@ -1560,9 +1539,9 @@
|
|
1560 |
"dev": true
|
1561 |
},
|
1562 |
"node_modules/deepmerge": {
|
1563 |
-
"version": "4.3.
|
1564 |
-
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.
|
1565 |
-
"integrity": "sha512-
|
1566 |
"dev": true,
|
1567 |
"engines": {
|
1568 |
"node": ">=0.10.0"
|
@@ -2194,9 +2173,9 @@
|
|
2194 |
"dev": true
|
2195 |
},
|
2196 |
"node_modules/graceful-fs": {
|
2197 |
-
"version": "4.2.
|
2198 |
-
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.
|
2199 |
-
"integrity": "sha512-
|
2200 |
"dev": true
|
2201 |
},
|
2202 |
"node_modules/grapheme-splitter": {
|
@@ -3430,9 +3409,9 @@
|
|
3430 |
}
|
3431 |
},
|
3432 |
"node_modules/set-cookie-parser": {
|
3433 |
-
"version": "2.
|
3434 |
-
"resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.
|
3435 |
-
"integrity": "sha512-
|
3436 |
"dev": true
|
3437 |
},
|
3438 |
"node_modules/shebang-command": {
|
@@ -3657,18 +3636,18 @@
|
|
3657 |
}
|
3658 |
},
|
3659 |
"node_modules/svelte": {
|
3660 |
-
"version": "3.
|
3661 |
-
"resolved": "https://registry.npmjs.org/svelte/-/svelte-3.
|
3662 |
-
"integrity": "sha512-
|
3663 |
"dev": true,
|
3664 |
"engines": {
|
3665 |
"node": ">= 8"
|
3666 |
}
|
3667 |
},
|
3668 |
"node_modules/svelte-check": {
|
3669 |
-
"version": "3.0
|
3670 |
-
"resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-3.0.
|
3671 |
-
"integrity": "sha512-
|
3672 |
"dev": true,
|
3673 |
"dependencies": {
|
3674 |
"@jridgewell/trace-mapping": "^0.3.17",
|
@@ -3677,8 +3656,8 @@
|
|
3677 |
"import-fresh": "^3.2.1",
|
3678 |
"picocolors": "^1.0.0",
|
3679 |
"sade": "^1.7.4",
|
3680 |
-
"svelte-preprocess": "^5.0.
|
3681 |
-
"typescript": "^
|
3682 |
},
|
3683 |
"bin": {
|
3684 |
"svelte-check": "bin/svelte-check"
|
@@ -3687,6 +3666,19 @@
|
|
3687 |
"svelte": "^3.55.0"
|
3688 |
}
|
3689 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3690 |
"node_modules/svelte-hmr": {
|
3691 |
"version": "0.15.1",
|
3692 |
"resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.15.1.tgz",
|
@@ -3700,14 +3692,13 @@
|
|
3700 |
}
|
3701 |
},
|
3702 |
"node_modules/svelte-preprocess": {
|
3703 |
-
"version": "5.0.
|
3704 |
-
"resolved": "https://registry.npmjs.org/svelte-preprocess/-/svelte-preprocess-5.0.
|
3705 |
-
"integrity": "sha512-
|
3706 |
"dev": true,
|
3707 |
"hasInstallScript": true,
|
3708 |
"dependencies": {
|
3709 |
"@types/pug": "^2.0.6",
|
3710 |
-
"@types/sass": "^1.43.1",
|
3711 |
"detect-indent": "^6.1.0",
|
3712 |
"magic-string": "^0.27.0",
|
3713 |
"sorcery": "^0.11.0",
|
@@ -3727,7 +3718,7 @@
|
|
3727 |
"stylus": "^0.55.0",
|
3728 |
"sugarss": "^2.0.0 || ^3.0.0 || ^4.0.0",
|
3729 |
"svelte": "^3.23.0",
|
3730 |
-
"typescript": "
|
3731 |
},
|
3732 |
"peerDependenciesMeta": {
|
3733 |
"@babel/core": {
|
@@ -3962,15 +3953,15 @@
|
|
3962 |
}
|
3963 |
},
|
3964 |
"node_modules/undici": {
|
3965 |
-
"version": "5.
|
3966 |
-
"resolved": "https://registry.npmjs.org/undici/-/undici-5.
|
3967 |
-
"integrity": "sha512-
|
3968 |
"dev": true,
|
3969 |
"dependencies": {
|
3970 |
"busboy": "^1.6.0"
|
3971 |
},
|
3972 |
"engines": {
|
3973 |
-
"node": ">=
|
3974 |
}
|
3975 |
},
|
3976 |
"node_modules/unplugin": {
|
|
|
1 |
{
|
2 |
"name": "chat-ui",
|
3 |
+
"version": "0.1.0",
|
4 |
"lockfileVersion": 3,
|
5 |
"requires": true,
|
6 |
"packages": {
|
7 |
"": {
|
8 |
"name": "chat-ui",
|
9 |
+
"version": "0.1.0",
|
10 |
"dependencies": {
|
11 |
"@huggingface/inference": "^2.2.0",
|
12 |
"autoprefixer": "^10.4.14",
|
|
|
23 |
},
|
24 |
"devDependencies": {
|
25 |
"@iconify-json/carbon": "^1.1.16",
|
26 |
+
"@sveltejs/adapter-node": "^1.2.4",
|
27 |
+
"@sveltejs/kit": "^1.15.10",
|
28 |
"@tailwindcss/typography": "^0.5.9",
|
29 |
"@types/marked": "^4.0.8",
|
30 |
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
|
|
35 |
"prettier": "^2.8.0",
|
36 |
"prettier-plugin-svelte": "^2.8.1",
|
37 |
"prettier-plugin-tailwindcss": "^0.2.7",
|
38 |
+
"svelte": "^3.58.0",
|
39 |
+
"svelte-check": "^3.2.0",
|
40 |
"tslib": "^2.4.1",
|
41 |
"typescript": "^4.9.3",
|
42 |
"unplugin-icons": "^0.16.1",
|
|
|
769 |
}
|
770 |
},
|
771 |
"node_modules/@sveltejs/adapter-node": {
|
772 |
+
"version": "1.2.4",
|
773 |
+
"resolved": "https://registry.npmjs.org/@sveltejs/adapter-node/-/adapter-node-1.2.4.tgz",
|
774 |
+
"integrity": "sha512-TNnhS+OKRZ9RKnC+ho5mlE2FJquI61i0v7yOXxBUSU3LAoYH2kwVVL8P8ecjefmZ8BOfM1V54pBnDODBU5CEaA==",
|
775 |
"dev": true,
|
776 |
"dependencies": {
|
777 |
"@rollup/plugin-commonjs": "^24.0.0",
|
|
|
784 |
}
|
785 |
},
|
786 |
"node_modules/@sveltejs/kit": {
|
787 |
+
"version": "1.15.10",
|
788 |
+
"resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-1.15.10.tgz",
|
789 |
+
"integrity": "sha512-qRZxODfsixjgY+7OOxhAQB8viVaxjyDUz2lM6cE22kObzF5mNke81FIxB2wdaOX42LyfVwIYULZQSr7duxLZ7w==",
|
790 |
"dev": true,
|
791 |
"hasInstallScript": true,
|
792 |
"dependencies": {
|
793 |
+
"@sveltejs/vite-plugin-svelte": "^2.1.1",
|
794 |
"@types/cookie": "^0.5.1",
|
795 |
"cookie": "^0.5.0",
|
796 |
"devalue": "^4.3.0",
|
|
|
799 |
"magic-string": "^0.30.0",
|
800 |
"mime": "^3.0.0",
|
801 |
"sade": "^1.8.1",
|
802 |
+
"set-cookie-parser": "^2.6.0",
|
803 |
"sirv": "^2.0.2",
|
804 |
"tiny-glob": "^0.2.9",
|
805 |
+
"undici": "~5.22.0"
|
806 |
},
|
807 |
"bin": {
|
808 |
"svelte-kit": "svelte-kit.js"
|
|
|
816 |
}
|
817 |
},
|
818 |
"node_modules/@sveltejs/vite-plugin-svelte": {
|
819 |
+
"version": "2.1.1",
|
820 |
+
"resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-2.1.1.tgz",
|
821 |
+
"integrity": "sha512-7YeBDt4us0FiIMNsVXxyaP4Hwyn2/v9x3oqStkHU3ZdIc5O22pGwUwH33wUqYo+7Itdmo8zxJ45Qvfm3H7UUjQ==",
|
822 |
"dev": true,
|
823 |
"dependencies": {
|
824 |
"debug": "^4.3.4",
|
825 |
+
"deepmerge": "^4.3.1",
|
826 |
"kleur": "^4.1.5",
|
827 |
+
"magic-string": "^0.30.0",
|
828 |
"svelte-hmr": "^0.15.1",
|
829 |
+
"vitefu": "^0.2.4"
|
830 |
},
|
831 |
"engines": {
|
832 |
"node": "^14.18.0 || >= 16"
|
|
|
836 |
"vite": "^4.0.0"
|
837 |
}
|
838 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
839 |
"node_modules/@tailwindcss/typography": {
|
840 |
"version": "0.5.9",
|
841 |
"resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.9.tgz",
|
|
|
905 |
"integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==",
|
906 |
"dev": true
|
907 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
908 |
"node_modules/@types/semver": {
|
909 |
"version": "7.3.13",
|
910 |
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz",
|
|
|
1539 |
"dev": true
|
1540 |
},
|
1541 |
"node_modules/deepmerge": {
|
1542 |
+
"version": "4.3.1",
|
1543 |
+
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz",
|
1544 |
+
"integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==",
|
1545 |
"dev": true,
|
1546 |
"engines": {
|
1547 |
"node": ">=0.10.0"
|
|
|
2173 |
"dev": true
|
2174 |
},
|
2175 |
"node_modules/graceful-fs": {
|
2176 |
+
"version": "4.2.11",
|
2177 |
+
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
|
2178 |
+
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
|
2179 |
"dev": true
|
2180 |
},
|
2181 |
"node_modules/grapheme-splitter": {
|
|
|
3409 |
}
|
3410 |
},
|
3411 |
"node_modules/set-cookie-parser": {
|
3412 |
+
"version": "2.6.0",
|
3413 |
+
"resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz",
|
3414 |
+
"integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==",
|
3415 |
"dev": true
|
3416 |
},
|
3417 |
"node_modules/shebang-command": {
|
|
|
3636 |
}
|
3637 |
},
|
3638 |
"node_modules/svelte": {
|
3639 |
+
"version": "3.58.0",
|
3640 |
+
"resolved": "https://registry.npmjs.org/svelte/-/svelte-3.58.0.tgz",
|
3641 |
+
"integrity": "sha512-brIBNNB76mXFmU/Kerm4wFnkskBbluBDCjx/8TcpYRb298Yh2dztS2kQ6bhtjMcvUhd5ynClfwpz5h2gnzdQ1A==",
|
3642 |
"dev": true,
|
3643 |
"engines": {
|
3644 |
"node": ">= 8"
|
3645 |
}
|
3646 |
},
|
3647 |
"node_modules/svelte-check": {
|
3648 |
+
"version": "3.2.0",
|
3649 |
+
"resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-3.2.0.tgz",
|
3650 |
+
"integrity": "sha512-6ZnscN8dHEN5Eq5LgIzjj07W9nc9myyBH+diXsUAuiY/3rt0l65/LCIQYlIuoFEjp2F1NhXqZiJwV9omPj9tMw==",
|
3651 |
"dev": true,
|
3652 |
"dependencies": {
|
3653 |
"@jridgewell/trace-mapping": "^0.3.17",
|
|
|
3656 |
"import-fresh": "^3.2.1",
|
3657 |
"picocolors": "^1.0.0",
|
3658 |
"sade": "^1.7.4",
|
3659 |
+
"svelte-preprocess": "^5.0.3",
|
3660 |
+
"typescript": "^5.0.3"
|
3661 |
},
|
3662 |
"bin": {
|
3663 |
"svelte-check": "bin/svelte-check"
|
|
|
3666 |
"svelte": "^3.55.0"
|
3667 |
}
|
3668 |
},
|
3669 |
+
"node_modules/svelte-check/node_modules/typescript": {
|
3670 |
+
"version": "5.0.4",
|
3671 |
+
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz",
|
3672 |
+
"integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==",
|
3673 |
+
"dev": true,
|
3674 |
+
"bin": {
|
3675 |
+
"tsc": "bin/tsc",
|
3676 |
+
"tsserver": "bin/tsserver"
|
3677 |
+
},
|
3678 |
+
"engines": {
|
3679 |
+
"node": ">=12.20"
|
3680 |
+
}
|
3681 |
+
},
|
3682 |
"node_modules/svelte-hmr": {
|
3683 |
"version": "0.15.1",
|
3684 |
"resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.15.1.tgz",
|
|
|
3692 |
}
|
3693 |
},
|
3694 |
"node_modules/svelte-preprocess": {
|
3695 |
+
"version": "5.0.3",
|
3696 |
+
"resolved": "https://registry.npmjs.org/svelte-preprocess/-/svelte-preprocess-5.0.3.tgz",
|
3697 |
+
"integrity": "sha512-GrHF1rusdJVbOZOwgPWtpqmaexkydznKzy5qIC2FabgpFyKN57bjMUUUqPRfbBXK5igiEWn1uO/DXsa2vJ5VHA==",
|
3698 |
"dev": true,
|
3699 |
"hasInstallScript": true,
|
3700 |
"dependencies": {
|
3701 |
"@types/pug": "^2.0.6",
|
|
|
3702 |
"detect-indent": "^6.1.0",
|
3703 |
"magic-string": "^0.27.0",
|
3704 |
"sorcery": "^0.11.0",
|
|
|
3718 |
"stylus": "^0.55.0",
|
3719 |
"sugarss": "^2.0.0 || ^3.0.0 || ^4.0.0",
|
3720 |
"svelte": "^3.23.0",
|
3721 |
+
"typescript": ">=3.9.5 || ^4.0.0 || ^5.0.0"
|
3722 |
},
|
3723 |
"peerDependenciesMeta": {
|
3724 |
"@babel/core": {
|
|
|
3953 |
}
|
3954 |
},
|
3955 |
"node_modules/undici": {
|
3956 |
+
"version": "5.22.0",
|
3957 |
+
"resolved": "https://registry.npmjs.org/undici/-/undici-5.22.0.tgz",
|
3958 |
+
"integrity": "sha512-fR9RXCc+6Dxav4P9VV/sp5w3eFiSdOjJYsbtWfd4s5L5C4ogyuVpdKIVHeW0vV1MloM65/f7W45nR9ZxwVdyiA==",
|
3959 |
"dev": true,
|
3960 |
"dependencies": {
|
3961 |
"busboy": "^1.6.0"
|
3962 |
},
|
3963 |
"engines": {
|
3964 |
+
"node": ">=14.0"
|
3965 |
}
|
3966 |
},
|
3967 |
"node_modules/unplugin": {
|
package.json
CHANGED
@@ -13,8 +13,8 @@
|
|
13 |
},
|
14 |
"devDependencies": {
|
15 |
"@iconify-json/carbon": "^1.1.16",
|
16 |
-
"@sveltejs/adapter-node": "^1.2.
|
17 |
-
"@sveltejs/kit": "^1.
|
18 |
"@tailwindcss/typography": "^0.5.9",
|
19 |
"@types/marked": "^4.0.8",
|
20 |
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
@@ -25,8 +25,8 @@
|
|
25 |
"prettier": "^2.8.0",
|
26 |
"prettier-plugin-svelte": "^2.8.1",
|
27 |
"prettier-plugin-tailwindcss": "^0.2.7",
|
28 |
-
"svelte": "^3.
|
29 |
-
"svelte-check": "^3.0
|
30 |
"tslib": "^2.4.1",
|
31 |
"typescript": "^4.9.3",
|
32 |
"unplugin-icons": "^0.16.1",
|
|
|
13 |
},
|
14 |
"devDependencies": {
|
15 |
"@iconify-json/carbon": "^1.1.16",
|
16 |
+
"@sveltejs/adapter-node": "^1.2.4",
|
17 |
+
"@sveltejs/kit": "^1.15.10",
|
18 |
"@tailwindcss/typography": "^0.5.9",
|
19 |
"@types/marked": "^4.0.8",
|
20 |
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
|
|
25 |
"prettier": "^2.8.0",
|
26 |
"prettier-plugin-svelte": "^2.8.1",
|
27 |
"prettier-plugin-tailwindcss": "^0.2.7",
|
28 |
+
"svelte": "^3.58.0",
|
29 |
+
"svelte-check": "^3.2.0",
|
30 |
"tslib": "^2.4.1",
|
31 |
"typescript": "^4.9.3",
|
32 |
"unplugin-icons": "^0.16.1",
|
src/lib/actions/snapScrollToBottom.ts
CHANGED
@@ -8,7 +8,7 @@ const detachedOffset = 10;
|
|
8 |
* @param node element to snap scroll to bottom
|
9 |
* @param dependency pass in a dependency to update scroll on changes.
|
10 |
*/
|
11 |
-
export const snapScrollToBottom = (node: HTMLElement, dependency:
|
12 |
let prevScrollValue = node.scrollTop;
|
13 |
let isDetached = false;
|
14 |
|
|
|
8 |
* @param node element to snap scroll to bottom
|
9 |
* @param dependency pass in a dependency to update scroll on changes.
|
10 |
*/
|
11 |
+
export const snapScrollToBottom = (node: HTMLElement, dependency: unknown) => {
|
12 |
let prevScrollValue = node.scrollTop;
|
13 |
let isDetached = false;
|
14 |
|
src/lib/buildPrompt.ts
CHANGED
@@ -12,7 +12,7 @@ import type { Message } from "./types/Message";
|
|
12 |
*
|
13 |
* <|assistant|>hi<|endoftext|><|prompter|>hello<|endoftext|><|assistant|>
|
14 |
*/
|
15 |
-
export function buildPrompt(messages: Message[]): string {
|
16 |
const prompt =
|
17 |
messages
|
18 |
.map(
|
|
|
12 |
*
|
13 |
* <|assistant|>hi<|endoftext|><|prompter|>hello<|endoftext|><|assistant|>
|
14 |
*/
|
15 |
+
export function buildPrompt(messages: Pick<Message, "from" | "content">[]): string {
|
16 |
const prompt =
|
17 |
messages
|
18 |
.map(
|
src/lib/components/CopyToClipBoardBtn.svelte
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
export let value: string;
|
9 |
|
10 |
let isSuccess = false;
|
11 |
-
let timeout:
|
12 |
|
13 |
const handleClick = async () => {
|
14 |
// writeText() can be unavailable or fail in some cases (iframe, etc) so we try/catch
|
|
|
8 |
export let value: string;
|
9 |
|
10 |
let isSuccess = false;
|
11 |
+
let timeout: ReturnType<typeof setTimeout>;
|
12 |
|
13 |
const handleClick = async () => {
|
14 |
// writeText() can be unavailable or fail in some cases (iframe, etc) so we try/catch
|
src/lib/components/EthicsModal.svelte
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
import type { Settings } from "$lib/types/Settings";
|
6 |
import { updateSettings } from "$lib/updateSettings";
|
7 |
|
8 |
-
export let settings: Omit<Settings, "sessionId">;
|
9 |
</script>
|
10 |
|
11 |
<Modal>
|
|
|
5 |
import type { Settings } from "$lib/types/Settings";
|
6 |
import { updateSettings } from "$lib/updateSettings";
|
7 |
|
8 |
+
export let settings: Omit<Settings, "sessionId" | "createdAt" | "updatedAt">;
|
9 |
</script>
|
10 |
|
11 |
<Modal>
|
src/lib/components/ScrollToBottomBtn.svelte
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
export let scrollNode: HTMLElement;
|
7 |
export { className as class };
|
8 |
|
9 |
-
let visible
|
10 |
let className = "";
|
11 |
let observer: ResizeObserver | null = null;
|
12 |
|
|
|
6 |
export let scrollNode: HTMLElement;
|
7 |
export { className as class };
|
8 |
|
9 |
+
let visible = false;
|
10 |
let className = "";
|
11 |
let observer: ResizeObserver | null = null;
|
12 |
|
src/lib/components/StopGeneratingBtn.svelte
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<script lang="ts">
|
2 |
import CarbonPause from "~icons/carbon/pause-filled";
|
3 |
|
4 |
-
export let visible
|
5 |
export let className = "";
|
6 |
</script>
|
7 |
|
|
|
1 |
<script lang="ts">
|
2 |
import CarbonPause from "~icons/carbon/pause-filled";
|
3 |
|
4 |
+
export let visible = false;
|
5 |
export let className = "";
|
6 |
</script>
|
7 |
|
src/lib/components/chat/ChatMessage.svelte
CHANGED
@@ -25,13 +25,13 @@
|
|
25 |
}
|
26 |
|
27 |
export let message: Message;
|
28 |
-
export let loading
|
29 |
|
30 |
const dispatch = createEventDispatcher<{ retry: void }>();
|
31 |
|
32 |
let contentEl: HTMLElement;
|
33 |
-
let loadingEl:
|
34 |
-
let pendingTimeout:
|
35 |
|
36 |
const renderer = new marked.Renderer();
|
37 |
|
|
|
25 |
}
|
26 |
|
27 |
export let message: Message;
|
28 |
+
export let loading = false;
|
29 |
|
30 |
const dispatch = createEventDispatcher<{ retry: void }>();
|
31 |
|
32 |
let contentEl: HTMLElement;
|
33 |
+
let loadingEl: IconLoading;
|
34 |
+
let pendingTimeout: ReturnType<typeof setTimeout>;
|
35 |
|
36 |
const renderer = new marked.Renderer();
|
37 |
|
src/lib/components/chat/ChatWindow.svelte
CHANGED
@@ -11,9 +11,9 @@
|
|
11 |
import { PUBLIC_MODEL_ID, PUBLIC_MODEL_NAME } from "$env/static/public";
|
12 |
|
13 |
export let messages: Message[] = [];
|
14 |
-
export let disabled
|
15 |
-
export let loading
|
16 |
-
export let pending
|
17 |
|
18 |
let message: string;
|
19 |
|
|
|
11 |
import { PUBLIC_MODEL_ID, PUBLIC_MODEL_NAME } from "$env/static/public";
|
12 |
|
13 |
export let messages: Message[] = [];
|
14 |
+
export let disabled = false;
|
15 |
+
export let loading = false;
|
16 |
+
export let pending = false;
|
17 |
|
18 |
let message: string;
|
19 |
|
src/lib/components/icons/IconChevron.svelte
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<script lang="ts">
|
2 |
-
export let classNames
|
3 |
</script>
|
4 |
|
5 |
<svg
|
|
|
1 |
<script lang="ts">
|
2 |
+
export let classNames = "";
|
3 |
</script>
|
4 |
|
5 |
<svg
|
src/lib/components/icons/IconLoading.svelte
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<script lang="ts">
|
2 |
-
export let classNames
|
3 |
</script>
|
4 |
|
5 |
<svg
|
|
|
1 |
<script lang="ts">
|
2 |
+
export let classNames = "";
|
3 |
</script>
|
4 |
|
5 |
<svg
|
src/lib/components/icons/Logo.svelte
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<script lang="ts">
|
2 |
-
export let classNames
|
3 |
</script>
|
4 |
|
5 |
<svg
|
|
|
1 |
<script lang="ts">
|
2 |
+
export let classNames = "";
|
3 |
</script>
|
4 |
|
5 |
<svg
|
src/routes/+layout.svelte
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
|
21 |
let isNavOpen = false;
|
22 |
let isSettingsOpen = false;
|
23 |
-
let errorToastTimeout:
|
24 |
let currentError: string | null;
|
25 |
|
26 |
async function onError() {
|
|
|
20 |
|
21 |
let isNavOpen = false;
|
22 |
let isSettingsOpen = false;
|
23 |
+
let errorToastTimeout: ReturnType<typeof setTimeout>;
|
24 |
let currentError: string | null;
|
25 |
|
26 |
async function onError() {
|
src/routes/conversation/[id]/+page.svelte
CHANGED
@@ -41,8 +41,8 @@
|
|
41 |
top_p: 0.95,
|
42 |
repetition_penalty: 1.2,
|
43 |
top_k: 50,
|
44 |
-
// @ts-ignore
|
45 |
truncate: parseInt(PUBLIC_MAX_INPUT_TOKENS),
|
|
|
46 |
watermark: false,
|
47 |
max_new_tokens: 1024,
|
48 |
stop: [PUBLIC_SEP_TOKEN],
|
@@ -56,10 +56,10 @@
|
|
56 |
}
|
57 |
);
|
58 |
|
59 |
-
for await (const
|
60 |
pending = false;
|
61 |
|
62 |
-
if (!
|
63 |
break;
|
64 |
}
|
65 |
|
@@ -79,17 +79,17 @@
|
|
79 |
}
|
80 |
|
81 |
// final message
|
82 |
-
if (
|
83 |
const lastMessage = messages[messages.length - 1];
|
84 |
|
85 |
if (lastMessage) {
|
86 |
-
lastMessage.content =
|
87 |
messages = [...messages];
|
88 |
}
|
89 |
break;
|
90 |
}
|
91 |
|
92 |
-
if (!
|
93 |
const lastMessage = messages[messages.length - 1];
|
94 |
|
95 |
if (lastMessage?.from !== "assistant") {
|
@@ -97,10 +97,10 @@
|
|
97 |
messages = [
|
98 |
...messages,
|
99 |
// id doesn't match the backend id but it's not important for assistant messages
|
100 |
-
{ from: "assistant", content:
|
101 |
];
|
102 |
} else {
|
103 |
-
lastMessage.content +=
|
104 |
messages = [...messages];
|
105 |
}
|
106 |
}
|
|
|
41 |
top_p: 0.95,
|
42 |
repetition_penalty: 1.2,
|
43 |
top_k: 50,
|
|
|
44 |
truncate: parseInt(PUBLIC_MAX_INPUT_TOKENS),
|
45 |
+
// @ts-expect-error this param is not available in @huggingface/inference
|
46 |
watermark: false,
|
47 |
max_new_tokens: 1024,
|
48 |
stop: [PUBLIC_SEP_TOKEN],
|
|
|
56 |
}
|
57 |
);
|
58 |
|
59 |
+
for await (const output of response) {
|
60 |
pending = false;
|
61 |
|
62 |
+
if (!output) {
|
63 |
break;
|
64 |
}
|
65 |
|
|
|
79 |
}
|
80 |
|
81 |
// final message
|
82 |
+
if (output.generated_text) {
|
83 |
const lastMessage = messages[messages.length - 1];
|
84 |
|
85 |
if (lastMessage) {
|
86 |
+
lastMessage.content = output.generated_text;
|
87 |
messages = [...messages];
|
88 |
}
|
89 |
break;
|
90 |
}
|
91 |
|
92 |
+
if (!output.token.special) {
|
93 |
const lastMessage = messages[messages.length - 1];
|
94 |
|
95 |
if (lastMessage?.from !== "assistant") {
|
|
|
97 |
messages = [
|
98 |
...messages,
|
99 |
// id doesn't match the backend id but it's not important for assistant messages
|
100 |
+
{ from: "assistant", content: output.token.text.trimStart(), id: randomUUID() },
|
101 |
];
|
102 |
} else {
|
103 |
+
lastMessage.content += output.token.text;
|
104 |
messages = [...messages];
|
105 |
}
|
106 |
}
|
src/routes/conversation/[id]/+server.ts
CHANGED
@@ -83,7 +83,11 @@ export async function POST({ request, fetch, locals, params }) {
|
|
83 |
signal: abortController.signal,
|
84 |
});
|
85 |
|
86 |
-
|
|
|
|
|
|
|
|
|
87 |
|
88 |
async function saveMessage() {
|
89 |
let generated_text = await parseGeneratedText(stream2, convId, date, abortController);
|
|
|
83 |
signal: abortController.signal,
|
84 |
});
|
85 |
|
86 |
+
if (!resp.body) {
|
87 |
+
throw new Error("Response body is empty");
|
88 |
+
}
|
89 |
+
|
90 |
+
const [stream1, stream2] = resp.body.tee();
|
91 |
|
92 |
async function saveMessage() {
|
93 |
let generated_text = await parseGeneratedText(stream2, convId, date, abortController);
|