coyotte508 HF staff commited on
Commit
cad3e14
1 Parent(s): ed0f702

Add MongoDB (#14)

Browse files
.env CHANGED
@@ -1,4 +1,4 @@
1
- MONGODB_URL=mongodb://localhost:27017
2
  MONGODB_DB_NAME=chat-ui
3
  HF_TOKEN=#your huggingface token here
4
 
 
1
+ MONGODB_URL=#your mongodb URL here
2
  MONGODB_DB_NAME=chat-ui
3
  HF_TOKEN=#your huggingface token here
4
 
package-lock.json CHANGED
@@ -10,12 +10,12 @@
10
  "dependencies": {
11
  "@huggingface/inference": "^2.0.0-rc2",
12
  "autoprefixer": "^10.4.14",
 
13
  "postcss": "^8.4.21",
14
  "tailwind-scrollbar": "^3.0.0",
15
  "tailwindcss": "^3.3.1"
16
  },
17
  "devDependencies": {
18
- "@sveltejs/adapter-auto": "^2.0.0",
19
  "@sveltejs/adapter-node": "^1.2.0",
20
  "@sveltejs/kit": "^1.5.0",
21
  "@typescript-eslint/eslint-plugin": "^5.45.0",
@@ -706,18 +706,6 @@
706
  }
707
  }
708
  },
709
- "node_modules/@sveltejs/adapter-auto": {
710
- "version": "2.0.0",
711
- "resolved": "https://registry.npmjs.org/@sveltejs/adapter-auto/-/adapter-auto-2.0.0.tgz",
712
- "integrity": "sha512-b+gkHFZgD771kgV3aO4avHFd7y1zhmMYy9i6xOK7m/rwmwaRO8gnF5zBc0Rgca80B2PMU1bKNxyBTHA14OzUAQ==",
713
- "dev": true,
714
- "dependencies": {
715
- "import-meta-resolve": "^2.2.0"
716
- },
717
- "peerDependencies": {
718
- "@sveltejs/kit": "^1.0.0"
719
- }
720
- },
721
  "node_modules/@sveltejs/adapter-node": {
722
  "version": "1.2.0",
723
  "resolved": "https://registry.npmjs.org/@sveltejs/adapter-node/-/adapter-node-1.2.0.tgz",
@@ -734,25 +722,25 @@
734
  }
735
  },
736
  "node_modules/@sveltejs/kit": {
737
- "version": "1.7.1",
738
- "resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-1.7.1.tgz",
739
- "integrity": "sha512-epaQCaZ/D3Qr/SgrRKHv+MpM6rz8JdaXSjOjas8t7PbDJl88KpqYWUvsmyuJQn/yNNGar23kENyy4NueNnjIKQ==",
740
  "dev": true,
741
  "hasInstallScript": true,
742
  "dependencies": {
743
  "@sveltejs/vite-plugin-svelte": "^2.0.0",
744
  "@types/cookie": "^0.5.1",
745
  "cookie": "^0.5.0",
746
- "devalue": "^4.2.3",
747
  "esm-env": "^1.0.0",
748
  "kleur": "^4.1.5",
749
- "magic-string": "^0.29.0",
750
  "mime": "^3.0.0",
751
  "sade": "^1.8.1",
752
  "set-cookie-parser": "^2.5.1",
753
  "sirv": "^2.0.2",
754
  "tiny-glob": "^0.2.9",
755
- "undici": "5.19.1"
756
  },
757
  "bin": {
758
  "svelte-kit": "svelte-kit.js"
@@ -819,8 +807,7 @@
819
  "node_modules/@types/node": {
820
  "version": "18.13.0",
821
  "resolved": "https://registry.npmjs.org/@types/node/-/node-18.13.0.tgz",
822
- "integrity": "sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg==",
823
- "dev": true
824
  },
825
  "node_modules/@types/pug": {
826
  "version": "2.0.6",
@@ -849,6 +836,20 @@
849
  "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==",
850
  "dev": true
851
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
852
  "node_modules/@typescript-eslint/eslint-plugin": {
853
  "version": "5.52.0",
854
  "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.52.0.tgz",
@@ -1227,6 +1228,14 @@
1227
  "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
1228
  }
1229
  },
 
 
 
 
 
 
 
 
1230
  "node_modules/buffer-crc32": {
1231
  "version": "0.2.13",
1232
  "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
@@ -2001,6 +2010,18 @@
2001
  "url": "https://github.com/sponsors/sindresorhus"
2002
  }
2003
  },
 
 
 
 
 
 
 
 
 
 
 
 
2004
  "node_modules/globalyzer": {
2005
  "version": "0.1.0",
2006
  "resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz",
@@ -2090,16 +2111,6 @@
2090
  "url": "https://github.com/sponsors/sindresorhus"
2091
  }
2092
  },
