lauro1 commited on
Commit
d54ea4b
1 Parent(s): 3fd3010
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .env +6 -11
  2. .env.local +0 -5
  3. package-lock.json +302 -324
  4. package.json +4 -1
  5. src/app.html +13 -13
  6. src/lib/components/BigModal.svelte +62 -0
  7. src/lib/components/LoadingModal.svelte +50 -26
  8. src/lib/components/LoadingModalWritable.js +1 -1
  9. src/lib/components/Login.svelte +346 -0
  10. src/lib/components/LoginModal.svelte +116 -51
  11. src/lib/components/MobileNav.svelte +3 -3
  12. src/lib/components/NavConversationItem.svelte +9 -7
  13. src/lib/components/NavMenu.svelte +121 -63
  14. src/lib/components/PleaseWaitModal.svelte +17 -0
  15. src/lib/components/SettingsModal2.svelte +235 -0
  16. src/lib/components/ShouldLoginModal.svelte +24 -0
  17. src/lib/components/TextModal.svelte +28 -0
  18. src/lib/components/chat/ChatIntroduction.svelte +28 -13
  19. src/lib/components/chat/ChatMessage.svelte +13 -22
  20. src/lib/components/chat/ChatMessages.svelte +5 -4
  21. src/lib/components/chat/ChatWindow.svelte +113 -35
  22. src/lib/components/icons/Help.svelte +26 -0
  23. src/lib/components/icons/Logo.svelte +7 -2
  24. src/lib/components/straightModal.svelte +61 -0
  25. src/lib/server/models.ts +2 -2
  26. src/lib/switchTheme.ts +2 -7
  27. src/lib/utils/template.ts +5 -1
  28. src/routes/+layout.server.ts +4 -0
  29. src/routes/+layout.svelte +63 -13
  30. src/routes/+page.svelte +34 -15
  31. src/routes/LayoutWritable.js +8 -0
  32. src/routes/LocalDB.ts +1 -1
  33. src/routes/conversation/[id]/+page.svelte +78 -29
  34. src/routes/conversation/[id]/phi/m.d.ts +80 -61
  35. src/routes/conversation/[id]/phi/m.js +451 -401
  36. src/routes/conversation/[id]/phi/m_bg.wasm.d.ts +12 -2
  37. src/routes/conversation/[id]/worker.js +279 -143
  38. src/routes/login/+page.server.ts +1 -1
  39. src/routes/model/flan/+page.svelte +16 -0
  40. src/routes/model/phi/+page.svelte +16 -0
  41. src/routes/tools.ts +27 -0
  42. static/chatui/backup/favicon-blue.png +0 -0
  43. static/chatui/backup/favicon-transparent.png +0 -0
  44. static/chatui/backup/favicon.png +0 -0
  45. static/chatui/{favicon.svg → backup/favicon.svg} +0 -0
  46. static/chatui/chat-new-logo.png +0 -0
  47. static/chatui/chat.png +0 -0
  48. static/chatui/favicon.png +0 -0
  49. static/chatui/help.png +0 -0
  50. static/chatui/hide-password.png +0 -0
.env CHANGED
@@ -112,7 +112,7 @@ MODELS=`[
112
  "repetition_penalty": 1.2,
113
  "top_k": 50,
114
  "truncate": 1000,
115
- "max_new_tokens": 45
116
  }
117
  }
118
  ]`
@@ -122,13 +122,7 @@ PUBLIC_ORIGIN=#https://huggingface.co
122
  PUBLIC_SHARE_PREFIX=#https://hf.co/chat
123
  PUBLIC_GOOGLE_ANALYTICS_ID=#G-XXXXXXXX / Leave empty to disable
124
  PUBLIC_DEPRECATED_GOOGLE_ANALYTICS_ID=#UA-XXXXXXXX-X / Leave empty to disable
125
- PUBLIC_ANNOUNCEMENT_BANNERS=`[
126
- {
127
- "title": "Private Llama 2 70b integration coming soon",
128
- "linkTitle": "Join our Beta",
129
- "linkHref": "https://www.mithrilsecurity.io/beta-registration-for-private-llama2-chat"
130
- }
131
- ]`
132
 
133
  PARQUET_EXPORT_DATASET=
134
  PARQUET_EXPORT_HF_TOKEN=
@@ -137,8 +131,9 @@ PARQUET_EXPORT_SECRET=
137
  RATE_LIMIT= # requests per minute
138
  MESSAGES_BEFORE_LOGIN=# how many messages a user can send in a conversation before having to login. set to 0 to force login right away
139
 
140
- PUBLIC_APP_NAME=ChatUI # name used as title throughout the app
141
  PUBLIC_APP_ASSETS=chatui # used to find logos & favicons in static/$PUBLIC_APP_ASSETS
142
  PUBLIC_APP_COLOR=blue # can be any of tailwind colors: https://tailwindcss.com/docs/customizing-colors#default-color-palette
143
- PUBLIC_APP_DATA_SHARING=#set to 1 to enable options & text regarding data sharing
144
- PUBLIC_APP_DISCLAIMER=#set to 1 to show a disclaimer on login page
 
 
112
  "repetition_penalty": 1.2,
113
  "top_k": 50,
114
  "truncate": 1000,
115
+ "max_new_tokens": 512
116
  }
117
  }
