diff --git a/localtunnel.js b/localtunnel.js new file mode 100644 index 0000000..070bf22 --- /dev/null +++ b/localtunnel.js @@ -0,0 +1,14 @@ +import localtunnel from 'localtunnel'; + +(async () => { + const tunnel = await localtunnel({ port: 11424 }); + + // the assigned public url for your tunnel + // i.e. https://abcdefgjhij.localtunnel.me + console.log(tunnel.url); + + tunnel.on('close', () => { + // tunnels are closed + console.log('Tunnel closed'); + }); +})(); \ No newline at end of file diff --git a/package.json b/package.json index 43bf123..80aaec5 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "start": "vite build && node ./server/server.js", "server": "node ./server/server.js", "dev": "vite dev --host", - "build": "vite build" + "build": "vite build", + "local": "node ./localtunnel.js" }, "devDependencies": { "@sveltejs/adapter-auto": "^3.0.0", @@ -27,6 +28,7 @@ "cors": "^2.8.5", "dotenv": "^16.4.5", "express": "^4.21.0", + "localtunnel": "^2.0.2", "mongoose": "^8.6.2", "ms": "^2.1.3", "ollama": "^0.5.9", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4cf8af4..d1454ce 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -29,6 +29,9 @@ importers: express: specifier: ^4.21.0 version: 4.21.0 + localtunnel: + specifier: ^2.0.2 + version: 2.0.2 mongoose: specifier: ^8.6.2 version: 8.6.2 @@ -447,6 +450,9 @@ packages: array-flatten@1.1.1: resolution: {integrity: sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==} + axios@0.21.4: + resolution: {integrity: sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==} + axobject-query@4.1.0: resolution: {integrity: sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==} engines: {node: '>= 0.4'} @@ -489,6 +495,9 @@ packages: resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} engines: {node: '>= 8.10.0'} + cliui@7.0.4: + resolution: {integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==} + code-red@1.0.4: resolution: {integrity: sha512-7qJWqItLA8/VPVlKJlFXU+NBlo/qyfs39aJcuMT/2ere32ZqvF5OSxgdM5xOfJJ7O429gg2HM47y8v9P+9wrNw==} @@ -545,6 +554,15 @@ packages: supports-color: optional: true + debug@4.3.2: + resolution: {integrity: sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + debug@4.3.7: resolution: {integrity: sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==} engines: {node: '>=6.0'} @@ -610,6 +628,10 @@ packages: engines: {node: '>=12'} hasBin: true + escalade@3.2.0: + resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} + engines: {node: '>=6'} + escape-html@1.0.3: resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==} @@ -646,6 +668,15 @@ packages: resolution: {integrity: sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==} engines: {node: '>= 0.8'} + follow-redirects@1.15.9: + resolution: {integrity: sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==} + engines: {node: '>=4.0'} + peerDependencies: + debug: '*' + peerDependenciesMeta: + debug: + optional: true + foreground-child@3.3.0: resolution: {integrity: sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==} engines: {node: '>=14'} @@ -669,6 +700,10 @@ packages: function-bind@1.1.2: resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + get-caller-file@2.0.5: + resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} + engines: {node: 6.* || 8.* || >= 10.*} + get-intrinsic@1.2.4: resolution: {integrity: sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==} engines: {node: '>= 0.4'} @@ -774,6 +809,11 @@ packages: resolution: {integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==} engines: {node: '>=6'} + localtunnel@2.0.2: + resolution: {integrity: sha512-n418Cn5ynvJd7m/N1d9WVJISLJF/ellZnfsLnx8WBWGzxv/ntNcFkJ1o6se5quUhCplfLGBNL5tYHiq5WF3Nug==} + engines: {node: '>=8.3.0'} + hasBin: true + locate-character@3.0.0: resolution: {integrity: sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==} @@ -874,6 +914,9 @@ packages: ms@2.0.0: resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} + ms@2.1.2: + resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} + ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} @@ -905,6 +948,9 @@ packages: resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==} engines: {node: '>= 0.8'} + openurl@1.1.1: + resolution: {integrity: sha512-d/gTkTb1i1GKz5k3XE3XFV/PxQ1k45zDqGP2OA7YhgsaLoqm6qRvARAZOFer1fcXritWlGBRCu/UgeS4HAnXAA==} + package-json-from-dist@1.0.0: resolution: {integrity: sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==} @@ -964,6 +1010,10 @@ packages: resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} engines: {node: '>=8.10.0'} + require-directory@2.1.1: + resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} + engines: {node: '>=0.10.0'} + resolve@1.22.8: resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} hasBin: true @@ -1180,6 +1230,18 @@ packages: resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} engines: {node: '>=12'} + y18n@5.0.8: + resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} + engines: {node: '>=10'} + + yargs-parser@20.2.9: + resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==} + engines: {node: '>=10'} + + yargs@17.1.1: + resolution: {integrity: sha512-c2k48R0PwKIqKhPMWjeiF6y2xY/gPMUlro0sgxqXpbOIohWiLNXWslsootttv7E1e73QPAMQSg5FeySbVcpsPQ==} + engines: {node: '>=12'} + snapshots: '@ampproject/remapping@2.3.0': @@ -1469,6 +1531,12 @@ snapshots: array-flatten@1.1.1: {} + axios@0.21.4(debug@4.3.2): + dependencies: + follow-redirects: 1.15.9(debug@4.3.2) + transitivePeerDependencies: + - debug + axobject-query@4.1.0: {} balanced-match@1.0.2: {} @@ -1526,6 +1594,12 @@ snapshots: optionalDependencies: fsevents: 2.3.3 + cliui@7.0.4: + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 + code-red@1.0.4: dependencies: '@jridgewell/sourcemap-codec': 1.5.0 @@ -1579,6 +1653,10 @@ snapshots: dependencies: ms: 2.0.0 + debug@4.3.2: + dependencies: + ms: 2.1.2 + debug@4.3.7: dependencies: ms: 2.1.3 @@ -1643,6 +1721,8 @@ snapshots: '@esbuild/win32-ia32': 0.21.5 '@esbuild/win32-x64': 0.21.5 + escalade@3.2.0: {} + escape-html@1.0.3: {} esm-env@1.0.0: {} @@ -1709,6 +1789,10 @@ snapshots: transitivePeerDependencies: - supports-color + follow-redirects@1.15.9(debug@4.3.2): + optionalDependencies: + debug: 4.3.2 + foreground-child@3.3.0: dependencies: cross-spawn: 7.0.3 @@ -1725,6 +1809,8 @@ snapshots: function-bind@1.1.2: {} + get-caller-file@2.0.5: {} + get-intrinsic@1.2.4: dependencies: es-errors: 1.3.0 @@ -1828,6 +1914,15 @@ snapshots: kleur@4.1.5: {} + localtunnel@2.0.2: + dependencies: + axios: 0.21.4(debug@4.3.2) + debug: 4.3.2 + openurl: 1.1.1 + yargs: 17.1.1 + transitivePeerDependencies: + - supports-color + locate-character@3.0.0: {} lru-cache@10.4.3: {} @@ -1904,6 +1999,8 @@ snapshots: ms@2.0.0: {} + ms@2.1.2: {} + ms@2.1.3: {} nanoid@3.3.7: {} @@ -1924,6 +2021,8 @@ snapshots: dependencies: ee-first: 1.1.1 + openurl@1.1.1: {} + package-json-from-dist@1.0.0: {} parseurl@1.3.3: {} @@ -1979,6 +2078,8 @@ snapshots: dependencies: picomatch: 2.3.1 + require-directory@2.1.1: {} + resolve@1.22.8: dependencies: is-core-module: 2.15.1 @@ -2209,3 +2310,17 @@ snapshots: ansi-styles: 6.2.1 string-width: 5.1.2 strip-ansi: 7.1.0 + + y18n@5.0.8: {} + + yargs-parser@20.2.9: {} + + yargs@17.1.1: + dependencies: + cliui: 7.0.4 + escalade: 3.2.0 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 20.2.9 diff --git a/server/ai.js b/server/ai.js index c71364b..332b979 100644 --- a/server/ai.js +++ b/server/ai.js @@ -1,6 +1,10 @@ import {Ollama} from 'ollama' -const ollama = new Ollama({ host: '172.29.186.121:11434' }) +const ollama = new Ollama({ host: '172.29.186.121:11434', fetch: { + headers: { + 'bypass-tunnel-reminder': 'lol' + } +}}); // const response = await ollama.chat({ // model: 'llama3:latest', @@ -41,7 +45,8 @@ const questions = [ "Do you prefer recipes that yield leftovers (great for meal prep) or single-serving portions?", "Are you looking for budget-friendly options, or are you willing to splurge a bit for a special meal?", "What’s the calorie range you want your meal to stay in? (You can specify yes or no)" -] +]; + // const testAnswers =[ // "Lunch", // "Italian", @@ -70,7 +75,7 @@ export default class FDAI { let qaA = ""; for(let i = 0; i < questionAmount; i++) { - qaA += `Q${i}. ${answers[i]}\nA${i}. ${answers[i]}` + qaA += `Q${i}. ${questions[i]}\nA${i}. ${answers[i]}` } const response = await ollama.generate({ diff --git a/src/routes/+layout.js b/src/routes/+layout.js index 5f06f9f..df54098 100644 --- a/src/routes/+layout.js +++ b/src/routes/+layout.js @@ -1,20 +1,21 @@ -import {createClient} from "@propelauth/javascript"; -const authClient = createClient({ - authUrl: "https://auth.fooddecisive.co/", - enableBackgroundTokenRefresh: true, -}); +// import {createClient} from "@propelauth/javascript"; +// const authClient = createClient({ +// authUrl: "https://auth.fooddecisive.co/", +// enableBackgroundTokenRefresh: true, +// }); export async function load() { - const authInfo = await authClient.getAuthenticationInfoOrNull(); - console.log("authInfo", authInfo) - if (authInfo) { - console.log("User is logged in as", authInfo.user.email) - } else { - console.log("User is not logged in") - } - return { - authInfo: authInfo ? authInfo : null - }; + // const authInfo = await authClient.getAuthenticationInfoOrNull(); + // console.log("authInfo", authInfo) + // if (authInfo) { + // console.log("User is logged in as", authInfo.user.email) + // } else { + // console.log("User is not logged in") + // } + + // return { + // authInfo: authInfo ? authInfo : null + // }; } \ No newline at end of file