2093
- "node_modules/import-meta-resolve": {
2094
- "version": "2.2.1",
2095
- "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-2.2.1.tgz",
2096
- "integrity": "sha512-C6lLL7EJPY44kBvA80gq4uMsVFw5x3oSKfuMl1cuZ2RkI5+UJqQXgn+6hlUew0y4ig7Ypt4CObAAIzU53Nfpuw==",
2097
- "dev": true,
2098
- "funding": {
2099
- "type": "github",
2100
- "url": "https://github.com/sponsors/wooorm"
2101
- }
2102
- },
2103
  "node_modules/imurmurhash": {
2104
  "version": "0.1.4",
2105
  "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
@@ -2123,6 +2134,11 @@
2123
  "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
2124
  "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
2125
  },
 
 
 
 
 
2126
  "node_modules/is-binary-path": {
2127
  "version": "2.1.0",
2128
  "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
@@ -2328,9 +2344,9 @@
2328
  }
2329
  },
2330
  "node_modules/magic-string": {
2331
- "version": "0.29.0",
2332
- "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.29.0.tgz",
2333
- "integrity": "sha512-WcfidHrDjMY+eLjlU+8OvwREqHwpgCeKVBUpQ3OhYYuvfaYCUgcbuBzappNzZvg/v8onU3oQj+BYpkOJe9Iw4Q==",
2334
  "dev": true,
2335
  "dependencies": {
2336
  "@jridgewell/sourcemap-codec": "^1.4.13"
@@ -2339,6 +2355,12 @@
2339
  "node": ">=12"
2340
  }
2341
  },
 
 
 
 
 
 
2342
  "node_modules/merge2": {
2343
  "version": "1.4.1",
2344
  "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
@@ -2412,6 +2434,47 @@
2412
  "mkdirp": "bin/cmd.js"
2413
  }
2414
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2415
  "node_modules/mri": {
2416
  "version": "1.2.0",
2417
  "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz",
@@ -2803,7 +2866,6 @@
2803
  "version": "2.3.0",
2804
  "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz",
2805
  "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==",
2806
- "dev": true,
2807
  "engines": {
2808
  "node": ">=6"
2809
  }
@@ -2992,6 +3054,18 @@
2992
  "rimraf": "bin.js"
2993
  }
2994
  },
 
 
 
 
 
 
 
 
 
 
 
 
2995
  "node_modules/semver": {
2996
  "version": "7.3.8",
2997
  "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
@@ -3057,6 +3131,28 @@
3057
  "node": ">=8"
3058
  }
3059
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3060
  "node_modules/sorcery": {
3061
  "version": "0.11.0",
3062
  "resolved": "https://registry.npmjs.org/sorcery/-/sorcery-0.11.0.tgz",
@@ -3080,6 +3176,15 @@
3080
  "node": ">=0.10.0"
3081
  }
3082
  },
 
 
 
 
 
 
 
 
 