118
  ]`
 
122
  PUBLIC_SHARE_PREFIX=#https://hf.co/chat
123
  PUBLIC_GOOGLE_ANALYTICS_ID=#G-XXXXXXXX / Leave empty to disable
124
  PUBLIC_DEPRECATED_GOOGLE_ANALYTICS_ID=#UA-XXXXXXXX-X / Leave empty to disable
125
+ PUBLIC_ANNOUNCEMENT_BANNERS=`[]`
 
 
 
 
 
 
126
 
127
  PARQUET_EXPORT_DATASET=
128
  PARQUET_EXPORT_HF_TOKEN=
 
131
  RATE_LIMIT= # requests per minute
132
  MESSAGES_BEFORE_LOGIN=# how many messages a user can send in a conversation before having to login. set to 0 to force login right away
133
 
134
+ PUBLIC_APP_NAME=BlindChat # name used as title throughout the app
135
  PUBLIC_APP_ASSETS=chatui # used to find logos & favicons in static/$PUBLIC_APP_ASSETS
136
  PUBLIC_APP_COLOR=blue # can be any of tailwind colors: https://tailwindcss.com/docs/customizing-colors#default-color-palette
137
+ PUBLIC_APP_DATA_SHARING=0#set to 1 to enable options & text regarding data sharing
138
+ PUBLIC_APP_DISCLAIMER=#set to 1 to show a disclaimer on login page
139
+ PUBLIC_SHOW_LOCAL_MODELS_WARNING=true # show warning that advise not to use local models on mobile devices
.env.local DELETED
@@ -1,5 +0,0 @@
1
- # Use .env.local to change these variables
2
- # DO NOT EDIT THIS FILE WITH SENSITIVE DATA
3
-
4
- PUBLIC_APP_NAME=BlindChat
5
- PUBLIC_APP_DATA_SHARING=false
 
 
 
 
 
 
package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
  {
2
  "name": "chat-ui",
3
- "version": "0.0.8",
4
  "lockfileVersion": 3,
5
  "requires": true,
6
  "packages": {
7
  "": {
8
  "name": "chat-ui",
9
- "version": "0.0.8",
10
  "dependencies": {
11
  "@huggingface/hub": "^0.5.1",
12
  "@huggingface/inference": "^2.2.0",
@@ -27,6 +27,7 @@
27
  "save": "^2.9.0",
28
  "serpapi": "^1.1.1",
29
  "svelte-device-info": "^1.0.0",
 
30
  "tailwind-scrollbar": "^3.0.0",
31
  "tailwindcss": "^3.3.1",
32
  "urijs": "^1.19.11",
@@ -53,6 +54,7 @@
53
  "prettier-plugin-tailwindcss": "^0.2.7",
54
  "svelte": "^3.58.0",
55
  "svelte-check": "^3.2.0",
 
56
  "tslib": "^2.4.1",
57
  "typescript": "^4.9.3",
58
  "unplugin-icons": "^0.16.1",
@@ -103,9 +105,9 @@
103
  }
104
  },
105
  "node_modules/@babel/runtime": {
106
- "version": "7.22.15",
107
- "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.15.tgz",
108
- "integrity": "sha512-T0O+aa+4w0u06iNmapipJXMV4HoUir03hpx3/YqXXhu9xim3w+dVphjFWl1OH8NbZHw5Lbm9k45drDkgq2VNNA==",
109
  "dependencies": {
110
  "regenerator-runtime": "^0.14.0"
111
  },
@@ -481,9 +483,9 @@
481
  }
482
  },
483
  "node_modules/@eslint-community/regexpp": {
484
- "version": "4.8.1",
485
- "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.8.1.tgz",
486
- "integrity": "sha512-PWiOzLIUAjN/w5K17PoF4n6sKBw0gqLHPhywmYHP4t1VFQQVYeb1yWsJwnMVEMl3tUHME7X/SJPZLmtG7XBDxQ==",
487
  "dev": true,
488
  "engines": {
489
  "node": "^12.0.0 || ^14.0.0 || >=16.0.0"
@@ -513,14 +515,22 @@
513
  }
514
  },
515
  "node_modules/@eslint/js": {
516
- "version": "8.49.0",
517
- "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.49.0.tgz",
518
- "integrity": "sha512-1S8uAY/MTJqVx0SC4epBq+N2yhuwtNwLbJYNZyhL2pO1ZVKn5HFXav5T41Ryzy9K9V7ZId2JB2oy/W4aCd9/2w==",
519
  "dev": true,
520
  "engines": {
521
  "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
522
  }
523
  },
 
 
 
 
 
 
 
 
524
  "node_modules/@huggingface/hub": {
525
  "version": "0.5.1",
526
  "resolved": "https://registry.npmjs.org/@huggingface/hub/-/hub-0.5.1.tgz",
@@ -533,20 +543,20 @@
533
  }
534
  },
535
  "node_modules/@huggingface/inference": {
536
- "version": "2.6.1",
537
- "resolved": "https://registry.npmjs.org/@huggingface/inference/-/inference-2.6.1.tgz",
538
- "integrity": "sha512-qFYchgOCPeEkZJKiSr7Kz62QwukJtgkeQCT7Q0SSKUcvHpTQVNJp6i/JrJMR4dBdzQysJ1SZDC0pLBBnnskTag==",
539
  "engines": {
540
  "node": ">=18"
541
  }
542
  },
543
  "node_modules/@humanwhocodes/config-array": {
544
- "version": "0.11.11",
545
- "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz",
546
- "integrity": "sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==",
547
  "dev": true,
548
  "dependencies": {
549
- "@humanwhocodes/object-schema": "^1.2.1",
550
  "debug": "^4.1.1",
551
  "minimatch": "^3.0.5"
552
  },
@@ -568,9 +578,9 @@
568
  }
569
  },
570
  "node_modules/@humanwhocodes/object-schema": {
571
- "version": "1.2.1",
572
- "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz",
573
- "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==",
574
  "dev": true
575
  },
576
  "node_modules/@iconify-json/carbon": {
@@ -598,9 +608,9 @@
598
  "dev": true
599
  },
600
  "node_modules/@iconify/utils": {
601
- "version": "2.1.10",
602
- "resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-2.1.10.tgz",
603
- "integrity": "sha512-0/+5hxjzCZ9RoYpqxnOzbnpQyMdZRuHcMxPJeuX+x/aZkAAD/N4TajDjAPT7LpX+M0bfLExj/p0bbDkUfp0lrg==",
604
  "dev": true,
605
  "dependencies": {
606
  "@antfu/install-pkg": "^0.1.1",
@@ -646,9 +656,9 @@
646
  "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg=="
647
  },
648
  "node_modules/@jridgewell/trace-mapping": {
649
- "version": "0.3.19",
650
- "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz",
651
- "integrity": "sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==",
652
  "dependencies": {
653
  "@jridgewell/resolve-uri": "^3.1.0",
654
  "@jridgewell/sourcemap-codec": "^1.4.14"
@@ -747,9 +757,9 @@
747
  "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw=="
748
  },
749
  "node_modules/@rollup/plugin-commonjs": {
750
- "version": "25.0.4",
751
- "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-25.0.4.tgz",
752
- "integrity": "sha512-L92Vz9WUZXDnlQQl3EwbypJR4+DM2EbsO+/KOcEkP4Mc6Ct453EeDB2uH9lgRwj4w5yflgNpq9pHOiY8aoUXBQ==",
753
  "dev": true,
754
  "dependencies": {
755
  "@rollup/pluginutils": "^5.0.1",
@@ -757,13 +767,13 @@
757
  "estree-walker": "^2.0.2",
758
  "glob": "^8.0.3",
759
  "is-reference": "1.2.1",
760
- "magic-string": "^0.27.0"
761
  },
762
  "engines": {
763
  "node": ">=14.0.0"
764
  },
765
  "peerDependencies": {
766
- "rollup": "^2.68.0||^3.0.0"
767
  },
768
  "peerDependenciesMeta": {
769
  "rollup": {
@@ -772,9 +782,9 @@
772
  }
773
  },
774
  "node_modules/@rollup/plugin-json": {
775
- "version": "6.0.0",
776
- "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-6.0.0.tgz",
777
- "integrity": "sha512-i/4C5Jrdr1XUarRhVu27EEwjt4GObltD7c+MkCIpO2QIbojw8MUs+CCTqOphQi3Qtg1FLmYt+l+6YeoIf51J7w==",
778
  "dev": true,
779
  "dependencies": {
780
  "@rollup/pluginutils": "^5.0.1"
@@ -783,7 +793,7 @@
783
  "node": ">=14.0.0"
784
  },
785
  "peerDependencies": {
786
- "rollup": "^1.20.0||^2.0.0||^3.0.0"
787
  },
788
  "peerDependenciesMeta": {
789
  "rollup": {
@@ -792,9 +802,9 @@
792
  }
793
  },
794
  "node_modules/@rollup/plugin-node-resolve": {
795
- "version": "15.2.1",
796
- "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.2.1.tgz",
797
- "integrity": "sha512-nsbUg588+GDSu8/NS8T4UAshO6xeaOfINNuXeVHcKV02LJtoRaM1SiOacClw4kws1SFiNhdLGxlbMY9ga/zs/w==",
798
  "dev": true,
799
  "dependencies": {
800
  "@rollup/pluginutils": "^5.0.1",
@@ -808,7 +818,7 @@
808
  "node": ">=14.0.0"
809
  },
810
  "peerDependencies": {
811
- "rollup": "^2.78.0||^3.0.0"
812
  },
813
  "peerDependenciesMeta": {
814
  "rollup": {
@@ -817,9 +827,9 @@
817
  }
818
  },
819
  "node_modules/@rollup/pluginutils": {
820
- "version": "5.0.4",
821
- "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.0.4.tgz",
822
- "integrity": "sha512-0KJnIoRI8A+a1dqOYLxH8vBf8bphDmty5QvIm2hqm7oFCFYKCAZWWd2hXgMibaPsNDhI0AtpYfQZJG47pt/k4g==",
823
  "dev": true,
824
  "dependencies": {
825
  "@types/estree": "^1.0.0",
@@ -830,7 +840,7 @@
830
  "node": ">=14.0.0"
831
  },
832
  "peerDependencies": {
833
- "rollup": "^1.20.0||^2.0.0||^3.0.0"
834
  },
835
  "peerDependenciesMeta": {
836
  "rollup": {
@@ -854,9 +864,9 @@
854
  }
855
  },
856
  "node_modules/@sveltejs/kit": {
857
- "version": "1.25.0",
858
- "resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-1.25.0.tgz",
859
- "integrity": "sha512-+VqMWJJYtcLoF8hYkdqY2qs/MPaawrMwA/gNBJW2o2UrcuYdNiy0ZZnjQQuPD33df/VcAulnoeyzF5ZtaajFEw==",
860
  "dev": true,
861
  "hasInstallScript": true,
862
  "dependencies": {
@@ -867,12 +877,12 @@
867
  "esm-env": "^1.0.0",
868
  "kleur": "^4.1.5",
869
  "magic-string": "^0.30.0",
870
- "mime": "^3.0.0",
871
  "sade": "^1.8.1",
872
  "set-cookie-parser": "^2.6.0",
873
  "sirv": "^2.0.2",
874
  "tiny-glob": "^0.2.9",
875
- "undici": "~5.23.0"
876
  },
877
  "bin": {
878
  "svelte-kit": "svelte-kit.js"
@@ -885,18 +895,6 @@
885
  "vite": "^4.0.0"
886
  }
887
  },
888
- "node_modules/@sveltejs/kit/node_modules/magic-string": {
889
- "version": "0.30.3",
890
- "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.3.tgz",
891
- "integrity": "sha512-B7xGbll2fG/VjP+SWg4sX3JynwIU0mjoTc6MPpKNuIvftk6u6vqhDnk1R80b8C2GBR6ywqy+1DcKBrevBg+bmw==",
892
- "dev": true,
893
- "dependencies": {
894
- "@jridgewell/sourcemap-codec": "^1.4.15"
895
- },
896
- "engines": {
897
- "node": ">=12"
898
- }
899
- },
900
  "node_modules/@sveltejs/vite-plugin-svelte": {
901
  "version": "2.4.6",
902
  "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-2.4.6.tgz",
@@ -936,18 +934,6 @@
936
  "vite": "^4.0.0"
937
  }
938
  },
939
- "node_modules/@sveltejs/vite-plugin-svelte/node_modules/magic-string": {
940
- "version": "0.30.3",
941
- "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.3.tgz",
942
- "integrity": "sha512-B7xGbll2fG/VjP+SWg4sX3JynwIU0mjoTc6MPpKNuIvftk6u6vqhDnk1R80b8C2GBR6ywqy+1DcKBrevBg+bmw==",
943
- "dev": true,
944
- "dependencies": {
945
- "@jridgewell/sourcemap-codec": "^1.4.15"
946
- },
947
- "engines": {
948
- "node": ">=12"
949
- }
950
- },
951
  "node_modules/@tailwindcss/typography": {
952
  "version": "0.5.10",
953
  "resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.10.tgz",
@@ -972,36 +958,36 @@
972
  }
973
  },
974
  "node_modules/@types/chai": {
975
- "version": "4.3.6",
976
- "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.6.tgz",
977
- "integrity": "sha512-VOVRLM1mBxIRxydiViqPcKn6MIxZytrbMpd6RJLIWKxUNr3zux8no0Oc7kJx0WAPIitgZ0gkrDS+btlqQpubpw==",
978
  "dev": true
979
  },
980
  "node_modules/@types/chai-subset": {
981
- "version": "1.3.3",
982
- "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.3.tgz",
983
- "integrity": "sha512-frBecisrNGz+F4T6bcc+NLeolfiojh5FxW2klu669+8BARtyQv2C/GkNW6FUodVe4BroGMP/wER/YDGc7rEllw==",
984
  "dev": true,
985
  "dependencies": {
986
  "@types/chai": "*"
987
  }
988
  },
989
  "node_modules/@types/cookie": {
990
- "version": "0.5.2",
991
- "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.5.2.tgz",
992
- "integrity": "sha512-DBpRoJGKJZn7RY92dPrgoMew8xCWc2P71beqsjyhEI/Ds9mOyVmBwtekyfhpwFIVt1WrxTonFifiOZ62V8CnNA==",
993
  "dev": true
994
  },
995
  "node_modules/@types/estree": {
996
- "version": "1.0.1",
997
- "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.1.tgz",
998
- "integrity": "sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==",
999
  "dev": true
1000
  },
1001
  "node_modules/@types/jsdom": {
1002
- "version": "21.1.3",
1003
- "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-21.1.3.tgz",
1004
- "integrity": "sha512-1zzqSP+iHJYV4lB3lZhNBa012pubABkj9yG/GuXuf6LZH1cSPIJBqFDrm5JX65HHt6VOnNYdTui/0ySerRbMgA==",
1005
  "dev": true,
1006
  "dependencies": {
1007
  "@types/node": "*",
@@ -1010,9 +996,9 @@
1010
  }
1011
  },
1012
  "node_modules/@types/json-schema": {
1013
- "version": "7.0.13",
1014
- "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.13.tgz",
1015
- "integrity": "sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ==",
1016
  "dev": true
1017
  },
1018
  "node_modules/@types/long": {
@@ -1021,38 +1007,41 @@
1021
  "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA=="
1022
  },
1023
  "node_modules/@types/marked": {
1024
- "version": "4.3.1",
1025
- "resolved": "https://registry.npmjs.org/@types/marked/-/marked-4.3.1.tgz",
1026
- "integrity": "sha512-vSSbKZFbNktrQ15v7o1EaH78EbWV+sPQbPjHG+Cp8CaNcPFUEfjZ0Iml/V0bFDwsTlYe8o6XC5Hfdp91cqPV2g==",
1027
  "dev": true
1028
  },
1029
  "node_modules/@types/node": {
1030
- "version": "20.6.2",
1031
- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.6.2.tgz",
1032
- "integrity": "sha512-Y+/1vGBHV/cYk6OI1Na/LHzwnlNCAfU3ZNGrc1LdRe/LAIbdDPTTv/HU3M7yXN448aTVDq3eKRm2cg7iKLb8gw=="
 
 
 
1033
  },
1034
  "node_modules/@types/node-int64": {
1035
- "version": "0.4.29",
1036
- "resolved": "https://registry.npmjs.org/@types/node-int64/-/node-int64-0.4.29.tgz",
1037
- "integrity": "sha512-rHXvenLTj/CcsmNAebaBOhxQ2MqEGl3yXZZcZ21XYR+gzGTTcpOy2N4IxpvTCz48loyQNatHvfn6GhIbbZ1R3Q==",
1038
  "dev": true,
1039
  "dependencies": {
1040
  "@types/node": "*"
1041
  }
1042
  },
1043
  "node_modules/@types/parquetjs": {
1044
- "version": "0.10.3",
1045
- "resolved": "https://registry.npmjs.org/@types/parquetjs/-/parquetjs-0.10.3.tgz",
1046
- "integrity": "sha512-n0xVEor3+3qHfCmFAf0pO4m/Pxc5JEmiVkEWWqJexN+p11/Nr+rqABKcIEj4X6tGKF1cnVIeBqy67mW2Yd+Kbg==",
1047
  "dev": true,
1048
  "dependencies": {
1049
  "@types/node-int64": "*"
1050
  }
1051
  },
1052
  "node_modules/@types/pug": {
1053
- "version": "2.0.6",
1054
- "resolved": "https://registry.npmjs.org/@types/pug/-/pug-2.0.6.tgz",
1055
- "integrity": "sha512-SnHmG9wN1UVmagJOnyo/qkk0Z7gejYxOYYmaAwr5u2yFYfsupN3sg10kyzN8Hep/2zbHxCnsumxOoRIRMBwKCg==",
1056
  "dev": true
1057
  },
1058
  "node_modules/@types/resolve": {
@@ -1062,21 +1051,21 @@
1062
  "dev": true
1063
  },
1064
  "node_modules/@types/semver": {
1065
- "version": "7.5.2",
1066
- "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.2.tgz",
1067
- "integrity": "sha512-7aqorHYgdNO4DM36stTiGO3DvKoex9TQRwsJU6vMaFGyqpBA1MNZkz+PG3gaNUPpTAOYhT1WR7M1JyA3fbS9Cw==",
1068
  "dev": true
1069
  },
1070
  "node_modules/@types/tough-cookie": {
1071
- "version": "4.0.3",
1072
- "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.3.tgz",
1073
- "integrity": "sha512-THo502dA5PzG/sfQH+42Lw3fvmYkceefOspdCwpHRul8ik2Jv1K8I5OZz1AT3/rs46kwgMCe9bSBmDLYkkOMGg==",
1074
  "dev": true
1075
  },
1076
  "node_modules/@types/urijs": {
1077
- "version": "1.19.20",
1078
- "resolved": "https://registry.npmjs.org/@types/urijs/-/urijs-1.19.20.tgz",
1079
- "integrity": "sha512-77Mq/2BeHU894J364dUv9tSwxxyCLtcX228Pc8TwZpP5bvOoMns+gZoftp3LYl3FBH8vChpWbuagKGiMki2c1A==",
1080
  "dev": true
1081
  },
1082
  "node_modules/@typescript-eslint/eslint-plugin": {
@@ -1267,6 +1256,12 @@
1267
  "url": "https://opencollective.com/typescript-eslint"
1268
  }
1269
  },
 
 
 
 
 
 
1270
  "node_modules/@vitest/expect": {
1271
  "version": "0.31.4",
1272
  "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.31.4.tgz",
@@ -1337,18 +1332,6 @@
1337
  "url": "https://opencollective.com/vitest"
1338
  }
1339
  },
1340
- "node_modules/@vitest/snapshot/node_modules/magic-string": {
1341
- "version": "0.30.3",
1342
- "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.3.tgz",
1343
- "integrity": "sha512-B7xGbll2fG/VjP+SWg4sX3JynwIU0mjoTc6MPpKNuIvftk6u6vqhDnk1R80b8C2GBR6ywqy+1DcKBrevBg+bmw==",
1344
- "dev": true,
1345
- "dependencies": {
1346
- "@jridgewell/sourcemap-codec": "^1.4.15"
1347
- },
1348
- "engines": {
1349
- "node": ">=12"
1350
- }
1351
- },
1352
  "node_modules/@vitest/spy": {
1353
  "version": "0.31.4",
1354
  "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-0.31.4.tgz",
@@ -1376,9 +1359,9 @@
1376
  }
1377
  },
1378
  "node_modules/@xenova/transformers": {
1379
- "version": "2.6.1",
1380
- "resolved": "https://registry.npmjs.org/@xenova/transformers/-/transformers-2.6.1.tgz",
1381
- "integrity": "sha512-fK1SkZUCvTdH1gEWmBUU5rvugZBqqu0ibkaBmUIr5t9Kf+Z8W4n0IszSRS2+M5ZHxRKS3SE7pFpsMDXByIzmQw==",
1382
  "dependencies": {
1383
  "onnxruntime-web": "1.14.0",
1384
  "sharp": "^0.32.0"
@@ -1530,9 +1513,9 @@
1530
  "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
1531
  },
1532
  "node_modules/autoprefixer": {
1533
- "version": "10.4.15",
1534
- "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.15.tgz",
1535
- "integrity": "sha512-KCuPB8ZCIqFdA4HwKXsvz7j6gvSDNhDP7WnUjBleRkKjPdvCmHFuQ77ocavI8FT6NdvlBnE2UFr2H4Mycn8Vew==",
1536
  "funding": [
1537
  {
1538
  "type": "opencollective",
@@ -1549,8 +1532,8 @@
1549
  ],
1550
  "dependencies": {
1551
  "browserslist": "^4.21.10",
1552
- "caniuse-lite": "^1.0.30001520",
1553
- "fraction.js": "^4.2.0",
1554
  "normalize-range": "^0.1.2",
1555
  "picocolors": "^1.0.0",
1556
  "postcss-value-parser": "^4.2.0"
@@ -1658,9 +1641,9 @@
1658
  }
1659
  },
1660
  "node_modules/browserslist": {
1661
- "version": "4.21.10",
1662
- "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.10.tgz",
1663
- "integrity": "sha512-bipEBdZfVH5/pwrvqc+Ub0kUPVfGUhlKxbvfD+z1BDnPEO/X98ruXGA1WP5ASpAFKan7Qr6j736IacbZQuAlKQ==",
1664
  "funding": [
1665
  {
1666
  "type": "opencollective",
@@ -1676,10 +1659,10 @@
1676
  }
1677
  ],
1678
  "dependencies": {
1679
- "caniuse-lite": "^1.0.30001517",
1680
- "electron-to-chromium": "^1.4.477",
1681
  "node-releases": "^2.0.13",
1682
- "update-browserslist-db": "^1.0.11"
1683
  },
1684
  "bin": {
1685
  "browserslist": "cli.js"
@@ -1688,6 +1671,14 @@
1688
  "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
1689
  }
1690
  },
 
 
 
 
 
 
 
 
1691
  "node_modules/buffer": {
1692
  "version": "5.7.1",
1693
  "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
@@ -1732,17 +1723,6 @@
1732
  "url": "https://github.com/sponsors/sindresorhus"
1733
  }
1734
  },
1735
- "node_modules/busboy": {
1736
- "version": "1.6.0",
1737
- "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz",
1738
- "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==",
1739
- "dependencies": {
1740
- "streamsearch": "^1.1.0"
1741
- },
1742
- "engines": {
1743
- "node": ">=10.16.0"
1744
- }
1745
- },
1746
  "node_modules/cac": {
1747
  "version": "6.7.14",
1748
  "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz",
@@ -1770,9 +1750,9 @@
1770
  }
1771
  },
1772
  "node_modules/caniuse-lite": {
1773
- "version": "1.0.30001538",
1774
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001538.tgz",
1775
- "integrity": "sha512-HWJnhnID+0YMtGlzcp3T9drmBJUVDchPJ08tpUGFLs9CYlwWPH2uLgpHn8fND5pCgXVtnGS3H4QR9XLMHVNkHw==",
1776
  "funding": [
1777
  {
1778
  "type": "opencollective",
@@ -1789,18 +1769,18 @@
1789
  ]
1790
  },
1791
  "node_modules/chai": {
1792
- "version": "4.3.8",
1793
- "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.8.tgz",
1794
- "integrity": "sha512-vX4YvVVtxlfSZ2VecZgFUTU5qPCYsobVI2O9FmwEXBhDigYGQA6jRXCycIs1yJnnWbZ6/+a2zNIF5DfVCcJBFQ==",
1795
  "dev": true,
1796
  "dependencies": {
1797
  "assertion-error": "^1.1.0",
1798
- "check-error": "^1.0.2",
1799
- "deep-eql": "^4.1.2",
1800
- "get-func-name": "^2.0.0",
1801
- "loupe": "^2.3.1",
1802
  "pathval": "^1.1.1",
1803
- "type-detect": "^4.0.5"
1804
  },
1805
  "engines": {
1806
  "node": ">=4"
@@ -1823,10 +1803,13 @@
1823
  }
1824
  },
1825
  "node_modules/check-error": {
1826
- "version": "1.0.2",
1827
- "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
1828
- "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==",
1829
  "dev": true,
 
 
 
1830
  "engines": {
1831
  "node": "*"
1832
  }
@@ -2215,9 +2198,9 @@
2215
  "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg=="
2216
  },
2217
  "node_modules/electron-to-chromium": {
2218
- "version": "1.4.523",
2219
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.523.tgz",
2220
- "integrity": "sha512-9AreocSUWnzNtvLcbpng6N+GkXnCcBR80IQkxRC9Dfdyg4gaWNUPBujAHUpKkiUkoSoR9UlhA4zD/IgBklmhzg=="
2221
  },
2222
  "node_modules/end-of-stream": {
2223
  "version": "1.4.4",
@@ -2302,18 +2285,19 @@
2302
  }
2303
  },
2304
  "node_modules/eslint": {
2305
- "version": "8.49.0",
2306
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.49.0.tgz",
2307
- "integrity": "sha512-jw03ENfm6VJI0jA9U+8H5zfl5b+FvuU3YYvZRdZHOlU2ggJkxrlkJH4HcDrZpj6YwD8kuYqvQM8LyesoazrSOQ==",
2308
  "dev": true,
2309
  "dependencies": {
2310
  "@eslint-community/eslint-utils": "^4.2.0",
2311
  "@eslint-community/regexpp": "^4.6.1",
2312
  "@eslint/eslintrc": "^2.1.2",
2313
- "@eslint/js": "8.49.0",
2314
- "@humanwhocodes/config-array": "^0.11.11",
2315
  "@humanwhocodes/module-importer": "^1.0.1",
2316
  "@nodelib/fs.walk": "^1.2.8",
 
2317
  "ajv": "^6.12.4",
2318
  "chalk": "^4.0.0",
2319
  "cross-spawn": "^7.0.2",
@@ -2368,9 +2352,9 @@
2368
  }
2369
  },
2370
  "node_modules/eslint-plugin-svelte": {
2371
- "version": "2.33.1",
2372
- "resolved": "https://registry.npmjs.org/eslint-plugin-svelte/-/eslint-plugin-svelte-2.33.1.tgz",
2373
- "integrity": "sha512-veYmyjsbt8ikXdaa6pLsgytdlzJpZZKw9vRaQlRBNKaLNmrbsdJulwiWfcDZ7tYJdaVpRB4iDFn/fuPeebxUVg==",
2374
  "dev": true,
2375
  "dependencies": {
2376
  "@eslint-community/eslint-utils": "^4.2.0",
@@ -2701,12 +2685,12 @@
2701
  }
2702
  },
2703
  "node_modules/flat-cache": {
2704
- "version": "3.1.0",
2705
- "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.0.tgz",
2706
- "integrity": "sha512-OHx4Qwrrt0E4jEIcI5/Xb+f+QmJYNj2rrK8wiIdQOIrB9WrrJL8cjZvXdXuBTkkEwEqLycb5BeZDV1o2i9bTew==",
2707
  "dev": true,
2708
  "dependencies": {
2709
- "flatted": "^3.2.7",
2710
  "keyv": "^4.5.3",
2711
  "rimraf": "^3.0.2"
2712
  },
@@ -2739,9 +2723,9 @@
2739
  }
2740
  },
2741
  "node_modules/fraction.js": {
2742
- "version": "4.3.6",
2743
- "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.6.tgz",
2744
- "integrity": "sha512-n2aZ9tNfYDwaHhvFTkhFErqOMIb8uyzSQ+vGJBjZyanAKZVbGUQ1sngfk9FdkBw7G26O7AgNjLcecLffD1c7eg==",
2745
  "engines": {
2746
  "node": "*"
2747
  },
@@ -2779,9 +2763,12 @@
2779
  }
2780
  },
2781
  "node_modules/function-bind": {
2782
- "version": "1.1.1",
2783
- "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
2784
- "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
 
 
 
2785
  },
2786
  "node_modules/get-func-name": {
2787
  "version": "2.0.2",
@@ -2861,9 +2848,9 @@
2861
  }
2862
  },
2863
  "node_modules/globals": {
2864
- "version": "13.21.0",
2865
- "resolved": "https://registry.npmjs.org/globals/-/globals-13.21.0.tgz",
2866
- "integrity": "sha512-ybyme3s4yy/t/3s35bewwXKOf7cvzfreG2lH0lZl0JB7I4GxRP2ghxOK/Nb9EkRXdbBXZLfq/p/0W2JUONB/Gg==",
2867
  "dev": true,
2868
  "dependencies": {
2869
  "type-fest": "^0.20.2"
@@ -2944,17 +2931,6 @@
2944
  "uglify-js": "^3.1.4"
2945
  }
2946
  },
2947
- "node_modules/has": {
2948
- "version": "1.0.3",
2949
- "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
2950
- "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
2951
- "dependencies": {
2952
- "function-bind": "^1.1.1"
2953
- },
2954
- "engines": {
2955
- "node": ">= 0.4.0"
2956
- }
2957
- },
2958
  "node_modules/has-flag": {
2959
  "version": "4.0.0",
2960
  "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@@ -2965,14 +2941,25 @@
2965
  }
2966
  },
2967
  "node_modules/hash-wasm": {
2968
- "version": "4.9.0",
2969
- "resolved": "https://registry.npmjs.org/hash-wasm/-/hash-wasm-4.9.0.tgz",
2970
- "integrity": "sha512-7SW7ejyfnRxuOc7ptQHSf4LDoZaWOivfzqw+5rpcQku0nHfmicPKE51ra9BiRLAmT8+gGLestr1XroUkqdjL6w=="
 
 
 
 
 
 
 
 
 
 
 
2971
  },
2972
  "node_modules/highlight.js": {
2973
- "version": "11.8.0",
2974
- "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.8.0.tgz",
2975
- "integrity": "sha512-MedQhoqVdr0U6SSnWPzfiadUcDHfN/Wzq25AkXiQv9oiOO/sG0S7XkvpFIqWBl9Yq1UYyYOOVORs5UW2XlPyzg==",
2976
  "engines": {
2977
  "node": ">=12.0.0"
2978
  }
@@ -3142,11 +3129,11 @@
3142
  }
3143
  },
3144
  "node_modules/is-core-module": {
3145
- "version": "2.13.0",
3146
- "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz",
3147
- "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==",
3148
  "dependencies": {
3149
- "has": "^1.0.3"
3150
  },
3151
  "funding": {
3152
  "url": "https://github.com/sponsors/ljharb"
@@ -3235,9 +3222,9 @@
3235
  }
3236
  },
3237
  "node_modules/jose": {
3238
- "version": "4.14.6",
3239
- "resolved": "https://registry.npmjs.org/jose/-/jose-4.14.6.tgz",
3240
- "integrity": "sha512-EqJPEUlZD0/CSUMubKtMaYUOtWe91tZXTWMJZoKSbLk+KtdhNdcvppH8lA9XwVu2V4Ailvsj0GBZJ2ZwDjfesQ==",
3241
  "funding": {
3242
  "url": "https://github.com/sponsors/panva"
3243
  }
@@ -3329,9 +3316,9 @@
3329
  "dev": true
3330
  },
3331
  "node_modules/keyv": {
3332
- "version": "4.5.3",
3333
- "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.3.tgz",
3334
- "integrity": "sha512-QCiSav9WaX1PgETJ+SpNnx2PRRapJ/oRSXM4VO5OGYGSjrxbKPVFVhB3l2OCbLCk329N8qyAtsJjSjvVBWzEug==",
3335
  "dev": true,
3336
  "dependencies": {
3337
  "json-buffer": "3.0.1"
@@ -3446,12 +3433,12 @@
3446
  "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA=="
3447
  },
3448
  "node_modules/loupe": {
3449
- "version": "2.3.6",
3450
- "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz",
3451
- "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==",
3452
  "dev": true,
3453
  "dependencies": {
3454
- "get-func-name": "^2.0.0"
3455
  }
3456
  },
3457
  "node_modules/lru-cache": {
@@ -3476,12 +3463,12 @@
3476
  }
3477
  },
3478
  "node_modules/magic-string": {
3479
- "version": "0.27.0",
3480
- "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.27.0.tgz",
3481
- "integrity": "sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA==",
3482
  "dev": true,
3483
  "dependencies": {
3484
- "@jridgewell/sourcemap-codec": "^1.4.13"
3485
  },
3486
  "engines": {
3487
  "node": ">=12"
@@ -3541,18 +3528,6 @@
3541
  "node": ">=8.6"
3542
  }
3543
  },
3544
- "node_modules/mime": {
3545
- "version": "3.0.0",
3546
- "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz",
3547
- "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==",
3548
- "dev": true,
3549
- "bin": {
3550
- "mime": "cli.js"
3551
- },
3552
- "engines": {
3553
- "node": ">=10.0.0"
3554
- }
3555
- },
3556
  "node_modules/mime-db": {
3557
  "version": "1.52.0",
3558
  "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
@@ -3602,9 +3577,9 @@
3602
  }
3603
  },
3604
  "node_modules/mingo": {
3605
- "version": "6.4.4",
3606
- "resolved": "https://registry.npmjs.org/mingo/-/mingo-6.4.4.tgz",
3607
- "integrity": "sha512-GtgwqyBVLxKf8tSvN26TjbK+XAUW5HlWR3D7qBsBh9urQyZznqG2BOx90t3MXklpSxawjvaANiWFUCIxd9xa7w=="
3608
  },
3609
  "node_modules/minimatch": {
3610
  "version": "3.1.2",
@@ -3727,9 +3702,9 @@
3727
  "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw=="
3728
  },
3729
  "node_modules/node-abi": {
3730
- "version": "3.47.0",
3731
- "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.47.0.tgz",
3732
- "integrity": "sha512-2s6B2CWZM//kPgwnuI0KrYwNjfdByE25zvAaEpq9IH4zcNsarH8Ihu/UuX6XMPEogDAxkuUFeZn60pXNHAqn3A==",
3733
  "dependencies": {
3734
  "semver": "^7.3.5"
3735
  },
@@ -3881,11 +3856,11 @@
3881
  }
3882
  },
3883
  "node_modules/openid-client": {
3884
- "version": "5.5.0",
3885
- "resolved": "https://registry.npmjs.org/openid-client/-/openid-client-5.5.0.tgz",
3886
- "integrity": "sha512-Y7Xl8BgsrkzWLHkVDYuroM67hi96xITyEDSkmWaGUiNX6CkcXC3XyQGdv5aWZ6dukVKBFVQCADi9gCavOmU14w==",
3887
  "dependencies": {
3888
- "jose": "^4.14.4",
3889
  "lru-cache": "^6.0.0",
3890
  "object-hash": "^2.2.0",
3891
  "oidc-token-hash": "^5.0.3"
@@ -3973,14 +3948,6 @@
3973
  "lzo": "^0.4.0"
3974
  }
3975
  },
3976
- "node_modules/parquetjs/node_modules/bson": {
3977
- "version": "1.1.6",
3978
- "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.6.tgz",
3979
- "integrity": "sha512-EvVNVeGo4tHxwi8L6bPj3y3itEvStdwvvlojVxxbyYfoaxJ6keLgrTuKdyfEAszFK+H3olzBuafE0yoh0D1gdg==",
3980
- "engines": {
3981
- "node": ">=0.6.19"
3982
- }
3983
- },
3984
  "node_modules/parse5": {
3985
  "version": "7.1.2",
3986
  "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz",
@@ -4104,9 +4071,9 @@
4104
  "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg=="
4105
  },
4106
  "node_modules/postcss": {
4107
- "version": "8.4.30",
4108
- "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.30.tgz",
4109
- "integrity": "sha512-7ZEao1g4kd68l97aWG/etQKPKq07us0ieSZ2TnFDk11i0ZfDW2AwKHYU8qv4MZKqN2fdBfg+7q0ES06UA73C1g==",
4110
  "funding": [
4111
  {
4112
  "type": "opencollective",
@@ -4240,9 +4207,9 @@
4240
  }
4241
  },
4242
  "node_modules/postcss-scss": {
4243
- "version": "4.0.8",
4244
- "resolved": "https://registry.npmjs.org/postcss-scss/-/postcss-scss-4.0.8.tgz",
4245
- "integrity": "sha512-Cr0X8Eu7xMhE96PJck6ses/uVVXDtE5ghUTKNUYgm8ozgP2TkgV3LWs3WgLV1xaSSLq8ZFiXaUrj0LVgG1fGEA==",
4246
  "dev": true,
4247
  "funding": [
4248
  {
@@ -4637,9 +4604,9 @@
4637
  "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ=="
4638
  },
4639
  "node_modules/resolve": {
4640
- "version": "1.22.6",
4641
- "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.6.tgz",
4642
- "integrity": "sha512-njhxM7mV12JfufShqGy3Rz8j11RPdLy4xi15UurGJeoHLfJpVXKdh3ueuOqbYUcDZnffr6X739JBo5LzyahEsw==",
4643
  "dependencies": {
4644
  "is-core-module": "^2.13.0",
4645
  "path-parse": "^1.0.7",
@@ -4706,9 +4673,9 @@
4706
  }
4707
  },
4708
  "node_modules/rollup": {
4709
- "version": "3.29.2",
4710
- "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.2.tgz",
4711
- "integrity": "sha512-CJouHoZ27v6siztc21eEQGo0kIcE5D1gVPA571ez0mMYb25LGYGKnVNXpEj5MGlepmDWGXNjDB5q7uNiPHC11A==",
4712
  "dev": true,
4713
  "bin": {
4714
  "rollup": "dist/bin/rollup"
@@ -5075,14 +5042,6 @@
5075
  "through": "~2.3.4"
5076
  }
5077
  },
5078
- "node_modules/streamsearch": {
5079
- "version": "1.1.0",
5080
- "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz",
5081
- "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==",
5082
- "engines": {
5083
- "node": ">=10.0.0"
5084
- }
5085
- },
5086
  "node_modules/streamx": {
5087
  "version": "2.15.1",
5088
  "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.1.tgz",
@@ -5230,9 +5189,9 @@
5230
  }
5231
  },
5232
  "node_modules/svelte-check": {
5233
- "version": "3.5.1",
5234
- "resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-3.5.1.tgz",
5235
- "integrity": "sha512-+Zb4iHxAhdUtcUg/WJPRjlS1RJalIsWAe9Mz6G1zyznSs7dDkT7VUBdXc3q7Iwg49O/VrZgyJRvOJkjuBfKjFA==",
5236
  "dev": true,
5237
  "dependencies": {
5238
  "@jridgewell/trace-mapping": "^0.3.17",
@@ -5270,16 +5229,16 @@
5270
  "integrity": "sha512-KL5/fXmhKVtM4ogoj9xrFTPjoWtTy/a8VFA5kEooIJiL48+aETCG2/owMvrsoyBRybUkzVf4ixkj+DncpNWMqw=="
5271
  },
5272
  "node_modules/svelte-eslint-parser": {
5273
- "version": "0.33.0",
5274
- "resolved": "https://registry.npmjs.org/svelte-eslint-parser/-/svelte-eslint-parser-0.33.0.tgz",
5275
- "integrity": "sha512-5awZ6Bs+Tb/zQwa41PSdcLynAVQTwW0HGyCBjtbAQ59taLZqDgQSMzRlDmapjZdDtzERm0oXDZNE0E+PKJ6ryg==",
5276
  "dev": true,
5277
  "dependencies": {
5278
  "eslint-scope": "^7.0.0",
5279
  "eslint-visitor-keys": "^3.0.0",
5280
  "espree": "^9.0.0",
5281
- "postcss": "^8.4.28",
5282
- "postcss-scss": "^4.0.7"
5283
  },
5284
  "engines": {
5285
  "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -5333,6 +5292,20 @@
5333
  "svelte": "^3.19.0 || ^4.0.0"
5334
  }
5335
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5336
  "node_modules/svelte-preprocess": {
5337
  "version": "5.0.4",
5338
  "resolved": "https://registry.npmjs.org/svelte-preprocess/-/svelte-preprocess-5.0.4.tgz",
@@ -5395,6 +5368,18 @@
5395
  }
5396
  }
5397
  },
 
 
 
 
 
 
 
 
 
 
 
 
5398
  "node_modules/symbol-tree": {
5399
  "version": "3.2.4",
5400
  "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
@@ -5496,9 +5481,9 @@
5496
  }
5497
  },
5498
  "node_modules/tailwindcss/node_modules/yaml": {
5499
- "version": "2.3.2",
5500
- "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.2.tgz",
5501
- "integrity": "sha512-N/lyzTPaJasoDmfV7YTrYCI0G/3ivm/9wdG0aHuheKowWQwGTsK0Eoiw6utmzAnI6pkJa0DUVygvp3spqqEKXg==",
5502
  "engines": {
5503
  "node": ">= 14"
5504
  }
@@ -5601,9 +5586,9 @@
5601
  }
5602
  },
5603
  "node_modules/tinyspy": {
5604
- "version": "2.1.1",
5605
- "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.1.1.tgz",
5606
- "integrity": "sha512-XPJL2uSzcOyBMky6OFrusqWlzfFrXtE0hPuMgW8A2HmaqrPo4ZQHRN/V0QXN3FSjKxpsbRrFc5LI7KOwBsT1/w==",
5607
  "dev": true,
5608
  "engines": {
5609
  "node": ">=14.0.0"
@@ -5744,9 +5729,9 @@
5744
  }
5745
  },
5746
  "node_modules/ufo": {
5747
- "version": "1.3.0",
5748
- "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.3.0.tgz",
5749
- "integrity": "sha512-bRn3CsoojyNStCZe0BG0Mt4Nr/4KF+rhFlnNXybgqt5pXHNFRlqinSoQaTrGyzE4X8aHplSb+TorH+COin9Yxw==",
5750
  "dev": true
5751
  },
5752
  "node_modules/uglify-js": {
@@ -5762,16 +5747,21 @@
5762
  }
5763
  },
5764
  "node_modules/undici": {
5765
- "version": "5.23.0",
5766
- "resolved": "https://registry.npmjs.org/undici/-/undici-5.23.0.tgz",
5767
- "integrity": "sha512-1D7w+fvRsqlQ9GscLBwcAJinqcZGHUKjbOmXdlE/v8BvEGXjeWAax+341q44EuTcHXXnfyKNbKRq4Lg7OzhMmg==",
5768
  "dependencies": {
5769
- "busboy": "^1.6.0"
5770
  },
5771
  "engines": {
5772
  "node": ">=14.0"
5773
  }
5774
  },
 
 
 
 
 
5775
  "node_modules/universalify": {
5776
  "version": "0.2.0",
5777
  "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz",
@@ -5835,9 +5825,9 @@
5835
  }
5836
  },
5837
  "node_modules/update-browserslist-db": {
5838
- "version": "1.0.11",
5839
- "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz",
5840
- "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==",
5841
  "funding": [
5842
  {
5843
  "type": "opencollective",
@@ -5909,9 +5899,9 @@
5909
  "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow=="
5910
  },
5911
  "node_modules/vite": {
5912
- "version": "4.4.9",
5913
- "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz",
5914
- "integrity": "sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==",
5915
  "dev": true,
5916
  "dependencies": {
5917
  "esbuild": "^0.18.10",
@@ -5987,12 +5977,12 @@
5987
  }
5988
  },
5989
  "node_modules/vitefu": {
5990
- "version": "0.2.4",
5991
- "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-0.2.4.tgz",
5992
- "integrity": "sha512-fanAXjSaf9xXtOOeno8wZXIhgia+CZury481LsDaV++lSvcU2R9Ch2bPh3PYFyoHW+w9LqAeYRISVQjUIew14g==",
5993
  "dev": true,
5994
  "peerDependencies": {
5995
- "vite": "^3.0.0 || ^4.0.0"
5996
  },
5997
  "peerDependenciesMeta": {
5998
  "vite": {
@@ -6078,18 +6068,6 @@
6078
  }
6079
  }
6080
  },
6081
- "node_modules/vitest/node_modules/magic-string": {
6082
- "version": "0.30.3",
6083
- "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.3.tgz",
6084
- "integrity": "sha512-B7xGbll2fG/VjP+SWg4sX3JynwIU0mjoTc6MPpKNuIvftk6u6vqhDnk1R80b8C2GBR6ywqy+1DcKBrevBg+bmw==",
6085
- "dev": true,
6086
- "dependencies": {
6087
- "@jridgewell/sourcemap-codec": "^1.4.15"
6088
- },
6089
- "engines": {
6090
- "node": ">=12"
6091
- }
6092
- },
6093
  "node_modules/w3c-xmlserializer": {
6094
  "version": "4.0.0",
6095
  "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz",
@@ -6206,9 +6184,9 @@
6206
  "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
6207
  },
6208
  "node_modules/ws": {
6209
- "version": "8.14.1",
6210
- "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.1.tgz",
6211
- "integrity": "sha512-4OOseMUq8AzRBI/7SLMUwO+FEDnguetSk7KMb1sHwvF2w2Wv5Hoj0nlifx8vtGsftE/jWHojPy8sMMzYLJ2G/A==",
6212
  "engines": {
6213
  "node": ">=10.0.0"
6214
  },
@@ -6265,9 +6243,9 @@
6265
  }
6266
  },
6267
  "node_modules/zod": {
6268
- "version": "3.22.2",
6269
- "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.2.tgz",
6270
- "integrity": "sha512-wvWkphh5WQsJbVk1tbx1l1Ly4yg+XecD+Mq280uBGt9wa5BKSWf4Mhp6GmrkPixhMxmabYY7RbzlwVP32pbGCg==",
6271
  "funding": {
6272
  "url": "https://github.com/sponsors/colinhacks"
6273
  }
 
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/hub": "^0.5.1",
12
  "@huggingface/inference": "^2.2.0",
 
27
  "save": "^2.9.0",
28
  "serpapi": "^1.1.1",
29
  "svelte-device-info": "^1.0.0",
30
+ "svelte-overlay": "^1.4.1",
31
  "tailwind-scrollbar": "^3.0.0",
32
  "tailwindcss": "^3.3.1",
33
  "urijs": "^1.19.11",
 
54
  "prettier-plugin-tailwindcss": "^0.2.7",
55
  "svelte": "^3.58.0",
56
  "svelte-check": "^3.2.0",
57
+ "svelte-mui": "^0.5.8",
58
  "tslib": "^2.4.1",
59
  "typescript": "^4.9.3",
60
  "unplugin-icons": "^0.16.1",
 
105
  }
106
  },
107
  "node_modules/@babel/runtime": {
108
+ "version": "7.23.2",
109
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.2.tgz",
110
+ "integrity": "sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg==",
111
  "dependencies": {
112
  "regenerator-runtime": "^0.14.0"
113
  },
 
483
  }
484
  },
485
  "node_modules/@eslint-community/regexpp": {
486
+ "version": "4.9.1",
487
+ "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.9.1.tgz",
488
+ "integrity": "sha512-Y27x+MBLjXa+0JWDhykM3+JE+il3kHKAEqabfEWq3SDhZjLYb6/BHL/JKFnH3fe207JaXkyDo685Oc2Glt6ifA==",
489
  "dev": true,
490
  "engines": {
491
  "node": "^12.0.0 || ^14.0.0 || >=16.0.0"
 
515
  }
516
  },
517
  "node_modules/@eslint/js": {
518
+ "version": "8.52.0",
519
+ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.52.0.tgz",
520
+ "integrity": "sha512-mjZVbpaeMZludF2fsWLD0Z9gCref1Tk4i9+wddjRvpUNqqcndPkBD09N/Mapey0b3jaXbLm2kICwFv2E64QinA==",
521
  "dev": true,
522
  "engines": {
523
  "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
524
  }
525
  },
526
+ "node_modules/@fastify/busboy": {
527
+ "version": "2.0.0",
528
+ "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.0.0.tgz",
529
+ "integrity": "sha512-JUFJad5lv7jxj926GPgymrWQxxjPYuJNiNjNMzqT+HiuP6Vl3dk5xzG+8sTX96np0ZAluvaMzPsjhHZ5rNuNQQ==",
530
+ "engines": {
531
+ "node": ">=14"
532
+ }
533
+ },
534
  "node_modules/@huggingface/hub": {
535
  "version": "0.5.1",
536
  "resolved": "https://registry.npmjs.org/@huggingface/hub/-/hub-0.5.1.tgz",
 
543
  }
544
  },
545
  "node_modules/@huggingface/inference": {
546
+ "version": "2.6.4",
547
+ "resolved": "https://registry.npmjs.org/@huggingface/inference/-/inference-2.6.4.tgz",
548
+ "integrity": "sha512-Xna7arltBSBoKaH3diGi3sYvkExgJMd/pF4T6vl2YbmDccbr1G/X5EPZ2048p+YgrJYG1jTYFCtY6Dr3HvJaow==",
549
  "engines": {
550
  "node": ">=18"
551
  }
552
  },
553
  "node_modules/@humanwhocodes/config-array": {
554
+ "version": "0.11.13",
555
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz",
556
+ "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==",
557
  "dev": true,
558
  "dependencies": {
559
+ "@humanwhocodes/object-schema": "^2.0.1",
560
  "debug": "^4.1.1",
561
  "minimatch": "^3.0.5"
562
  },
 
578
  }
579
  },
580
  "node_modules/@humanwhocodes/object-schema": {
581
+ "version": "2.0.1",
582
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz",
583
+ "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==",
584
  "dev": true
585
  },
586
  "node_modules/@iconify-json/carbon": {
 
608
  "dev": true
609
  },
610
  "node_modules/@iconify/utils": {
611
+ "version": "2.1.11",
612
+ "resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-2.1.11.tgz",
613
+ "integrity": "sha512-M/w3PkN8zQYXi8N6qK/KhnYMfEbbb6Sk8RZVn8g+Pmmu5ybw177RpsaGwpziyHeUsu4etrexYSWq3rwnIqzYCg==",
614
  "dev": true,
615
  "dependencies": {
616
  "@antfu/install-pkg": "^0.1.1",
 
656
  "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg=="
657
  },
658
  "node_modules/@jridgewell/trace-mapping": {
659
+ "version": "0.3.20",
660
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz",
661
+ "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==",
662
  "dependencies": {
663
  "@jridgewell/resolve-uri": "^3.1.0",
664
  "@jridgewell/sourcemap-codec": "^1.4.14"
 
757
  "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw=="
758
  },
759
  "node_modules/@rollup/plugin-commonjs": {
760
+ "version": "25.0.7",
761
+ "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-25.0.7.tgz",
762
+ "integrity": "sha512-nEvcR+LRjEjsaSsc4x3XZfCCvZIaSMenZu/OiwOKGN2UhQpAYI7ru7czFvyWbErlpoGjnSX3D5Ch5FcMA3kRWQ==",
763
  "dev": true,
764
  "dependencies": {
765
  "@rollup/pluginutils": "^5.0.1",
 
767
  "estree-walker": "^2.0.2",
768
  "glob": "^8.0.3",
769
  "is-reference": "1.2.1",
770
+ "magic-string": "^0.30.3"
771
  },
772
  "engines": {
773
  "node": ">=14.0.0"
774
  },
775
  "peerDependencies": {
776
+ "rollup": "^2.68.0||^3.0.0||^4.0.0"
777
  },
778
  "peerDependenciesMeta": {
779
  "rollup": {
 
782
  }
783
  },
784
  "node_modules/@rollup/plugin-json": {
785
+ "version": "6.0.1",
786
+ "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-6.0.1.tgz",
787
+ "integrity": "sha512-RgVfl5hWMkxN1h/uZj8FVESvPuBJ/uf6ly6GTj0GONnkfoBN5KC0MSz+PN2OLDgYXMhtG0mWpTrkiOjoxAIevw==",
788
  "dev": true,
789
  "dependencies": {
790
  "@rollup/pluginutils": "^5.0.1"
 
793
  "node": ">=14.0.0"
794
  },
795
  "peerDependencies": {
796
+ "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
797
  },
798
  "peerDependenciesMeta": {
799
  "rollup": {
 
802
  }
803
  },
804
  "node_modules/@rollup/plugin-node-resolve": {
805
+ "version": "15.2.3",
806
+ "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.2.3.tgz",
807
+ "integrity": "sha512-j/lym8nf5E21LwBT4Df1VD6hRO2L2iwUeUmP7litikRsVp1H6NWx20NEp0Y7su+7XGc476GnXXc4kFeZNGmaSQ==",
808
  "dev": true,
809
  "dependencies": {
810
  "@rollup/pluginutils": "^5.0.1",
 
818
  "node": ">=14.0.0"
819
  },
820
  "peerDependencies": {
821
+ "rollup": "^2.78.0||^3.0.0||^4.0.0"
822
  },
823
  "peerDependenciesMeta": {
824
  "rollup": {
 
827
  }
828
  },
829
  "node_modules/@rollup/pluginutils": {
830
+ "version": "5.0.5",
831
+ "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.0.5.tgz",
832
+ "integrity": "sha512-6aEYR910NyP73oHiJglti74iRyOwgFU4x3meH/H8OJx6Ry0j6cOVZ5X/wTvub7G7Ao6qaHBEaNsV3GLJkSsF+Q==",
833
  "dev": true,
834
  "dependencies": {
835
  "@types/estree": "^1.0.0",
 
840
  "node": ">=14.0.0"
841
  },
842
  "peerDependencies": {
843
+ "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
844
  },
845
  "peerDependenciesMeta": {
846
  "rollup": {
 
864
  }
865
  },
866
  "node_modules/@sveltejs/kit": {
867
+ "version": "1.27.0",
868
+ "resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-1.27.0.tgz",
869
+ "integrity": "sha512-a1wPIq2uO3RsTmV+KbA4venOgCJDbfHTXFe+g7eJR3N8l46DSuulUONJ1qnk2EnZWYC1Uj3Wbp3US0WFocIzXg==",
870
  "dev": true,
871
  "hasInstallScript": true,
872
  "dependencies": {
 
877
  "esm-env": "^1.0.0",
878
  "kleur": "^4.1.5",
879
  "magic-string": "^0.30.0",
880
+ "mrmime": "^1.0.1",
881
  "sade": "^1.8.1",
882
  "set-cookie-parser": "^2.6.0",
883
  "sirv": "^2.0.2",
884
  "tiny-glob": "^0.2.9",
885
+ "undici": "~5.26.2"
886
  },
887
  "bin": {
888
  "svelte-kit": "svelte-kit.js"
 
895
  "vite": "^4.0.0"
896
  }
897
  },
 
 
 
 
 
 
 
 
 
 
 
 
898
  "node_modules/@sveltejs/vite-plugin-svelte": {
899
  "version": "2.4.6",
900
  "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-2.4.6.tgz",
 
934
  "vite": "^4.0.0"
935
  }
936
  },
 
 
 
 
 
 
 
 
 
 
 
 
937
  "node_modules/@tailwindcss/typography": {
938
  "version": "0.5.10",
939
  "resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.10.tgz",
 
958
  }
959
  },
960
  "node_modules/@types/chai": {
961
+ "version": "4.3.9",
962
+ "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.9.tgz",
963
+ "integrity": "sha512-69TtiDzu0bcmKQv3yg1Zx409/Kd7r0b5F1PfpYJfSHzLGtB53547V4u+9iqKYsTu/O2ai6KTb0TInNpvuQ3qmg==",
964
  "dev": true
965
  },
966
  "node_modules/@types/chai-subset": {
967
+ "version": "1.3.4",
968
+ "resolved": "https://registry.npmjs.org/@types/chai-subset/-/chai-subset-1.3.4.tgz",
969
+ "integrity": "sha512-CCWNXrJYSUIojZ1149ksLl3AN9cmZ5djf+yUoVVV+NuYrtydItQVlL2ZDqyC6M6O9LWRnVf8yYDxbXHO2TfQZg==",
970
  "dev": true,
971
  "dependencies": {
972
  "@types/chai": "*"
973
  }
974
  },
975
  "node_modules/@types/cookie": {
976
+ "version": "0.5.3",
977
+ "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.5.3.tgz",
978
+ "integrity": "sha512-SLg07AS9z1Ab2LU+QxzU8RCmzsja80ywjf/t5oqw+4NSH20gIGlhLOrBDm1L3PBWzPa4+wkgFQVZAjE6Ioj2ug==",
979
  "dev": true
980
  },
981
  "node_modules/@types/estree": {
982
+ "version": "1.0.3",
983
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.3.tgz",
984
+ "integrity": "sha512-CS2rOaoQ/eAgAfcTfq6amKG7bsN+EMcgGY4FAFQdvSj2y1ixvOZTUA9mOtCai7E1SYu283XNw7urKK30nP3wkQ==",
985
  "dev": true
986
  },
987
  "node_modules/@types/jsdom": {
988
+ "version": "21.1.4",
989
+ "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-21.1.4.tgz",
990
+ "integrity": "sha512-NzAMLEV0KQ4cBaDx3Ls8VfJUElyDUm1xrtYRmcMK0gF8L5xYbujFVaQlJ50yinQ/d47j2rEP1XUzkiYrw4YRFA==",
991
  "dev": true,
992
  "dependencies": {
993
  "@types/node": "*",
 
996
  }
997
  },
998
  "node_modules/@types/json-schema": {
999
+ "version": "7.0.14",
1000
+ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.14.tgz",
1001
+ "integrity": "sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw==",
1002
  "dev": true
1003
  },
1004
  "node_modules/@types/long": {
 
1007
  "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA=="
1008
  },
1009
  "node_modules/@types/marked": {
1010
+ "version": "4.3.2",
1011
+ "resolved": "https://registry.npmjs.org/@types/marked/-/marked-4.3.2.tgz",
1012
+ "integrity": "sha512-a79Yc3TOk6dGdituy8hmTTJXjOkZ7zsFYV10L337ttq/rec8lRMDBpV7fL3uLx6TgbFCa5DU/h8FmIBQPSbU0w==",
1013
  "dev": true
1014
  },
1015
  "node_modules/@types/node": {
1016
+ "version": "20.8.8",
1017
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.8.tgz",
1018
+ "integrity": "sha512-YRsdVxq6OaLfmR9Hy816IMp33xOBjfyOgUd77ehqg96CFywxAPbDbXvAsuN2KVg2HOT8Eh6uAfU+l4WffwPVrQ==",
1019
+ "dependencies": {
1020
+ "undici-types": "~5.25.1"
1021
+ }
1022
  },
1023
  "node_modules/@types/node-int64": {
1024
+ "version": "0.4.31",
1025
+ "resolved": "https://registry.npmjs.org/@types/node-int64/-/node-int64-0.4.31.tgz",
1026
+ "integrity": "sha512-nkuJrHfmjsE3oJzbkygfRYX1tDMhBxj5LTZzP/GIGbBze6QXM6Juz6vxh9K8Y5OJODqAciY6gxdYNRqNgxsaEA==",
1027
  "dev": true,
1028
  "dependencies": {
1029
  "@types/node": "*"
1030
  }
1031
  },
1032
  "node_modules/@types/parquetjs": {
1033
+ "version": "0.10.5",
1034
+ "resolved": "https://registry.npmjs.org/@types/parquetjs/-/parquetjs-0.10.5.tgz",
1035
+ "integrity": "sha512-3qhqy+6LRCtr9gkc9AchsGG/31kd4SZOH++sUGEhFXHvbzBEWqvFRLsh4QGpbv6JQpgpF3z0jVKtA3YHm9ylig==",
1036
  "dev": true,
1037
  "dependencies": {
1038
  "@types/node-int64": "*"
1039
  }
1040
  },
1041
  "node_modules/@types/pug": {
1042
+ "version": "2.0.8",
1043
+ "resolved": "https://registry.npmjs.org/@types/pug/-/pug-2.0.8.tgz",
1044
+ "integrity": "sha512-QzhsZ1dMGyJbn/D9V80zp4GIA4J4rfAjCCxc3MP+new0E8dyVdSkR735Lx+n3LIaHNFcjHL5+TbziccuT+fdoQ==",
1045
  "dev": true
1046
  },
1047
  "node_modules/@types/resolve": {
 
1051
  "dev": true
1052
  },
1053
  "node_modules/@types/semver": {
1054
+ "version": "7.5.4",
1055
+ "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.4.tgz",
1056
+ "integrity": "sha512-MMzuxN3GdFwskAnb6fz0orFvhfqi752yjaXylr0Rp4oDg5H0Zn1IuyRhDVvYOwAXoJirx2xuS16I3WjxnAIHiQ==",
1057
  "dev": true
1058
  },
1059
  "node_modules/@types/tough-cookie": {
1060
+ "version": "4.0.4",
1061
+ "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.4.tgz",
1062
+ "integrity": "sha512-95Sfz4nvMAb0Nl9DTxN3j64adfwfbBPEYq14VN7zT5J5O2M9V6iZMIIQU1U+pJyl9agHYHNCqhCXgyEtIRRa5A==",
1063
  "dev": true
1064
  },
1065
  "node_modules/@types/urijs": {
1066
+ "version": "1.19.22",
1067
+ "resolved": "https://registry.npmjs.org/@types/urijs/-/urijs-1.19.22.tgz",
1068
+ "integrity": "sha512-qnYBwfN7O/+i6E1Kr8JaCKsrCLpRCiQ1XxkSxNIYuJ/5Aagt0+HlMX78DJMUrNzDULMz0eu2gcprlxJaDtACOw==",
1069
  "dev": true
1070
  },
1071
  "node_modules/@typescript-eslint/eslint-plugin": {
 
1256
  "url": "https://opencollective.com/typescript-eslint"
1257
  }
1258
  },
1259
+ "node_modules/@ungap/structured-clone": {
1260
+ "version": "1.2.0",
1261
+ "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz",
1262
+ "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==",
1263
+ "dev": true
1264
+ },
1265
  "node_modules/@vitest/expect": {
1266
  "version": "0.31.4",
1267
  "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.31.4.tgz",
 
1332
  "url": "https://opencollective.com/vitest"
1333
  }
1334
  },
 
 
 
 
 
 
 
 
 
 
 
 
1335
  "node_modules/@vitest/spy": {
1336
  "version": "0.31.4",
1337
  "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-0.31.4.tgz",
 
1359
  }
1360
  },
1361
  "node_modules/@xenova/transformers": {
1362
+ "version": "2.7.0",
1363
+ "resolved": "https://registry.npmjs.org/@xenova/transformers/-/transformers-2.7.0.tgz",
1364
+ "integrity": "sha512-py5RqZt9lL/FFUT5X6St+TOSBoVaEmDETI98lK9ApEOvlWeX4bTS2nMQDFe3nFMpv24+wllhmPw2Www/f/ubJA==",
1365
  "dependencies": {
1366
  "onnxruntime-web": "1.14.0",
1367
  "sharp": "^0.32.0"
 
1513
  "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
1514
  },
1515
  "node_modules/autoprefixer": {
1516
+ "version": "10.4.16",
1517
+ "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.16.tgz",
1518
+ "integrity": "sha512-7vd3UC6xKp0HLfua5IjZlcXvGAGy7cBAXTg2lyQ/8WpNhd6SiZ8Be+xm3FyBSYJx5GKcpRCzBh7RH4/0dnY+uQ==",
1519
  "funding": [
1520
  {
1521
  "type": "opencollective",
 
1532
  ],
1533
  "dependencies": {
1534
  "browserslist": "^4.21.10",
1535
+ "caniuse-lite": "^1.0.30001538",
1536
+ "fraction.js": "^4.3.6",
1537
  "normalize-range": "^0.1.2",
1538
  "picocolors": "^1.0.0",
1539
  "postcss-value-parser": "^4.2.0"
 
1641
  }
1642
  },
1643
  "node_modules/browserslist": {
1644
+ "version": "4.22.1",
1645
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.1.tgz",
1646
+ "integrity": "sha512-FEVc202+2iuClEhZhrWy6ZiAcRLvNMyYcxZ8raemul1DYVOVdFsbqckWLdsixQZCpJlwe77Z3UTalE7jsjnKfQ==",
1647
  "funding": [
1648
  {
1649
  "type": "opencollective",
 
1659
  }
1660
  ],
1661
  "dependencies": {
1662
+ "caniuse-lite": "^1.0.30001541",
1663
+ "electron-to-chromium": "^1.4.535",
1664
  "node-releases": "^2.0.13",
1665
+ "update-browserslist-db": "^1.0.13"
1666
  },
1667
  "bin": {
1668
  "browserslist": "cli.js"
 
1671
  "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
1672
  }
1673
  },
1674
+ "node_modules/bson": {
1675
+ "version": "1.1.6",
1676
+ "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.6.tgz",
1677
+ "integrity": "sha512-EvVNVeGo4tHxwi8L6bPj3y3itEvStdwvvlojVxxbyYfoaxJ6keLgrTuKdyfEAszFK+H3olzBuafE0yoh0D1gdg==",
1678
+ "engines": {
1679
+ "node": ">=0.6.19"
1680
+ }
1681
+ },
1682
  "node_modules/buffer": {
1683
  "version": "5.7.1",
1684
  "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
 
1723
  "url": "https://github.com/sponsors/sindresorhus"
1724
  }
1725
  },
 
 
 
 
 
 
 
 
 
 
 
1726
  "node_modules/cac": {
1727
  "version": "6.7.14",
1728
  "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz",
 
1750
  }
1751
  },
1752
  "node_modules/caniuse-lite": {
1753
+ "version": "1.0.30001553",
1754
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001553.tgz",
1755
+ "integrity": "sha512-N0ttd6TrFfuqKNi+pMgWJTb9qrdJu4JSpgPFLe/lrD19ugC6fZgF0pUewRowDwzdDnb9V41mFcdlYgl/PyKf4A==",
1756
  "funding": [
1757
  {
1758
  "type": "opencollective",
 
1769
  ]
1770
  },
1771
  "node_modules/chai": {
1772
+ "version": "4.3.10",
1773
+ "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.10.tgz",
1774
+ "integrity": "sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==",
1775
  "dev": true,
1776
  "dependencies": {
1777
  "assertion-error": "^1.1.0",
1778
+ "check-error": "^1.0.3",
1779
+ "deep-eql": "^4.1.3",
1780
+ "get-func-name": "^2.0.2",
1781
+ "loupe": "^2.3.6",
1782
  "pathval": "^1.1.1",
1783
+ "type-detect": "^4.0.8"
1784
  },
1785
  "engines": {
1786
  "node": ">=4"
 
1803
  }
1804
  },
1805
  "node_modules/check-error": {
1806
+ "version": "1.0.3",
1807
+ "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz",
1808
+ "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==",
1809
  "dev": true,
1810
+ "dependencies": {
1811
+ "get-func-name": "^2.0.2"
1812
+ },
1813
  "engines": {
1814
  "node": "*"
1815
  }
 
2198
  "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg=="
2199
  },
2200
  "node_modules/electron-to-chromium": {
2201
+ "version": "1.4.565",
2202
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.565.tgz",
2203
+ "integrity": "sha512-XbMoT6yIvg2xzcbs5hCADi0dXBh4//En3oFXmtPX+jiyyiCTiM9DGFT2SLottjpEs9Z8Mh8SqahbR96MaHfuSg=="
2204
  },
2205
  "node_modules/end-of-stream": {
2206
  "version": "1.4.4",
 
2285
  }
2286
  },
2287
  "node_modules/eslint": {
2288
+ "version": "8.52.0",
2289
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.52.0.tgz",
2290
+ "integrity": "sha512-zh/JHnaixqHZsolRB/w9/02akBk9EPrOs9JwcTP2ek7yL5bVvXuRariiaAjjoJ5DvuwQ1WAE/HsMz+w17YgBCg==",
2291
  "dev": true,
2292
  "dependencies": {
2293
  "@eslint-community/eslint-utils": "^4.2.0",
2294
  "@eslint-community/regexpp": "^4.6.1",
2295
  "@eslint/eslintrc": "^2.1.2",
2296
+ "@eslint/js": "8.52.0",
2297
+ "@humanwhocodes/config-array": "^0.11.13",
2298
  "@humanwhocodes/module-importer": "^1.0.1",
2299
  "@nodelib/fs.walk": "^1.2.8",
2300
+ "@ungap/structured-clone": "^1.2.0",
2301
  "ajv": "^6.12.4",
2302
  "chalk": "^4.0.0",
2303
  "cross-spawn": "^7.0.2",
 
2352
  }
2353
  },
2354
  "node_modules/eslint-plugin-svelte": {
2355
+ "version": "2.34.0",
2356
+ "resolved": "https://registry.npmjs.org/eslint-plugin-svelte/-/eslint-plugin-svelte-2.34.0.tgz",
2357
+ "integrity": "sha512-4RYUgNai7wr0v+T/kljMiYSjC/oqwgq5i+cPppawryAayj4C7WK1ixFlWCGmNmBppnoKCl4iA4ZPzPtlHcb4CA==",
2358
  "dev": true,
2359
  "dependencies": {
2360
  "@eslint-community/eslint-utils": "^4.2.0",
 
2685
  }
2686
  },
2687
  "node_modules/flat-cache": {
2688
+ "version": "3.1.1",
2689
+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.1.tgz",
2690
+ "integrity": "sha512-/qM2b3LUIaIgviBQovTLvijfyOQXPtSRnRK26ksj2J7rzPIecePUIpJsZ4T02Qg+xiAEKIs5K8dsHEd+VaKa/Q==",
2691
  "dev": true,
2692
  "dependencies": {
2693
+ "flatted": "^3.2.9",
2694
  "keyv": "^4.5.3",
2695
  "rimraf": "^3.0.2"
2696
  },
 
2723
  }
2724
  },
2725
  "node_modules/fraction.js": {
2726
+ "version": "4.3.7",
2727
+ "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz",
2728
+ "integrity": "sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==",
2729
  "engines": {
2730
  "node": "*"
2731
  },
 
2763
  }
2764
  },
2765
  "node_modules/function-bind": {
2766
+ "version": "1.1.2",
2767
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
2768
+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
2769
+ "funding": {
2770
+ "url": "https://github.com/sponsors/ljharb"
2771
+ }
2772
  },
2773
  "node_modules/get-func-name": {
2774
  "version": "2.0.2",
 
2848
  }
2849
  },
2850
  "node_modules/globals": {
2851
+ "version": "13.23.0",
2852
+ "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz",
2853
+ "integrity": "sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==",
2854
  "dev": true,
2855
  "dependencies": {
2856
  "type-fest": "^0.20.2"
 
2931
  "uglify-js": "^3.1.4"
2932
  }
2933
  },
 
 
 
 
 
 
 
 
 
 
 
2934
  "node_modules/has-flag": {
2935
  "version": "4.0.0",
2936
  "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
 
2941
  }
2942
  },
2943
  "node_modules/hash-wasm": {
2944
+ "version": "4.10.0",
2945
+ "resolved": "https://registry.npmjs.org/hash-wasm/-/hash-wasm-4.10.0.tgz",
2946
+ "integrity": "sha512-a0NjBNWjavvMalm/pPSEJ00MPDjRG8rv9D5BK7dBQTLGwAOVWqnTEUggaYs5szATB5UK5ULeIQr7QJXbczAZYA=="
2947
+ },
2948
+ "node_modules/hasown": {
2949
+ "version": "2.0.0",
2950
+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz",
2951
+ "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==",
2952
+ "dependencies": {
2953
+ "function-bind": "^1.1.2"
2954
+ },
2955
+ "engines": {
2956
+ "node": ">= 0.4"
2957
+ }
2958
  },
2959
  "node_modules/highlight.js": {
2960
+ "version": "11.9.0",
2961
+ "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.9.0.tgz",
2962
+ "integrity": "sha512-fJ7cW7fQGCYAkgv4CPfwFHrfd/cLS4Hau96JuJ+ZTOWhjnhoeN1ub1tFmALm/+lW5z4WCAuAV9bm05AP0mS6Gw==",
2963
  "engines": {
2964
  "node": ">=12.0.0"
2965
  }
 
3129
  }
3130
  },
3131
  "node_modules/is-core-module": {
3132
+ "version": "2.13.1",
3133
+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz",
3134
+ "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==",
3135
  "dependencies": {
3136
+ "hasown": "^2.0.0"
3137
  },
3138
  "funding": {
3139
  "url": "https://github.com/sponsors/ljharb"
 
3222
  }
3223
  },
3224
  "node_modules/jose": {
3225
+ "version": "4.15.4",
3226
+ "resolved": "https://registry.npmjs.org/jose/-/jose-4.15.4.tgz",
3227
+ "integrity": "sha512-W+oqK4H+r5sITxfxpSU+MMdr/YSWGvgZMQDIsNoBDGGy4i7GBPTtvFKibQzW06n3U3TqHjhvBJsirShsEJ6eeQ==",
3228
  "funding": {
3229
  "url": "https://github.com/sponsors/panva"
3230
  }
 
3316
  "dev": true
3317
  },
3318
  "node_modules/keyv": {
3319
+ "version": "4.5.4",
3320
+ "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
3321
+ "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==",
3322
  "dev": true,
3323
  "dependencies": {
3324
  "json-buffer": "3.0.1"
 
3433
  "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA=="
3434
  },
3435
  "node_modules/loupe": {
3436
+ "version": "2.3.7",
3437
+ "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz",
3438
+ "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==",
3439
  "dev": true,
3440
  "dependencies": {
3441
+ "get-func-name": "^2.0.1"
3442
  }
3443
  },
3444
  "node_modules/lru-cache": {
 
3463
  }
3464
  },
3465
  "node_modules/magic-string": {
3466
+ "version": "0.30.5",
3467
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.5.tgz",
3468
+ "integrity": "sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==",
3469
  "dev": true,
3470
  "dependencies": {
3471
+ "@jridgewell/sourcemap-codec": "^1.4.15"
3472
  },
3473
  "engines": {
3474
  "node": ">=12"
 
3528
  "node": ">=8.6"
3529
  }
3530
  },
 
 
 
 
 
 
 
 
 
 
 
 
3531
  "node_modules/mime-db": {
3532
  "version": "1.52.0",
3533
  "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
 
3577
  }
3578
  },
3579
  "node_modules/mingo": {
3580
+ "version": "6.4.8",
3581
+ "resolved": "https://registry.npmjs.org/mingo/-/mingo-6.4.8.tgz",
3582
+ "integrity": "sha512-mu7C7byBSpGGj6NllAKXLRr7L8gsZB6Yc4g4R22DDpLryvnH0tK+/X0BorMf3aXAr0pbmaG2O/2in9fUjV8Y8w=="
3583
  },
3584
  "node_modules/minimatch": {
3585
  "version": "3.1.2",
 
3702
  "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw=="
3703
  },
3704
  "node_modules/node-abi": {
3705
+ "version": "3.51.0",
3706
+ "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.51.0.tgz",
3707
+ "integrity": "sha512-SQkEP4hmNWjlniS5zdnfIXTk1x7Ome85RDzHlTbBtzE97Gfwz/Ipw4v/Ryk20DWIy3yCNVLVlGKApCnmvYoJbA==",
3708
  "dependencies": {
3709
  "semver": "^7.3.5"
3710
  },
 
3856
  }
3857
  },
3858
  "node_modules/openid-client": {
3859
+ "version": "5.6.1",
3860
+ "resolved": "https://registry.npmjs.org/openid-client/-/openid-client-5.6.1.tgz",
3861
+ "integrity": "sha512-PtrWsY+dXg6y8mtMPyL/namZSYVz8pjXz3yJiBNZsEdCnu9miHLB4ELVC85WvneMKo2Rg62Ay7NkuCpM0bgiLQ==",
3862
  "dependencies": {
3863
+ "jose": "^4.15.1",
3864
  "lru-cache": "^6.0.0",
3865
  "object-hash": "^2.2.0",
3866
  "oidc-token-hash": "^5.0.3"
 
3948
  "lzo": "^0.4.0"
3949
  }
3950
  },
 
 
 
 
 
 
 
 
3951
  "node_modules/parse5": {
3952
  "version": "7.1.2",
3953
  "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz",
 
4071
  "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg=="
4072
  },
4073
  "node_modules/postcss": {
4074
+ "version": "8.4.31",
4075
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",
4076
+ "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==",
4077
  "funding": [
4078
  {
4079
  "type": "opencollective",
 
4207
  }
4208
  },
4209
  "node_modules/postcss-scss": {
4210
+ "version": "4.0.9",
4211
+ "resolved": "https://registry.npmjs.org/postcss-scss/-/postcss-scss-4.0.9.tgz",
4212
+ "integrity": "sha512-AjKOeiwAitL/MXxQW2DliT28EKukvvbEWx3LBmJIRN8KfBGZbRTxNYW0kSqi1COiTZ57nZ9NW06S6ux//N1c9A==",
4213
  "dev": true,
4214
  "funding": [
4215
  {
 
4604
  "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ=="
4605
  },
4606
  "node_modules/resolve": {
4607
+ "version": "1.22.8",
4608
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
4609
+ "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==",
4610
  "dependencies": {
4611
  "is-core-module": "^2.13.0",
4612
  "path-parse": "^1.0.7",
 
4673
  }
4674
  },
4675
  "node_modules/rollup": {
4676
+ "version": "3.29.4",
4677
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz",
4678
+ "integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==",
4679
  "dev": true,
4680
  "bin": {
4681
  "rollup": "dist/bin/rollup"
 
5042
  "through": "~2.3.4"
5043
  }
5044
  },
 
 
 
 
 
 
 
 
5045
  "node_modules/streamx": {
5046
  "version": "2.15.1",
5047
  "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.1.tgz",
 
5189
  }
5190
  },
5191
  "node_modules/svelte-check": {
5192
+ "version": "3.5.2",
5193
+ "resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-3.5.2.tgz",
5194
+ "integrity": "sha512-5a/YWbiH4c+AqAUP+0VneiV5bP8YOk9JL3jwvN+k2PEPLgpu85bjQc5eE67+eIZBBwUEJzmO3I92OqKcqbp3fw==",
5195
  "dev": true,
5196
  "dependencies": {
5197
  "@jridgewell/trace-mapping": "^0.3.17",
 
5229
  "integrity": "sha512-KL5/fXmhKVtM4ogoj9xrFTPjoWtTy/a8VFA5kEooIJiL48+aETCG2/owMvrsoyBRybUkzVf4ixkj+DncpNWMqw=="
5230
  },
5231
  "node_modules/svelte-eslint-parser": {
5232
+ "version": "0.33.1",
5233
+ "resolved": "https://registry.npmjs.org/svelte-eslint-parser/-/svelte-eslint-parser-0.33.1.tgz",
5234
+ "integrity": "sha512-vo7xPGTlKBGdLH8T5L64FipvTrqv3OQRx9d2z5X05KKZDlF4rQk8KViZO4flKERY+5BiVdOh7zZ7JGJWo5P0uA==",
5235
  "dev": true,
5236
  "dependencies": {
5237
  "eslint-scope": "^7.0.0",
5238
  "eslint-visitor-keys": "^3.0.0",
5239
  "espree": "^9.0.0",
5240
+ "postcss": "^8.4.29",
5241
+ "postcss-scss": "^4.0.8"
5242
  },
5243
  "engines": {
5244
  "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
 
5292
  "svelte": "^3.19.0 || ^4.0.0"
5293
  }
5294
  },
5295
+ "node_modules/svelte-mui": {
5296
+ "version": "0.5.8",
5297
+ "resolved": "https://registry.npmjs.org/svelte-mui/-/svelte-mui-0.5.8.tgz",
5298
+ "integrity": "sha512-Qh1Z3rpk8PA0rCi8m2FynL6gyRJdBGNKQbyZms+Ywx+e3WLnKStUt3kWmEgwbn5NO1KJDQiq+wpmESegzFgARw==",
5299
+ "dev": true,
5300
+ "peerDependencies": {
5301
+ "svelte": "3.*"
5302
+ }
5303
+ },
5304
+ "node_modules/svelte-overlay": {
5305
+ "version": "1.4.1",
5306
+ "resolved": "https://registry.npmjs.org/svelte-overlay/-/svelte-overlay-1.4.1.tgz",
5307
+ "integrity": "sha512-HNtAvOeywwGNvIdeK4QpBa2IYhUNDSwMmwqpvb2XqAhscUT+R4RMEmRn9pEW5p/wmlcmJiiS8MGJ7ogUGFRS8w=="
5308
+ },
5309
  "node_modules/svelte-preprocess": {
5310
  "version": "5.0.4",
5311
  "resolved": "https://registry.npmjs.org/svelte-preprocess/-/svelte-preprocess-5.0.4.tgz",
 
5368
  }
5369
  }
5370
  },
5371
+ "node_modules/svelte-preprocess/node_modules/magic-string": {
5372
+ "version": "0.27.0",
5373
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.27.0.tgz",
5374
+ "integrity": "sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA==",
5375
+ "dev": true,
5376
+ "dependencies": {
5377
+ "@jridgewell/sourcemap-codec": "^1.4.13"
5378
+ },
5379
+ "engines": {
5380
+ "node": ">=12"
5381
+ }
5382
+ },
5383
  "node_modules/symbol-tree": {
5384
  "version": "3.2.4",
5385
  "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
 
5481
  }
5482
  },
5483
  "node_modules/tailwindcss/node_modules/yaml": {
5484
+ "version": "2.3.3",
5485
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.3.tgz",
5486
+ "integrity": "sha512-zw0VAJxgeZ6+++/su5AFoqBbZbrEakwu+X0M5HmcwUiBL7AzcuPKjj5we4xfQLp78LkEMpD0cOnUhmgOVy3KdQ==",
5487
  "engines": {
5488
  "node": ">= 14"
5489
  }
 
5586
  }
5587
  },
5588
  "node_modules/tinyspy": {
5589
+ "version": "2.2.0",
5590
+ "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.2.0.tgz",
5591
+ "integrity": "sha512-d2eda04AN/cPOR89F7Xv5bK/jrQEhmcLFe6HFldoeO9AJtps+fqEnh486vnT/8y4bw38pSyxDcTCAq+Ks2aJTg==",
5592
  "dev": true,
5593
  "engines": {
5594
  "node": ">=14.0.0"
 
5729
  }
5730
  },
5731
  "node_modules/ufo": {
5732
+ "version": "1.3.1",
5733
+ "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.3.1.tgz",
5734
+ "integrity": "sha512-uY/99gMLIOlJPwATcMVYfqDSxUR9//AUcgZMzwfSTJPDKzA1S8mX4VLqa+fiAtveraQUBCz4FFcwVZBGbwBXIw==",
5735
  "dev": true
5736
  },
5737
  "node_modules/uglify-js": {
 
5747
  }
5748
  },
5749
  "node_modules/undici": {
5750
+ "version": "5.26.5",
5751
+ "resolved": "https://registry.npmjs.org/undici/-/undici-5.26.5.tgz",
5752
+ "integrity": "sha512-cSb4bPFd5qgR7qr2jYAi0hlX9n5YKK2ONKkLFkxl+v/9BvC0sOpZjBHDBSXc5lWAf5ty9oZdRXytBIHzgUcerw==",
5753
  "dependencies": {
5754
+ "@fastify/busboy": "^2.0.0"
5755
  },
5756
  "engines": {
5757
  "node": ">=14.0"
5758
  }
5759
  },
5760
+ "node_modules/undici-types": {
5761
+ "version": "5.25.3",
5762
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.25.3.tgz",
5763
+ "integrity": "sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA=="
5764
+ },
5765
  "node_modules/universalify": {
5766
  "version": "0.2.0",
5767
  "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz",
 
5825
  }
5826
  },
5827
  "node_modules/update-browserslist-db": {
5828
+ "version": "1.0.13",
5829
+ "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz",
5830
+ "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==",
5831
  "funding": [
5832
  {
5833
  "type": "opencollective",
 
5899
  "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow=="
5900
  },
5901
  "node_modules/vite": {
5902
+ "version": "4.5.0",
5903
+ "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.0.tgz",
5904
+ "integrity": "sha512-ulr8rNLA6rkyFAlVWw2q5YJ91v098AFQ2R0PRFwPzREXOUJQPtFUG0t+/ZikhaOCDqFoDhN6/v8Sq0o4araFAw==",
5905
  "dev": true,
5906
  "dependencies": {
5907
  "esbuild": "^0.18.10",
 
5977
  }
5978
  },
5979
  "node_modules/vitefu": {
5980
+ "version": "0.2.5",
5981
+ "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-0.2.5.tgz",
5982
+ "integrity": "sha512-SgHtMLoqaeeGnd2evZ849ZbACbnwQCIwRH57t18FxcXoZop0uQu0uzlIhJBlF/eWVzuce0sHeqPcDo+evVcg8Q==",
5983
  "dev": true,
5984
  "peerDependencies": {
5985
+ "vite": "^3.0.0 || ^4.0.0 || ^5.0.0"
5986
  },
5987
  "peerDependenciesMeta": {
5988
  "vite": {
 
6068
  }
6069
  }
6070
  },
 
 
 
 
 
 
 
 
 
 
 
 
6071
  "node_modules/w3c-xmlserializer": {
6072
  "version": "4.0.0",
6073
  "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz",
 
6184
  "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
6185
  },
6186
  "node_modules/ws": {
6187
+ "version": "8.14.2",
6188
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.2.tgz",
6189
+ "integrity": "sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==",
6190
  "engines": {
6191
  "node": ">=10.0.0"
6192
  },
 
6243
  }
6244
  },
6245
  "node_modules/zod": {
6246
+ "version": "3.22.4",
6247
+ "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.4.tgz",
6248
+ "integrity": "sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==",
6249
  "funding": {
6250
  "url": "https://github.com/sponsors/colinhacks"
6251
  }
package.json CHANGED
@@ -1,10 +1,11 @@
1
  {
2
  "name": "chat-ui",
3
- "version": "0.0.8",
4
  "private": true,
5
  "packageManager": "npm@9.5.0",
6
  "scripts": {
7
  "dev": "vite dev",
 
8
  "build": "vite build",
9
  "preview": "vite preview",
10
  "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
@@ -33,6 +34,7 @@
33
  "prettier-plugin-tailwindcss": "^0.2.7",
34
  "svelte": "^3.58.0",
35
  "svelte-check": "^3.2.0",
 
36
  "tslib": "^2.4.1",
37
  "typescript": "^4.9.3",
38
  "unplugin-icons": "^0.16.1",
@@ -60,6 +62,7 @@
60
  "save": "^2.9.0",
61
  "serpapi": "^1.1.1",
62
  "svelte-device-info": "^1.0.0",
 
63
  "tailwind-scrollbar": "^3.0.0",
64
  "tailwindcss": "^3.3.1",
65
  "urijs": "^1.19.11",
 
1
  {
2
  "name": "chat-ui",
3
+ "version": "0.1.0",
4
  "private": true,
5
  "packageManager": "npm@9.5.0",
6
  "scripts": {
7
  "dev": "vite dev",
8
+ "dev_expose": "vite dev --host",
9
  "build": "vite build",
10
  "preview": "vite preview",
11
  "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
 
34
  "prettier-plugin-tailwindcss": "^0.2.7",
35
  "svelte": "^3.58.0",
36
  "svelte-check": "^3.2.0",
37
+ "svelte-mui": "^0.5.8",
38
  "tslib": "^2.4.1",
39
  "typescript": "^4.9.3",
40
  "unplugin-icons": "^0.16.1",
 
62
  "save": "^2.9.0",
63
  "serpapi": "^1.1.1",
64
  "svelte-device-info": "^1.0.0",
65
+ "svelte-overlay": "^1.4.1",
66
  "tailwind-scrollbar": "^3.0.0",
67
  "tailwindcss": "^3.3.1",
68
  "urijs": "^1.19.11",
src/app.html CHANGED
@@ -4,25 +4,25 @@
4
  <head>
5
  <!-- Google Tag Manager -->
6
  <script>
7
- var _paq = window._paq || [];
8
- window._paq=_paq;
9
- (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
10
- new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
11
- j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
12
- 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
13
- })(window,document,'script','dataLayer','GTM-TVD93MF');
 
 
 
 
 
14
  </script>
15
  <!-- End Google Tag Manager -->
16
  <meta charset="utf-8" />
17
  <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
18
  <meta property="og:image" content="/chatui/thumbnail.jpg" />
19
  <script>
20
- if (
21
- localStorage.theme === "dark" ||
22
- (!("theme" in localStorage) && window.matchMedia("(prefers-color-scheme: dark)").matches)
23
- ) {
24
- document.documentElement.classList.add("dark");
25
- }
26
  </script>
27
  %sveltekit.head%
28
  </head>
 
4
  <head>
5
  <!-- Google Tag Manager -->
6
  <script>
7
+ var _paq = window._paq || [];
8
+ window._paq = _paq;
9
+ (function (w, d, s, l, i) {
10
+ w[l] = w[l] || [];
11
+ w[l].push({ "gtm.start": new Date().getTime(), event: "gtm.js" });
12
+ var f = d.getElementsByTagName(s)[0],
13
+ j = d.createElement(s),
14
+ dl = l != "dataLayer" ? "&l=" + l : "";
15
+ j.async = true;
16
+ j.src = "https://www.googletagmanager.com/gtm.js?id=" + i + dl;
17
+ f.parentNode.insertBefore(j, f);
18
+ })(window, document, "script", "dataLayer", "GTM-TVD93MF");
19
  </script>
20
  <!-- End Google Tag Manager -->
21
  <meta charset="utf-8" />
22
  <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
23
  <meta property="og:image" content="/chatui/thumbnail.jpg" />
24
  <script>
25
+ document.documentElement.classList.add("dark");
 
 
 
 
 
26
  </script>
27
  %sveltekit.head%
28
  </head>
src/lib/components/BigModal.svelte ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { createEventDispatcher, onDestroy, onMount } from "svelte";
3
+ import { cubicOut } from "svelte/easing";
4
+ import { fade } from "svelte/transition";
5
+ import Portal from "./Portal.svelte";
6
+ import { browser } from "$app/environment";
7
+
8
+ export let width = "sm-8-10";
9
+
10
+ let backdropEl: HTMLDivElement;
11
+ let modalEl: HTMLDivElement;
12
+
13
+ const dispatch = createEventDispatcher<{ close: void }>();
14
+
15
+ function handleKeydown(event: KeyboardEvent) {
16
+ // close on ESC
17
+ if (event.key === "Escape") {
18
+ event.preventDefault();
19
+ dispatch("close");
20
+ }
21
+ }
22
+
23
+ function handleBackdropClick(event: MouseEvent) {
24
+ if (event.target === backdropEl) {
25
+ dispatch("close");
26
+ }
27
+ }
28
+
29
+ onMount(() => {
30
+ document.getElementById("app")?.setAttribute("inert", "true");
31
+ modalEl.focus();
32
+ });
33
+
34
+ onDestroy(() => {
35
+ if (!browser) return;
36
+ // remove inert attribute if this is the last modal
37
+ if (document.querySelectorAll('[role="dialog"]:not(#app *)').length === 1) {
38
+ document.getElementById("app")?.removeAttribute("inert");
39
+ }
40
+ });
41
+ </script>
42
+
43
+ <Portal>
44
+ <div
45
+ role="presentation"
46
+ tabindex="-1"
47
+ bind:this={backdropEl}
48
+ on:click={handleBackdropClick}
49
+ transition:fade={{ easing: cubicOut, duration: 300 }}
50
+ class="fixed inset-0 z-40 flex items-center justify-center bg-black/80 p-8 backdrop-blur-sm dark:bg-black/50"
51
+ >
52
+ <div
53
+ role="dialog"
54
+ tabindex="-1"
55
+ bind:this={modalEl}
56
+ on:keydown={handleKeydown}
57
+ class="-mt-10 overflow-hidden rounded-2xl shadow-2xl outline-none md:-mt-20 {width}"
58
+ >
59
+ <slot />
60
+ </div>
61
+ </div>
62
+ </Portal>
src/lib/components/LoadingModal.svelte CHANGED
@@ -1,7 +1,12 @@
1
  <script lang="ts">
2
  import Modal from "$lib/components/Modal.svelte";
3
  import is from "date-fns/locale/is";
4
- import { progress_writable, curr_model_writable, map_writable, phi_writable } from "./LoadingModalWritable.js";
 
 
 
 
 
5
 
6
  const forceUpdate = async (_) => {};
7
 
@@ -24,22 +29,19 @@
24
  if (model != undefined && model.startsWith("onnx")) {
25
  is_phi_loading = false;
26
  loadingMap.set(model, Math.floor(Number(percent)));
27
- }
28
- else if (model != undefined && model.endsWith("gguf")) {
29
  is_phi_loading = false;
30
  loadingMap.set(model, Math.floor(Number(percent)));
31
  }
32
- if (loadingMap.size > 0)
33
- {
34
  is_phi_loading = false;
35
  other_loading = true;
36
  loadingMap.forEach((per, model, map) => {
37
  if (per < 100 && loadingMap.size > 0) {
38
  other_loading = false;
39
  }
40
- })
41
  }
42
-
43
  });
44
  </script>
45
 
@@ -50,11 +52,11 @@
50
  </div>
51
  <br />
52
  {#await forceUpdate(pr) then _}
53
- {#if other_loading == false}
54
- <div class="text-s flex items-start text-gray-800">
55
- Please wait while we download the model. This has to be done only once.
56
- <br />
57
- </div>
58
  {#if is_phi_loading == false}
59
  <br />
60
  {#each [...loadingMap] as [key, value]}
@@ -65,25 +67,47 @@
65
  <br />
66
  {/each}
67
  {:else}
68
- <div class="text-left">
69
- <div role="status">
70
- <svg aria-hidden="true" class="inline w-8 h-8 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-gray-600 dark:fill-gray-300" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
71
- <path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/>
72
- <path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/>
73
- </svg>
74
- <span class="sr-only">Loading...</span>
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  </div>
76
- </div>
77
  {/if}
78
  {:else}
79
- <div class="text-s flex items-start text-gray-800">
80
- Loading the model into memory...
81
- </div>
82
  <div class="text-left">
83
  <div role="status">
84
- <svg aria-hidden="true" class="inline w-8 h-8 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-gray-600 dark:fill-gray-300" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
85
- <path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/>
86
- <path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/>
 
 
 
 
 
 
 
 
 
 
 
 
87
  </svg>
88
  <span class="sr-only">Loading...</span>
89
  </div>
 
1
  <script lang="ts">
2
  import Modal from "$lib/components/Modal.svelte";
3
  import is from "date-fns/locale/is";
4
+ import {
5
+ progress_writable,
6
+ curr_model_writable,
7
+ map_writable,
8
+ phi_writable,
9
+ } from "./LoadingModalWritable.js";
10
 
11
  const forceUpdate = async (_) => {};
12
 
 
29
  if (model != undefined && model.startsWith("onnx")) {
30
  is_phi_loading = false;
31
  loadingMap.set(model, Math.floor(Number(percent)));
32
+ } else if (model != undefined && model.endsWith("gguf")) {
 
33
  is_phi_loading = false;
34
  loadingMap.set(model, Math.floor(Number(percent)));
35
  }
36
+ if (loadingMap.size > 0) {
 
37
  is_phi_loading = false;
38
  other_loading = true;
39
  loadingMap.forEach((per, model, map) => {
40
  if (per < 100 && loadingMap.size > 0) {
41
  other_loading = false;
42
  }
43
+ });
44
  }
 
45
  });
46
  </script>
47
 
 
52
  </div>
53
  <br />
54
  {#await forceUpdate(pr) then _}
55
+ {#if other_loading == false}
56
+ <div class="text-s flex items-start text-gray-800">
57
+ Please wait while we download the model. This has to be done only once.
58
+ <br />
59
+ </div>
60
  {#if is_phi_loading == false}
61
  <br />
62
  {#each [...loadingMap] as [key, value]}
 
67
  <br />
68
  {/each}
69
  {:else}
70
+ <div class="text-left">
71
+ <div role="status">
72
+ <svg
73
+ aria-hidden="true"
74
+ class="mr-2 inline h-8 w-8 animate-spin fill-gray-600 text-gray-200 dark:fill-gray-300 dark:text-gray-600"
75
+ viewBox="0 0 100 101"
76
+ fill="none"
77
+ xmlns="http://www.w3.org/2000/svg"
78
+ >
79
+ <path
80
+ d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
81
+ fill="currentColor"
82
+ />
83
+ <path
84
+ d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
85
+ fill="currentFill"
86
+ />
87
+ </svg>
88
+ <span class="sr-only">Loading...</span>
89
+ </div>
90
  </div>
 
91
  {/if}
92
  {:else}
93
+ <div class="text-s flex items-start text-gray-800">Loading the model into memory...</div>
 
 
94
  <div class="text-left">
95
  <div role="status">
96
+ <svg
97
+ aria-hidden="true"
98
+ class="mr-2 inline h-8 w-8 animate-spin fill-gray-600 text-gray-200 dark:fill-gray-300 dark:text-gray-600"
99
+ viewBox="0 0 100 101"
100
+ fill="none"
101
+ xmlns="http://www.w3.org/2000/svg"
102
+ >
103
+ <path
104
+ d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
105
+ fill="currentColor"
106
+ />
107
+ <path
108
+ d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
109
+ fill="currentFill"
110
+ />
111
  </svg>
112
  <span class="sr-only">Loading...</span>
113
  </div>
src/lib/components/LoadingModalWritable.js CHANGED
@@ -3,4 +3,4 @@ import { writable } from "svelte/store";
3
  export const progress_writable = writable(0);
4
  export const curr_model_writable = writable("");
5
  export const map_writable = writable(["", ""]);
6
- export const phi_writable = writable(false);
 
3
  export const progress_writable = writable(0);
4
  export const curr_model_writable = writable("");
5
  export const map_writable = writable(["", ""]);
6
+ export const phi_writable = writable(false);
src/lib/components/Login.svelte ADDED
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { createEventDispatcher } from "svelte";
3
+ import { PUBLIC_APP_ASSETS, PUBLIC_ORIGIN } from "$env/static/public";
4
+ import { page } from "$app/stores";
5
+ import TextModal from "$lib/components/TextModal.svelte";
6
+ import { Checkbox } from "svelte-mui";
7
+ import Modal from "$lib/components/BigModal.svelte";
8
+ import { api_key_writable, email_addr_writable, is_logged_writable, is_magic_writable } from "../../routes/LayoutWritable";
9
+ import { goto } from "$app/navigation";
10
+ import { base } from "$app/paths";
11
+ import { getApiKey } from "../../routes/tools";
12
+
13
+ let email = ""; // email for login view
14
+ let email2 = ""; // email for magic link view
15
+ let password = "";
16
+ let showPassword = false;
17
+ let magicSuccess = false;
18
+ let loginFail = false;
19
+ let magicFail = false;
20
+ let magicView = false;
21
+ let subscribeNewsletter = true;
22
+ let error;
23
+ let hasAccount = true;
24
+
25
+ const dispatch = createEventDispatcher<{ close: void }>();
26
+
27
+ function toggleAccountStatus() {
28
+ hasAccount = !hasAccount;
29
+ magicView = false;
30
+ }
31
+
32
+ function setMagicView() {
33
+ hasAccount = !hasAccount;
34
+ magicView = true;
35
+ }
36
+
37
+ // async function isLogged() {
38
+ // try {
39
+ // const response = await fetch("https://cloud.mithrilsecurity.io/api/auth/getUserInfo", {
40
+ // method: "GET",
41
+ // credentials: "include",
42
+ // headers: {
43
+ // "Content-Type": "application/json",
44
+ // },
45
+ // });
46
+ // if (response.ok) {
47
+ // const res = await response.text()
48
+ // const json: JSON = JSON.parse(res)
49
+ // email_addr_writable.set(json.email)
50
+ // }
51
+ // else {
52
+ // // Handle errors here
53
+ // console.error("User is not logged in");
54
+ // }
55
+ // } catch (err) {
56
+ // // Handle network errors here
57
+ // console.error("Network error", err);
58
+ // }
59
+ // }
60
+
61
+ async function sendMagicLink(event: { preventDefault: () => void }) {
62
+ event.preventDefault();
63
+
64
+ const data = {
65
+ email: email2,
66
+ subscribeNewsletter,
67
+ };
68
+
69
+ try {
70
+ const response = await fetch("https://cloud.mithrilsecurity.io/api/auth/blindChatRegister", {
71
+ method: "POST",
72
+ credentials: "include",
73
+ headers: {
74
+ "Content-Type": "application/json",
75
+ },
76
+ body: JSON.stringify(data),
77
+ });
78
+ dataLayer.push({'event': 'signup-start'});
79
+ if (response.ok) {
80
+ magicSuccess = true;
81
+ } else {
82
+ magicFail = true;
83
+ }
84
+ } catch (error) {
85
+ console.error("Network error", error);
86
+ }
87
+ }
88
+
89
+ async function apiCallLogin(arg: { email: string; password: string; }) {
90
+ const data = {
91
+ email,
92
+ password,
93
+ };
94
+ let result = {
95
+ success:true,
96
+ error:"",
97
+ }
98
+ console.log("logging in...")
99
+ try {
100
+ const response = await fetch('https://cloud.mithrilsecurity.io/api/auth/login', {
101
+ method: 'POST',
102
+ credentials: "include",
103
+ headers: {
104
+ 'Content-Type': 'application/json'
105
+ },
106
+ body: JSON.stringify(data)
107
+ });
108
+ if (response.ok)
109
+ {
110
+ console.log(await response.text())
111
+ is_logged_writable.set(true)
112
+ api_key_writable.set(await getApiKey());
113
+ isLogged()
114
+ result.success = true;
115
+ }
116
+ else {
117
+ loginFail = true;
118
+ console.error("Login failed");
119
+ result.error = "Login failed";
120
+ }
121
+ } catch (error) {
122
+ console.error("Network error", error);
123
+ result.error = "Login failed";
124
+ }
125
+ return result;
126
+ }
127
+
128
+ async function registerUser(arg: { email: string; }) {
129
+ const data = {
130
+ email,
131
+ };
132
+ console.log("registering user")
133
+ try {
134
+ const response = await fetch('https://cloud.mithrilsecurity.io/api/auth/blindChatRegister', {
135
+ method: 'POST',
136
+ headers: {
137
+ 'Content-Type': 'application/json'
138
+ },
139
+ body: JSON.stringify(data)
140
+ });
141
+ dataLayer.push({'event': 'signup-start'});
142
+ if (response.ok)
143
+ {
144
+ magicSuccess = true;
145
+ api_key_writable.set(await getApiKey());
146
+ }
147
+ else {
148
+ magicFail = true;
149
+ }
150
+ } catch (error) {
151
+ console.error("Network error", error);
152
+ }
153
+ }
154
+
155
+ function reloadSession() {
156
+
157
+ }
158
+
159
+ function submitForm() {
160
+ if(email && password) { // Basic validation
161
+ apiCallLogin({email, password}) // TODO: sort out error handling here
162
+ .then(result => {
163
+ console.log(result)
164
+ if(result.success) {
165
+ reloadSession();
166
+ goto(`${base}/`, { invalidateAll: true });
167
+ } else {
168
+ error = result.error;
169
+ }
170
+ });
171
+ }
172
+ }
173
+
174
+ // For toggling the password visibility:
175
+ function handleClickShowPassword() {
176
+ showPassword = !showPassword;
177
+ }
178
+
179
+ </script>
180
+
181
+ <Modal on:close>
182
+ <script>
183
+ let overlayComp
184
+ <Overlay bind:this={overlayComp} />
185
+ overlayComp.setTheme();
186
+ </script>
187
+ <div class="border rounded-2xl border-mithril-border pt-4 px-12 pb-12 bg-login text-white md:min-w-[450px]">
188
+ <div class = "pb-4 flex justify-end">
189
+ <div>
190
+ <!-- Top right link text -->
191
+ <button type="button" class="underline" on:click={toggleAccountStatus}>
192
+ {#if hasAccount}
193
+ I don't have an account
194
+ {:else if magicView}
195
+ Return
196
+ {:else}
197
+ I have an account
198
+ {/if}
199
+ </button>
200
+ </div>
201
+ </div>
202
+ <div class="flex justify-center">
203
+ <!-- Title of modal -->
204
+ <div class="font-bold text-3xl text-mithril-yellow">
205
+ {#if hasAccount}
206
+ Sign in
207
+ {:else if magicView}
208
+ Sign in
209
+ {:else}
210
+ Sign up
211
+ {/if}
212
+ </div>
213
+ </div>
214
+ <!-- VIEW #1 Classic sign in view -->
215
+ {#if hasAccount}
216
+ <script>
217
+ document.getElementById("login").style.display = "block";
218
+ </script>
219
+ <div id="login" class="py-4" style="max-width: 350px">
220
+ <form on:submit={submitForm}>
221
+ <div class="pt-4 flex justify-between items-center flex-wrap gap-2.5 border-1 border-gray">
222
+ <!-- Classic sign in view -->
223
+ <input id="email1"
224
+ class="bg-login rounded-2xl text-white border border-mithril-border p-2 w-full"
225
+ type="email" bind:value={email} placeholder="Email" />
226
+ </div>
227
+ <div class="py-4 flex justify-between items-center flex-wrap gap-2.5 border-1 border-gray relative">
228
+ <!-- Text input for the "shown" password -->
229
+ <input
230
+ type="text"
231
+ class="bg-login rounded-2xl text-white border border-mithril-border p-2 w-full"
232
+ bind:value={password}
233
+ placeholder="Password"
234
+ class:hidden={!showPassword}
235
+ />
236
+ <!-- Password input for the "hidden" password -->
237
+ <input
238
+ class="bg-login rounded-2xl text-white border border-mithril-border p-2 w-full"
239
+ type="password"
240
+ bind:value={password}
241
+ placeholder="Password"
242
+ class:hidden={showPassword}
243
+ />
244
+ {#if !showPassword}
245
+ <!-- show password icon -->
246
+ <img
247
+ class="css-vubbuv toggle-visibility-icon absolute right-3 top-1/2 transform -translate-y-1/2 cursor-pointer"
248
+ alt="show password button"
249
+ src="{PUBLIC_ORIGIN || $page.url.origin}{base}/{PUBLIC_APP_ASSETS}/show-password.png"
250
+ title="show password button"
251
+ width="20"
252
+ height="20"
253
+ on:click={handleClickShowPassword}
254
+ />
255
+ {:else}
256
+ <!-- TODO: hide password icon -->
257
+ <img
258
+ class="css-vubbuv toggle-visibility-icon absolute right-3 top-1/2 transform -translate-y-1/2 cursor-pointer"
259
+ alt="help password button"
260
+ src="{PUBLIC_ORIGIN || $page.url.origin}{base}/{PUBLIC_APP_ASSETS}/hide-password.png"
261
+ title="hide password button"
262
+ width="20"
263
+ height="20"
264
+ on:click={handleClickShowPassword}
265
+ />
266
+ {/if}
267
+ </div>
268
+ <!-- Sign in button -->
269
+ <div class="py-3 flex justify-center items-center flex-wrap gap-2.5 border-1 border-gray">
270
+ <button class="p-3 flex justify-right content-center bg-mithril-yellow text-black rounded-lg min-w-36 py-2 px-3 text-center"
271
+ type="submit">
272
+ Sign in
273
+ </button>
274
+ </div>
275
+ {#if loginFail}
276
+ <TextModal title="Login failed" text="Please check your credentials try again" on:close={() => (loginFail = false)}/>
277
+ {/if}
278
+ <div class="p-3 underline justify-right text-right">
279
+ <!-- TODO Add in forgotten password later
280
+ <button on:click={resetPassword}>Forgot Password?</button>
281
+ -->
282
+ </div>
283
+ </form>
284
+ <div class="flex items-center justify-center relative">
285
+ <div class="absolute top-1/2 left-0 right-0 h-px bg-gray-300"></div>
286
+ <span class="MuiDivider-wrapper css-c1ovea relative z-10 px-4 bg-login">OR</span>
287
+ </div>
288
+ <!-- Magic link screen button -->
289
+ <div class="pt-4 pb-0 flex justify-center items-center flex-wrap gap-2.5">
290
+ <button class="bg-login rounded-2xl text-white border border-mithril-yellow p-2 w-full"
291
+ on:click={setMagicView}>Sign in with magic link ✨</button>
292
+ </div>
293
+ </div>
294
+ <!-- VIEW #2 Magic link -->
295
+ {:else if magicView}
296
+ <script>
297
+ document.getElementById("login").style.display = "none";
298
+ </script>
299
+ <div class="relative flex flex-col space-y-4 pt-4" style="max-width: 350px">
300
+ <div class="py-3 flex justify-between items-center flex-wrap gap-2.5 border-1 border-gray">
301
+ <input
302
+ class="bg-login rounded-2xl text-white border border-mithril-border p-2 w-full"
303
+ type="email" bind:value={email2} placeholder="Email" />
304
+ </div>
305
+ <div class="flex justify-center items-center flex-wrap gap-2.5 border-1 order-gray">
306
+ <button class="p-3 flex content-center bg-yellow-500 text-black rounded-lg min-w-36 py-2 px-3 text-center"
307
+ on:click={sendMagicLink}>Sign in with magic link ✉️ </button>
308
+ {#if magicSuccess}
309
+ <TextModal title="Magic link sent" text="✅ Check your emails for your magic login link" on:close={() => (magicSuccess = false)}/>
310
+ {:else if magicFail}
311
+ <TextModal title="Error" text="Please check your email address is valid and try again" on:close={() => (magicFail = false)}/>
312
+ {/if}
313
+ <p class="pt-5">
314
+ By using our services, you agree to the{' '}<a class="text-mithril-yellow" href="https://www.mithrilsecurity.io/privacy-policy" target="_blank">Terms of Service</a>.
315
+ </p>
316
+ </div>
317
+ </div>
318
+ <!-- VIEW #3 Sign up -->
319
+ {:else if !hasAccount && !magicView}
320
+ <!-- force get rid of login view in background -->
321
+ <script>
322
+ document.getElementById("login").style.display = "none";
323
+ </script>
324
+ <div class="relative flex flex-col space-y-4 pt-4" style="max-width: 350px">
325
+ <!-- email input -->
326
+ <div class="pt-4 flex justify-between items-center flex-wrap gap-2.5 border-1 border-gray">
327
+ <input id="email1"
328
+ class="bg-login rounded-2xl text-white border border-mithril-border p-2 w-full"
329
+ type="email" bind:value={email} placeholder="Email" />
330
+ </div>
331
+ <div class="flex justify-center items-center flex-wrap gap-2.5 border-1 order-gray">
332
+ <button class="p-3 flex content-center bg-yellow-500 text-black rounded-lg min-w-36 py-2 px-3 text-center"
333
+ on:click={registerUser}>Sign up</button>
334
+ {#if magicSuccess}
335
+ <TextModal title="Thank you" text="✅ Please click on the magic link we have sent you to access your account" on:close={() => (magicSuccess = false)}/>
336
+ {:else if magicFail}
337
+ <TextModal title="Error" text="Please check your email address is valid and try again" on:close={() => (magicFail = false)}/>
338
+ {/if}
339
+ <p class="pt-5">
340
+ By signing up, you agree to the{' '}<a class="text-mithril-yellow" href="https://www.mithrilsecurity.io/privacy-policy" target="_blank">Terms of Service</a>.
341
+ </p>
342
+ </div>
343
+ </div>
344
+ {/if}
345
+ </div>
346
+ </Modal>
src/lib/components/LoginModal.svelte CHANGED
@@ -8,69 +8,134 @@
8
  import type { LayoutData } from "../../routes/$types";
9
  import Logo from "./icons/Logo.svelte";
10
  export let settings: LayoutData["settings"];
 
 
 
11
 
12
  const isIframe = browser && window.self !== window.parent;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  </script>
14
 
15
  <Modal>
16
  <div
17
- class="flex w-full flex-col items-center gap-6 bg-gradient-to-t from-primary-500/40 via-primary-500/10 to-primary-500/0 px-4 pb-10 pt-9 text-center"
18
  >
19
- <h2 class="flex items-center text-2xl font-semibold text-gray-800">
20
- <Logo classNames="mr-1" />
21
- {PUBLIC_APP_NAME}
22
- <div
23
- class="ml-3 flex h-6 items-center rounded-lg border border-gray-100 bg-gray-50 px-2 text-base text-gray-400"
24
- >
25
- v{PUBLIC_VERSION}
26
- </div>
27
- </h2>
28
- {#if $page.data.requiresLogin}
29
- <p
30
- class="px-4 text-lg font-semibold leading-snug text-gray-800 sm:px-12"
31
- style="text-wrap: balance;"
32
- >
33
- Please Sign in with Hugging Face to continue
34
- </p>
35
- {/if}
36
- <p class="text-base text-gray-800">
37
- Disclaimer: AI is an area of active research with known problems such as biased generation and
38
- misinformation. Do not use this application for high-stakes decisions or advice.
39
- </p>
40
- {#if PUBLIC_APP_DATA_SHARING}
41
- <p class="px-2 text-sm text-gray-500">
42
- Your conversations will be shared with model authors unless you disable it from your
43
- settings.
44
- </p>
45
- {/if}
46
- <form
47
- action="{base}/{$page.data.requiresLogin ? 'login' : 'settings'}"
48
- target={isIframe ? "_blank" : ""}
49
- method="POST"
50
- class="flex w-full flex-col items-center gap-2"
51
- >
52
- {#if $page.data.requiresLogin}
53
- <button
54
- type="submit"
55
- class="mt-2 flex items-center whitespace-nowrap rounded-full bg-black px-5 py-2 text-lg font-semibold text-gray-100 transition-colors hover:bg-primary-500"
56
  >
57
- Sign in
58
- {#if PUBLIC_APP_NAME === "HuggingChat"}
59
- with <LogoHuggingFaceBorderless classNames="text-xl mr-1 ml-1.5" /> Hugging Face
60
- {/if}
61
  </button>
62
- {:else}
63
- <input type="hidden" name="ethicsModalAccepted" value={true} />
64
- {#each Object.entries(settings) as [key, val]}
65
- <input type="hidden" name={key} value={val} />
66
- {/each}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  <button
68
  type="submit"
69
- class="mt-2 rounded-full bg-black px-5 py-2 text-lg font-semibold text-gray-100 transition-colors hover:bg-primary-500"
70
  >
71
- Start chatting
72
  </button>
73
- {/if}
74
- </form>
 
 
 
 
75
  </div>
76
  </Modal>
 
8
  import type { LayoutData } from "../../routes/$types";
9
  import Logo from "./icons/Logo.svelte";
10
  export let settings: LayoutData["settings"];
11
+ import { createEventDispatcher } from "svelte";
12
+ import { Textfield, Checkbox } from "svelte-mui";
13
+ import CarbonClose from "~icons/carbon/close";
14
 
15
  const isIframe = browser && window.self !== window.parent;
16
+
17
+ let email = ""; // The email value
18
+ let success = false;
19
+ let subscribeNewsletter = false; // The subscribeNewsletter value
20
+
21
+ const dispatch = createEventDispatcher<{ close: void }>();
22
+
23
+ async function handleSubmit(event: { preventDefault: () => void }) {
24
+ event.preventDefault();
25
+
26
+ const data = {
27
+ email,
28
+ subscribeNewsletter,
29
+ };
30
+
31
+ try {
32
+ const response = await fetch("https://cloud.mithrilsecurity.io/api/auth/blindChatRegister", {
33
+ method: "POST",
34
+ credentials: "include",
35
+ headers: {
36
+ "Content-Type": "application/json",
37
+ },
38
+ body: JSON.stringify(data),
39
+ });
40
+ dataLayer.push({'event': 'signup-start'});
41
+ if (response.ok) {
42
+ // Handle a successful response
43
+ console.log("Registration successful");
44
+ success = true;
45
+ } else {
46
+ console.log(response);
47
+ // Handle errors
48
+ console.error("Registration failed");
49
+ }
50
+ } catch (error) {
51
+ // Handle network errors
52
+ console.error("Network error", error);
53
+ }
54
+ }
55
+
56
+ async function apiSubmit(event: { preventDefault: () => void }) {
57
+ event.preventDefault();
58
+
59
+ try {
60
+ const response = await fetch("https://mithrilsecurity.io/api/apiKeys", {
61
+ method: "GET",
62
+ credentials: "include",
63
+ headers: {
64
+ "Content-Type": "application/json",
65
+ },
66
+ });
67
+
68
+ if (response.ok) {
69
+ // Handle a successful response
70
+ console.log(response);
71
+ console.log("Api call successful");
72
+ } else {
73
+ // Handle errors
74
+ console.error("Api call failed");
75
+ }
76
+ } catch (error) {
77
+ // Handle network errors
78
+ console.error("Network error", error);
79
+ }
80
+ }
81
  </script>
82
 
83
  <Modal>
84
  <div
85
+ class="max-w-[400px] flex w-full flex-col items-center gap-6 bg-gradient-to-t from-primary-500/40 via-primary-500/10 to-primary-500/0 px-4 pb-10 pt-9 text-center"
86
  >
87
+ {#if !success}
88
+ <h2 class="flex items-center text-2xl font-semibold text-gray-800">
89
+ <Logo classNames="mr-1" />
90
+ <div class="text-white">{PUBLIC_APP_NAME}</div>
91
+ <div
92
+ class="ml-3 flex h-6 items-center rounded-lg border border-gray-100 bg-gray-50 px-2 text-base text-gray-400"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  >
94
+ v{PUBLIC_VERSION}
95
+ </div>
96
+ <button type="button" class="group" on:click={() => dispatch("close")}>
97
+ <CarbonClose class="text-gray-900 group-hover:text-gray-500" />
98
  </button>
99
+ </h2>
100
+ {#if $page.data.requiresLogin}
101
+ <p
102
+ class="px-4 text-lg font-semibold leading-snug text-gray-800 sm:px-12"
103
+ style="text-wrap: balance;"
104
+ >
105
+ Please Sign in with Mithril Security Cloud to continue
106
+ </p>
107
+ {/if}
108
+ <p class="text-base text-gray-800">
109
+ Disclaimer: AI is an area of active research with known problems such as biased generation
110
+ and misinformation. Do not use this application for high-stakes decisions or advice.
111
+ </p>
112
+ <form
113
+ on:submit={handleSubmit}
114
+ target={isIframe ? "_blank" : ""}
115
+ class="flex w-full flex-col items-center gap-2"
116
+ >
117
+ <div>
118
+ <Textfield variant="outlined" type="email" bind:value={email} label="Email" required />
119
+ <Checkbox
120
+ bind:checked={subscribeNewsletter}
121
+ label="Subscribe to Newsletter"
122
+ type="checkbox"
123
+ id="subscribeNewsletter"
124
+ >
125
+ Subscribe to Newsletter
126
+ </Checkbox>
127
+ </div>
128
  <button
129
  type="submit"
130
+ class="mt-2 flex items-center whitespace-nowrap rounded-full bg-black px-5 py-2 text-lg font-semibold text-gray-100 transition-colors hover:bg-primary-500"
131
  >
132
+ Magic link 🪄
133
  </button>
134
+ </form>
135
+ {:else}
136
+ <p class="flex items-center text-2xl font-semibold text-gray-800" style="text-wrap: balance;">
137
+ Magic link sent to your email address. Please check your inbox.
138
+ </p>
139
+ {/if}
140
  </div>
141
  </Modal>
src/lib/components/MobileNav.svelte CHANGED
@@ -30,7 +30,7 @@
30
  </script>
31
 
32
  <nav
33
- class="flex h-12 items-center justify-between border-b bg-gray-50 px-4 dark:border-gray-800 dark:bg-gray-800/70 md:hidden"
34
  >
35
  <button
36
  type="button"
@@ -45,11 +45,11 @@
45
  >
46
  </nav>
47
  <nav
48
- class="fixed inset-0 z-30 grid max-h-screen grid-cols-1 grid-rows-[auto,auto,1fr,auto] bg-white bg-gradient-to-l from-gray-50 dark:bg-gray-900 dark:from-gray-800/30 {isOpen
49
  ? 'block'
50
  : 'hidden'}"
51
  >
52
- <div class="flex h-12 items-center px-4">
53
  <button
54
  type="button"
55
  class="-mr-3 ml-auto flex h-9 w-9 items-center justify-center"
 
30
  </script>
31
 
32
  <nav
33
+ class="font-semibold flex h-12 items-center justify-between border-b bg-gray-50 px-4 dark:border-gray-800 dark:bg-chat md:hidden"
34
  >
35
  <button
36
  type="button"
 
45
  >
46
  </nav>
47
  <nav
48
+ class="fixed inset-0 z-30 grid max-h-screen grid-cols-1 grid-rows-[auto,auto,1fr,auto] dark:bg-chat {isOpen
49
  ? 'block'
50
  : 'hidden'}"
51
  >
52
+ <div class="bg-[#142343] flex h-12 items-center px-4">
53
  <button
54
  type="button"
55
  class="-mr-3 ml-auto flex h-9 w-9 items-center justify-center"
src/lib/components/NavConversationItem.svelte CHANGED
@@ -28,11 +28,13 @@
28
  params_writable.set(conv.id);
29
  }}
30
  href="{base}/conversation/{conv.id}"
31
- class="group flex h-11 flex-none items-center gap-1.5 rounded-lg pl-3 pr-2 text-gray-500 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-700 {conv.id ===
32
  $page.params.id
33
- ? 'bg-gray-100 dark:bg-gray-700'
34
- : ''}"
35
  >
 
 
36
  <div class="flex-1 truncate">
37
  {#if confirmDelete}
38
  <span class="font-semibold"> Delete </span>
@@ -43,7 +45,7 @@
43
  {#if confirmDelete}
44
  <button
45
  type="button"
46
- class="flex h-5 w-5 items-center justify-center rounded md:hidden md:group-hover:flex"
47
  title="Confirm delete action"
48
  on:click|preventDefault={() => dispatch("deleteConversation", conv.id)}
49
  >
@@ -51,7 +53,7 @@
51
  </button>
52
  <button
53
  type="button"
54
- class="flex h-5 w-5 items-center justify-center rounded md:hidden md:group-hover:flex"
55
  title="Cancel delete action"
56
  on:click|preventDefault={() => {
57
  confirmDelete = false;
@@ -62,7 +64,7 @@
62
  {:else}
63
  <button
64
  type="button"
65
- class="flex h-5 w-5 items-center justify-center rounded md:hidden md:group-hover:flex"
66
  title="Edit conversation title"
67
  on:click|preventDefault={() => {
68
  const newTitle = prompt("Edit this conversation title:", conv.title);
@@ -75,7 +77,7 @@
75
 
76
  <button
77
  type="button"
78
- class="flex h-5 w-5 items-center justify-center rounded md:hidden md:group-hover:flex"
79
  title="Delete conversation"
80
  on:click|preventDefault={(event) => {
81
  if (event.shiftKey) {
 
28
  params_writable.set(conv.id);
29
  }}
30
  href="{base}/conversation/{conv.id}"
31
+ class="group flex h-11 flex-none items-center gap-1.5 pl-3 pr-2 rounded-2xl hover:bg-gray-100 dark:hover:bg-gray-700 {conv.id ===
32
  $page.params.id
33
+ ? 'border border-[#1E9FE7] dark:text-white'
34
+ : 'border border-[#0F4A81] dark:text-[#B4B4B4]'}"
35
  >
36
+ <!-- styling for current chat goes just after question mark above-->
37
+
38
  <div class="flex-1 truncate">
39
  {#if confirmDelete}
40
  <span class="font-semibold"> Delete </span>
 
45
  {#if confirmDelete}
46
  <button
47
  type="button"
48
+ class="flex h-5 w-5 items-center justify-center rounded-2xl md:hidden md:group-hover:flex"
49
  title="Confirm delete action"
50
  on:click|preventDefault={() => dispatch("deleteConversation", conv.id)}
51
  >
 
53
  </button>
54
  <button
55
  type="button"
56
+ class="flex h-5 w-5 items-center justify-center rounded-2xl md:hidden md:group-hover:flex"
57
  title="Cancel delete action"
58
  on:click|preventDefault={() => {
59
  confirmDelete = false;
 
64
  {:else}
65
  <button
66
  type="button"
67
+ class="flex h-5 w-5 items-center justify-center rounded-2xl md:hidden md:group-hover:flex"
68
  title="Edit conversation title"
69
  on:click|preventDefault={() => {
70
  const newTitle = prompt("Edit this conversation title:", conv.title);
 
77
 
78
  <button
79
  type="button"
80
+ class="flex h-5 w-5 items-center justify-center rounded-2xl md:hidden md:group-hover:flex"
81
  title="Delete conversation"
82
  on:click|preventDefault={(event) => {
83
  if (event.shiftKey) {
src/lib/components/NavMenu.svelte CHANGED
@@ -1,12 +1,13 @@
1
  <script lang="ts">
2
  import { base } from "$app/paths";
3
  import { createEventDispatcher } from "svelte";
4
-
5
  import Logo from "$lib/components/icons/Logo.svelte";
6
- import { switchTheme } from "$lib/switchTheme";
7
- import { PUBLIC_APP_NAME, PUBLIC_ORIGIN } from "$env/static/public";
8
  import NavConversationItem from "./NavConversationItem.svelte";
9
  import type { LayoutData } from "../../routes/$types";
 
10
 
11
  const dispatch = createEventDispatcher<{
12
  shareConversation: { id: string; title: string };
@@ -19,89 +20,146 @@
19
  title: string;
20
  }> = [];
21
 
 
22
  export let canLogin: boolean;
 
23
  export let user: LayoutData["user"];
24
 
25
  export let loginModalVisible;
26
- </script>
27
 
28
- <div class="sticky top-0 flex flex-none items-center justify-between px-3 py-3.5 max-sm:pt-0">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  <a class="flex items-center rounded-xl text-lg font-semibold" href="{PUBLIC_ORIGIN}{base}/">
30
  <Logo classNames="mr-1" />
31
- {PUBLIC_APP_NAME}
32
  </a>
33
  <a
34
  href={`${base}/`}
35
- class="flex rounded-lg border bg-white px-2 py-0.5 text-center shadow-sm hover:shadow-none dark:border-gray-600 dark:bg-gray-700"
36
  >
37
  New Chat
38
  </a>
39
  </div>
 
 
 
40
  <div
41
- class="scrollbar-custom flex flex-col gap-1 overflow-y-auto rounded-r-xl bg-gradient-to-l from-gray-50 px-3 pb-3 pt-2 dark:from-gray-800/30"
 
42
  >
43
  {#each conversations as conv (conv.id)}
44
- <NavConversationItem on:editConversationTitle on:deleteConversation {conv} />
 
 
45
  {/each}
46
  </div>
47
- <div
48
- class="mt-0.5 flex flex-col gap-1 rounded-r-xl bg-gradient-to-l from-gray-50 p-3 text-sm dark:from-gray-800/30"
 
 
 
49
  >
50
- {#if user?.username || user?.email}
51
- <form
52
- action="{base}/logout"
53
- method="post"
54
- class="group flex items-center gap-1.5 rounded-lg pl-3 pr-2 hover:bg-gray-100 dark:hover:bg-gray-700"
 
 
 
 
 
 
 
 
55
  >
56
- <span
57
- class="flex h-9 flex-none shrink items-center gap-1.5 truncate pr-2 text-gray-500 dark:text-gray-400"
58
- >{user?.username || user?.email}</span
59
- >
60
- <button
61
- type="submit"
62
- class="ml-auto h-6 flex-none items-center gap-1.5 rounded-md border bg-white px-2 text-gray-700 shadow-sm group-hover:flex hover:shadow-none dark:border-gray-600 dark:bg-gray-600 dark:text-gray-400 dark:hover:text-gray-300 md:hidden"
63
- >
64
- Sign Out
65
- </button>
66
- </form>
67
- {/if}
68
- {#if canLogin}
 
 
 
 
69
  <button
70
- on:click={() => (loginModalVisible = true)}
71
  type="button"
72
- class="flex h-9 flex-none items-center gap-1.5 rounded-lg pl-3 pr-2 text-gray-500 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-700"
 
73
  >
74
- Login
75
  </button>
76
- {/if}
77
- <button
78
- on:click={switchTheme}
79
- type="button"
80
- class="flex h-9 flex-none items-center gap-1.5 rounded-lg pl-3 pr-2 text-gray-500 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-700"
81
- >
82
- Theme
83
- </button>
84
- <button
85
- on:click={() => dispatch("clickSettings")}
86
- type="button"
87
- class="flex h-9 flex-none items-center gap-1.5 rounded-lg pl-3 pr-2 text-gray-500 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-700"
88
- >
89
- Settings
90
- </button>
91
- <a
92
- href="https://www.mithrilsecurity.io/contact"
93
- target="_blank"
94
- rel="noreferrer"
95
- class="flex h-9 flex-none items-center gap-1.5 rounded-lg pl-3 pr-2 text-gray-500 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-700"
96
- >
97
- Feedback
98
- </a>
99
- <a
100
- href="https://www.mithrilsecurity.io/faq"
101
- target="_blank"
102
- rel="noreferrer"
103
- class="flex h-9 flex-none items-center gap-1.5 rounded-lg pl-3 pr-2 text-gray-500 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-700"
104
- >
105
- About & Privacy
106
- </a>
107
  </div>
 
 
 
1
  <script lang="ts">
2
  import { base } from "$app/paths";
3
  import { createEventDispatcher } from "svelte";
4
+ import Login from "$lib/components/Login.svelte";
5
  import Logo from "$lib/components/icons/Logo.svelte";
6
+ import { page } from "$app/stores";
7
+ import { PUBLIC_APP_NAME, PUBLIC_ORIGIN, PUBLIC_APP_ASSETS } from "$env/static/public";
8
  import NavConversationItem from "./NavConversationItem.svelte";
9
  import type { LayoutData } from "../../routes/$types";
10
+ import { api_key_writable, is_logged_writable, is_magic_writable, email_addr_writable } from "../../routes/LayoutWritable";
11
 
12
  const dispatch = createEventDispatcher<{
13
  shareConversation: { id: string; title: string };
 
20
  title: string;
21
  }> = [];
22
 
23
+
24
  export let canLogin: boolean;
25
+ export let signedIn: boolean;
26
  export let user: LayoutData["user"];
27
 
28
  export let loginModalVisible;
 
29
 
30
+ let isSubMenuOpen: boolean = false;
31
+ let magic = false;
32
+ let isLogged = false;
33
+
34
+ is_magic_writable.subscribe((val) => {
35
+ magic = val;
36
+ })
37
+
38
+ is_logged_writable.subscribe((val) => {
39
+ isLogged = val;
40
+ })
41
+
42
+ let email_addr = ""
43
+
44
+ email_addr_writable.subscribe((val) => {
45
+ email_addr = val
46
+ })
47
+
48
+ function toggleSubMenu() {
49
+ isSubMenuOpen = !isSubMenuOpen;
50
+ }
51
+
52
+ async function logoutSubmit(event: { preventDefault: () => void }) {
53
+ event.preventDefault();
54
+
55
+ try {
56
+ const response = await fetch("https://cloud.mithrilsecurity.io/api/auth/logout", {
57
+ method: "POST",
58
+ credentials: "include",
59
+ headers: {
60
+ "Content-Type": "application/json",
61
+ },
62
+ });
63
+ if (response.ok) {
64
+ // Handle a successful response
65
+ console.log("Logout successful");
66
+ signedIn = false;
67
+ is_logged_writable.set(false);
68
+ api_key_writable.set("");
69
+ email_addr_writable.set("");
70
+ } else {
71
+ // Handle errors
72
+ console.error("Logout failed");
73
+ }
74
+ } catch (error) {
75
+ // Handle network errors
76
+ console.error("Network error", error);
77
+ }
78
+ }
79
+
80
+ function handleKeyDown(event: { key: string; }) {
81
+ if (event.key === 'Enter') {
82
+ toggleSubMenu();
83
+ }
84
+ }
85
+
86
+ function handleTempClick() {
87
+ loginModalVisible = true;
88
+ is_magic_writable.set(false);
89
+ }
90
+ </script>
91
+ <!-- top left corner - remove from class bg-[#141c2a] -->
92
+ <div class="bg-[#142343] sticky top-0 flex flex-none items-center justify-between px-3 py-5 max-sm:pt-0">
93
  <a class="flex items-center rounded-xl text-lg font-semibold" href="{PUBLIC_ORIGIN}{base}/">
94
  <Logo classNames="mr-1" />
95
+ <div class = "pl-2 text-white"> {PUBLIC_APP_NAME} </div>
96
  </a>
97
  <a
98
  href={`${base}/`}
99
+ class="flex rounded-lg border bg-white px-2 py-0.5 text-center shadow-sm hover:shadow-none dark:border-mithril-border dark:bg-sidebar"
100
  >
101
  New Chat
102
  </a>
103
  </div>
104
+ <!-- left side bar
105
+ style = "background-color: #141c2a !important;"
106
+ -->
107
  <div
108
+ class="bg-[#142343] scrollbar-custom flex flex-col gap-1 overflow-y-auto px-3 pb-3 pt-2 dark:from-gray-800/30"
109
+
110
  >
111
  {#each conversations as conv (conv.id)}
112
+ <div class="py-1">
113
+ <NavConversationItem on:editConversationTitle on:deleteConversation {conv}/>
114
+ </div>
115
  {/each}
116
  </div>
117
+ <!-- <div class="display position relative inline-block bg-[#142343] flex justify-center items-center pb-4">
118
+ <div
119
+ class="rounded-2xl text-center bg-[#0d1830] flex items-center justify-center group h-11 -lg text-white w-[96%] hover:bg-gray-600 font-semibold"
120
+ on:click={toggleSubMenu}
121
+ on:keydown={handleKeyDown}
122
  >
123
+ {email_addr.length > 0 ? email_addr : "Not logged in"}
124
+ </div>
125
+
126
+ {#if isSubMenuOpen}
127
+ <script type="text/javascript">
128
+ document.getElementById("submenu").style.display = "block";
129
+ </script>
130
+ <div class="justify-center items-center rounded-2xl {isSubMenuOpen ? 'open' : ''}" style="position: absolute; bottom: 100%; width: 96%; background-color: #0d1830 !important;">
131
+ <div>
132
+ <button
133
+ on:click={() => dispatch("clickSettings")}
134
+ type="button"
135
+ class="px-8 block py-3 text-center h-11 text-white hover:bg-gray-600 rounded-2xl" style="width: 100%;"
136
  >
137
+ Settings
138
+ </button>
139
+ <div class="flex justify-center" style="position: relative;">
140
+ <a href="https://1qdag6eehid.typeform.com/to/EFrGfL1u" target="_blank" rel="noopener noreferrer"
141
+ class="px-8 block py-3 text-center h-11 text-white hover:bg-gray-600 rounded-2xl w-[100%]">
142
+ Give Feedback
143
+ </a>
144
+ <img
145
+ class="absolute max-w-[3%] md:max-w-[6%] bottom-[32%] right-[35%] md:right-[20%]"
146
+ alt="redirect to page in new tab icon"
147
+ src="{PUBLIC_ORIGIN || $page.url.origin}{base}/{PUBLIC_APP_ASSETS}/link.png"
148
+ title="link to open new page"
149
+ />
150
+ </div>
151
+ <div class="justify flex items-center justify-center">
152
+ <p class="border-t border-mithril-border w-[80%]"></p>
153
+ </div>
154
  <button
155
+ on:click={logoutSubmit}
156
  type="button"
157
+ class="px-8 py-3 text-center h-11 text-white hover:bg-gray-600 rounded-2xl"
158
+ style="width: 100%;"
159
  >
160
+ <p class="">Log out</p>
161
  </button>
162
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  </div>
164
+ {/if} -->
165
+ <!-- </div> -->
src/lib/components/PleaseWaitModal.svelte ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import Modal from "$lib/components/Modal.svelte";
3
+ import { createEventDispatcher } from "svelte";
4
+ import CarbonClose from "~icons/carbon/close";
5
+
6
+ const dispatch = createEventDispatcher<{ close: void }>();
7
+ </script>
8
+
9
+ <Modal>
10
+ <div class="flex w-full flex-col gap-0 p-2">
11
+ <div class="m-2 flex items-start text-xl font-bold text-gray-800">
12
+ <h1>Please wait...</h1>
13
+ <br />
14
+ </div>
15
+ <br />
16
+ </div>
17
+ </Modal>
src/lib/components/SettingsModal2.svelte ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { createEventDispatcher } from "svelte";
3
+ import Modal from "$lib/components/BigModal.svelte";
4
+ import Modal2 from "$lib/components/straightModal.svelte";
5
+ import TextModal from "$lib/components/TextModal.svelte";
6
+ import { writable } from 'svelte/store';
7
+ import CarbonClose from "~icons/carbon/close";
8
+ import type { Model } from "$lib/types/Model";
9
+ import type { LayoutData } from "../../routes/$types";
10
+ import { api_key_writable, email_addr_writable, is_logged_writable } from "../../routes/LayoutWritable";
11
+
12
+ export let settings: LayoutData["settings"];
13
+ export let models: Array<Model>;
14
+
15
+ let opSuccess = false;
16
+ let opFail = false;
17
+ let emailOpSuccess = false;
18
+ let emailOpFail = false;
19
+ let mismatch = false;
20
+ let isConfirmingDeletion = false;
21
+ let isAccountView: boolean = true;
22
+ let isThemeView: boolean = false;
23
+ let newEmail = '';
24
+ const themeStore = writable(
25
+ localStorage.theme
26
+ );
27
+
28
+ const dispatch = createEventDispatcher<{ close: void }>();
29
+
30
+ export function switchTheme() {
31
+ const { classList } = document.querySelector("html") as HTMLElement;
32
+ classList.add("dark");
33
+ localStorage.theme = "dark";
34
+ themeStore.set('dark');
35
+ }
36
+ function themeViewToggle() {
37
+ isAccountView = false;
38
+ isThemeView = true;
39
+ }
40
+
41
+ function accountViewToggle() {
42
+ isAccountView = true;
43
+ isThemeView = false;
44
+ }
45
+
46
+ async function deleteAccount() {
47
+ isConfirmingDeletion = false;
48
+ try {
49
+ const response = await fetch('https://cloud.mithrilsecurity.io/api/auth/deleteAccount', {
50
+ method: "POST",
51
+ credentials: "include",
52
+ });
53
+ if (response.ok) {
54
+ dispatch("close")
55
+ is_logged_writable.set(false);
56
+ api_key_writable.set("");
57
+ email_addr_writable.set("");
58
+ } else {
59
+ opFail = true;
60
+ }
61
+ }
62
+ catch (error) {
63
+ console.error('Error:', error);
64
+ }
65
+ }
66
+
67
+ async function changeEmail(newEmail: string) {
68
+ try {
69
+ const data = {
70
+ newEmail,
71
+ };
72
+ const response = await fetch('https://cloud.mithrilsecurity.io/api/auth/changeEmail', {
73
+ method: 'POST',
74
+ credentials: "include",
75
+ headers: {
76
+ 'Content-Type': 'application/json',
77
+ },
78
+ body: JSON.stringify(data),
79
+ });
80
+ if (response.ok) {
81
+ emailOpSuccess = true;
82
+ } else {
83
+ emailOpFail = true;
84
+ }
85
+ } catch (error) {
86
+ console.error('Error:', error);
87
+ }
88
+ }
89
+
90
+ async function changePassword(newPassword: string, confirmPassword: string) {
91
+ try {
92
+ if (newPassword !== confirmPassword) {
93
+ mismatch = true;
94
+ return;
95
+ }
96
+ console.log("ping")
97
+ const response = await fetch('https://cloud.mithrilsecurity.io/api/auth/createPassword', {
98
+ method: 'POST',
99
+ credentials: "include",
100
+ headers: {
101
+ 'Content-Type': 'application/json',
102
+ },
103
+ body: JSON.stringify({ password: newPassword, passwordConfirm: confirmPassword }),
104
+ });
105
+
106
+ if (response.ok) {
107
+ opSuccess = true;
108
+ }
109
+ else {
110
+ opFail = true;
111
+ }
112
+ } catch (error) {
113
+ console.error('Error:', error);
114
+ opFail = true;
115
+ }
116
+ }
117
+
118
+ let newPassword = '';
119
+ let confirmPassword = '';
120
+
121
+ async function handlePasswordChange() {
122
+ await changePassword(newPassword, confirmPassword);
123
+ }
124
+
125
+ async function handleEmailChange(newEmail: string) {
126
+ await changeEmail(newEmail);
127
+ }
128
+ </script>
129
+
130
+ <Modal on:close>
131
+ <script>
132
+ let overlayComp
133
+ <Overlay bind:this={overlayComp} />
134
+ overlayComp.setTheme();
135
+ </script>
136
+ <div class= "border rounded-2xl border-mithril-border py-4 md:pt-4 px-4 md:pb-8 bg-login text-white md:min-w-[500px]>">
137
+ <!-- Close button div -->
138
+ <div class="flex justify-end">
139
+ <button type="button" class="text-xl flex justify-end group text-black dark:text-white" on:click={() => dispatch("close")}>
140
+ <CarbonClose />
141
+ </button>
142
+ </div>
143
+
144
+ <!-- VIEW #1 ACCOUNT VIEW -->
145
+ {#if isAccountView}
146
+ <!-- Title div -->
147
+ <div class="flex justify-center">
148
+ <div class="font-bold text-2xl text-mithril-yellow">Account</div>
149
+ </div>
150
+ {/if}
151
+
152
+ <div id="modal" class="bg-white dark:bg-login dark:text-white md:min-w-[500px]" style="display: flex;">
153
+ <div class = "md:min-w-[500px] md:min-h-[400px]" style="flex: 4; margin-right:40px;">
154
+ <!-- Account modal view -->
155
+ {#if isAccountView}
156
+ <script type="text/javascript">
157
+ document.getElementById("themeView").style.display = "block";
158
+ </script>
159
+ <div class="modal-content pl-5" id="accountView">
160
+
161
+ <!-- Change email section -->
162
+ <h2 class="pt-4 md:pt-8 font-semibold text-xl text-mithril-yellow">Change email</h2>
163
+ <p class="text-base">New email address</p>
164
+ <div class="flex justify-between items-center flex-wrap gap-2.5">
165
+ <input type="email"
166
+ placeholder="Enter new email"
167
+ class="bg-login rounded-lg text-base text-white border border-mithril-border p-2 w-[60%]"
168
+ style="justify-content: space-between;"
169
+ bind:value={newEmail} />
170
+
171
+ <!-- Yellow change email button -->
172
+ <button class="bg-yellow-500 text-base text-black rounded-lg min-w-[160px] py-2 px-3 justify-between" on:click={handleEmailChange(newEmail)}>Change Email</button>
173
+ {#if emailOpSuccess}
174
+ <TextModal title="Email updated" text="Please click on the confirmation link that has been sent to your updated email address." on:close={() => (emailOpSuccess = false)}/>
175
+ {:else if emailOpFail}
176
+ <TextModal title="Update failed" text="Please check the email address entered is valid" on:close={() => (emailOpFail = false)}/>
177
+ {/if}
178
+ </div>
179
+
180
+ <!-- Create password section -->
181
+ <h2 class="pt-8 font-medium font-semibold text-xl text-mithril-yellow">Create password</h2>
182
+ <p>New password</p>
183
+ <input type="password"
184
+ placeholder="Enter new password"
185
+ bind:value={newPassword}
186
+ class="bg-login rounded-lg text-base text-white border border-mithril-border p-2 w-[60%]">
187
+ <p style="padding-top:20px;">Confirm password</p>
188
+
189
+ <div class="flex justify-between items-center flex-wrap gap-2.5">
190
+ <input type="password"
191
+ placeholder="Confirm new password"
192
+ class="bg-login rounded-lg text-base text-white border border-mithril-border p-2 w-[60%]"
193
+ style="justify-content: space-between;"
194
+ bind:value={confirmPassword}/>
195
+
196
+ <button class="bg-yellow-500 text-base text-black rounded-lg min-w-[160px] py-2 px-3 justify-between" on:click={handlePasswordChange}>Change password</button>
197
+ {#if opSuccess}
198
+ <TextModal title="Password updated" text="✅ Your password has successfully been created" on:close={() => (opSuccess = false)}/>
199
+ {:else if opFail}
200
+ <TextModal title="Update failed" text={mismatch === true ? "Passwords don't match" : "Unexpected error. Please try again"} on:close={() => (opFail = false, mismatch = false)}/>
201
+ {/if}
202
+ </div>
203
+
204
+ <!-- Delete account section -->
205
+ <h2 class="pt-8 font-semibold text-xl text-mithril-yellow">Delete account</h2>
206
+ <div class="flex justify-between items-center flex-wrap gap-2.5 py-5">
207
+ <button on:click = {() => (isConfirmingDeletion = true)}
208
+ class="rounded-lg md:text-base min-w-[160px] py-2 px-3 ml-auto border border-red-700 hover:bg-red-700">Delete account</button>
209
+ {#if isConfirmingDeletion}
210
+ <Modal2 on:close={() => (isConfirmingDeletion = false)}>
211
+ <form class="dark:bg-darkBackground flex w-full flex-col gap-5 p-6 dark:border dark:border-gray-400">
212
+ <div class="flex items-start justify-between text-xl font-semibold text-gray-800">
213
+ <h2 class="dark:text-white font-medium text-xl">Are you sure?</h2>
214
+ <button type="button" class="group" on:click={() => (isConfirmingDeletion = false)}>
215
+ <CarbonClose class="text-gray-900 dark:text-gray-400 group-hover:text-gray-500"/>
216
+ </button>
217
+ </div>
218
+ <p class="dark:text-gray-400 text-gray-800">This action will delete your account.<br>This cannot be undone.</p>
219
+ <button
220
+ type="button"
221
+ class="mt-2 rounded-full bg-red-700 px-5 py-2 text-lg font-semibold text-gray-100 ring-gray-400 ring-offset-1 transition-all hover:ring focus-visible:outline-none focus-visible:ring"
222
+ on:click={deleteAccount}
223
+ >
224
+ Confirm
225
+ </button>
226
+ </form>
227
+ </Modal2>
228
+ {/if}
229
+ </div>
230
+ </div>
231
+ {/if}
232
+ </div>
233
+ </div>
234
+ </div>
235
+ </Modal>
src/lib/components/ShouldLoginModal.svelte ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import Modal from "$lib/components/Modal.svelte";
3
+ import { createEventDispatcher } from "svelte";
4
+ import CarbonClose from "~icons/carbon/close";
5
+
6
+ const dispatch = createEventDispatcher<{ close: void }>();
7
+ </script>
8
+
9
+ <Modal>
10
+ <div class="flex w-full flex-col gap-0 p-2">
11
+ <div class="m-2 flex items-start text-xl font-bold text-gray-800">
12
+ <h1>You need to be logged in before using this model.</h1>
13
+ <br />
14
+ <button type="button" class="group" on:click={() => dispatch("close")}>
15
+ <CarbonClose class="text-gray-900 group-hover:text-gray-500" />
16
+ </button>
17
+ </div>
18
+ <div class="text-m m-2 flex items-start text-gray-800">
19
+ <br />This model is hosted on a secured enclave. Please login and try again to send your
20
+ request.<br />
21
+ </div>
22
+ <br />
23
+ </div>
24
+ </Modal>
src/lib/components/TextModal.svelte ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import Modal from "$lib/components/Modal.svelte";
3
+ import { createEventDispatcher } from "svelte";
4
+ import CarbonClose from "~icons/carbon/close";
5
+
6
+ export let text="";
7
+ export let title="";
8
+ const dispatch = createEventDispatcher<{ close: void }>();
9
+ </script>
10
+
11
+ <Modal>
12
+ <div class="border rounded-2xl border-mithril-border p-2 bg-login text-white">
13
+ <div class = "flex justify-end">
14
+ <button type="button" class="justify-end" on:click={() => dispatch("close")}>
15
+ <CarbonClose class="justify-end dark:text-white text-gray-900 group-hover:text-gray-500" />
16
+ </button>
17
+ </div>
18
+ <div class="pb-6 dark:text-gray-400 m-2 text-gray-800 text-center" style="display: flex; flex-direction: column; align-items: center;">
19
+ <div class="pb-4 dark:text-mithril-yellow m-2 flex items-center justify-between text-2xl font-bold text-gray-800">
20
+ <h1>{title}</h1>
21
+ </div>
22
+ <div class="text-m">
23
+ {text}
24
+ </div>
25
+ </div>
26
+ </div>
27
+ </Modal>
28
+
src/lib/components/chat/ChatIntroduction.svelte CHANGED
@@ -33,27 +33,31 @@
33
 
34
  const dispatch = createEventDispatcher<{ message: string }>();
35
 
 
 
 
 
 
 
 
 
 
36
  $: title = env.PUBLIC_APP_NAME;
37
  </script>
38
 
39
- <div class="my-auto grid gap-8 lg:grid-cols-3">
40
  <div class="lg:col-span-1">
41
  <div>
42
  <div class="mb-3 flex items-center text-2xl font-semibold">
43
- <Logo classNames="mr-1 flex-none" />
44
- {PUBLIC_APP_NAME}
45
- <div
46
- class="ml-3 flex h-6 items-center rounded-lg border border-gray-100 bg-gray-50 px-2 text-base text-gray-400 dark:border-gray-700/60 dark:bg-gray-800"
47
- >
48
- v{PUBLIC_VERSION}
49
- </div>
50
  </div>
51
  <p class="text-base text-gray-600 dark:text-gray-400">
52
  Enjoying the best AI models, with privacy
53
  </p>
54
  </div>
55
  </div>
56
- <div class="lg:col-span-2 lg:pl-24">
57
  {#each announcementBanners as banner}
58
  <AnnouncementBanner classNames="mb-4" title={banner.title}>
59
  <a
@@ -74,6 +78,7 @@
74
  )}
75
  />
76
  {/if}
 
77
  <div class="overflow-hidden rounded-xl border dark:border-gray-800">
78
  <div class="flex p-3">
79
  <div>
@@ -91,17 +96,27 @@
91
  </div>
92
  <ModelCardMetadata variant="dark" model={currentModel} />
93
  </div>
 
94
  </div>
95
  {#if currentModelMetadata.promptExamples}
96
- <div class="lg:col-span-3 lg:mt-6">
97
  <div class="grid gap-3 lg:grid-cols-3 lg:gap-5">
98
  {#each currentModelMetadata.promptExamples as example}
99
  <button
100
  type="button"
101
- class="rounded-xl border bg-gray-50 p-2.5 text-gray-600 hover:bg-gray-100 dark:border-gray-800 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700 sm:p-4"
102
- on:click={() => dispatch("message", example.prompt)}
 
 
 
103
  >
104
- {example.title}
 
 
 
 
 
 
105
  </button>
106
  {/each}
107
  </div>
 
33
 
34
  const dispatch = createEventDispatcher<{ message: string }>();
35
 
36
+ function getTitles(str: string) {
37
+ const split = str.split(' ')
38
+ const map_str = new Map();
39
+ for (let i = 0; i < split.length; i++) {
40
+ map_str.set(i, split[i])
41
+ }
42
+ return map_str
43
+ }
44
+
45
  $: title = env.PUBLIC_APP_NAME;
46
  </script>
47
 
48
+ <div class="my-auto grid gap-8 lg:grid-cols-2">
49
  <div class="lg:col-span-1">
50
  <div>
51
  <div class="mb-3 flex items-center text-2xl font-semibold">
52
+ <Logo classNames="mr-1flex-none" />
53
+ <div class = "pl-2 text-white"> {PUBLIC_APP_NAME} </div>
 
 
 
 
 
54
  </div>
55
  <p class="text-base text-gray-600 dark:text-gray-400">
56
  Enjoying the best AI models, with privacy
57
  </p>
58
  </div>
59
  </div>
60
+ <div class="lg:col-span-2 lg:pl-24 w-[50%] flex absolute right-[0%]">
61
  {#each announcementBanners as banner}
62
  <AnnouncementBanner classNames="mb-4" title={banner.title}>
63
  <a
 
78
  )}
79
  />
80
  {/if}
81
+ {#if models.length > 1}
82
  <div class="overflow-hidden rounded-xl border dark:border-gray-800">
83
  <div class="flex p-3">
84
  <div>
 
96
  </div>
97
  <ModelCardMetadata variant="dark" model={currentModel} />
98
  </div>
99
+ {/if}
100
  </div>
101
  {#if currentModelMetadata.promptExamples}
102
+ <div class="lg:col-span-2 lg:mt-6">
103
  <div class="grid gap-3 lg:grid-cols-3 lg:gap-5">
104
  {#each currentModelMetadata.promptExamples as example}
105
  <button
106
  type="button"
107
+ class="rounded-xl border bg-gray-50 p-2.5 text-gray-600 hover:bg-gray-100 dark:border-gray-800 dark:bg-prompts dark:text-gray-300 dark:hover:bg-gray-700 sm:p-4"
108
+ on:click={() => {
109
+ dataLayer.push({ event: "prompt", titre_prompt: [example.title] });
110
+ dispatch("message", example.prompt)}
111
+ }
112
  >
113
+ {#each [...getTitles(example.title)] as [key, value]}
114
+ {#if key < 3}
115
+ <b>{value + " "} </b>
116
+ {:else}
117
+ {value + " "}
118
+ {/if}
119
+ {/each}
120
  </button>
121
  {/each}
122
  </div>
src/lib/components/chat/ChatMessage.svelte CHANGED
@@ -28,19 +28,11 @@
28
  .replaceAll("<", "&lt;")
29
  .trim();
30
 
31
- for (const stop of [...(model.parameters?.stop ?? []), "<|endoftext|>"]) {
32
- if (ret.endsWith(stop)) {
33
- ret = ret.slice(0, -stop.length).trim();
34
- }
35
- }
36
-
37
  return ret;
38
  }
39
  function unsanitizeMd(md: string) {
40
- if (md != undefined)
41
- return md.replaceAll("&lt;", "<");
42
- else
43
- return ""
44
  }
45
 
46
  export let model: Model;
@@ -95,9 +87,6 @@
95
  // }
96
  });
97
 
98
- $: downloadLink =
99
- message.from === "user" ? `${$page.url.pathname}/message/${message.id}/prompt` : undefined;
100
-
101
  let webSearchIsDone = true;
102
 
103
  $: webSearchIsDone =
@@ -107,7 +96,7 @@
107
 
108
  {#if message.from === "assistant"}
109
  <div
110
- class="group relative -mb-8 flex items-start justify-start gap-4 pb-8 leading-relaxed"
111
  on:click={() => (isTapped = !isTapped)}
112
  on:keypress={() => (isTapped = !isTapped)}
113
  >
@@ -117,7 +106,7 @@
117
  class="mt-5 h-3 w-3 flex-none select-none rounded-full shadow-lg"
118
  />
119
  <div
120
- class="relative min-h-[calc(2rem+theme(spacing[3.5])*2)] min-w-[60px] break-words rounded-2xl border border-gray-100 bg-gradient-to-br from-gray-50 px-5 py-3.5 text-gray-600 prose-pre:my-2 dark:border-gray-800 dark:from-gray-800/40 dark:text-gray-300"
121
  >
122
  {#if webSearchMessages && webSearchMessages.length > 0}
123
  <OpenWebSearchResults
@@ -131,24 +120,26 @@
131
  {/if}
132
 
133
  <div
134
- class="prose max-w-none dark:prose-invert max-sm:prose-sm prose-headings:font-semibold prose-h1:text-lg prose-h2:text-base prose-h3:text-base prose-pre:bg-gray-800 dark:prose-pre:bg-gray-900"
135
  bind:this={contentEl}
136
  >
137
- {#if message.isCode == true}
138
- <CodeBlock lang={"python"} code={unsanitizeMd(message.content)} />
 
139
  {:else}
140
- <!-- eslint-disable-next-line svelte/no-at-html-tags -->
141
- {@html marked(message.content, options)}
142
  {/if}
 
143
  </div>
144
  </div>
145
  </div>
146
  {/if}
147
  {#if message.from === "user"}
148
- <div class="group relative flex items-start justify-start gap-4 max-sm:text-sm">
149
  <div class="mt-5 h-3 w-3 flex-none rounded-full" />
150
  <div
151
- class="max-w-full whitespace-break-spaces break-words rounded-2xl px-5 py-3.5 text-gray-500 dark:text-gray-400"
152
  >
153
  {message.content.trim()}
154
  </div>
 
28
  .replaceAll("<", "&lt;")
29
  .trim();
30
 
 
 
 
 
 
 
31
  return ret;
32
  }
33
  function unsanitizeMd(md: string) {
34
+ if (md != undefined) return md.replaceAll("&lt;", "<");
35
+ else return "";
 
 
36
  }
37
 
38
  export let model: Model;
 
87
  // }
88
  });
89
 
 
 
 
90
  let webSearchIsDone = true;
91
 
92
  $: webSearchIsDone =
 
96
 
97
  {#if message.from === "assistant"}
98
  <div
99
+ class="group relative -mb-8 flex items-start justify-start gap-4 pb-8 leading-relaxed max-w-[80%]"
100
  on:click={() => (isTapped = !isTapped)}
101
  on:keypress={() => (isTapped = !isTapped)}
102
  >
 
106
  class="mt-5 h-3 w-3 flex-none select-none rounded-full shadow-lg"
107
  />
108
  <div
109
+ class="bg-ai-chat relative min-h-[calc(2rem+theme(spacing[3.5])*2)] min-w-[60px] break-words rounded-2xl border border-gray-100 px-5 py-3.5 prose-pre:my-2 dark:border-gray-800 dark:from-gray-800/40 text-white"
110
  >
111
  {#if webSearchMessages && webSearchMessages.length > 0}
112
  <OpenWebSearchResults
 
120
  {/if}
121
 
122
  <div
123
+ class="prose max-w-none dark:prose-invert max-sm:prose-sm prose-headings:font-semibold prose-h1:text-lg prose-h2:text-base prose-h3:text-base prose-pre:bg-gray-800 dark:prose-pre:bg-gray-900 text-white"
124
  bind:this={contentEl}
125
  >
126
+ {#each tokens as token}
127
+ {#if token.type === "code"}
128
+ <CodeBlock lang={token.lang} code={unsanitizeMd(token.text)} />
129
  {:else}
130
+ <!-- eslint-disable-next-line svelte/no-at-html-tags -->
131
+ {@html marked(token.raw, options)}
132
  {/if}
133
+ {/each}
134
  </div>
135
  </div>
136
  </div>
137
  {/if}
138
  {#if message.from === "user"}
139
+ <div class="group relative flex items-start justify-end gap-4">
140
  <div class="mt-5 h-3 w-3 flex-none rounded-full" />
141
  <div
142
+ class="bg-user-chat max-w-[80%] whitespace-break-spaces break-words rounded-2xl px-5 py-3.5 text-white prose dark:prose-invert max-sm:prose-sm prose-headings:font-semibold prose-h1:text-lg prose-h2:text-base prose-h3:text-base prose-pre:bg-gray-900 text-white"
143
  >
144
  {message.content.trim()}
145
  </div>
src/lib/components/chat/ChatMessages.svelte CHANGED
@@ -47,12 +47,13 @@
47
  }));
48
  </script>
49
 
 
50
  <div
51
- class="scrollbar-custom mr-1 h-full overflow-y-auto"
52
  use:snapScrollToBottom={messages.length ? [...messages, ...webSearchMessages] : false}
53
  bind:this={chatContainer}
54
  >
55
- <div class="mx-auto flex h-full max-w-3xl flex-col gap-6 px-5 pt-6 sm:gap-8 xl:max-w-4xl">
56
  {#each messages as message, i}
57
  <ChatMessage
58
  loading={loading && i === messages.length - 1}
@@ -76,8 +77,8 @@
76
  {/if}
77
  <div class="h-44 flex-none" />
78
  </div>
79
- <ScrollToBottomBtn
 
80
  class="bottom-36 right-4 max-md:hidden lg:right-10"
81
  scrollNode={chatContainer}
82
  />
83
- </div>
 
47
  }));
48
  </script>
49
 
50
+ <!-- main chat background-->
51
  <div
52
+ class="scrollbar-custom mr-1 h-[95%] overflow-y-auto bg-chat"
53
  use:snapScrollToBottom={messages.length ? [...messages, ...webSearchMessages] : false}
54
  bind:this={chatContainer}
55
  >
56
+ <div class="mx-auto flex h-[95%] max-w-3xl flex-col gap-6 px-5 pt-6 sm:gap-8 xl:max-w-4xl">
57
  {#each messages as message, i}
58
  <ChatMessage
59
  loading={loading && i === messages.length - 1}
 
77
  {/if}
78
  <div class="h-44 flex-none" />
79
  </div>
80
+ </div>
81
+ <ScrollToBottomBtn
82
  class="bottom-36 right-4 max-md:hidden lg:right-10"
83
  scrollNode={chatContainer}
84
  />
 
src/lib/components/chat/ChatWindow.svelte CHANGED
@@ -1,12 +1,12 @@
1
  <script lang="ts">
2
  import type { Message } from "$lib/types/Message";
3
  import { createEventDispatcher } from "svelte";
4
-
5
  import CarbonSendAltFilled from "~icons/carbon/send-alt-filled";
6
- import CarbonExport from "~icons/carbon/export";
7
  import CarbonStopFilledAlt from "~icons/carbon/stop-filled-alt";
8
  import EosIconsLoading from "~icons/eos-icons/loading";
9
-
 
10
  import ChatMessages from "./ChatMessages.svelte";
11
  import ChatInput from "./ChatInput.svelte";
12
  import StopGeneratingBtn from "../StopGeneratingBtn.svelte";
@@ -14,9 +14,10 @@
14
  import type { LayoutData } from "../../../routes/$types";
15
  import WebSearchToggle from "../WebSearchToggle.svelte";
16
  import type { WebSearchMessage } from "$lib/types/WebSearch";
17
- import LoginModal from "../LoginModal.svelte";
18
 
19
  export let messages: Message[] = [];
 
 
20
  export let loading = false;
21
  export let pending = false;
22
  export let shared = false;
@@ -31,6 +32,29 @@
31
 
32
  let loginModalOpen = false;
33
  let message: string;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
  const dispatch = createEventDispatcher<{
36
  message: string;
@@ -45,11 +69,30 @@
45
  message = "";
46
  };
47
  </script>
48
-
49
- <div class="relative min-h-0 min-w-0">
50
- {#if loginModalOpen}
51
- <LoginModal {settings} on:close={() => (loginModalOpen = false)} />
52
- {/if}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  <ChatMessages
54
  {loading}
55
  {pending}
@@ -67,8 +110,9 @@
67
  if (!loading) dispatch("retry", ev.detail);
68
  }}
69
  />
70
- <div
71
- class="dark:via-gray-80 pointer-events-none absolute inset-x-0 bottom-0 z-0 mx-auto flex w-full max-w-3xl flex-col items-center justify-center bg-gradient-to-t from-white via-white/80 to-white/0 px-3.5 py-4 dark:border-gray-800 dark:from-gray-900 dark:to-gray-900/0 max-md:border-t max-md:bg-white max-md:dark:bg-gray-900 sm:px-5 md:py-8 xl:max-w-4xl [&>*]:pointer-events-auto"
 
72
  >
73
  <div class="flex w-full pb-3 max-md:justify-between">
74
  {#if settings?.searchEnabled}
@@ -88,7 +132,7 @@
88
  >
89
  <div class="flex w-full flex-1 border-none bg-transparent">
90
  <ChatInput
91
- placeholder="Ask anything"
92
  bind:value={message}
93
  on:submit={handleSubmit}
94
  on:keypress={() => {
@@ -120,28 +164,62 @@
120
  </button>
121
  {/if}
122
  </div>
123
- </form>
124
- <div class="mt-2 flex justify-between self-stretch px-1 text-xs text-gray-400/90 max-sm:gap-2">
125
- <p>
126
- Model: <a
127
- href={currentModel.modelUrl || "https://huggingface.co/" + currentModel.name}
128
- target="_blank"
129
- rel="noreferrer"
130
- class="hover:underline">{currentModel.displayName}</a
131
- > <span class="max-sm:hidden">·</span><br class="sm:hidden" /> Generated content may be
132
- inaccurate or false.
133
- <br /><br /> 🔒 All conversations are end-to-end protected
134
- </p>
135
- <!-- {#if messages.length}
136
- <button
137
- class="flex flex-none items-center hover:text-gray-400 hover:underline max-sm:rounded-lg max-sm:bg-gray-50 max-sm:px-2.5 dark:max-sm:bg-gray-800"
138
- type="button"
139
- on:click={() => dispatch("share")}
140
  >
141
- <CarbonExport class="text-[.6rem] sm:mr-1.5 sm:text-primary-500" />
142
- <div class="max-sm:hidden">Share this conversation</div>
143
- </button>
144
- {/if} -->
145
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  </div>
147
- </div>
 
1
  <script lang="ts">
2
  import type { Message } from "$lib/types/Message";
3
  import { createEventDispatcher } from "svelte";
4
+ import Help from "$lib/components/icons/Help.svelte"
5
  import CarbonSendAltFilled from "~icons/carbon/send-alt-filled";
 
6
  import CarbonStopFilledAlt from "~icons/carbon/stop-filled-alt";
7
  import EosIconsLoading from "~icons/eos-icons/loading";
8
+ import CarbonClose from "~icons/carbon/close";
9
+ import { helpMenu } from "../../../routes/LayoutWritable";
10
  import ChatMessages from "./ChatMessages.svelte";
11
  import ChatInput from "./ChatInput.svelte";
12
  import StopGeneratingBtn from "../StopGeneratingBtn.svelte";
 
14
  import type { LayoutData } from "../../../routes/$types";
15
  import WebSearchToggle from "../WebSearchToggle.svelte";
16
  import type { WebSearchMessage } from "$lib/types/WebSearch";
 
17
 
18
  export let messages: Message[] = [];
19
+ let isHelpMenuOpen: boolean = false;
20
+ let isPrivacyBannerOpen: boolean = true;
21
  export let loading = false;
22
  export let pending = false;
23
  export let shared = false;
 
32
 
33
  let loginModalOpen = false;
34
  let message: string;
35
+
36
+ helpMenu.subscribe((val) => {
37
+ isHelpMenuOpen = val;
38
+ })
39
+
40
+ function closeHelpMenu() {
41
+ helpMenu.set(false);
42
+ }
43
+
44
+ function closePrivacyBanner() {
45
+ isPrivacyBannerOpen = false;
46
+ }
47
+
48
+ function toggleHelpMenu() {
49
+ helpMenu.set(!isHelpMenuOpen);
50
+ console.log($helpMenu);
51
+ }
52
+
53
+ function handleKeyDown(event: { key: string; }) {
54
+ if (event.key === 'Enter') {
55
+ toggleHelpMenu();
56
+ }
57
+ }
58
 
59
  const dispatch = createEventDispatcher<{
60
  message: string;
 
69
  message = "";
70
  };
71
  </script>
72
+ <div class="bg-chat relative min-h-0 min-w-0">
73
+ <!-- {#if isPrivacyBannerOpen}
74
+ <script type="text/javascript">
75
+ document.getElementById("PrivacyBanner").style.display = "block";
76
+ </script> -->
77
+ <!-- <div class="bg-chat" id="privacy-banner">
78
+ <div class="border-b border-gray-600 flex justify-between px-4">
79
+ <div class="justify-center items-center text-center flex-1">
80
+ <p class="px-4 py-3 text-black/white text-xs lg:text-base">
81
+ 🔒 Prompts are end-to-end protected.<br>
82
+ Not even Mithril Security can read or train on them. Learn more
83
+ <a
84
+ href="https://www.mithrilsecurity.io/privacy-policy#new-pp"
85
+ target="_blank"
86
+ rel="noopener noreferrer"
87
+ style="text-decoration: underline; color: #f0b92d;">here</a
88
+ >.</p>
89
+ </div>
90
+ <button type="button" class="pt-2" style="align-self: flex-start;" on:click={closePrivacyBanner}>
91
+ <CarbonClose class="text-white" />
92
+ </button>
93
+ </div>
94
+ </div> -->
95
+ <!-- {/if} -->
96
  <ChatMessages
97
  {loading}
98
  {pending}
 
110
  if (!loading) dispatch("retry", ev.detail);
111
  }}
112
  />
113
+ <!-- chat input background bg-gradient-to-t from-white via-white/80 to-white/0 -->
114
+ <div
115
+ class="dark:bg-chat border-0 pointer-events-none absolute inset-x-0 bottom-0 z-0 mx-auto flex w-full max-w-3xl flex-col items-center justify-center px-3.5 py-2 sm:px-5 md:pb-6 md:pt-4 xl:max-w-4xl [&>*]:pointer-events-auto"
116
  >
117
  <div class="flex w-full pb-3 max-md:justify-between">
118
  {#if settings?.searchEnabled}
 
132
  >
133
  <div class="flex w-full flex-1 border-none bg-transparent">
134
  <ChatInput
135
+ placeholder="Type here"
136
  bind:value={message}
137
  on:submit={handleSubmit}
138
  on:keypress={() => {
 
164
  </button>
165
  {/if}
166
  </div>
167
+ <div class="mt-2 flex justify-end self-stretch text-xs text-gray-400/90 max-sm:gap-2">
168
+ <div
169
+ class="pb-2 pr-2 rounded-2xl text-center flex items-center justify-end group h-11 -lg font-semibold text-gray-400 hover:bg-gray-700"
170
+ on:click={toggleHelpMenu}
171
+ on:keydown={handleKeyDown}
 
 
 
 
 
 
 
 
 
 
 
 
172
  >
173
+ <Help/>
174
+ </div>
175
+ </div>
176
+ </form>
177
+ {#if messages.length}
178
+ <script type="text/javascript">
179
+ document.getElementById("banner").style.display = "block";
180
+ </script>
181
+ {:else}
182
+ <script type="text/javascript">
183
+ document.getElementById("banner").style.display = "none";
184
+ </script>
185
+ {/if}
186
+ <!-- {#if messages.length}
187
+ <button
188
+ class="flex flex-none items-center hover:text-gray-400 hover:underline max-sm:rounded-lg max-sm:bg-gray-50 max-sm:px-2.5 dark:max-sm:bg-gray-800"
189
+ type="button"
190
+ on:click={() => dispatch("share")}
191
+ >
192
+ <CarbonExport class="text-[.6rem] sm:mr-1.5 sm:text-primary-500" />
193
+ <div class="max-sm:hidden">Share this conversation</div>
194
+ </button>
195
+ {/if} -->
196
+ {#if isHelpMenuOpen}
197
+ <script type="text/javascript">
198
+ document.getElementById("helpMenu").style.display = "block";
199
+ </script>
200
+ <div id="helpMenu" class="bottom-[80%] right-[0%] md:bottom-[45%] md:right-[0%] xl:bottom-[50%] xl:right-[-22%] p-2 border border-gray-600 flex justify-center items-center rounded-2xl bg-[#0d1830] {isHelpMenuOpen ? 'open' : ''}" style="position: absolute;">
201
+ <div>
202
+ <div class="justify-center items-center text-center flex-1">
203
+ <div class="flex justify-between px-2">
204
+ <a href="https://www.mithrilsecurity.io/contact" target="_blank" rel="noopener noreferrer" class="rounded-2xl px-8 block py-3 text-center h-11 text-white hover:bg-gray-600" style="width: 100%;">
205
+ Help ⤵️
206
+ </a>
207
+ <button type="button" class="pt-2" style="align-self: flex-start;" on:click={closeHelpMenu}>
208
+ <CarbonClose class="text-white" />
209
+ </button>
210
+ </div>
211
+ </div>
212
+ <!-- <a href="https://1qdag6eehid.typeform.com/to/EFrGfL1u" target="_blank" rel="noopener noreferrer" class="rounded-2xl px-8 block text-center h-11 py-3 text-white hover:bg-gray-600" style="width: 100%;">
213
+ Give Feedback ⤵️
214
+ </a> -->
215
+ <a href="https://www.mithrilsecurity.io/faq" target="_blank" rel="noopener noreferrer" class="rounded-xl block text-center h-11 py-3 text-white hover:bg-gray-600" style="width: 100%;">
216
+ FAQ ⤵️
217
+ </a>
218
+ <a href="https://github.com/mithril-security/blind_chat/issues" target="_blank" rel="noopener noreferrer" class="rounded-2xl block text-center h-11 pt-3 text-white hover:bg-gray-600" style="width: 100%;">
219
+ Report an issue ⤵️
220
+ </a>
221
+ </div>
222
+ </div>
223
+ {/if}
224
+ </div>
225
  </div>
 
src/lib/components/icons/Help.svelte ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { page } from "$app/stores";
3
+ import { PUBLIC_APP_ASSETS, PUBLIC_APP_NAME, PUBLIC_ORIGIN } from "$env/static/public";
4
+ import { base } from "$app/paths";
5
+ export let classNames = "";
6
+
7
+ function toggleHelpMenu() {
8
+ }
9
+
10
+ function handleKeyDown(event: { key: string; }) {
11
+ if (event.key === 'Enter') {
12
+ toggleHelpMenu();
13
+ }
14
+ }
15
+
16
+ </script>
17
+ <img
18
+ alt="help menu button"
19
+ on:click={toggleHelpMenu}
20
+ on:keydown={handleKeyDown}
21
+ class={classNames}
22
+ src="{PUBLIC_ORIGIN || $page.url.origin}{base}/{PUBLIC_APP_ASSETS}/help.png"
23
+ title="help button"
24
+ width="20"
25
+ height="20"
26
+ />
src/lib/components/icons/Logo.svelte CHANGED
@@ -9,13 +9,18 @@
9
  {#if PUBLIC_APP_ASSETS === "chatui"}
10
  <object
11
  class={classNames}
12
- data="{PUBLIC_ORIGIN || $page.url.origin}{base}/{PUBLIC_APP_ASSETS}/chat.png"
13
  title="{PUBLIC_APP_NAME} logo"
 
 
 
14
  />
15
  {:else}
16
  <object
17
  class={classNames}
18
- data="{PUBLIC_ORIGIN || $page.url.origin}{base}/{PUBLIC_APP_ASSETS}/favicon.png"
19
  title="{PUBLIC_APP_NAME} logo"
 
 
20
  />
21
  {/if}
 
9
  {#if PUBLIC_APP_ASSETS === "chatui"}
10
  <object
11
  class={classNames}
12
+ data="{PUBLIC_ORIGIN || $page.url.origin}{base}/{PUBLIC_APP_ASSETS}/chat-new-logo.png"
13
  title="{PUBLIC_APP_NAME} logo"
14
+ width="60"
15
+ height="60"
16
+ style="border:none ! important;"
17
  />
18
  {:else}
19
  <object
20
  class={classNames}
21
+ data="{PUBLIC_ORIGIN || $page.url.origin}{base}/{PUBLIC_APP_ASSETS}/chat-new-logo.png"
22
  title="{PUBLIC_APP_NAME} logo"
23
+ width="60"
24
+ height="60"
25
  />
26
  {/if}
src/lib/components/straightModal.svelte ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { createEventDispatcher, onDestroy, onMount } from "svelte";
3
+ import { cubicOut } from "svelte/easing";
4
+ import { fade } from "svelte/transition";
5
+ import Portal from "./Portal.svelte";
6
+ import { browser } from "$app/environment";
7
+
8
+ export let width = "w-9/10";
9
+ let backdropEl: HTMLDivElement;
10
+ let modalEl: HTMLDivElement;
11
+
12
+ const dispatch = createEventDispatcher<{ close: void }>();
13
+
14
+ function handleKeydown(event: KeyboardEvent) {
15
+ // close on ESC
16
+ if (event.key === "Escape") {
17
+ event.preventDefault();
18
+ dispatch("close");
19
+ }
20
+ }
21
+
22
+ function handleBackdropClick(event: MouseEvent) {
23
+ if (event.target === backdropEl) {
24
+ dispatch("close");
25
+ }
26
+ }
27
+
28
+ onMount(() => {
29
+ document.getElementById("app")?.setAttribute("inert", "true");
30
+ modalEl.focus();
31
+ });
32
+
33
+ onDestroy(() => {
34
+ if (!browser) return;
35
+ // remove inert attribute if this is the last modal
36
+ if (document.querySelectorAll('[role="dialog"]:not(#app *)').length === 1) {
37
+ document.getElementById("app")?.removeAttribute("inert");
38
+ }
39
+ });
40
+ </script>
41
+
42
+ <Portal>
43
+ <div
44
+ role="presentation"
45
+ tabindex="-1"
46
+ bind:this={backdropEl}
47
+ on:click={handleBackdropClick}
48
+ transition:fade={{ easing: cubicOut, duration: 300 }}
49
+ class="fixed inset-0 z-40 flex items-center justify-center bg-black/80 p-8 backdrop-blur-sm dark:bg-black/50"
50
+ >
51
+ <div
52
+ role="dialog"
53
+ tabindex="-1"
54
+ bind:this={modalEl}
55
+ on:keydown={handleKeydown}
56
+ class="-mt-10 overflow-hidden bg-white shadow-2xl outline-none md:-mt-20 {width}"
57
+ >
58
+ <slot />
59
+ </div>
60
+ </div>
61
+ </Portal>
src/lib/server/models.ts CHANGED
@@ -66,6 +66,7 @@ const modelsRaw = z
66
  is_local: z.boolean().optional(),
67
  is_code: z.boolean().optional(),
68
  is_phi: z.boolean().optional(),
 
69
  type: z.string().min(1),
70
  websiteUrl: z.string().url().optional(),
71
  modelUrl: z.string().url().optional(),
@@ -85,8 +86,7 @@ const modelsRaw = z
85
  "{{#each messages}}" +
86
  "{{#ifUser}}{{@root.userMessageToken}}{{content}}{{@root.userMessageEndToken}}{{/ifUser}}" +
87
  "{{#ifAssistant}}{{@root.assistantMessageToken}}{{content}}{{@root.assistantMessageEndToken}}{{/ifAssistant}}" +
88
- "{{/each}}" +
89
- "{{assistantMessageToken}}"
90
  ),
91
  webSearchSummaryPromptTemplate: z
92
  .string()
 
66
  is_local: z.boolean().optional(),
67
  is_code: z.boolean().optional(),
68
  is_phi: z.boolean().optional(),
69
+ server_addr: z.string().min(1).optional(),
70
  type: z.string().min(1),
71
  websiteUrl: z.string().url().optional(),
72
  modelUrl: z.string().url().optional(),
 
86
  "{{#each messages}}" +
87
  "{{#ifUser}}{{@root.userMessageToken}}{{content}}{{@root.userMessageEndToken}}{{/ifUser}}" +
88
  "{{#ifAssistant}}{{@root.assistantMessageToken}}{{content}}{{@root.assistantMessageEndToken}}{{/ifAssistant}}" +
89
+ "{{/each}}"
 
90
  ),
91
  webSearchSummaryPromptTemplate: z
92
  .string()
src/lib/switchTheme.ts CHANGED
@@ -1,10 +1,5 @@
1
  export function switchTheme() {
2
  const { classList } = document.querySelector("html") as HTMLElement;
3
- if (classList.contains("dark")) {
4
- classList.remove("dark");
5
- localStorage.theme = "light";
6
- } else {
7
- classList.add("dark");
8
- localStorage.theme = "dark";
9
- }
10
  }
 
1
  export function switchTheme() {
2
  const { classList } = document.querySelector("html") as HTMLElement;
3
+ classList.add("dark");
4
+ localStorage.theme = "dark";
 
 
 
 
 
5
  }
src/lib/utils/template.ts CHANGED
@@ -1,5 +1,5 @@
1
  import type { Message } from "$lib/types/Message";
2
- import type { LegacyParamatersTemplateInput } from "$lib/types/Template";
3
  import Handlebars from "handlebars";
4
 
5
  Handlebars.registerHelper("ifUser", function (this: Pick<Message, "from" | "content">, options) {
@@ -26,3 +26,7 @@ export function compileTemplate<T>(input: string, model: LegacyParamatersTemplat
26
  return template({ ...model, ...inputs }, options);
27
  };
28
  }
 
 
 
 
 
1
  import type { Message } from "$lib/types/Message";
2
+ import type { ChatTemplateInput, LegacyParamatersTemplateInput } from "$lib/types/Template";
3
  import Handlebars from "handlebars";
4
 
5
  Handlebars.registerHelper("ifUser", function (this: Pick<Message, "from" | "content">, options) {
 
26
  return template({ ...model, ...inputs }, options);
27
  };
28
  }
29
+
30
+ export function compileTemplate2(input: string, model: LegacyParamatersTemplateInput) {
31
+ return compileTemplate<ChatTemplateInput>(input, model)
32
+ }
src/routes/+layout.server.ts CHANGED
@@ -43,7 +43,10 @@ export const load: LayoutServerLoad = async ({ locals, depends, url }) => {
43
  websiteUrl: model.websiteUrl,
44
  modelUrl: model.modelUrl,
45
  is_local: model.is_local,
 
 
46
  is_phi: model.is_phi,
 
47
  is_code: model.is_code,
48
  type: model.type,
49
  datasetName: model.datasetName,
@@ -53,6 +56,7 @@ export const load: LayoutServerLoad = async ({ locals, depends, url }) => {
53
  promptExamples: model.promptExamples,
54
  parameters: model.parameters,
55
  preprompt: model.preprompt,
 
56
  })),
57
  oldModels,
58
  user: locals.user && {
 
43
  websiteUrl: model.websiteUrl,
44
  modelUrl: model.modelUrl,
45
  is_local: model.is_local,
46
+ userMessageToken: model.userMessageToken,
47
+ assistantMessageToken: model.assistantMessageToken,
48
  is_phi: model.is_phi,
49
+ server_addr: model.server_addr,
50
  is_code: model.is_code,
51
  type: model.type,
52
  datasetName: model.datasetName,
 
56
  promptExamples: model.promptExamples,
57
  parameters: model.parameters,
58
  preprompt: model.preprompt,
59
+ chatPromptTemplate: model.chatPromptTemplate
60
  })),
61
  oldModels,
62
  user: locals.user && {
src/routes/+layout.svelte CHANGED
@@ -5,7 +5,11 @@
5
  import { browser } from "$app/environment";
6
  import "../styles/main.css";
7
  import { base } from "$app/paths";
8
- import { PUBLIC_ORIGIN, PUBLIC_APP_DISCLAIMER } from "$env/static/public";
 
 
 
 
9
 
10
  import { shareConversation } from "$lib/shareConversation";
11
  import { UrlDependency } from "$lib/types/UrlDependency";
@@ -15,7 +19,8 @@
15
  import NavMenu from "$lib/components/NavMenu.svelte";
16
  import Toast from "$lib/components/Toast.svelte";
17
  import ConfirmModal from "$lib/components/ConfirmModal.svelte";
18
- import SettingsModal from "$lib/components/SettingsModal.svelte";
 
19
  import LoadingModal from "$lib/components/LoadingModal.svelte";
20
  import LoginModal from "$lib/components/LoginModal.svelte";
21
  import { PUBLIC_APP_ASSETS, PUBLIC_APP_NAME } from "$env/static/public";
@@ -24,6 +29,11 @@
24
  is_init_writable,
25
  refresh_chats_writable,
26
  refresh_chats_writable_empty,
 
 
 
 
 
27
  } from "./LayoutWritable";
28
  import {
29
  deleteAllChats,
@@ -34,16 +44,22 @@
34
  } from "../routes/LocalDB";
35
  import { env } from "$env/dynamic/public";
36
  import InitModelModal from "$lib/components/InitModelModal.svelte";
 
37
 
38
  export let data;
39
  let isloading = false;
40
  let isInit = false;
41
- let showWarning = true;
 
42
 
43
  let go_to_main = false;
44
 
45
  let conversations_list = [];
46
 
 
 
 
 
47
  is_init_writable.subscribe((value) => {
48
  isInit = value;
49
  });
@@ -112,12 +128,7 @@
112
  }
113
 
114
  onMount(async () => {
115
- try {
116
- dataLayer.push({ event: "Avertissement"});
117
- } catch (e) {
118
- console.log("Google Tag Manager might not be loaded. Ignoring the error");
119
- console.log(e);
120
- }
121
  await refreshChats();
122
  });
123
 
@@ -127,6 +138,7 @@
127
 
128
  $: if ($error) onError();
129
 
 
130
  const requiresLogin =
131
  !$page.error &&
132
  !$page.route.id?.startsWith("/r/") &&
@@ -142,11 +154,46 @@
142
  conversations_list = ret;
143
  }
144
  $: title = env.PUBLIC_APP_NAME;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  </script>
146
 
147
  <svelte:head>
148
  <title>{PUBLIC_APP_NAME}</title>
149
- <meta name="description" content="Private Conversational AI" />
150
  <meta property="og:title" content={PUBLIC_APP_NAME} />
151
  <meta property="og:type" content="website" />
152
  <meta property="og:url" content="{PUBLIC_ORIGIN || $page.url.origin}{base}" />
@@ -193,6 +240,7 @@
193
  conversations={conversations_list}
194
  user={data.user}
195
  canLogin={data.user === undefined && data.requiresLogin}
 
196
  bind:loginModalVisible
197
  on:shareConversation={(ev) => shareConversation(ev.detail.id, ev.detail.title)}
198
  on:deleteConversation={(ev) => deleteConversation(ev.detail)}
@@ -205,6 +253,7 @@
205
  conversations={conversations_list}
206
  user={data.user}
207
  canLogin={data.user === undefined && data.requiresLogin}
 
208
  bind:loginModalVisible
209
  on:shareConversation={(ev) => shareConversation(ev.detail.id, ev.detail.title)}
210
  on:deleteConversation={(ev) => deleteConversation(ev.detail)}
@@ -215,6 +264,9 @@
215
  {#if currentError}
216
  <Toast message={currentError} />
217
  {/if}
 
 
 
218
  {#if showWarning}
219
  <ConfirmModal on:close={() => (showWarning = false)} />
220
  {/if}
@@ -232,8 +284,6 @@
232
  models={data.models}
233
  />
234
  {/if}
235
- {#if (requiresLogin && data.messagesBeforeLogin === 0) || loginModalVisible}
236
- <LoginModal settings={data.settings} />
237
- {/if}
238
  <slot />
239
  </div>
 
5
  import { browser } from "$app/environment";
6
  import "../styles/main.css";
7
  import { base } from "$app/paths";
8
+ import {
9
+ PUBLIC_ORIGIN,
10
+ PUBLIC_APP_DISCLAIMER,
11
+ PUBLIC_SHOW_LOCAL_MODELS_WARNING,
12
+ } from "$env/static/public";
13
 
14
  import { shareConversation } from "$lib/shareConversation";
15
  import { UrlDependency } from "$lib/types/UrlDependency";
 
19
  import NavMenu from "$lib/components/NavMenu.svelte";
20
  import Toast from "$lib/components/Toast.svelte";
21
  import ConfirmModal from "$lib/components/ConfirmModal.svelte";
22
+ import ShouldLoginModal from "$lib/components/ShouldLoginModal.svelte";
23
+ import SettingsModal from "$lib/components/SettingsModal2.svelte";
24
  import LoadingModal from "$lib/components/LoadingModal.svelte";
25
  import LoginModal from "$lib/components/LoginModal.svelte";
26
  import { PUBLIC_APP_ASSETS, PUBLIC_APP_NAME } from "$env/static/public";
 
29
  is_init_writable,
30
  refresh_chats_writable,
31
  refresh_chats_writable_empty,
32
+ api_key_writable,
33
+ is_logged_writable,
34
+ showLoggedPopup_writable,
35
+ is_magic_writable,
36
+ email_addr_writable
37
  } from "./LayoutWritable";
38
  import {
39
  deleteAllChats,
 
44
  } from "../routes/LocalDB";
45
  import { env } from "$env/dynamic/public";
46
  import InitModelModal from "$lib/components/InitModelModal.svelte";
47
+ import { getApiKey } from "./tools";
48
 
49
  export let data;
50
  let isloading = false;
51
  let isInit = false;
52
+ let showWarning = PUBLIC_SHOW_LOCAL_MODELS_WARNING === "true" ? true : false;
53
+ let shouldLogin = false;
54
 
55
  let go_to_main = false;
56
 
57
  let conversations_list = [];
58
 
59
+ showLoggedPopup_writable.subscribe((value) => {
60
+ shouldLogin = value;
61
+ });
62
+
63
  is_init_writable.subscribe((value) => {
64
  isInit = value;
65
  });
 
128
  }
129
 
130
  onMount(async () => {
131
+ localStorage.theme = "dark";
 
 
 
 
 
132
  await refreshChats();
133
  });
134
 
 
138
 
139
  $: if ($error) onError();
140
 
141
+ data.requiresLogin = true; //
142
  const requiresLogin =
143
  !$page.error &&
144
  !$page.route.id?.startsWith("/r/") &&
 
154
  conversations_list = ret;
155
  }
156
  $: title = env.PUBLIC_APP_NAME;
157
+ let loggedIn = false;
158
+ // async function isLogged() {
159
+ // try {
160
+ // const response = await fetch("https://cloud.mithrilsecurity.io/api/auth/getUserInfo", {
161
+ // method: "GET",
162
+ // credentials: "include",
163
+ // headers: {
164
+ // "Content-Type": "application/json",
165
+ // },
166
+ // });
167
+ // dataLayer.push({'event': 'login'});
168
+ // if (response.ok) {
169
+ // const res = await response.text()
170
+ // const json: JSON = JSON.parse(res)
171
+ // email_addr_writable.set(json.email)
172
+ // console.log(res)
173
+ // // Handle a successful response here
174
+ // console.log("User is logged in successfully");
175
+ // var apiKey = await getApiKey();
176
+ // loggedIn = true;
177
+ // is_logged_writable.set(loggedIn);
178
+ // api_key_writable.set(apiKey);
179
+ // }
180
+ // else {
181
+ // // Handle errors here
182
+ // console.error("User is not logged in");
183
+ // }
184
+ // } catch (err) {
185
+ // // Handle network errors here
186
+ // console.error("Network error", err);
187
+
188
+ // }
189
+ // is_magic_writable.set(true);
190
+ // }
191
+ // isLogged();
192
  </script>
193
 
194
  <svelte:head>
195
  <title>{PUBLIC_APP_NAME}</title>
196
+ <meta name="og:description" content="Private Conversational AI" />
197
  <meta property="og:title" content={PUBLIC_APP_NAME} />
198
  <meta property="og:type" content="website" />
199
  <meta property="og:url" content="{PUBLIC_ORIGIN || $page.url.origin}{base}" />
 
240
  conversations={conversations_list}
241
  user={data.user}
242
  canLogin={data.user === undefined && data.requiresLogin}
243
+ signedIn={loggedIn}
244
  bind:loginModalVisible
245
  on:shareConversation={(ev) => shareConversation(ev.detail.id, ev.detail.title)}
246
  on:deleteConversation={(ev) => deleteConversation(ev.detail)}
 
253
  conversations={conversations_list}
254
  user={data.user}
255
  canLogin={data.user === undefined && data.requiresLogin}
256
+ signedIn={loggedIn}
257
  bind:loginModalVisible
258
  on:shareConversation={(ev) => shareConversation(ev.detail.id, ev.detail.title)}
259
  on:deleteConversation={(ev) => deleteConversation(ev.detail)}
 
264
  {#if currentError}
265
  <Toast message={currentError} />
266
  {/if}
267
+ {#if shouldLogin}
268
+ <ShouldLoginModal on:close={() => showLoggedPopup_writable.set(false)} />
269
+ {/if}
270
  {#if showWarning}
271
  <ConfirmModal on:close={() => (showWarning = false)} />
272
  {/if}
 
284
  models={data.models}
285
  />
286
  {/if}
287
+ <!-- {#if (requiresLogin && data.messagesBeforeLogin === 0) || loginModalVisible} -->
 
 
288
  <slot />
289
  </div>
src/routes/+page.svelte CHANGED
@@ -1,34 +1,45 @@
1
  <script lang="ts">
2
- import { onMount } from 'svelte';
3
- import { goto, invalidate } from "$app/navigation";
4
  import { base } from "$app/paths";
5
  import { PUBLIC_APP_NAME } from "$env/static/public";
6
  import ChatWindow from "$lib/components/chat/ChatWindow.svelte";
7
  import { ERROR_MESSAGES, error } from "$lib/stores/errors";
8
  import { pendingMessage } from "$lib/stores/pendingMessage";
9
  import { findCurrentModel } from "$lib/utils/models";
10
- import { createChat } from "../routes/LocalDB";
11
  import { params_writable } from "../routes/conversation/[id]/ParamsWritable";
12
- import { curr_model_writable, curr_model_writable_string } from "./LayoutWritable";
 
 
 
 
 
 
13
 
14
- onMount(() => {
15
- try {
16
- dataLayer.push({ event: "virtualPageview", nom_modele: ["No"] });
17
- } catch (e) {
18
- console.log("Google Tag Manager might not be loaded. Ignoring the error");
19
- console.log(e);
20
- }
 
 
 
21
  });
22
 
23
- let curr_model_id = 0;
 
 
24
 
25
  curr_model_writable.subscribe((val) => {
26
  curr_model_id = val;
 
 
 
 
 
27
  });
28
 
29
- export let data;
30
- let loading = false;
31
-
32
  // dec2hex :: Integer -> String
33
  // i.e. 0-255 -> '00'-'ff'
34
  function dec2hex(dec) {
@@ -44,6 +55,14 @@
44
 
45
  async function createConversation(message: string) {
46
  try {
 
 
 
 
 
 
 
 
47
  loading = true;
48
 
49
  const conversationId = generateId(16);
 
1
  <script lang="ts">
2
+ import { goto } from "$app/navigation";
 
3
  import { base } from "$app/paths";
4
  import { PUBLIC_APP_NAME } from "$env/static/public";
5
  import ChatWindow from "$lib/components/chat/ChatWindow.svelte";
6
  import { ERROR_MESSAGES, error } from "$lib/stores/errors";
7
  import { pendingMessage } from "$lib/stores/pendingMessage";
8
  import { findCurrentModel } from "$lib/utils/models";
 
9
  import { params_writable } from "../routes/conversation/[id]/ParamsWritable";
10
+ import {
11
+ curr_model_writable,
12
+ curr_model_writable_string,
13
+ is_logged_writable,
14
+ showLoggedPopup_writable,
15
+ api_key_writable,
16
+ } from "./LayoutWritable";
17
 
18
+ let curr_model_id = 0;
19
+ let curr_model;
20
+ let api_key = "";
21
+
22
+ export let data;
23
+ let loading = false;
24
+ let isLogged = false;
25
+
26
+ is_logged_writable.subscribe((val) => {
27
+ isLogged = val;
28
  });
29
 
30
+ api_key_writable.subscribe((val) => {
31
+ api_key = val;
32
+ });
33
 
34
  curr_model_writable.subscribe((val) => {
35
  curr_model_id = val;
36
+ curr_model = findCurrentModel(
37
+ [...data.models, ...data.oldModels],
38
+ data.models[curr_model_id].name
39
+ );
40
+ console.log(curr_model);
41
  });
42
 
 
 
 
43
  // dec2hex :: Integer -> String
44
  // i.e. 0-255 -> '00'-'ff'
45
  function dec2hex(dec) {
 
55
 
56
  async function createConversation(message: string) {
57
  try {
58
+ const is_local = curr_model.is_local ?? true;
59
+ if (!is_local) {
60
+ if (!isLogged) {
61
+ showLoggedPopup_writable.set(true);
62
+ return;
63
+ }
64
+ }
65
+
66
  loading = true;
67
 
68
  const conversationId = generateId(16);
src/routes/LayoutWritable.js CHANGED
@@ -7,3 +7,11 @@ export const refresh_chats_writable = writable([]);
7
  export const refresh_chats_writable_empty = writable(false);
8
  export const curr_model_writable = writable(0);
9
  export const curr_model_writable_string = writable("");
 
 
 
 
 
 
 
 
 
7
  export const refresh_chats_writable_empty = writable(false);
8
  export const curr_model_writable = writable(0);
9
  export const curr_model_writable_string = writable("");
10
+ export const api_key_writable = writable("");
11
+ export const jwt_writable = writable("");
12
+ export const is_logged_writable = writable(false);
13
+ export const email_addr_writable = writable("");
14
+ export const is_magic_writable = writable(false);
15
+ export const showLoggedPopup_writable = writable(false);
16
+ export const userWritable = writable(undefined);
17
+ export const helpMenu = writable(false);
src/routes/LocalDB.ts CHANGED
@@ -28,7 +28,7 @@ export class ChatDatabase extends Dexie {
28
  chats: null,
29
  });
30
  this.version(17).stores({
31
- chats: null,
32
  });
33
  this.version(18).stores({
34
  chats: "++index, title, createdAt, id, message, model",
 
28
  chats: null,
29
  });
30
  this.version(17).stores({
31
+ chats: null,
32
  });
33
  this.version(18).stores({
34
  chats: "++index, title, createdAt, id, message, model",
src/routes/conversation/[id]/+page.svelte CHANGED
@@ -20,23 +20,41 @@
20
  isloading_writable,
21
  curr_model_writable,
22
  is_init_writable,
23
- cancel_writable,
 
 
 
24
  } from "../../LayoutWritable.js";
25
  import { map_writable, phi_writable } from "$lib/components/LoadingModalWritable.js";
26
  import { params_writable } from "./ParamsWritable.js";
27
  import { addMessageToChat, getChats, getMessages, getTitle, getModel } from "../../LocalDB.js";
28
  import { env } from "$env/dynamic/public";
 
29
  export let data;
 
 
 
30
 
31
  let curr_model_id = 0;
32
  curr_model_writable.subscribe((val) => {
33
  curr_model_id = val;
34
  });
35
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  let pipelineWorker;
37
 
38
  let pipe: Pipeline;
39
-
40
  let id = "";
41
 
42
  let title_ret = "BlindChat";
@@ -67,7 +85,7 @@
67
  try {
68
  if (e.data.file == "tokenizer.json")
69
  // Avoid to send the tag multiple times
70
- dataLayer.push({ event: "debut_chargement_chat", nom_modele: [e.data.name] });
71
  } catch (e) {
72
  console.log("Google Tag Manager might not be loaded. Ignoring the error");
73
  console.log(e);
@@ -89,9 +107,18 @@
89
  case "done":
90
  break;
91
 
 
 
 
 
 
 
 
 
 
92
  case "ready":
93
  try {
94
- dataLayer.push({ event: "fin_chargement_chat", nom_modele: [e.data.model] });
95
  } catch (e) {
96
  console.log("Google Tag Manager might not be loaded. Ignoring the error");
97
  console.log(e);
@@ -151,6 +178,40 @@
151
  let conversationId = $page.params.id;
152
  const responseId = randomUUID();
153
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  let opt = "";
155
 
156
  messages = [
@@ -175,27 +236,28 @@
175
  isCode: false,
176
  };
177
 
178
- try {
179
- dataLayer.push({ event: "envoi_message", nom_modele: [curr_model_obj.name] });
180
- } catch (e) {
181
- console.log("Google Tag Manager might not be loaded. Ignoring the error");
182
- console.log(e);
183
- }
184
-
185
  addMessageToChat(conversationId, msg, curr_model);
186
 
187
  let lastMessage = messages[messages.length - 1];
188
  pipelineWorker.postMessage({
189
- is_phi: curr_model_obj.is_phi ?? false,
190
  id_now: id_now,
191
- task: curr_model_obj.type,
192
- max_new_tokens: curr_model_obj.parameters?.max_new_tokens ?? 256,
193
- temperature: curr_model_obj.parameters?.temperature ?? 0.7,
194
  model: curr_model,
195
  text: inputs,
196
  webSearchId: webSearchId,
197
  conversationId: conversationId,
 
 
198
  });
 
 
 
 
 
 
 
 
 
199
  }
200
 
201
  async function summarizeTitle(id: string) {
@@ -290,7 +352,7 @@
290
  }
291
  console.error(err);
292
  } finally {
293
- loading = curr_model_obj.is_phi ?? false;
294
  pending = false;
295
  }
296
  }
@@ -342,12 +404,6 @@
342
  lastLoadedMessages = res;
343
  }
344
  id_now = randomUUID();
345
- try {
346
- dataLayer.push({ event: "virtualPageview", nom_modele: [curr_model] });
347
- } catch (e) {
348
- console.log("Google Tag Manager might not be loaded. Ignoring the error");
349
- console.log(e);
350
- }
351
  }
352
  });
353
 
@@ -380,13 +436,6 @@
380
 
381
  pipelineWorker.addEventListener("message", onMessageReceived);
382
 
383
- try {
384
- dataLayer.push({ event: "virtualPageview", nom_modele: [curr_model] });
385
- } catch (e) {
386
- console.log("Google Tag Manager might not be loaded. Ignoring the error");
387
- console.log(e);
388
- }
389
-
390
  if ($pendingMessage) {
391
  const val = $pendingMessage;
392
  const messageId = $pendingMessageIdToRetry || undefined;
 
20
  isloading_writable,
21
  curr_model_writable,
22
  is_init_writable,
23
+ api_key_writable,
24
+ jwt_writable,
25
+ is_logged_writable,
26
+ showLoggedPopup_writable,
27
  } from "../../LayoutWritable.js";
28
  import { map_writable, phi_writable } from "$lib/components/LoadingModalWritable.js";
29
  import { params_writable } from "./ParamsWritable.js";
30
  import { addMessageToChat, getChats, getMessages, getTitle, getModel } from "../../LocalDB.js";
31
  import { env } from "$env/dynamic/public";
32
+
33
  export let data;
34
+ let api_key = "";
35
+ let jwt = "";
36
+ let isLogged = false;
37
 
38
  let curr_model_id = 0;
39
  curr_model_writable.subscribe((val) => {
40
  curr_model_id = val;
41
  });
42
 
43
+ is_logged_writable.subscribe((val) => {
44
+ isLogged = val;
45
+ });
46
+
47
+ api_key_writable.subscribe((val) => {
48
+ api_key = val;
49
+ });
50
+
51
+ jwt_writable.subscribe((val) => {
52
+ jwt = val;
53
+ });
54
+
55
  let pipelineWorker;
56
 
57
  let pipe: Pipeline;
 
58
  let id = "";
59
 
60
  let title_ret = "BlindChat";
 
85
  try {
86
  if (e.data.file == "tokenizer.json")
87
  // Avoid to send the tag multiple times
88
+ dataLayer.push({ event: "debut_chargement_chat", nom_modele: [e.curr_model_obj.name] });
89
  } catch (e) {
90
  console.log("Google Tag Manager might not be loaded. Ignoring the error");
91
  console.log(e);
 
107
  case "done":
108
  break;
109
 
110
+ case "error":
111
+ $error = e.data.error
112
+ break;
113
+
114
+ case "invalid_jwt":
115
+ api_key_writable.set("");
116
+ jwt_writable.set("");
117
+ break;
118
+
119
  case "ready":
120
  try {
121
+ dataLayer.push({ event: "fin_chargement_chat", nom_modele: [e.curr_model_obj.name] });
122
  } catch (e) {
123
  console.log("Google Tag Manager might not be loaded. Ignoring the error");
124
  console.log(e);
 
178
  let conversationId = $page.params.id;
179
  const responseId = randomUUID();
180
 
181
+ const is_local = curr_model_obj.is_local ?? true;
182
+ if (!is_local) {
183
+ if (!isLogged) {
184
+ showLoggedPopup_writable.set(true);
185
+ return;
186
+ } else {
187
+ if (jwt === "") {
188
+ const data = { api_key };
189
+ const response = await fetch("https://cloud.mithrilsecurity.io/api/auth/licensing", {
190
+ method: "POST",
191
+ credentials: "include",
192
+ headers: {
193
+ "Content-Type": "application/json",
194
+ },
195
+ body: JSON.stringify(data),
196
+ });
197
+
198
+ if (response.ok) {
199
+ // Handle a successful response
200
+ console.log("Licensing OK");
201
+ jwt = await response.text();
202
+ jwt_writable.set(jwt);
203
+ } else {
204
+ console.log(response);
205
+ // Handle errors
206
+ console.error("Licensing NOK");
207
+ }
208
+ } else {
209
+ console.log("Using existing JWT");
210
+ console.log(jwt);
211
+ }
212
+ }
213
+ }
214
+
215
  let opt = "";
216
 
217
  messages = [
 
236
  isCode: false,
237
  };
238
 
 
 
 
 
 
 
 
239
  addMessageToChat(conversationId, msg, curr_model);
240
 
241
  let lastMessage = messages[messages.length - 1];
242
  pipelineWorker.postMessage({
243
+ model_obj: curr_model_obj,
244
  id_now: id_now,
 
 
 
245
  model: curr_model,
246
  text: inputs,
247
  webSearchId: webSearchId,
248
  conversationId: conversationId,
249
+ messages: messages,
250
+ jwt: jwt,
251
  });
252
+
253
+ try {
254
+ dataLayer.push({ event: "envoi_message", nom_modele: [curr_model_obj.name] });
255
+ } catch (e) {
256
+ console.log("Google Tag Manager might not be loaded. Ignoring the error");
257
+ console.log(e);
258
+ }
259
+
260
+ console.log(dataLayer)
261
  }
262
 
263
  async function summarizeTitle(id: string) {
 
352
  }
353
  console.error(err);
354
  } finally {
355
+ loading = curr_model_obj.is_phi ?? !curr_model_obj.is_local ?? false;
356
  pending = false;
357
  }
358
  }
 
404
  lastLoadedMessages = res;
405
  }
406
  id_now = randomUUID();
 
 
 
 
 
 
407
  }
408
  });
409
 
 
436
 
437
  pipelineWorker.addEventListener("message", onMessageReceived);
438
 
 
 
 
 
 
 
 
439
  if ($pendingMessage) {
440
  const val = $pendingMessage;
441
  const messageId = $pendingMessageIdToRetry || undefined;
src/routes/conversation/[id]/phi/m.d.ts CHANGED
@@ -1,65 +1,84 @@
1
  /* tslint:disable */
2
  /* eslint-disable */
3
  /**
4
- */
5
  export class Model {
6
- free(): void;
7
- /**
8
- * @param {Uint8Array} weights
9
- * @param {Uint8Array} tokenizer
10
- * @param {boolean} quantized
11
- */
12
- constructor(weights: Uint8Array, tokenizer: Uint8Array, quantized: boolean);
13
- /**
14
- * @param {string} prompt
15
- * @param {number} temp
16
- * @param {number} top_p
17
- * @param {number} repeat_penalty
18
- * @param {number} repeat_last_n
19
- * @param {bigint} seed
20
- * @returns {string}
21
- */
22
- init_with_prompt(prompt: string, temp: number, top_p: number, repeat_penalty: number, repeat_last_n: number, seed: bigint): string;
23
- /**
24
- * @returns {string}
25
- */
26
- next_token(): string;
27
- }
28
-
29
- export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
30
-
31
- export interface InitOutput {
32
- readonly memory: WebAssembly.Memory;
33
- readonly __wbg_model_free: (a: number) => void;
34
- readonly model_load: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
35
- readonly model_init_with_prompt: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
36
- readonly model_next_token: (a: number, b: number) => void;
37
- readonly main: (a: number, b: number) => number;
38
- readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
39
- readonly __wbindgen_malloc: (a: number, b: number) => number;
40
- readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
41
- readonly __wbindgen_free: (a: number, b: number, c: number) => void;
42
- readonly __wbindgen_exn_store: (a: number) => void;
43
- readonly __wbindgen_start: () => void;
44
- }
45
-
46
- export type SyncInitInput = BufferSource | WebAssembly.Module;
47
- /**
48
- * Instantiates the given `module`, which can either be bytes or
49
- * a precompiled `WebAssembly.Module`.
50
- *
51
- * @param {SyncInitInput} module
52
- *
53
- * @returns {InitOutput}
54
- */
55
- export function initSync(module: SyncInitInput): InitOutput;
56
-
57
- /**
58
- * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
59
- * for everything else, calls `WebAssembly.instantiate` directly.
60
- *
61
- * @param {InitInput | Promise<InitInput>} module_or_path
62
- *
63
- * @returns {Promise<InitOutput>}
64
- */
65
- export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  /* tslint:disable */
2
  /* eslint-disable */
3
  /**
4
+ */
5
  export class Model {
6
+ free(): void;
7
+ /**
8
+ * @param {Uint8Array} weights
9
+ * @param {Uint8Array} tokenizer
10
+ * @param {boolean} quantized
11
+ */
12
+ constructor(weights: Uint8Array, tokenizer: Uint8Array, quantized: boolean);
13
+ /**
14
+ * @param {string} prompt
15
+ * @param {number} temp
16
+ * @param {number} top_p
17
+ * @param {number} repeat_penalty
18
+ * @param {number} repeat_last_n
19
+ * @param {bigint} seed
20
+ * @returns {string}
21
+ */
22
+ init_with_prompt(
23
+ prompt: string,
24
+ temp: number,
25
+ top_p: number,
26
+ repeat_penalty: number,
27
+ repeat_last_n: number,
28
+ seed: bigint
29
+ ): string;
30
+ /**
31
+ * @returns {string}
32
+ */
33
+ next_token(): string;
34
+ }
35
+
36
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
37
+
38
+ export interface InitOutput {
39
+ readonly memory: WebAssembly.Memory;
40
+ readonly __wbg_model_free: (a: number) => void;
41
+ readonly model_load: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
42
+ readonly model_init_with_prompt: (
43
+ a: number,
44
+ b: number,
45
+ c: number,
46
+ d: number,
47
+ e: number,
48
+ f: number,
49
+ g: number,
50
+ h: number,
51
+ i: number
52
+ ) => void;
53
+ readonly model_next_token: (a: number, b: number) => void;
54
+ readonly main: (a: number, b: number) => number;
55
+ readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
56
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
57
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
58
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
59
+ readonly __wbindgen_exn_store: (a: number) => void;
60
+ readonly __wbindgen_start: () => void;
61
+ }
62
+
63
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
64
+ /**
65
+ * Instantiates the given `module`, which can either be bytes or
66
+ * a precompiled `WebAssembly.Module`.
67
+ *
68
+ * @param {SyncInitInput} module
69
+ *
70
+ * @returns {InitOutput}
71
+ */
72
+ export function initSync(module: SyncInitInput): InitOutput;
73
+
74
+ /**
75
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
76
+ * for everything else, calls `WebAssembly.instantiate` directly.
77
+ *
78
+ * @param {InitInput | Promise<InitInput>} module_or_path
79
+ *
80
+ * @returns {Promise<InitOutput>}
81
+ */
82
+ export default function __wbg_init(
83
+ module_or_path?: InitInput | Promise<InitInput>
84
+ ): Promise<InitOutput>;
src/routes/conversation/[id]/phi/m.js CHANGED
@@ -1,21 +1,30 @@
1
  let wasm;
2
 
3
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
4
-
5
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
 
 
 
 
 
 
 
 
 
6
 
7
  let cachedUint8Memory0 = null;
8
 
9
  function getUint8Memory0() {
10
- if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
11
- cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
12
- }
13
- return cachedUint8Memory0;
14
  }
15
 
16
  function getStringFromWasm0(ptr, len) {
17
- ptr = ptr >>> 0;
18
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
19
  }
20
 
21
  const heap = new Array(128).fill(undefined);
@@ -25,452 +34,493 @@ heap.push(undefined, null, true, false);
25
  let heap_next = heap.length;
26
 
27
  function addHeapObject(obj) {
28
- if (heap_next === heap.length) heap.push(heap.length + 1);
29
- const idx = heap_next;
30
- heap_next = heap[idx];
31
 
32
- heap[idx] = obj;
33
- return idx;
34
  }
35
 
36
- function getObject(idx) { return heap[idx]; }
 
 
37
 
38
  function dropObject(idx) {
39
- if (idx < 132) return;
40
- heap[idx] = heap_next;
41
- heap_next = idx;
42
  }
43
 
44
  function takeObject(idx) {
45
- const ret = getObject(idx);
46
- dropObject(idx);
47
- return ret;
48
  }
49
 
50
  let WASM_VECTOR_LEN = 0;
51
 
52
  function passArray8ToWasm0(arg, malloc) {
53
- const ptr = malloc(arg.length * 1, 1) >>> 0;
54
- getUint8Memory0().set(arg, ptr / 1);
55
- WASM_VECTOR_LEN = arg.length;
56
- return ptr;
57
  }
58
 
59
  let cachedInt32Memory0 = null;
60
 
61
  function getInt32Memory0() {
62
- if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
63
- cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
64
- }
65
- return cachedInt32Memory0;
66
  }
67
 
68
- const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
69
-
70
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
71
- ? function (arg, view) {
72
- return cachedTextEncoder.encodeInto(arg, view);
73
- }
74
- : function (arg, view) {
75
- const buf = cachedTextEncoder.encode(arg);
76
- view.set(buf);
77
- return {
78
- read: arg.length,
79
- written: buf.length
80
- };
81
- });
 
 
 
 
 
 
 
 
82
 
83
  function passStringToWasm0(arg, malloc, realloc) {
84
-
85
- if (realloc === undefined) {
86
- const buf = cachedTextEncoder.encode(arg);
87
- const ptr = malloc(buf.length, 1) >>> 0;
88
- getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
89
- WASM_VECTOR_LEN = buf.length;
90
- return ptr;
91
- }
92
-
93
- let len = arg.length;
94
- let ptr = malloc(len, 1) >>> 0;
95
-
96
- const mem = getUint8Memory0();
97
-
98
- let offset = 0;
99
-
100
- for (; offset < len; offset++) {
101
- const code = arg.charCodeAt(offset);
102
- if (code > 0x7F) break;
103
- mem[ptr + offset] = code;
104
- }
105
-
106
- if (offset !== len) {
107
- if (offset !== 0) {
108
- arg = arg.slice(offset);
109
- }
110
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
111
- const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
112
- const ret = encodeString(arg, view);
113
-
114
- offset += ret.written;
115
- }
116
-
117
- WASM_VECTOR_LEN = offset;
118
- return ptr;
 
119
  }
120
 
121
  function handleError(f, args) {
122
- try {
123
- return f.apply(this, args);
124
- } catch (e) {
125
- wasm.__wbindgen_exn_store(addHeapObject(e));
126
- }
127
  }
128
  /**
129
- */
130
  export class Model {
131
-
132
- static __wrap(ptr) {
133
- ptr = ptr >>> 0;
134
- const obj = Object.create(Model.prototype);
135
- obj.__wbg_ptr = ptr;
136
-
137
- return obj;
138
- }
139
-
140
- __destroy_into_raw() {
141
- const ptr = this.__wbg_ptr;
142
- this.__wbg_ptr = 0;
143
-
144
- return ptr;
145
- }
146
-
147
- free() {
148
- const ptr = this.__destroy_into_raw();
149
- wasm.__wbg_model_free(ptr);
150
- }
151
- /**
152
- * @param {Uint8Array} weights
153
- * @param {Uint8Array} tokenizer
154
- * @param {boolean} quantized
155
- */
156
- constructor(weights, tokenizer, quantized) {
157
- try {
158
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
159
- const ptr0 = passArray8ToWasm0(weights, wasm.__wbindgen_malloc);
160
- const len0 = WASM_VECTOR_LEN;
161
- const ptr1 = passArray8ToWasm0(tokenizer, wasm.__wbindgen_malloc);
162
- const len1 = WASM_VECTOR_LEN;
163
- wasm.model_load(retptr, ptr0, len0, ptr1, len1, quantized);
164
- var r0 = getInt32Memory0()[retptr / 4 + 0];
165
- var r1 = getInt32Memory0()[retptr / 4 + 1];
166
- var r2 = getInt32Memory0()[retptr / 4 + 2];
167
- if (r2) {
168
- throw takeObject(r1);
169
- }
170
- return Model.__wrap(r0);
171
- } finally {
172
- wasm.__wbindgen_add_to_stack_pointer(16);
173
- }
174
- }
175
- /**
176
- * @param {string} prompt
177
- * @param {number} temp
178
- * @param {number} top_p
179
- * @param {number} repeat_penalty
180
- * @param {number} repeat_last_n
181
- * @param {bigint} seed
182
- * @returns {string}
183
- */
184
- init_with_prompt(prompt, temp, top_p, repeat_penalty, repeat_last_n, seed) {
185
- let deferred3_0;
186
- let deferred3_1;
187
- try {
188
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
189
- const ptr0 = passStringToWasm0(prompt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
190
- const len0 = WASM_VECTOR_LEN;
191
- wasm.model_init_with_prompt(retptr, this.__wbg_ptr, ptr0, len0, temp, top_p, repeat_penalty, repeat_last_n, seed);
192
- var r0 = getInt32Memory0()[retptr / 4 + 0];
193
- var r1 = getInt32Memory0()[retptr / 4 + 1];
194
- var r2 = getInt32Memory0()[retptr / 4 + 2];
195
- var r3 = getInt32Memory0()[retptr / 4 + 3];
196
- var ptr2 = r0;
197
- var len2 = r1;
198
- if (r3) {
199
- ptr2 = 0; len2 = 0;
200
- throw takeObject(r2);
201
- }
202
- deferred3_0 = ptr2;
203
- deferred3_1 = len2;
204
- return getStringFromWasm0(ptr2, len2);
205
- } finally {
206
- wasm.__wbindgen_add_to_stack_pointer(16);
207
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
208
- }
209
- }
210
- /**
211
- * @returns {string}
212
- */
213
- next_token() {
214
- let deferred2_0;
215
- let deferred2_1;
216
- try {
217
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
218
- wasm.model_next_token(retptr, this.__wbg_ptr);
219
- var r0 = getInt32Memory0()[retptr / 4 + 0];
220
- var r1 = getInt32Memory0()[retptr / 4 + 1];
221
- var r2 = getInt32Memory0()[retptr / 4 + 2];
222
- var r3 = getInt32Memory0()[retptr / 4 + 3];
223
- var ptr1 = r0;
224
- var len1 = r1;
225
- if (r3) {
226
- ptr1 = 0; len1 = 0;
227
- throw takeObject(r2);
228
- }
229
- deferred2_0 = ptr1;
230
- deferred2_1 = len1;
231
- return getStringFromWasm0(ptr1, len1);
232
- } finally {
233
- wasm.__wbindgen_add_to_stack_pointer(16);
234
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
235
- }
236
- }
 
 
 
 
 
 
 
 
 
 
 
237
  }
238
 
239
  async function __wbg_load(module, imports) {
240
- if (typeof Response === 'function' && module instanceof Response) {
241
- if (typeof WebAssembly.instantiateStreaming === 'function') {
242
- try {
243
- return await WebAssembly.instantiateStreaming(module, imports);
244
-
245
- } catch (e) {
246
- if (module.headers.get('Content-Type') != 'application/wasm') {
247
- console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
248
-
249
- } else {
250
- throw e;
251
- }
252
- }
253
- }
254
-
255
- const bytes = await module.arrayBuffer();
256
- return await WebAssembly.instantiate(bytes, imports);
257
-
258
- } else {
259
- const instance = await WebAssembly.instantiate(module, imports);
260
-
261
- if (instance instanceof WebAssembly.Instance) {
262
- return { instance, module };
263
-
264
- } else {
265
- return instance;
266
- }
267
- }
268
  }
269
 
270
  function __wbg_get_imports() {
271
- const imports = {};
272
- imports.wbg = {};
273
- imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
274
- const ret = new Error(getStringFromWasm0(arg0, arg1));
275
- return addHeapObject(ret);
276
- };
277
- imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
278
- const ret = new Error();
279
- return addHeapObject(ret);
280
- };
281
- imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
282
- const ret = getObject(arg1).stack;
283
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
284
- const len1 = WASM_VECTOR_LEN;
285
- getInt32Memory0()[arg0 / 4 + 1] = len1;
286
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
287
- };
288
- imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
289
- let deferred0_0;
290
- let deferred0_1;
291
- try {
292
- deferred0_0 = arg0;
293
- deferred0_1 = arg1;
294
- console.error(getStringFromWasm0(arg0, arg1));
295
- } finally {
296
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
297
- }
298
- };
299
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
300
- takeObject(arg0);
301
- };
302
- imports.wbg.__wbg_log_ff7e0b5e6573cdff = function(arg0, arg1) {
303
- console.log(getStringFromWasm0(arg0, arg1));
304
- };
305
- imports.wbg.__wbg_crypto_c48a774b022d20ac = function(arg0) {
306
- const ret = getObject(arg0).crypto;
307
- return addHeapObject(ret);
308
- };
309
- imports.wbg.__wbindgen_is_object = function(arg0) {
310
- const val = getObject(arg0);
311
- const ret = typeof(val) === 'object' && val !== null;
312
- return ret;
313
- };
314
- imports.wbg.__wbg_process_298734cf255a885d = function(arg0) {
315
- const ret = getObject(arg0).process;
316
- return addHeapObject(ret);
317
- };
318
- imports.wbg.__wbg_versions_e2e78e134e3e5d01 = function(arg0) {
319
- const ret = getObject(arg0).versions;
320
- return addHeapObject(ret);
321
- };
322
- imports.wbg.__wbg_node_1cd7a5d853dbea79 = function(arg0) {
323
- const ret = getObject(arg0).node;
324
- return addHeapObject(ret);
325
- };
326
- imports.wbg.__wbindgen_is_string = function(arg0) {
327
- const ret = typeof(getObject(arg0)) === 'string';
328
- return ret;
329
- };
330
- imports.wbg.__wbg_msCrypto_bcb970640f50a1e8 = function(arg0) {
331
- const ret = getObject(arg0).msCrypto;
332
- return addHeapObject(ret);
333
- };
334
- imports.wbg.__wbg_require_8f08ceecec0f4fee = function() { return handleError(function () {
335
- const ret = module.require;
336
- return addHeapObject(ret);
337
- }, arguments) };
338
- imports.wbg.__wbindgen_is_function = function(arg0) {
339
- const ret = typeof(getObject(arg0)) === 'function';
340
- return ret;
341
- };
342
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
343
- const ret = getStringFromWasm0(arg0, arg1);
344
- return addHeapObject(ret);
345
- };
346
- imports.wbg.__wbg_getRandomValues_37fa2ca9e4e07fab = function() { return handleError(function (arg0, arg1) {
347
- getObject(arg0).getRandomValues(getObject(arg1));
348
- }, arguments) };
349
- imports.wbg.__wbg_randomFillSync_dc1e9a60c158336d = function() { return handleError(function (arg0, arg1) {
350
- getObject(arg0).randomFillSync(takeObject(arg1));
351
- }, arguments) };
352
- imports.wbg.__wbg_newnoargs_581967eacc0e2604 = function(arg0, arg1) {
353
- const ret = new Function(getStringFromWasm0(arg0, arg1));
354
- return addHeapObject(ret);
355
- };
356
- imports.wbg.__wbg_call_cb65541d95d71282 = function() { return handleError(function (arg0, arg1) {
357
- const ret = getObject(arg0).call(getObject(arg1));
358
- return addHeapObject(ret);
359
- }, arguments) };
360
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
361
- const ret = getObject(arg0);
362
- return addHeapObject(ret);
363
- };
364
- imports.wbg.__wbg_self_1ff1d729e9aae938 = function() { return handleError(function () {
365
- const ret = self.self;
366
- return addHeapObject(ret);
367
- }, arguments) };
368
- imports.wbg.__wbg_window_5f4faef6c12b79ec = function() { return handleError(function () {
369
- const ret = window.window;
370
- return addHeapObject(ret);
371
- }, arguments) };
372
- imports.wbg.__wbg_globalThis_1d39714405582d3c = function() { return handleError(function () {
373
- const ret = globalThis.globalThis;
374
- return addHeapObject(ret);
375
- }, arguments) };
376
- imports.wbg.__wbg_global_651f05c6a0944d1c = function() { return handleError(function () {
377
- const ret = global.global;
378
- return addHeapObject(ret);
379
- }, arguments) };
380
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
381
- const ret = getObject(arg0) === undefined;
382
- return ret;
383
- };
384
- imports.wbg.__wbg_call_01734de55d61e11d = function() { return handleError(function (arg0, arg1, arg2) {
385
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
386
- return addHeapObject(ret);
387
- }, arguments) };
388
- imports.wbg.__wbg_now_9c5990bda04c7e53 = function() {
389
- const ret = Date.now();
390
- return ret;
391
- };
392
- imports.wbg.__wbg_buffer_085ec1f694018c4f = function(arg0) {
393
- const ret = getObject(arg0).buffer;
394
- return addHeapObject(ret);
395
- };
396
- imports.wbg.__wbg_newwithbyteoffsetandlength_6da8e527659b86aa = function(arg0, arg1, arg2) {
397
- const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
398
- return addHeapObject(ret);
399
- };
400
- imports.wbg.__wbg_new_8125e318e6245eed = function(arg0) {
401
- const ret = new Uint8Array(getObject(arg0));
402
- return addHeapObject(ret);
403
- };
404
- imports.wbg.__wbg_set_5cf90238115182c3 = function(arg0, arg1, arg2) {
405
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
406
- };
407
- imports.wbg.__wbg_newwithlength_e5d69174d6984cd7 = function(arg0) {
408
- const ret = new Uint8Array(arg0 >>> 0);
409
- return addHeapObject(ret);
410
- };
411
- imports.wbg.__wbg_subarray_13db269f57aa838d = function(arg0, arg1, arg2) {
412
- const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
413
- return addHeapObject(ret);
414
- };
415
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
416
- throw new Error(getStringFromWasm0(arg0, arg1));
417
- };
418
- imports.wbg.__wbindgen_memory = function() {
419
- const ret = wasm.memory;
420
- return addHeapObject(ret);
421
- };
422
-
423
- return imports;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
424
  }
425
 
426
- function __wbg_init_memory(imports, maybe_memory) {
427
-
428
- }
429
 
430
  function __wbg_finalize_init(instance, module) {
431
- wasm = instance.exports;
432
- __wbg_init.__wbindgen_wasm_module = module;
433
- cachedInt32Memory0 = null;
434
- cachedUint8Memory0 = null;
435
 
436
- wasm.__wbindgen_start();
437
- return wasm;
438
  }
439
 
440
  function initSync(module) {
441
- if (wasm !== undefined) return wasm;
442
 
443
- const imports = __wbg_get_imports();
444
 
445
- __wbg_init_memory(imports);
446
 
447
- if (!(module instanceof WebAssembly.Module)) {
448
- module = new WebAssembly.Module(module);
449
- }
450
 
451
- const instance = new WebAssembly.Instance(module, imports);
452
 
453
- return __wbg_finalize_init(instance, module);
454
  }
455
 
456
  async function __wbg_init(input) {
457
- if (wasm !== undefined) return wasm;
458
 
459
- if (typeof input === 'undefined') {
460
- input = new URL('m_bg.wasm', import.meta.url);
461
- }
462
- const imports = __wbg_get_imports();
463
 
464
- if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
465
- input = fetch(input);
466
- }
 
 
 
 
467
 
468
- __wbg_init_memory(imports);
469
 
470
- const { instance, module } = await __wbg_load(await input, imports);
471
 
472
- return __wbg_finalize_init(instance, module);
473
  }
474
 
475
- export { initSync }
476
- export default __wbg_init;
 
1
  let wasm;
2
 
3
+ const cachedTextDecoder =
4
+ typeof TextDecoder !== "undefined"
5
+ ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true })
6
+ : {
7
+ decode: () => {
8
+ throw Error("TextDecoder not available");
9
+ },
10
+ };
11
+
12
+ if (typeof TextDecoder !== "undefined") {
13
+ cachedTextDecoder.decode();
14
+ }
15
 
16
  let cachedUint8Memory0 = null;
17
 
18
  function getUint8Memory0() {
19
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
20
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
21
+ }
22
+ return cachedUint8Memory0;
23
  }
24
 
25
  function getStringFromWasm0(ptr, len) {
26
+ ptr = ptr >>> 0;
27
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
28
  }
29
 
30
  const heap = new Array(128).fill(undefined);
 
34
  let heap_next = heap.length;
35
 
36
  function addHeapObject(obj) {
37
+ if (heap_next === heap.length) heap.push(heap.length + 1);
38
+ const idx = heap_next;
39
+ heap_next = heap[idx];
40
 
41
+ heap[idx] = obj;
42
+ return idx;
43
  }
44
 
45
+ function getObject(idx) {
46
+ return heap[idx];
47
+ }
48
 
49
  function dropObject(idx) {
50
+ if (idx < 132) return;
51
+ heap[idx] = heap_next;
52
+ heap_next = idx;
53
  }
54
 
55
  function takeObject(idx) {
56
+ const ret = getObject(idx);
57
+ dropObject(idx);
58
+ return ret;
59
  }
60
 
61
  let WASM_VECTOR_LEN = 0;
62
 
63
  function passArray8ToWasm0(arg, malloc) {
64
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
65
+ getUint8Memory0().set(arg, ptr / 1);
66
+ WASM_VECTOR_LEN = arg.length;
67
+ return ptr;
68
  }
69
 
70
  let cachedInt32Memory0 = null;
71
 
72
  function getInt32Memory0() {
73
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
74
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
75
+ }
76
+ return cachedInt32Memory0;
77
  }
78
 
79
+ const cachedTextEncoder =
80
+ typeof TextEncoder !== "undefined"
81
+ ? new TextEncoder("utf-8")
82
+ : {
83
+ encode: () => {
84
+ throw Error("TextEncoder not available");
85
+ },
86
+ };
87
+
88
+ const encodeString =
89
+ typeof cachedTextEncoder.encodeInto === "function"
90
+ ? function (arg, view) {
91
+ return cachedTextEncoder.encodeInto(arg, view);
92
+ }
93
+ : function (arg, view) {
94
+ const buf = cachedTextEncoder.encode(arg);
95
+ view.set(buf);
96
+ return {
97
+ read: arg.length,
98
+ written: buf.length,
99
+ };
100
+ };
101
 
102
  function passStringToWasm0(arg, malloc, realloc) {
103
+ if (realloc === undefined) {
104
+ const buf = cachedTextEncoder.encode(arg);
105
+ const ptr = malloc(buf.length, 1) >>> 0;
106
+ getUint8Memory0()
107
+ .subarray(ptr, ptr + buf.length)
108
+ .set(buf);
109
+ WASM_VECTOR_LEN = buf.length;
110
+ return ptr;
111
+ }
112
+
113
+ let len = arg.length;
114
+ let ptr = malloc(len, 1) >>> 0;
115
+
116
+ const mem = getUint8Memory0();
117
+
118
+ let offset = 0;
119
+
120
+ for (; offset < len; offset++) {
121
+ const code = arg.charCodeAt(offset);
122
+ if (code > 0x7f) break;
123
+ mem[ptr + offset] = code;
124
+ }
125
+
126
+ if (offset !== len) {
127
+ if (offset !== 0) {
128
+ arg = arg.slice(offset);
129
+ }
130
+ ptr = realloc(ptr, len, (len = offset + arg.length * 3), 1) >>> 0;
131
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
132
+ const ret = encodeString(arg, view);
133
+
134
+ offset += ret.written;
135
+ }
136
+
137
+ WASM_VECTOR_LEN = offset;
138
+ return ptr;
139
  }
140
 
141
  function handleError(f, args) {
142
+ try {
143
+ return f.apply(this, args);
144
+ } catch (e) {
145
+ wasm.__wbindgen_exn_store(addHeapObject(e));
146
+ }
147
  }
148
  /**
149
+ */
150
  export class Model {
151
+ static __wrap(ptr) {
152
+ ptr = ptr >>> 0;
153
+ const obj = Object.create(Model.prototype);
154
+ obj.__wbg_ptr = ptr;
155
+
156
+ return obj;
157
+ }
158
+
159
+ __destroy_into_raw() {
160
+ const ptr = this.__wbg_ptr;
161
+ this.__wbg_ptr = 0;
162
+
163
+ return ptr;
164
+ }
165
+
166
+ free() {
167
+ const ptr = this.__destroy_into_raw();
168
+ wasm.__wbg_model_free(ptr);
169
+ }
170
+ /**
171
+ * @param {Uint8Array} weights
172
+ * @param {Uint8Array} tokenizer
173
+ * @param {boolean} quantized
174
+ */
175
+ constructor(weights, tokenizer, quantized) {
176
+ try {
177
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
178
+ const ptr0 = passArray8ToWasm0(weights, wasm.__wbindgen_malloc);
179
+ const len0 = WASM_VECTOR_LEN;
180
+ const ptr1 = passArray8ToWasm0(tokenizer, wasm.__wbindgen_malloc);
181
+ const len1 = WASM_VECTOR_LEN;
182
+ wasm.model_load(retptr, ptr0, len0, ptr1, len1, quantized);
183
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
184
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
185
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
186
+ if (r2) {
187
+ throw takeObject(r1);
188
+ }
189
+ return Model.__wrap(r0);
190
+ } finally {
191
+ wasm.__wbindgen_add_to_stack_pointer(16);
192
+ }
193
+ }
194
+ /**
195
+ * @param {string} prompt
196
+ * @param {number} temp
197
+ * @param {number} top_p
198
+ * @param {number} repeat_penalty
199
+ * @param {number} repeat_last_n
200
+ * @param {bigint} seed
201
+ * @returns {string}
202
+ */
203
+ init_with_prompt(prompt, temp, top_p, repeat_penalty, repeat_last_n, seed) {
204
+ let deferred3_0;
205
+ let deferred3_1;
206
+ try {
207
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
208
+ const ptr0 = passStringToWasm0(prompt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
209
+ const len0 = WASM_VECTOR_LEN;
210
+ wasm.model_init_with_prompt(
211
+ retptr,
212
+ this.__wbg_ptr,
213
+ ptr0,
214
+ len0,
215
+ temp,
216
+ top_p,
217
+ repeat_penalty,
218
+ repeat_last_n,
219
+ seed
220
+ );
221
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
222
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
223
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
224
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
225
+ var ptr2 = r0;
226
+ var len2 = r1;
227
+ if (r3) {
228
+ ptr2 = 0;
229
+ len2 = 0;
230
+ throw takeObject(r2);
231
+ }
232
+ deferred3_0 = ptr2;
233
+ deferred3_1 = len2;
234
+ return getStringFromWasm0(ptr2, len2);
235
+ } finally {
236
+ wasm.__wbindgen_add_to_stack_pointer(16);
237
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
238
+ }
239
+ }
240
+ /**
241
+ * @returns {string}
242
+ */
243
+ next_token() {
244
+ let deferred2_0;
245
+ let deferred2_1;
246
+ try {
247
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
248
+ wasm.model_next_token(retptr, this.__wbg_ptr);
249
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
250
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
251
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
252
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
253
+ var ptr1 = r0;
254
+ var len1 = r1;
255
+ if (r3) {
256
+ ptr1 = 0;
257
+ len1 = 0;
258
+ throw takeObject(r2);
259
+ }
260
+ deferred2_0 = ptr1;
261
+ deferred2_1 = len1;
262
+ return getStringFromWasm0(ptr1, len1);
263
+ } finally {
264
+ wasm.__wbindgen_add_to_stack_pointer(16);
265
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
266
+ }
267
+ }
268
  }
269
 
270
  async function __wbg_load(module, imports) {
271
+ if (typeof Response === "function" && module instanceof Response) {
272
+ if (typeof WebAssembly.instantiateStreaming === "function") {
273
+ try {
274
+ return await WebAssembly.instantiateStreaming(module, imports);
275
+ } catch (e) {
276
+ if (module.headers.get("Content-Type") != "application/wasm") {
277
+ console.warn(
278
+ "`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",
279
+ e
280
+ );
281
+ } else {
282
+ throw e;
283
+ }
284
+ }
285
+ }
286
+
287
+ const bytes = await module.arrayBuffer();
288
+ return await WebAssembly.instantiate(bytes, imports);
289
+ } else {
290
+ const instance = await WebAssembly.instantiate(module, imports);
291
+
292
+ if (instance instanceof WebAssembly.Instance) {
293
+ return { instance, module };
294
+ } else {
295
+ return instance;
296
+ }
297
+ }
 
298
  }
299
 
300
  function __wbg_get_imports() {
301
+ const imports = {};
302
+ imports.wbg = {};
303
+ imports.wbg.__wbindgen_error_new = function (arg0, arg1) {
304
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
305
+ return addHeapObject(ret);
306
+ };
307
+ imports.wbg.__wbg_new_abda76e883ba8a5f = function () {
308
+ const ret = new Error();
309
+ return addHeapObject(ret);
310
+ };
311
+ imports.wbg.__wbg_stack_658279fe44541cf6 = function (arg0, arg1) {
312
+ const ret = getObject(arg1).stack;
313
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
314
+ const len1 = WASM_VECTOR_LEN;
315
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
316
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
317
+ };
318
+ imports.wbg.__wbg_error_f851667af71bcfc6 = function (arg0, arg1) {
319
+ let deferred0_0;
320
+ let deferred0_1;
321
+ try {
322
+ deferred0_0 = arg0;
323
+ deferred0_1 = arg1;
324
+ console.error(getStringFromWasm0(arg0, arg1));
325
+ } finally {
326
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
327
+ }
328
+ };
329
+ imports.wbg.__wbindgen_object_drop_ref = function (arg0) {
330
+ takeObject(arg0);
331
+ };
332
+ imports.wbg.__wbg_log_ff7e0b5e6573cdff = function (arg0, arg1) {
333
+ console.log(getStringFromWasm0(arg0, arg1));
334
+ };
335
+ imports.wbg.__wbg_crypto_c48a774b022d20ac = function (arg0) {
336
+ const ret = getObject(arg0).crypto;
337
+ return addHeapObject(ret);
338
+ };
339
+ imports.wbg.__wbindgen_is_object = function (arg0) {
340
+ const val = getObject(arg0);
341
+ const ret = typeof val === "object" && val !== null;
342
+ return ret;
343
+ };
344
+ imports.wbg.__wbg_process_298734cf255a885d = function (arg0) {
345
+ const ret = getObject(arg0).process;
346
+ return addHeapObject(ret);
347
+ };
348
+ imports.wbg.__wbg_versions_e2e78e134e3e5d01 = function (arg0) {
349
+ const ret = getObject(arg0).versions;
350
+ return addHeapObject(ret);
351
+ };
352
+ imports.wbg.__wbg_node_1cd7a5d853dbea79 = function (arg0) {
353
+ const ret = getObject(arg0).node;
354
+ return addHeapObject(ret);
355
+ };
356
+ imports.wbg.__wbindgen_is_string = function (arg0) {
357
+ const ret = typeof getObject(arg0) === "string";
358
+ return ret;
359
+ };
360
+ imports.wbg.__wbg_msCrypto_bcb970640f50a1e8 = function (arg0) {
361
+ const ret = getObject(arg0).msCrypto;
362
+ return addHeapObject(ret);
363
+ };
364
+ imports.wbg.__wbg_require_8f08ceecec0f4fee = function () {
365
+ return handleError(function () {
366
+ const ret = module.require;
367
+ return addHeapObject(ret);
368
+ }, arguments);
369
+ };
370
+ imports.wbg.__wbindgen_is_function = function (arg0) {
371
+ const ret = typeof getObject(arg0) === "function";
372
+ return ret;
373
+ };
374
+ imports.wbg.__wbindgen_string_new = function (arg0, arg1) {
375
+ const ret = getStringFromWasm0(arg0, arg1);
376
+ return addHeapObject(ret);
377
+ };
378
+ imports.wbg.__wbg_getRandomValues_37fa2ca9e4e07fab = function () {
379
+ return handleError(function (arg0, arg1) {
380
+ getObject(arg0).getRandomValues(getObject(arg1));
381
+ }, arguments);
382
+ };
383
+ imports.wbg.__wbg_randomFillSync_dc1e9a60c158336d = function () {
384
+ return handleError(function (arg0, arg1) {
385
+ getObject(arg0).randomFillSync(takeObject(arg1));
386
+ }, arguments);
387
+ };
388
+ imports.wbg.__wbg_newnoargs_581967eacc0e2604 = function (arg0, arg1) {
389
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
390
+ return addHeapObject(ret);
391
+ };
392
+ imports.wbg.__wbg_call_cb65541d95d71282 = function () {
393
+ return handleError(function (arg0, arg1) {
394
+ const ret = getObject(arg0).call(getObject(arg1));
395
+ return addHeapObject(ret);
396
+ }, arguments);
397
+ };
398
+ imports.wbg.__wbindgen_object_clone_ref = function (arg0) {
399
+ const ret = getObject(arg0);
400
+ return addHeapObject(ret);
401
+ };
402
+ imports.wbg.__wbg_self_1ff1d729e9aae938 = function () {
403
+ return handleError(function () {
404
+ const ret = self.self;
405
+ return addHeapObject(ret);
406
+ }, arguments);
407
+ };
408
+ imports.wbg.__wbg_window_5f4faef6c12b79ec = function () {
409
+ return handleError(function () {
410
+ const ret = window.window;
411
+ return addHeapObject(ret);
412
+ }, arguments);
413
+ };
414
+ imports.wbg.__wbg_globalThis_1d39714405582d3c = function () {
415
+ return handleError(function () {
416
+ const ret = globalThis.globalThis;
417
+ return addHeapObject(ret);
418
+ }, arguments);
419
+ };
420
+ imports.wbg.__wbg_global_651f05c6a0944d1c = function () {
421
+ return handleError(function () {
422
+ const ret = global.global;
423
+ return addHeapObject(ret);
424
+ }, arguments);
425
+ };
426
+ imports.wbg.__wbindgen_is_undefined = function (arg0) {
427
+ const ret = getObject(arg0) === undefined;
428
+ return ret;
429
+ };
430
+ imports.wbg.__wbg_call_01734de55d61e11d = function () {
431
+ return handleError(function (arg0, arg1, arg2) {
432
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
433
+ return addHeapObject(ret);
434
+ }, arguments);
435
+ };
436
+ imports.wbg.__wbg_now_9c5990bda04c7e53 = function () {
437
+ const ret = Date.now();
438
+ return ret;
439
+ };
440
+ imports.wbg.__wbg_buffer_085ec1f694018c4f = function (arg0) {
441
+ const ret = getObject(arg0).buffer;
442
+ return addHeapObject(ret);
443
+ };
444
+ imports.wbg.__wbg_newwithbyteoffsetandlength_6da8e527659b86aa = function (arg0, arg1, arg2) {
445
+ const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
446
+ return addHeapObject(ret);
447
+ };
448
+ imports.wbg.__wbg_new_8125e318e6245eed = function (arg0) {
449
+ const ret = new Uint8Array(getObject(arg0));
450
+ return addHeapObject(ret);
451
+ };
452
+ imports.wbg.__wbg_set_5cf90238115182c3 = function (arg0, arg1, arg2) {
453
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
454
+ };
455
+ imports.wbg.__wbg_newwithlength_e5d69174d6984cd7 = function (arg0) {
456
+ const ret = new Uint8Array(arg0 >>> 0);
457
+ return addHeapObject(ret);
458
+ };
459
+ imports.wbg.__wbg_subarray_13db269f57aa838d = function (arg0, arg1, arg2) {
460
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
461
+ return addHeapObject(ret);
462
+ };
463
+ imports.wbg.__wbindgen_throw = function (arg0, arg1) {
464
+ throw new Error(getStringFromWasm0(arg0, arg1));
465
+ };
466
+ imports.wbg.__wbindgen_memory = function () {
467
+ const ret = wasm.memory;
468
+ return addHeapObject(ret);
469
+ };
470
+
471
+ return imports;
472
  }