3083
  "node_modules/streamsearch": {
3084
  "version": "1.1.0",
3085
  "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz",
@@ -3413,6 +3518,17 @@
3413
  "node": ">=6"
3414
  }
3415
  },
 
 
 
 
 
 
 
 
 
 
 
3416
  "node_modules/ts-interface-checker": {
3417
  "version": "0.1.13",
3418
  "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz",
@@ -3457,18 +3573,6 @@
3457
  "node": ">= 0.8.0"
3458
  }
3459
  },
3460
- "node_modules/type-fest": {
3461
- "version": "0.20.2",
3462
- "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz",
3463
- "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==",
3464
- "dev": true,
3465
- "engines": {
3466
- "node": ">=10"
3467
- },
3468
- "funding": {
3469
- "url": "https://github.com/sponsors/sindresorhus"
3470
- }
3471
- },
3472
  "node_modules/typescript": {
3473
  "version": "4.9.5",
3474
  "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
@@ -3483,9 +3587,9 @@
3483
  }
3484
  },
3485
  "node_modules/undici": {
3486
- "version": "5.19.1",
3487
- "resolved": "https://registry.npmjs.org/undici/-/undici-5.19.1.tgz",
3488
- "integrity": "sha512-YiZ61LPIgY73E7syxCDxxa3LV2yl3sN8spnIuTct60boiiRaE1J8mNWHO8Im2Zi/sFrPusjLlmRPrsyraSqX6A==",
3489
  "dev": true,
3490
  "dependencies": {
3491
  "busboy": "^1.6.0"
@@ -3596,6 +3700,26 @@
3596
  }
3597
  }
3598
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3599
  "node_modules/which": {
3600
  "version": "2.0.2",
3601
  "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
 
10
  "dependencies": {
11
  "@huggingface/inference": "^2.0.0-rc2",
12
  "autoprefixer": "^10.4.14",
13
+ "mongodb": "^5.3.0",
14
  "postcss": "^8.4.21",
15
  "tailwind-scrollbar": "^3.0.0",
16
  "tailwindcss": "^3.3.1"
17
  },
18
  "devDependencies": {
 
19
  "@sveltejs/adapter-node": "^1.2.0",
20
  "@sveltejs/kit": "^1.5.0",
21
  "@typescript-eslint/eslint-plugin": "^5.45.0",
 
706
  }
707
  }
708
  },
 
 
 
 
 
 
 
 
 
 
 
 
709
  "node_modules/@sveltejs/adapter-node": {
710
  "version": "1.2.0",
711
  "resolved": "https://registry.npmjs.org/@sveltejs/adapter-node/-/adapter-node-1.2.0.tgz",
 
722
  }
723
  },
724
  "node_modules/@sveltejs/kit": {
725
+ "version": "1.15.7",
726
+ "resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-1.15.7.tgz",
727
+ "integrity": "sha512-dgdKExsMJ16X3q8tEcuDlv+QIWAlJcf7IqCU2HWV13nmtTzwSA2n4VtEx9Gy5OGhH0SUAGNIupmlf0TdFSMXbw==",
728
  "dev": true,
729
  "hasInstallScript": true,
730
  "dependencies": {
731
  "@sveltejs/vite-plugin-svelte": "^2.0.0",
732
  "@types/cookie": "^0.5.1",
733
  "cookie": "^0.5.0",
734
+ "devalue": "^4.3.0",
735
  "esm-env": "^1.0.0",
736
  "kleur": "^4.1.5",
737
+ "magic-string": "^0.30.0",
738
  "mime": "^3.0.0",
739
  "sade": "^1.8.1",
740
  "set-cookie-parser": "^2.5.1",
741
  "sirv": "^2.0.2",
742
  "tiny-glob": "^0.2.9",
743
+ "undici": "5.20.0"
744
  },
745
  "bin": {
746
  "svelte-kit": "svelte-kit.js"
 
807
  "node_modules/@types/node": {
808
  "version": "18.13.0",
809
  "resolved": "https://registry.npmjs.org/@types/node/-/node-18.13.0.tgz",
810
+ "integrity": "sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg=="
 
811
  },
812
  "node_modules/@types/pug": {
813
  "version": "2.0.6",
 
836
  "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==",
837
  "dev": true
838
  },
839
+ "node_modules/@types/webidl-conversions": {
840
+ "version": "7.0.0",
841
+ "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
842
+ "integrity": "sha512-xTE1E+YF4aWPJJeUzaZI5DRntlkY3+BCVJi0axFptnjGmAoWxkyREIh/XMrfxVLejwQxMCfDXdICo0VLxThrog=="
843
+ },
844
+ "node_modules/@types/whatwg-url": {
845
+ "version": "8.2.2",
846
+ "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz",
847
+ "integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==",
848
+ "dependencies": {
849
+ "@types/node": "*",
850
+ "@types/webidl-conversions": "*"
851
+ }
852
+ },
853
  "node_modules/@typescript-eslint/eslint-plugin": {
854
  "version": "5.52.0",
855
  "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.52.0.tgz",
 
1228
  "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
1229
  }
1230
  },
1231
+ "node_modules/bson": {
1232
+ "version": "5.2.0",
1233
+ "resolved": "https://registry.npmjs.org/bson/-/bson-5.2.0.tgz",
1234
+ "integrity": "sha512-HevkSpDbpUfsrHWmWiAsNavANKYIErV2ePXllp1bwq5CDreAaFVj6RVlZpJnxK4WWDCJ/5jMUpaY6G526q3Hjg==",
1235
+ "engines": {
1236
+ "node": ">=14.20.1"
1237
+ }
1238
+ },
1239
  "node_modules/buffer-crc32": {
1240
  "version": "0.2.13",
1241
  "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
 
2010
  "url": "https://github.com/sponsors/sindresorhus"
2011
  }
2012
  },
2013
+ "node_modules/globals/node_modules/type-fest": {
2014
+ "version": "0.20.2",
2015
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz",
2016
+ "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==",
2017
+ "dev": true,
2018
+ "engines": {
2019
+ "node": ">=10"
2020
+ },
2021
+ "funding": {
2022
+ "url": "https://github.com/sponsors/sindresorhus"
2023
+ }
2024
+ },
2025
  "node_modules/globalyzer": {
2026
  "version": "0.1.0",
2027
  "resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz",
 
2111
  "url": "https://github.com/sponsors/sindresorhus"
2112
  }
2113
  },
 
 
 
 
 
 
 
 
 
 
2114
  "node_modules/imurmurhash": {
2115
  "version": "0.1.4",
2116
  "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
 
2134
  "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
2135
  "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
2136
  },
2137
+ "node_modules/ip": {
2138
+ "version": "2.0.0",
2139
+ "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz",
2140
+ "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ=="
2141
+ },
2142
  "node_modules/is-binary-path": {
2143
  "version": "2.1.0",
2144
  "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
 
2344
  }
2345
  },
2346
  "node_modules/magic-string": {
2347
+ "version": "0.30.0",
2348
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.0.tgz",
2349
+ "integrity": "sha512-LA+31JYDJLs82r2ScLrlz1GjSgu66ZV518eyWT+S8VhyQn/JL0u9MeBOvQMGYiPk1DBiSN9DDMOcXvigJZaViQ==",
2350
  "dev": true,
2351
  "dependencies": {
2352
  "@jridgewell/sourcemap-codec": "^1.4.13"
 
2355
  "node": ">=12"
2356
  }
2357
  },
2358
+ "node_modules/memory-pager": {
2359
+ "version": "1.5.0",
2360
+ "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
2361
+ "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
2362
+ "optional": true
2363
+ },
2364
  "node_modules/merge2": {
2365
  "version": "1.4.1",
2366
  "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
 
2434
  "mkdirp": "bin/cmd.js"
2435
  }
2436
  },