473
 
474
+ function __wbg_init_memory(imports, maybe_memory) {}
 
 
475
 
476
  function __wbg_finalize_init(instance, module) {
477
+ wasm = instance.exports;
478
+ __wbg_init.__wbindgen_wasm_module = module;
479
+ cachedInt32Memory0 = null;
480
+ cachedUint8Memory0 = null;
481
 
482
+ wasm.__wbindgen_start();
483
+ return wasm;
484
  }
485
 
486
  function initSync(module) {
487
+ if (wasm !== undefined) return wasm;
488
 
489
+ const imports = __wbg_get_imports();
490
 
491
+ __wbg_init_memory(imports);
492
 
493
+ if (!(module instanceof WebAssembly.Module)) {
494
+ module = new WebAssembly.Module(module);
495
+ }
496
 
497
+ const instance = new WebAssembly.Instance(module, imports);
498
 
499
+ return __wbg_finalize_init(instance, module);
500
  }
501
 
502
  async function __wbg_init(input) {
503
+ if (wasm !== undefined) return wasm;
504
 
505
+ if (typeof input === "undefined") {
506
+ input = new URL("m_bg.wasm", import.meta.url);
507
+ }
508
+ const imports = __wbg_get_imports();
509
 
510
+ if (
511
+ typeof input === "string" ||
512
+ (typeof Request === "function" && input instanceof Request) ||
513
+ (typeof URL === "function" && input instanceof URL)
514
+ ) {
515
+ input = fetch(input);
516
+ }
517
 
518
+ __wbg_init_memory(imports);
519
 
520
+ const { instance, module } = await __wbg_load(await input, imports);
521
 
522
+ return __wbg_finalize_init(instance, module);
523
  }