2437
+ "node_modules/mongodb": {
2438
+ "version": "5.3.0",
2439
+ "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.3.0.tgz",
2440
+ "integrity": "sha512-Wy/sbahguL8c3TXQWXmuBabiLD+iVmz+tOgQf+FwkCjhUIorqbAxRbbz00g4ZoN4sXIPwpAlTANMaGRjGGTikQ==",
2441
+ "dependencies": {
2442
+ "bson": "^5.2.0",
2443
+ "mongodb-connection-string-url": "^2.6.0",
2444
+ "socks": "^2.7.1"
2445
+ },
2446
+ "engines": {
2447
+ "node": ">=14.20.1"
2448
+ },
2449
+ "optionalDependencies": {
2450
+ "saslprep": "^1.0.3"
2451
+ },
2452
+ "peerDependencies": {
2453
+ "@aws-sdk/credential-providers": "^3.201.0",
2454
+ "mongodb-client-encryption": ">=2.3.0 <3",
2455
+ "snappy": "^7.2.2"
2456
+ },
2457
+ "peerDependenciesMeta": {
2458
+ "@aws-sdk/credential-providers": {
2459
+ "optional": true
2460
+ },
2461
+ "mongodb-client-encryption": {
2462
+ "optional": true
2463
+ },
2464
+ "snappy": {
2465
+ "optional": true
2466
+ }
2467
+ }
2468
+ },
2469
+ "node_modules/mongodb-connection-string-url": {
2470
+ "version": "2.6.0",
2471
+ "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.6.0.tgz",
2472
+ "integrity": "sha512-WvTZlI9ab0QYtTYnuMLgobULWhokRjtC7db9LtcVfJ+Hsnyr5eo6ZtNAt3Ly24XZScGMelOcGtm7lSn0332tPQ==",
2473
+ "dependencies": {
2474
+ "@types/whatwg-url": "^8.2.1",
2475
+ "whatwg-url": "^11.0.0"
2476
+ }
2477
+ },
2478
  "node_modules/mri": {
2479
  "version": "1.2.0",
2480
  "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz",
 
2866
  "version": "2.3.0",
2867
  "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz",
2868
  "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==",
 
2869
  "engines": {
2870
  "node": ">=6"
2871
  }
 
3054
  "rimraf": "bin.js"
3055
  }
3056
  },
3057
+ "node_modules/saslprep": {
3058
+ "version": "1.0.3",
3059
+ "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz",
3060
+ "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==",
3061
+ "optional": true,
3062
+ "dependencies": {
3063
+ "sparse-bitfield": "^3.0.3"
3064
+ },
3065
+ "engines": {
3066
+ "node": ">=6"
3067
+ }
3068
+ },
3069
  "node_modules/semver": {
3070
  "version": "7.3.8",
3071
  "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
 
3131
  "node": ">=8"
3132
  }
3133
  },
3134
+ "node_modules/smart-buffer": {
3135
+ "version": "4.2.0",
3136
+ "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
3137
+ "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
3138
+ "engines": {
3139
+ "node": ">= 6.0.0",
3140
+ "npm": ">= 3.0.0"
3141
+ }
3142
+ },
3143
+ "node_modules/socks": {
3144
+ "version": "2.7.1",
3145
+ "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz",
3146
+ "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==",
3147
+ "dependencies": {
3148
+ "ip": "^2.0.0",
3149
+ "smart-buffer": "^4.2.0"
3150
+ },
3151
+ "engines": {
3152
+ "node": ">= 10.13.0",
3153
+ "npm": ">= 3.0.0"
3154
+ }
3155
+ },
3156
  "node_modules/sorcery": {
3157
  "version": "0.11.0",
3158
  "resolved": "https://registry.npmjs.org/sorcery/-/sorcery-0.11.0.tgz",
 
3176
  "node": ">=0.10.0"
3177
  }
3178
  },
3179
+ "node_modules/sparse-bitfield": {
3180
+ "version": "3.0.3",
3181
+ "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
3182
+ "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==",
3183
+ "optional": true,
3184
+ "dependencies": {
3185
+ "memory-pager": "^1.0.2"
3186
+ }
3187
+ },
3188
  "node_modules/streamsearch": {
3189
  "version": "1.1.0",
3190
  "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz",
 
3518
  "node": ">=6"
3519
  }
3520
  },
3521
+ "node_modules/tr46": {
3522
+ "version": "3.0.0",
3523
+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz",
3524
+ "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==",
3525
+ "dependencies": {
3526
+ "punycode": "^2.1.1"
3527
+ },
3528
+ "engines": {
3529
+ "node": ">=12"
3530
+ }
3531
+ },
3532
  "node_modules/ts-interface-checker": {
3533
  "version": "0.1.13",
3534
  "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz",
 
3573
  "node": ">= 0.8.0"
3574
  }
3575
  },
 
 
 
 
 
 
 
 
 
 
 
 
3576
  "node_modules/typescript": {
3577
  "version": "4.9.5",
3578
  "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
 
3587
  }
3588
  },
3589
  "node_modules/undici": {
3590
+ "version": "5.20.0",
3591
+ "resolved": "https://registry.npmjs.org/undici/-/undici-5.20.0.tgz",
3592
+ "integrity": "sha512-J3j60dYzuo6Eevbawwp1sdg16k5Tf768bxYK4TUJRH7cBM4kFCbf3mOnM/0E3vQYXvpxITbbWmBafaDbxLDz3g==",
3593
  "dev": true,
3594
  "dependencies": {
3595
  "busboy": "^1.6.0"
 
3700
  }
3701
  }
3702
  },
3703
+ "node_modules/webidl-conversions": {
3704
+ "version": "7.0.0",
3705
+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
3706
+ "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
3707
+ "engines": {
3708
+ "node": ">=12"
3709
+ }
3710
+ },
3711
+ "node_modules/whatwg-url": {
3712
+ "version": "11.0.0",
3713
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz",
3714
+ "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==",
3715
+ "dependencies": {
3716
+ "tr46": "^3.0.0",
3717
+ "webidl-conversions": "^7.0.0"
3718
+ },
3719
+ "engines": {
3720
+ "node": ">=12"
3721
+ }
3722
+ },
3723
  "node_modules/which": {
3724
  "version": "2.0.2",
3725
  "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
package.json CHANGED
@@ -12,7 +12,6 @@
12
  "format": "prettier --plugin-search-dir . --write ."
13
  },