524
 
525
+ export { initSync };
526
+ export default __wbg_init;
src/routes/conversation/[id]/phi/m_bg.wasm.d.ts CHANGED
@@ -3,7 +3,17 @@
3
  export const memory: WebAssembly.Memory;
4
  export function __wbg_model_free(a: number): void;
5
  export function model_load(a: number, b: number, c: number, d: number, e: number, f: number): void;
6
- export function model_init_with_prompt(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number): void;
 
 
 
 
 
 
 
 
 
 
7
  export function model_next_token(a: number, b: number): void;
8
  export function main(a: number, b: number): number;
9
  export function __wbindgen_add_to_stack_pointer(a: number): number;
@@ -11,4 +21,4 @@ export function __wbindgen_malloc(a: number, b: number): number;
11
  export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
12
  export function __wbindgen_free(a: number, b: number, c: number): void;
13
  export function __wbindgen_exn_store(a: number): void;
14
- export function __wbindgen_start(): void;
 
3
  export const memory: WebAssembly.Memory;
4
  export function __wbg_model_free(a: number): void;
5
  export function model_load(a: number, b: number, c: number, d: number, e: number, f: number): void;
6
+ export function model_init_with_prompt(
7
+ a: number,
8
+ b: number,
9
+ c: number,
10
+ d: number,
11
+ e: number,
12
+ f: number,
13
+ g: number,
14
+ h: number,
15
+ i: number
16
+ ): void;
17
  export function model_next_token(a: number, b: number): void;