14
  "devDependencies": {
15
- "@sveltejs/adapter-auto": "^2.0.0",
16
  "@sveltejs/adapter-node": "^1.2.0",
17
  "@sveltejs/kit": "^1.5.0",
18
  "@typescript-eslint/eslint-plugin": "^5.45.0",
@@ -32,6 +31,7 @@
32
  "dependencies": {
33
  "@huggingface/inference": "^2.0.0-rc2",
34
  "autoprefixer": "^10.4.14",
 
35
  "postcss": "^8.4.21",
36
  "tailwind-scrollbar": "^3.0.0",
37
  "tailwindcss": "^3.3.1"
 
12
  "format": "prettier --plugin-search-dir . --write ."
13
  },
14
  "devDependencies": {
 
15
  "@sveltejs/adapter-node": "^1.2.0",
16
  "@sveltejs/kit": "^1.5.0",
17
  "@typescript-eslint/eslint-plugin": "^5.45.0",
 
31
  "dependencies": {
32
  "@huggingface/inference": "^2.0.0-rc2",
33
  "autoprefixer": "^10.4.14",
34
+ "mongodb": "^5.3.0",
35
  "postcss": "^8.4.21",
36
  "tailwind-scrollbar": "^3.0.0",
37
  "tailwindcss": "^3.3.1"
src/lib/server/database.ts ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { MONGODB_URL, MONGODB_DB_NAME } from '$env/static/private';
2
+ import { MongoClient } from 'mongodb';
3
+ import type { Conversation } from '$lib/types/Conversation';
4
+
5
+ const client = new MongoClient(MONGODB_URL, {
6
+ // directConnection: true
7
+ });
8
+
9
+ export const connectPromise = client.connect().catch(console.error);
10
+
11
+ const db = client.db(MONGODB_DB_NAME);
12
+
13
+ const conversations = db.collection<Conversation>('conversations');
14
+
15
+ export { client, db };
16
+ export const collections = { conversations };
17
+
18
+ client.on('open', () => {
19
+ conversations.createIndex({ sessionId: 1, updatedAt: -1 });
20
+ });
src/lib/types/Conversation.ts ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { ObjectId } from 'mongodb';
2
+ import type { Message } from './Message';
3
+
4
+ export interface Conversation {
5
+ _id: ObjectId;
6
+ sessionId: string;
7
+
8
+ title: string;
9
+ messages: Message[];
10
+
11
+ createdAt: Date;
12
+ updatedAt: Date;
13
+ }
src/lib/types/Message.ts ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ export interface Message {
2
+ from: 'user' | 'assistant';
3
+ content: 'string';
4
+ }
src/routes/+page.server.ts ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { PageServerLoad } from './$types';
2
+ import { collections } from '$lib/server/database';
3
+ import type { Conversation } from '$lib/types/Conversation';
4
+
5
+ export const load: PageServerLoad = async () => {
6
+ const { conversations } = collections;
7
+
8
+ return {
9
+ conversations: await conversations
10
+ .find()
11
+ .sort({ updatedAt: -1 })
12
+ .project<Pick<Conversation, 'title' | '_id' | 'updatedAt' | 'createdAt'>>({
13
+ title: 1,
14
+ _id: 1,
15
+ updatedAt: 1,
16
+ createdAt: 1
17
+ })
18
+ .map((conv) => ({ id: conv._id.toString(), title: conv.title }))
19
+ .toArray()
20
+ };
21
+ };
src/routes/+page.svelte CHANGED
@@ -14,6 +14,9 @@
14
  PUBLIC_USER_MESSAGE_TOKEN
15
  } from '$env/static/public';
16
  import { page } from '$app/stores';
 
 
 
17
 
18
  const userToken = PUBLIC_USER_MESSAGE_TOKEN || '<|prompter|>';
19
  const assistantToken = PUBLIC_ASSISTANT_MESSAGE_TOKEN || '<|assistant|>';
@@ -121,12 +124,12 @@
121
  >
122
  </div>
123
  <div class="flex flex-col overflow-y-auto p-3 -mt-3 gap-2">
124
- {#each Array(5) as _}
125
  <a
126
- href="/"
127
  class="truncate py-3 px-3 rounded-lg flex-none text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"
128
  >
129
- Amet consectetur adipisicing elit. Eos dolorum nihil alias.
130
  </a>
131
  {/each}
132
  </div>
 
14
  PUBLIC_USER_MESSAGE_TOKEN
15
  } from '$env/static/public';
16
  import { page } from '$app/stores';
17
+ import type { PageData } from './$types';
18
+
19
+ export let data: PageData;
20
 
21
  const userToken = PUBLIC_USER_MESSAGE_TOKEN || '<|prompter|>';
22
  const assistantToken = PUBLIC_ASSISTANT_MESSAGE_TOKEN || '<|assistant|>';
 
124
  >
125
  </div>
126
  <div class="flex flex-col overflow-y-auto p-3 -mt-3 gap-2">
127
+ {#each data.conversations as conv}
128
  <a
129
+ href="/conversation/{conv.id}"
130
  class="truncate py-3 px-3 rounded-lg flex-none text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"
131
  >
132
+ {conv.title}
133
  </a>
134
  {/each}
135
  </div>