18
  export function main(a: number, b: number): number;
19
  export function __wbindgen_add_to_stack_pointer(a: number): number;
 
21
  export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
22
  export function __wbindgen_free(a: number, b: number, c: number): void;
23
  export function __wbindgen_exn_store(a: number): void;
24
+ export function __wbindgen_start(): void;
src/routes/conversation/[id]/worker.js CHANGED
@@ -1,100 +1,101 @@
1
  import { pipeline, env } from "@xenova/transformers";
2
  import init, { Model } from "./phi/m.js";
3
- import URI from "urijs"
 
 
4
 
5
  // Shamelessly stolen from Transformers.js
6
 
7
  export async function tryCache(cache, ...names) {
8
- for (let name of names) {
9
- try {
10
- console.log(name)
11
- let result = await cache.match(name);
12
- if (result) return result;
13
- } catch (e) {
14
- continue;
15
- }
16
- }
17
- return undefined;
18
  }
19
 
20
  async function read_stream(url, response) {
21
  const reader = response.body.getReader();
22
- const contentLength = +response.headers.get('Content-Length');
23
  let receivedLength = 0;
24
- let chunks = [];
25
- let uri = new URI(url)
26
 
27
- while(true) {
28
- const {done, value} = await reader.read();
29
  if (done) {
30
  break;
31
  }
32
  chunks.push(value);
33
  receivedLength += value.length;
34
- let percent = (receivedLength / contentLength) * 100
35
  self.postMessage({ status: "progress", file: uri.filename(), progress: percent });
36
  }
37
 
38
- let chunksAll = new Uint8Array(receivedLength);
39
  let position = 0;
40
- for(let chunk of chunks) {
41
- chunksAll.set(chunk, position);
42
  position += chunk.length;
43
  }
44
- return chunksAll
45
  }
46
 
47
  async function fetchArrayBuffer(url) {
48
- let cache = await caches.open('transformers-cache');
49
 
50
  const response = await tryCache(cache, url);
51
  if (response != undefined) {
52
- console.log(url)
53
- let res = await read_stream(url, response)
54
- cache.put(url, new Response(res, {
55
- headers: response.headers
56
- }));
 
 
 
57
  return new Uint8Array(res);
58
- }
59
- else {
60
  const response = await fetch(url);
61
- let res = await read_stream(url, response)
62
- cache.put(url, new Response(res, {
63
- headers: response.headers,
64
- }));
 
 
 
65
  return new Uint8Array(res);
66
  }
67
-
68
-
69
  }
70
 
71
  class Phi {
72
  static instance = {};
73
-
74
  static async getInstance(weightsURL, modelID, tokenizerURL, quantized) {
75
- // load individual modelID only once
76
- if (!this.instance[modelID]) {
77
- await init();
78
-
79
- self.postMessage({ status: "loading", message: "Loading Model" });
80
-
81
- const [weightsArrayU8, tokenizerArrayU8] = await Promise.all([
82
- fetchArrayBuffer(weightsURL),
83
- fetchArrayBuffer(tokenizerURL),
84
- ]);
85
-
86
- self.postMessage({ status: "init_model" });
87
-
88
- this.instance[modelID] = new Model(
89
- weightsArrayU8,
90
- tokenizerArrayU8,
91
- quantized
92
- );
93
- self.postMessage({ status: "ready", model: "phi-1_5" });
94
- }
95
- return this.instance[modelID];
96
  }
97
- }
98
 
99
  export class FlanPipeline {
100
  static curr_model = "";
@@ -119,23 +120,31 @@ let phi_model = null;
119
 
120
  // Listen for messages from the main thread
121
  self.addEventListener("message", async (event) => {
122
- if (event.data.command != "abort") {
123
- if (event.data.is_phi) {
 
 
 
 
 
 
 
 
 
124
  controller = new AbortController();
125
  generate_phi(event.data);
126
- }
127
- else {
128
  let pipe = await FlanPipeline.getInstance(
129
  (x) => {
130
  self.postMessage(x);
131
  },
132
  event.data.model,
133
- event.data.task
134
  );
135
-
136
  let output = await pipe(event.data.text, {
137
- max_new_tokens: event.data.max_new_tokens,
138
- temperature: event.data.temperature,
139
  callback_function: (x) => {
140
  self.postMessage({
141
  status: "update",
@@ -144,30 +153,144 @@ self.addEventListener("message", async (event) => {
144
  });
145
  },
146
  });
147
-
148
  // Send the output back to the main thread
149
  self.postMessage({
150
  status: "complete",
151
  output: output,
152
  searchID: event.data.searchID,
153
  id_now: event.data.id_now,
 
154
  });
155
  }
156
- }
157
- else {
158
- if (controller != null)
159
- controller.abort();
160
- }
161
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
 
 
 
 
 
 
163
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
 
165
  async function generate_phi(data) {
166
  const tokenizerURL = "https://huggingface.co/microsoft/phi-1_5/raw/main/tokenizer.json";
167
  const weightsURL = "https://huggingface.co/lmz/candle-quantized-phi/resolve/main/model-q4k.gguf";
168
- let prompt = data.text
169
- let maxSeqLen = data.max_new_tokens
170
- let temp = data.temperature
171
  let modelID = 0;
172
  let quantized = true;
173
  let top_p = 1;
@@ -177,76 +300,89 @@ async function generate_phi(data) {
177
  self.postMessage({ status: "initiate", file: "tokenizer.json", name: "phi-1_5" }); // Fake init
178
 
179
  try {
180
- const model = await Phi.getInstance(
181
- weightsURL,
182
- modelID,
183
- tokenizerURL,
184
- quantized
185
- );
186
-
187
- const firstToken = model.init_with_prompt(
188
- prompt,
189
- temp,
190
- top_p,
191
- repeatPenalty,
192
- 64,
193
- BigInt(seed)
194
- );
195
- const seq_len = 2048;
196
-
197
- let sentence = firstToken;
198
- let maxTokens = maxSeqLen ? maxSeqLen : seq_len - prompt.length - 1;
199
- let startTime = performance.now();
200
- let tokensCount = 0;
201
-
202
- while (tokensCount < maxTokens) {
203
- await new Promise(async (resolve) => {
204
- if (controller && controller.signal.aborted) {
205
- self.postMessage({
206
- status: "aborted",
207
- message: "Aborted",
208
- output: sentence,
209
- searchID: data.searchID,
210
- id_now: data.id_now,
211
- });
212
- return;
213
- }
214
- const token = await model.next_token();
215
- if (token === "<|endoftext|>") {
216
- self.postMessage({
217
- status: "complete",
218
- output: sentence,
219
- searchID: data.searchID,
220
- id_now: data.id_now,
 
 
 
 
 
221
  });
222
- return;
223
- }
224
- const tokensSec =
225
- ((tokensCount + 1) / (performance.now() - startTime)) * 1000;
226
-
227
- sentence += token;
228
- self.postMessage({
229
- status: "update",
230
- message: "Generating token",
231
- token: token,
232
  output: sentence,
233
- totalTime: performance.now() - startTime,
234
- tokensSec,
235
- prompt: prompt,
236
  id_now: data.id_now,
237
- });
238
- setTimeout(resolve, 0);
239
  });
240
- tokensCount++;
241
- }
242
- self.postMessage({
243
- status: "complete",
244
- output: sentence,
245
- searchID: data.searchID,
246
- id_now: data.id_now,
247
- });
248
  } catch (e) {
249
- console.log(e)
250
- self.postMessage({ error: e });
251
  }
252
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import { pipeline, env } from "@xenova/transformers";
2
  import init, { Model } from "./phi/m.js";
3
+ import { streamToAsyncIterable } from "$lib/utils/streamToAsyncIterable";
4
+ import URI from "urijs";
5
+ import { compileTemplate2 } from "$lib/utils/template";
6
 
7
  // Shamelessly stolen from Transformers.js
8
 
9
  export async function tryCache(cache, ...names) {
10
+ for (let name of names) {
11
+ try {
12
+ console.log(name);
13
+ let result = await cache.match(name);
14
+ if (result) return result;
15
+ } catch (e) {
16
+ continue;
17
+ }
18
+ }
19
+ return undefined;
20
  }
21
 
22
  async function read_stream(url, response) {
23
  const reader = response.body.getReader();
24
+ const contentLength = +response.headers.get("Content-Length");
25
  let receivedLength = 0;
26
+ let chunks = [];
27
+ let uri = new URI(url);
28
 
29
+ while (true) {
30
+ const { done, value } = await reader.read();
31
  if (done) {
32
  break;
33
  }
34
  chunks.push(value);
35
  receivedLength += value.length;
36
+ let percent = (receivedLength / contentLength) * 100;
37
  self.postMessage({ status: "progress", file: uri.filename(), progress: percent });
38
  }
39
 
40
+ let chunksAll = new Uint8Array(receivedLength);
41
  let position = 0;
42
+ for (let chunk of chunks) {
43
+ chunksAll.set(chunk, position);
44
  position += chunk.length;
45
  }
46
+ return chunksAll;
47
  }
48
 
49
  async function fetchArrayBuffer(url) {
50
+ let cache = await caches.open("transformers-cache");
51
 
52
  const response = await tryCache(cache, url);
53
  if (response != undefined) {
54
+ console.log(url);
55
+ let res = await read_stream(url, response);
56
+ cache.put(
57
+ url,
58
+ new Response(res, {
59
+ headers: response.headers,
60
+ })
61
+ );
62
  return new Uint8Array(res);
63
+ } else {
 
64
  const response = await fetch(url);
65
+ let res = await read_stream(url, response);
66
+ cache.put(
67
+ url,
68
+ new Response(res, {
69
+ headers: response.headers,
70
+ })
71
+ );
72
  return new Uint8Array(res);
73
  }
 
 
74
  }
75
 
76
  class Phi {
77
  static instance = {};
78
+
79
  static async getInstance(weightsURL, modelID, tokenizerURL, quantized) {
80
+ // load individual modelID only once
81
+ if (!this.instance[modelID]) {
82
+ await init();
83
+
84
+ self.postMessage({ status: "loading", message: "Loading Model" });
85
+
86
+ const [weightsArrayU8, tokenizerArrayU8] = await Promise.all([
87
+ fetchArrayBuffer(weightsURL),
88
+ fetchArrayBuffer(tokenizerURL),
89
+ ]);
90
+
91
+ self.postMessage({ status: "init_model" });
92
+
93
+ this.instance[modelID] = new Model(weightsArrayU8, tokenizerArrayU8, quantized);
94
+ self.postMessage({ status: "ready", model: "phi-1_5" });
95
+ }
96
+ return this.instance[modelID];
 
 
 
 
97
  }
98
+ }
99
 
100
  export class FlanPipeline {
101
  static curr_model = "";
 
120
 
121
  // Listen for messages from the main thread
122
  self.addEventListener("message", async (event) => {
123
+ if (event.data.command == "abort") {
124
+ console.log("ABORT");
125
+ if (controller != null) {
126
+ try {
127
+ controller.abort();
128
+ } catch (e) {
129
+ console.log(e);
130
+ }
131
+ }
132
+ } else if (event.data.model_obj.is_local ?? true) {
133
+ if (event.data.model_obj.is_phi ?? false) {
134
  controller = new AbortController();
135
  generate_phi(event.data);
136
+ } else {
 
137
  let pipe = await FlanPipeline.getInstance(
138
  (x) => {
139
  self.postMessage(x);
140
  },
141
  event.data.model,
142
+ event.data.model_obj.type
143
  );
144
+
145
  let output = await pipe(event.data.text, {
146
+ max_new_tokens: event.data.model_obj.parameters?.max_new_tokens ?? 256,
147
+ temperature: event.data.model_obj.parameters?.temperature ?? 0.7,
148
  callback_function: (x) => {
149
  self.postMessage({
150
  status: "update",
 
153
  });
154
  },
155
  });
156
+
157
  // Send the output back to the main thread
158
  self.postMessage({
159
  status: "complete",
160
  output: output,
161
  searchID: event.data.searchID,
162
  id_now: event.data.id_now,
163
+ model: "phi-1_5",
164
  });
165
  }
166
+ } else {
167
+ const m = {
168
+ preprompt: event.data.model_obj.preprompt,
169
+ userMessageToken: event.data.model_obj.userMessageToken,
170
+ userMessageEndToken: event.data.model_obj.userMessageEndToken,
171
+ assistantMessageToken: event.data.model_obj.assistantMessageToken,
172
+ assistantMessageEndToken: event.data.model_obj.assistantMessageEndToken,
173
+ }
174
+ console.log(event.data.model_obj.chatPromptTemplate)
175
+ const t = compileTemplate2(event.data.model_obj.chatPromptTemplate, m)
176
+ const res = t({messages: event.data.messages, preprompt: m.preprompt})
177
+ console.log(res)
178
+ controller = new AbortController();
179
+ const context = buildContext(event.data);
180
+ const newParameters = {
181
+ max_new_tokens: event.data.model_obj.parameters?.max_new_tokens ?? 256,
182
+ temperature: event.data.model_obj.parameters?.temperature ?? 0.7,
183
+ truncate: event.data.model_obj.parameters?.truncate ?? 2048,
184
+ return_full_text: false,
185
+ };
186
+ let body = JSON.stringify({
187
+ inputs: res,
188
+ parameters: newParameters,
189
+ });
190
+ let text_output = "";
191
+ const server_addr = event.data.model_obj.server_addr ?? ""
192
+ try {
193
+ let resp = await fetch(server_addr + "/generate_stream", {
194
+ headers: {
195
+ "Content-Type": "application/json",
196
+ accesstoken: event.data.jwt,
197
+ },
198
+ method: "POST",
199
+ body: body,
200
+ signal: controller.signal,
201
+ });
202
+ if (resp.ok) {
203
+ let stream1 = resp.body;
204
+ for await (const input of streamToAsyncIterable(stream1)) {
205
+ const lines = new TextDecoder()
206
+ .decode(input)
207
+ .split("\n")
208
+ .filter((line) => line.startsWith("data:"));
209
 
210
+ for (const message of lines) {
211
+ let lastIndex = message.lastIndexOf("\ndata:");
212
+ if (lastIndex === -1) {
213
+ lastIndex = message.indexOf("data");
214
+ }
215
 
216
+ if (lastIndex === -1) {
217
+ console.error("Could not parse last message", message);
218
+ }
219
+
220
+ let lastMessage = message.slice(lastIndex).trim().slice("data:".length);
221
+ if (lastMessage.includes("\n")) {
222
+ lastMessage = lastMessage.slice(0, lastMessage.indexOf("\n"));
223
+ }
224
+
225
+ try {
226
+ const lastMessageJSON = JSON.parse(lastMessage);
227
+ if (!lastMessageJSON.generated_text) {
228
+ const res = lastMessageJSON.token.text;
229
+ text_output += res;
230
+ self.postMessage({
231
+ status: "update",
232
+ output: text_output,
233
+ id_now: event.data.id_now,
234
+ });
235
+ }
236
+ } catch (e) {
237
+ console.log(lastMessage);
238
+ console.log(e);
239
+ }
240
+ }
241
+ }
242
+ } else {
243
+ if (resp.status == 401 || resp.status == 403) {
244
+ self.postMessage({
245
+ status: "invalid_jwt",
246
+ });
247
+ }
248
+ console.log(resp);
249
+ self.postMessage({
250
+ status: "aborted",
251
+ output: text_output,
252
+ searchID: event.data.searchID,
253
+ id_now: event.data.id_now,
254
+ })
255
+ self.postMessage({
256
+ status: "error",
257
+ output: text_output,
258
+ error: "Error while trying to communicate with the server",
259
+ })
260
+ return;
261
+ }
262
+ } catch (e) {
263
+ console.log(e)
264
+ self.postMessage({
265
+ status: "aborted",
266
+ output: text_output,
267
+ searchID: event.data.searchID,
268
+ id_now: event.data.id_now,
269
+ })
270
+ if (e.name != "AbortError") {
271
+ self.postMessage({
272
+ status: "error",
273
+ output: text_output,
274
+ error: "Error while trying to communicate with the server",
275
+ })
276
+ }
277
+ return;
278
+ }
279
+ self.postMessage({
280
+ status: "complete",
281
+ output: text_output,
282
+ searchID: event.data.searchID,
283
+ id_now: event.data.id_now,
284
+ });
285
+ }
286
+ });
287
 
288
  async function generate_phi(data) {
289
  const tokenizerURL = "https://huggingface.co/microsoft/phi-1_5/raw/main/tokenizer.json";
290
  const weightsURL = "https://huggingface.co/lmz/candle-quantized-phi/resolve/main/model-q4k.gguf";
291
+ let prompt = data.text;
292
+ let maxSeqLen = data.model_obj.parameters?.max_new_tokens ?? 256;
293
+ let temp = data.model_obj.parameters?.temperature ?? 0.7;
294
  let modelID = 0;
295
  let quantized = true;
296
  let top_p = 1;
 
300
  self.postMessage({ status: "initiate", file: "tokenizer.json", name: "phi-1_5" }); // Fake init
301
 
302
  try {
303
+ const model = await Phi.getInstance(weightsURL, modelID, tokenizerURL, quantized);
304
+
305
+ const firstToken = model.init_with_prompt(prompt, temp, top_p, repeatPenalty, 64, BigInt(seed));
306
+ const seq_len = 2048;
307
+
308
+ let sentence = firstToken;
309
+ let maxTokens = maxSeqLen ? maxSeqLen : seq_len - prompt.length - 1;
310
+ let startTime = performance.now();
311
+ let tokensCount = 0;
312
+
313
+ while (tokensCount < maxTokens) {
314
+ await new Promise(async (resolve) => {
315
+ if (controller && controller.signal.aborted) {
316
+ self.postMessage({
317
+ status: "aborted",
318
+ message: "Aborted",
319
+ output: sentence,
320
+ searchID: data.searchID,
321
+ id_now: data.id_now,
322
+ });
323
+ return;
324
+ }
325
+ const token = await model.next_token();
326
+ if (token === "<|endoftext|>") {
327
+ self.postMessage({
328
+ status: "complete",
329
+ output: sentence,
330
+ searchID: data.searchID,
331
+ id_now: data.id_now,
332
+ });
333
+ return;
334
+ }
335
+ const tokensSec = ((tokensCount + 1) / (performance.now() - startTime)) * 1000;
336
+
337
+ sentence += token;
338
+ self.postMessage({
339
+ status: "update",
340
+ message: "Generating token",
341
+ token: token,
342
+ output: sentence,
343
+ totalTime: performance.now() - startTime,
344
+ tokensSec,
345
+ prompt: prompt,
346
+ id_now: data.id_now,
347
+ });
348
+ setTimeout(resolve, 0);
349
  });
350
+ tokensCount++;
351
+ }
352
+ self.postMessage({
353
+ status: "complete",
 
 
 
 
 
 
354
  output: sentence,
355
+ searchID: data.searchID,
 
 
356
  id_now: data.id_now,
 
 
357
  });
 
 
 
 
 
 
 
 
358
  } catch (e) {
359
+ console.log(e);
360
+ self.postMessage({ error: e });
361
  }
362
+ }
363
+ function buildContext(data) {
364
+ // Will be replaced by the original contextManager made by HF
365
+ let context = "";
366
+ let got_user_prompt = false;
367
+ for (let message of data.messages) {
368
+ if (message.content.trim().length > 0) {
369
+ if (message.from === "user") {
370
+ if (got_user_prompt == false) {
371
+ context = context + "<s>[INST] " + message.content;
372
+ got_user_prompt = true;
373
+ } else {
374
+ context = context + " " + message.content;
375
+ }
376
+ } else {
377
+ got_user_prompt = false;
378
+ context = context + " [/INST]" + message.content + " </s>";
379
+ }
380
+ }
381
+ }
382
+ if (got_user_prompt == true) {
383
+ context = context + " [/INST]";
384
+ } else {
385
+ context = context + "<s>[INST] " + data.text + " [/INST]";
386
+ }
387
+ return context;
388
+ }
src/routes/login/+page.server.ts CHANGED
@@ -3,7 +3,7 @@ import { getOIDCAuthorizationUrl } from "$lib/server/auth";
3
  import { base } from "$app/paths";
4
 
5
  export const actions = {
6
- default: async function ({ url, locals, request }) {
7
  // TODO: Handle errors if provider is not responding
8
  const referer = request.headers.get("referer");
9
  const authorizationUrl = await getOIDCAuthorizationUrl(
 
3
  import { base } from "$app/paths";
4
 
5
  export const actions = {
6
+ default: async function ({ url }: { url: URLSearchParams; locals: any; request: Request }) {
7
  // TODO: Handle errors if provider is not responding
8
  const referer = request.headers.get("referer");
9
  const authorizationUrl = await getOIDCAuthorizationUrl(
src/routes/model/flan/+page.svelte ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { goto, invalidate } from "$app/navigation";
3
+ import { PUBLIC_APP_NAME } from "$env/static/public";
4
+ import { base } from "$app/paths";
5
+ import { onMount } from "svelte";
6
+ import { curr_model_writable } from "../../../routes/LayoutWritable";
7
+
8
+ onMount(() => {
9
+ curr_model_writable.set(0);
10
+ goto(`/`, { invalidateAll: true });
11
+ });
12
+ </script>
13
+
14
+ <svelte:head>
15
+ <title>{PUBLIC_APP_NAME}</title>
16
+ </svelte:head>
src/routes/model/phi/+page.svelte ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { goto, invalidate } from "$app/navigation";
3
+ import { PUBLIC_APP_NAME } from "$env/static/public";
4
+ import { base } from "$app/paths";
5
+ import { onMount } from "svelte";
6
+ import { curr_model_writable } from "../../../routes/LayoutWritable";
7
+
8
+ onMount(() => {
9
+ curr_model_writable.set(1);
10
+ goto(`/`, { invalidateAll: true });
11
+ });
12
+ </script>
13
+
14
+ <svelte:head>
15
+ <title>{PUBLIC_APP_NAME}</title>
16
+ </svelte:head>
src/routes/tools.ts ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export async function getApiKey() {
2
+ try {
3
+ const response = await fetch("https://cloud.mithrilsecurity.io/api/apiKeys/chat", {
4
+ method: "GET",
5
+ credentials: "include",
6
+ headers: {
7
+ "Content-Type": "application/json",
8
+ },
9
+ });
10
+
11
+ if (response.ok) {
12
+ // Parse the JSON response
13
+ const data = await response.json();
14
+
15
+ const apiKeyValue = data.value;
16
+
17
+ return apiKeyValue;
18
+ } else {
19
+ // Handle errors
20
+ console.error("API Key retrieval failed");
21
+ }
22
+ } catch (error) {
23
+ // Handle network errors
24
+ console.error("Network error", error);
25
+ }
26
+ return "";
27
+ }
static/chatui/backup/favicon-blue.png ADDED
static/chatui/backup/favicon-transparent.png ADDED
static/chatui/backup/favicon.png ADDED
static/chatui/{favicon.svg → backup/favicon.svg} RENAMED
File without changes
static/chatui/chat-new-logo.png ADDED
static/chatui/chat.png CHANGED
static/chatui/favicon.png CHANGED
static/chatui/help.png ADDED
static/chatui/hide-password.png ADDED