mirror of
https://github.com/hpware/news-analyze.git
synced 2025-07-17 03:29:29 +08:00
commit
9c36116feb
22
.env.example
22
.env.example
@ -1,28 +1,12 @@
|
||||
# Please use .env.exmaple as an starting point. Rename it to .env and fill in the values, the application requrires it.
|
||||
|
||||
# This is the default .env file.
|
||||
|
||||
# S3 INFO
|
||||
S3_ACCESS_KEY=""
|
||||
S3_SECRET_KEY=""
|
||||
S3_BUCKETNAME=""
|
||||
S3_ENDPOINT=""
|
||||
|
||||
# GITHUB OAUTH (NOT WORKING 4n)
|
||||
NUXT_GITHUB_CLIENT_ID=""
|
||||
NUXT_GITHUB_CLIENT_SECRET=""
|
||||
|
||||
# GLOBAL DATABASE
|
||||
POSTGRES_URL=""
|
||||
|
||||
# THE BELOW TWO IS NOW IN THE DB, PLEASE FOLOW THIS GUIDE: https://github.com/hpware/news-analyze?tab=readme-ov-file#notes
|
||||
# GROQ API KEY
|
||||
GROQ_API_KEY=""
|
||||
#GROQ_API_KEY=""
|
||||
|
||||
# PASSWORD SALT
|
||||
PASSWORD_HASH_SALT=""
|
||||
|
||||
# CF TURNSTILE
|
||||
NUXT_CF_TURNSTILE_SITE_KEY=""
|
||||
NUXT_CF_TURNSTILE_SECRET_KEY=""
|
||||
|
||||
NUXT_DEV_ENV=false
|
||||
#PASSWORD_HASH_SALT=""
|
||||
|
19
README.md
19
README.md
@ -27,6 +27,20 @@ Beta (Beta Docker Image): https://newsbeta.20090526.xyz
|
||||
|
||||
https://github.com/user-attachments/assets/29414c5d-3b2f-420d-93c0-95c14a15bbb7
|
||||
|
||||
## Notes:
|
||||
The enviroment vars are stored in the database, which is cursed, I know, but this is the only way to let the system access new envs sent by the user, so if you are trying to spin up a instence of this app you MUST put the postgres url in the .env & create a table using beekeeper studio (my choice for SQL editing, you can choose whatever you like), and after that you can create the entire database by using this api call, https://<<your_domain>>/api/create_database in your browser.
|
||||
```sql
|
||||
CREATE TABLE IF NOT EXISTS global_vars (
|
||||
NAME TEXT PRIMARY KEY NOT NULL,
|
||||
VAR TEXT NOT NULL
|
||||
);
|
||||
INSERT INTO global_vars(name, var)
|
||||
VALUES ('groq_api_key', '<<YOUR_API_KEY_HERE>>');
|
||||
INSERT INTO global_vars(name, var)
|
||||
VALUES ('password_hash_salt', '<<YOUR_PASSWORD_SALT_HERE>>');
|
||||
```
|
||||
Replace `<<YOUR_API_KEY_HERE>>` with your actual api key, and also replace `<<YOUR_PASSWORD_SALT_HERE>>` with a random salt you get by running this command on your Mac/Linux device (Windows idk) `openssl rand -base64 48`.
|
||||
|
||||
## Issues:
|
||||
### Onboarding:
|
||||
Onboarding is a must for most people that are using the app for the first time, but I want to do to via a non-video like system, however implementing the function in a already large repo is kinda hard. So later this week, I will just add a basic video onboarding system.
|
||||
@ -61,13 +75,10 @@ This code is absolutly NOT designed to be spinned up at Vercel or Netlify, it ha
|
||||
### The API returning outdated data from more than 5+ years:
|
||||
Here is the GitHub Issue: https://github.com/hpware/news-analyze/issues/2
|
||||
|
||||
### Groq API not loading to .env for some reasons.
|
||||
If the user did not load a GROQ api, the summerizing system will just fail outright. Fixing this rn.
|
||||
|
||||
### When using the desktop in the dev env it pops up an error
|
||||

|
||||
|
||||
For some reasons, Nuxt's dev env prev does not display this error, but with the newer ones, it started displaying this error, please run `./wipedev.sh` or `./wipedev.bat` and restart the dev server. (And this is only a temp fix, I have no idea how can I fix this, if you have a fix, please submit a PR thx.)
|
||||
For some reasons, Nuxt's dev env prev does not display this error, but with the newer ones, it started displaying this error, please run `./wipedev.sh` or `./wipedev.bat` and restart the dev server. (And this is only a temp fix, I have no idea how can I fix this, if you have a fix, please submit a PR, thx.)
|
||||
|
||||
## Why?
|
||||
|
||||
|
90
bun.lock
90
bun.lock
@ -8,7 +8,7 @@
|
||||
"@fontsource/fira-sans": "^5.2.6",
|
||||
"@heroicons/vue": "^2.2.0",
|
||||
"@monyone/aho-corasick": "^1.0.4",
|
||||
"@nuxtjs/i18n": "9.5.4",
|
||||
"@nuxtjs/i18n": "9.5.5",
|
||||
"@nuxtjs/robots": "5.2.10",
|
||||
"@nuxtjs/seo": "3.0.3",
|
||||
"@nuxtjs/tailwindcss": "6.14.0",
|
||||
@ -21,18 +21,18 @@
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"crypto-js": "^4.2.0",
|
||||
"groq-sdk": "^0.22.0",
|
||||
"groq-sdk": "^0.25.0",
|
||||
"gsap": "^3.13.0",
|
||||
"html-to-json-parser": "^2.0.1",
|
||||
"js-confetti": "^0.12.0",
|
||||
"lucide-vue-next": "^0.511.0",
|
||||
"lucide-vue-next": "^0.515.0",
|
||||
"nuxt": "^3.17.5",
|
||||
"pg-backup": "^0.0.2",
|
||||
"postgres": "^3.4.7",
|
||||
"prettier": "^3.5.3",
|
||||
"reka-ui": "^2.3.1",
|
||||
"rss-parser": "^3.13.0",
|
||||
"shadcn-nuxt": "2.1.0",
|
||||
"shadcn-nuxt": "2.2.0",
|
||||
"tailwind-merge": "^3.3.1",
|
||||
"tailwind-scrollbar": "^4.0.2",
|
||||
"tailwindcss": "^3.4.17",
|
||||
@ -356,7 +356,7 @@
|
||||
|
||||
"@nuxt/vite-builder": ["@nuxt/vite-builder@3.17.6", "", { "dependencies": { "@nuxt/kit": "3.17.6", "@rollup/plugin-replace": "^6.0.2", "@vitejs/plugin-vue": "^5.2.4", "@vitejs/plugin-vue-jsx": "^4.2.0", "autoprefixer": "^10.4.21", "consola": "^3.4.2", "cssnano": "^7.0.7", "defu": "^6.1.4", "esbuild": "^0.25.5", "escape-string-regexp": "^5.0.0", "exsolve": "^1.0.7", "externality": "^1.0.2", "get-port-please": "^3.1.2", "h3": "^1.15.3", "jiti": "^2.4.2", "knitwork": "^1.2.0", "magic-string": "^0.30.17", "mlly": "^1.7.4", "mocked-exports": "^0.1.1", "ohash": "^2.0.11", "pathe": "^2.0.3", "perfect-debounce": "^1.0.0", "pkg-types": "^2.2.0", "postcss": "^8.5.6", "rollup-plugin-visualizer": "^6.0.3", "std-env": "^3.9.0", "ufo": "^1.6.1", "unenv": "^2.0.0-rc.18", "vite": "^6.3.5", "vite-node": "^3.2.4", "vite-plugin-checker": "^0.9.3", "vue-bundle-renderer": "^2.1.1" }, "peerDependencies": { "vue": "^3.3.4" } }, "sha512-D7bf0BE2nDFj23ryKuSakQFDETt5rpnMTlaoDsRElrApFRvMNzF7pYHuHjvPELsi0UmaqCb8sZn6ki0GALEu2A=="],
|
||||
|
||||
"@nuxtjs/i18n": ["@nuxtjs/i18n@9.5.4", "", { "dependencies": { "@intlify/h3": "^0.6.1", "@intlify/shared": "^10.0.7", "@intlify/unplugin-vue-i18n": "^6.0.8", "@intlify/utils": "^0.13.0", "@miyaneee/rollup-plugin-json5": "^1.2.0", "@nuxt/kit": "^3.16.2", "@oxc-parser/wasm": "^0.60.0", "@rollup/plugin-yaml": "^4.1.2", "@vue/compiler-sfc": "^3.5.13", "debug": "^4.4.0", "defu": "^6.1.4", "esbuild": "^0.25.1", "estree-walker": "^3.0.3", "h3": "^1.15.1", "knitwork": "^1.2.0", "magic-string": "^0.30.17", "mlly": "^1.7.4", "oxc-parser": "^0.61.2", "pathe": "^2.0.3", "typescript": "^5.6.2", "ufo": "^1.5.4", "unplugin": "^2.2.2", "unplugin-vue-router": "^0.12.0", "vue-i18n": "^10.0.7", "vue-router": "^4.5.0" } }, "sha512-HSCC6bLvkI74AOJ/Hsa8+52uy92Bzpu/lVOKYJZIR/HV4TtV48fgKLPRlL8RmCXx/AmKBtrPsLfhAAIj9RBAKQ=="],
|
||||
"@nuxtjs/i18n": ["@nuxtjs/i18n@9.5.5", "", { "dependencies": { "@intlify/h3": "^0.6.1", "@intlify/shared": "^10.0.7", "@intlify/unplugin-vue-i18n": "^6.0.8", "@intlify/utils": "^0.13.0", "@miyaneee/rollup-plugin-json5": "^1.2.0", "@nuxt/kit": "^3.17.2", "@oxc-parser/wasm": "^0.60.0", "@rollup/plugin-yaml": "^4.1.2", "@vue/compiler-sfc": "^3.5.13", "debug": "^4.4.0", "defu": "^6.1.4", "esbuild": "^0.25.1", "estree-walker": "^3.0.3", "h3": "^1.15.1", "knitwork": "^1.2.0", "magic-string": "^0.30.17", "mlly": "^1.7.4", "oxc-parser": "^0.70.0", "pathe": "^2.0.3", "typescript": "^5.6.2", "ufo": "^1.5.4", "unplugin": "^2.2.2", "unplugin-vue-router": "^0.12.0", "vue-i18n": "^10.0.7", "vue-router": "^4.5.1" } }, "sha512-c3zuH9JCslzRGbe5OVq7FFF4BFQuTUvHncaIk6gROf0uFbc7uqAL3h+MQSV7kQj9bRsbBoccppYqITTuKb3dvg=="],
|
||||
|
||||
"@nuxtjs/robots": ["@nuxtjs/robots@5.2.10", "", { "dependencies": { "@nuxt/kit": "^3.16.2", "consola": "^3.4.2", "defu": "^6.1.4", "nuxt-site-config": "^3.1.9", "pathe": "^2.0.3", "pkg-types": "^2.1.0", "sirv": "^3.0.1", "std-env": "^3.9.0", "ufo": "^1.6.1" } }, "sha512-WiO+VA8UwDgVLy7JCrGTrAmSNNw397OuNseKOG051ixswEDd0QhNw4cUtgNd2RkSIL7WlkfwkizdJFCd9y9iXw=="],
|
||||
|
||||
@ -432,33 +432,33 @@
|
||||
|
||||
"@oxc-parser/binding-android-arm64": ["@oxc-parser/binding-android-arm64@0.75.0", "", { "os": "android", "cpu": "arm64" }, "sha512-nSHUHCO59G+kbixFVc7dK1j3l1EU3nVNLkj47ysCyl7RW3Z9cwCITp7SVwm+gl3ufCuVU4bkaBpgFnesnqZeDg=="],
|
||||
|
||||
"@oxc-parser/binding-darwin-arm64": ["@oxc-parser/binding-darwin-arm64@0.61.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-xpDuwawMDCHg3plbSjpMbrhNTzO1AlvvHqsUOTE3WDmv5K7fFD72f3Pl+SxPJ4D/IhMdskec1B5ZfZHM1iAFmQ=="],
|
||||
"@oxc-parser/binding-darwin-arm64": ["@oxc-parser/binding-darwin-arm64@0.70.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-pIi7L9PnsBctS/ruW6JQVSYRJkh76PblBN46uQxpBfVsM57c1s4HGZlmGysQWbdmQTFDZW+SmH3u0JpmDLF0+A=="],
|
||||
|
||||
"@oxc-parser/binding-darwin-x64": ["@oxc-parser/binding-darwin-x64@0.61.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-1zjghOALDDhg5mPJgQfoud/bLOxD3M9n8l2LxXK4NngxGh3xXq1K7vAs2dzDnwZI6FaStrrBMDJSocT2hggiLg=="],
|
||||
"@oxc-parser/binding-darwin-x64": ["@oxc-parser/binding-darwin-x64@0.70.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-EbKqtOHzZR56ZFC5HHg6XrYneFAJmpLC1Z6FSgbI061Ley1atAViQg7S6Agm9wAcPpns+BeFJqXEBx/y3MKa2w=="],
|
||||
|
||||
"@oxc-parser/binding-freebsd-x64": ["@oxc-parser/binding-freebsd-x64@0.75.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-Qz/iLccz8ecbeH0jterDVZcw9xmbuJn0/Jo+yc3+tqd3Iwirp+UbY/6c7SOkFFciF1dNN4G2FLpmDQSSWFZdjw=="],
|
||||
"@oxc-parser/binding-freebsd-x64": ["@oxc-parser/binding-freebsd-x64@0.70.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-MVUaOMEUVE8q3nsWtEo589h++V5wAdqTbCRa9WY4Yuyxska4xcuJQk/kDNCx+n92saS7Luk+b20O9+VCI03c+A=="],
|
||||
|
||||
"@oxc-parser/binding-linux-arm-gnueabihf": ["@oxc-parser/binding-linux-arm-gnueabihf@0.61.2", "", { "os": "linux", "cpu": "arm" }, "sha512-OppSdOE7BAHfx/hNbsS4tf+CPCEWEXeEB/4tJKcv6qysZKsTD6XXWUzn2F7KR7TFNSzA0hPjnZyezjFgo+xvcQ=="],
|
||||
"@oxc-parser/binding-linux-arm-gnueabihf": ["@oxc-parser/binding-linux-arm-gnueabihf@0.70.0", "", { "os": "linux", "cpu": "arm" }, "sha512-8N4JTYTgKiRHlMUDAdzKs6iEC57a8ex408VgKoLD/Fl+Un79qOti3S9sotdnWSdH/BsDQeO5NW+PKaqFBTw+hA=="],
|
||||
|
||||
"@oxc-parser/binding-linux-arm-musleabihf": ["@oxc-parser/binding-linux-arm-musleabihf@0.75.0", "", { "os": "linux", "cpu": "arm" }, "sha512-solH8uhoWkqHaVLGdBjB6cxbKugqRjxiEdXOQYeNXJo5d5gJxLW6WFhLhRedajwVtxVaKhcNNW4vrwuhU85OXA=="],
|
||||
"@oxc-parser/binding-linux-arm-musleabihf": ["@oxc-parser/binding-linux-arm-musleabihf@0.70.0", "", { "os": "linux", "cpu": "arm" }, "sha512-Bsu+YvtgWuSfSDJTHMF5APZBOtvddR0GiHyrL0yaXDwaYvAL/E7XcoSK2GdmKTpw+J8nk5IlejEXlQliPo52pQ=="],
|
||||
|
||||
"@oxc-parser/binding-linux-arm64-gnu": ["@oxc-parser/binding-linux-arm64-gnu@0.61.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-CqhKWDvVr4rZpi8Evh/K7FKwn9UnPhF0F0ivF+CsFCMOaS5egalmFRRybQk1QuwGq1XjTA3D8puqvlF0p82+ew=="],
|
||||
"@oxc-parser/binding-linux-arm64-gnu": ["@oxc-parser/binding-linux-arm64-gnu@0.70.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-tDzHWKexJPHR+qSiuAFoZ1v8EgCd4ggBNbjJHkcIHsoYKnsKaT1+uE9xfW9UhI1mhv2lo1JJ9n9og2yDTGxSeA=="],
|
||||
|
||||
"@oxc-parser/binding-linux-arm64-musl": ["@oxc-parser/binding-linux-arm64-musl@0.61.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-wLtzWy6EyMf7F83pcJhanolaQ7xnwnVAj2wjdJ52qgX4oQjqZZUo6Rk/LE2iY8Aq/R2Bx2yREFeIC4R1kjtB0A=="],
|
||||
"@oxc-parser/binding-linux-arm64-musl": ["@oxc-parser/binding-linux-arm64-musl@0.70.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-BJ+N25UWmHU624558ojSTnht3uFL00jV1c8qk1hnKf4cl6+ovFcoktRWAWSBlgLEP8tLlu8qgIhz875tMj2PkQ=="],
|
||||
|
||||
"@oxc-parser/binding-linux-riscv64-gnu": ["@oxc-parser/binding-linux-riscv64-gnu@0.75.0", "", { "os": "linux", "cpu": "none" }, "sha512-thRPaGeeKuVFI1fTY+G5zeh5w34eUYszliA/2qpAsb1yWfq+imHgsdloFLi3wW1CiR1mnk6AhKFoj7u3JGVWTA=="],
|
||||
"@oxc-parser/binding-linux-riscv64-gnu": ["@oxc-parser/binding-linux-riscv64-gnu@0.70.0", "", { "os": "linux", "cpu": "none" }, "sha512-nxu22nVuPA2xy1cxvBC0D5mVl0myqStOw3XBkVkDViNL01iPyuEFJd5VsM0GqsgrXvF95H/jrbMd+XWnto924g=="],
|
||||
|
||||
"@oxc-parser/binding-linux-s390x-gnu": ["@oxc-parser/binding-linux-s390x-gnu@0.75.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-ku2ckoJeXXLe6ZiWFXXYALpfmAtoPUzsWOlFf7HssOYbhHEm/RH9yw/GoUNRwZdz1uSi6tYzNvLZ915irffK/w=="],
|
||||
"@oxc-parser/binding-linux-s390x-gnu": ["@oxc-parser/binding-linux-s390x-gnu@0.70.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-AQ6Xj97lYRxHZl94cZIHJxT5M1qkeEi+vQe+e7M2lAtjcURl8cwhZmWKSv4rt4BQRVfO3ys0bY8AgIh4eFJiqw=="],
|
||||
|
||||
"@oxc-parser/binding-linux-x64-gnu": ["@oxc-parser/binding-linux-x64-gnu@0.61.2", "", { "os": "linux", "cpu": "x64" }, "sha512-aJ+g/pDcOeqfB2bVZkUjHlCBL8H7lsgkuYVGKKLYxN/oLjrt2Jf/BVu6fL3NxmSSaFmtHKowDgoRAjiKwxQWEQ=="],
|
||||
"@oxc-parser/binding-linux-x64-gnu": ["@oxc-parser/binding-linux-x64-gnu@0.70.0", "", { "os": "linux", "cpu": "x64" }, "sha512-RIxaVsIxtG90CoX6/Okij8itaMrJp4SEJm1pSL0pz3hGo0yur3Il9M1mmGvOpW+avY8uHdwXIvf2qMnnTKZuoQ=="],
|
||||
|
||||
"@oxc-parser/binding-linux-x64-musl": ["@oxc-parser/binding-linux-x64-musl@0.61.2", "", { "os": "linux", "cpu": "x64" }, "sha512-PosnNyxTqCiMTgva5w695p3ooCcFU8tU+c+JnGgkBgD8pKTbV6fwn8dc4GlcgyyLaM1rD+zi/s+4ooTVML8iIA=="],
|
||||
"@oxc-parser/binding-linux-x64-musl": ["@oxc-parser/binding-linux-x64-musl@0.70.0", "", { "os": "linux", "cpu": "x64" }, "sha512-B3S0G4TlZ+WLdQq4mSQtt2ZW0MAkKWc8dla17tZY86kcXvvCWwACvj7I27Z/nSlb7uJOdRZS9/r6Gw0uAARNVQ=="],
|
||||
|
||||
"@oxc-parser/binding-wasm32-wasi": ["@oxc-parser/binding-wasm32-wasi@0.61.2", "", { "dependencies": { "@napi-rs/wasm-runtime": "^0.2.7" }, "cpu": "none" }, "sha512-zOxdLDItMXeB1GdVCtOOW+aC+Ra6C4E1ivT4rbhaaVe70RsCRa2fGmNC0divvgfQsL2eGBkCuB4d4N9DjfhK4Q=="],
|
||||
"@oxc-parser/binding-wasm32-wasi": ["@oxc-parser/binding-wasm32-wasi@0.70.0", "", { "dependencies": { "@napi-rs/wasm-runtime": "^0.2.9" }, "cpu": "none" }, "sha512-QN8yxH7eHXTqed8Oo7ZUzOWn6hixXa8EVINLy21eLU9isoifSPKMswSmCXHxsM2L5rIIvzoaKfghGOru1mMQbw=="],
|
||||
|
||||
"@oxc-parser/binding-win32-arm64-msvc": ["@oxc-parser/binding-win32-arm64-msvc@0.61.2", "", { "os": "win32", "cpu": "arm64" }, "sha512-E7VMrb4XF748hyzIax2KV7TEfi27SfXoi/BH5guiBicSef/31qwHRdKCh708lmIYmbeEJ9D0wO/25K6dvTl8QQ=="],
|
||||
"@oxc-parser/binding-win32-arm64-msvc": ["@oxc-parser/binding-win32-arm64-msvc@0.70.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-6k8/s78g0GQKqrxk4F0wYj32NBF9oSP6089e6BeuIRQ9l+Zh0cuI6unJeLzXNszxmlqq84xmf/tmP3MSDG43Uw=="],
|
||||
|
||||
"@oxc-parser/binding-win32-x64-msvc": ["@oxc-parser/binding-win32-x64-msvc@0.61.2", "", { "os": "win32", "cpu": "x64" }, "sha512-GtRVVz4DGF94MzlJ7xCIpITu6WKYdTqWc2cqMaJEzYDC8EsHjNkfbGhmawhyodFFuTfWqPAjJecIvvAnfMLpxw=="],
|
||||
"@oxc-parser/binding-win32-x64-msvc": ["@oxc-parser/binding-win32-x64-msvc@0.70.0", "", { "os": "win32", "cpu": "x64" }, "sha512-nd9o1QtEvupaJZ3Wn7PfsuC00n31NNRQZ5+Mui6Q0ZyDzp+obqPUSbSt7xh9Dy0c5zgtYMk8WY4n/VBJY2VvTQ=="],
|
||||
|
||||
"@oxc-parser/wasm": ["@oxc-parser/wasm@0.60.0", "", { "dependencies": { "@oxc-project/types": "^0.60.0" } }, "sha512-Dkf9/D87WGBCW3L0+1DtpAfL4SrNsgeRvxwjpKCtbH7Kf6K+pxrT0IridaJfmWKu1Ml+fDvj+7HEyBcfUC/TXQ=="],
|
||||
|
||||
@ -1388,7 +1388,7 @@
|
||||
|
||||
"graceful-fs": ["graceful-fs@4.2.11", "", {}, "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="],
|
||||
|
||||
"groq-sdk": ["groq-sdk@0.22.0", "", { "dependencies": { "@types/node": "^18.11.18", "@types/node-fetch": "^2.6.4", "abort-controller": "^3.0.0", "agentkeepalive": "^4.2.1", "form-data-encoder": "1.7.2", "formdata-node": "^4.3.2", "node-fetch": "^2.6.7" } }, "sha512-wLkIFlfbi6u9BM8x79wt+yKYqUHoF//od2P5U0MMZRvj/hR+sCZxx1E/ymSGP+M5/fER85MHhPOd/8q3BP4BbQ=="],
|
||||
"groq-sdk": ["groq-sdk@0.25.0", "", { "dependencies": { "@types/node": "^18.11.18", "@types/node-fetch": "^2.6.4", "abort-controller": "^3.0.0", "agentkeepalive": "^4.2.1", "form-data-encoder": "1.7.2", "formdata-node": "^4.3.2", "node-fetch": "^2.6.7" } }, "sha512-IZQb/U0LZQcoF6Amoq8Kh+3seDYdk7278VrAOCz/W4I2nC7PvqEwik3RjRe3bxrOBFvUFHhL/3J+jzVzfjhZUQ=="],
|
||||
|
||||
"gsap": ["gsap@3.13.0", "", {}, "sha512-QL7MJ2WMjm1PHWsoFrAQH/J8wUeqZvMtHO58qdekHpCfhvhSL4gSiz6vJf5EeMP0LOn3ZCprL2ki/gjED8ghVw=="],
|
||||
|
||||
@ -1656,7 +1656,7 @@
|
||||
|
||||
"lru-cache": ["lru-cache@10.4.3", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="],
|
||||
|
||||
"lucide-vue-next": ["lucide-vue-next@0.511.0", "", { "peerDependencies": { "vue": ">=3.0.1" } }, "sha512-VSv0F3pHniGN7JMMzDcLFNMQbl8381+shNnHwV8hi+El7xl2ZL8qdNuzPoiBViKk8mTKK5K3ZDfmE/wEcTZVIQ=="],
|
||||
"lucide-vue-next": ["lucide-vue-next@0.515.0", "", { "peerDependencies": { "vue": ">=3.0.1" } }, "sha512-RqR6xrhay6xtnRPpfNQUYAO8yQjxWkoL7RWIa6im9IUmqGD2nsdUqDP8ZnpS5Ji4QhemSk6vgPJxAsYUbeLICw=="],
|
||||
|
||||
"luxon": ["luxon@3.6.1", "", {}, "sha512-tJLxrKJhO2ukZ5z0gyjY1zPh3Rh88Ej9P7jNrZiHMUXHae1yvI2imgOZtL1TO8TW6biMMKfTtAOoEJANgtWBMQ=="],
|
||||
|
||||
@ -1832,7 +1832,7 @@
|
||||
|
||||
"osenv": ["osenv@0.1.5", "", { "dependencies": { "os-homedir": "^1.0.0", "os-tmpdir": "^1.0.0" } }, "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g=="],
|
||||
|
||||
"oxc-parser": ["oxc-parser@0.61.2", "", { "dependencies": { "@oxc-project/types": "^0.61.2" }, "optionalDependencies": { "@oxc-parser/binding-darwin-arm64": "0.61.2", "@oxc-parser/binding-darwin-x64": "0.61.2", "@oxc-parser/binding-linux-arm-gnueabihf": "0.61.2", "@oxc-parser/binding-linux-arm64-gnu": "0.61.2", "@oxc-parser/binding-linux-arm64-musl": "0.61.2", "@oxc-parser/binding-linux-x64-gnu": "0.61.2", "@oxc-parser/binding-linux-x64-musl": "0.61.2", "@oxc-parser/binding-wasm32-wasi": "0.61.2", "@oxc-parser/binding-win32-arm64-msvc": "0.61.2", "@oxc-parser/binding-win32-x64-msvc": "0.61.2" } }, "sha512-ZJnAP7VLQhqqnfku7+gssTwmbQyfbZ552Vly4O2BMHkvDwfwLlPtAIYjMq57Lcj5HLmopI0oZlk7xTSML/YsZA=="],
|
||||
"oxc-parser": ["oxc-parser@0.70.0", "", { "dependencies": { "@oxc-project/types": "^0.70.0" }, "optionalDependencies": { "@oxc-parser/binding-darwin-arm64": "0.70.0", "@oxc-parser/binding-darwin-x64": "0.70.0", "@oxc-parser/binding-freebsd-x64": "0.70.0", "@oxc-parser/binding-linux-arm-gnueabihf": "0.70.0", "@oxc-parser/binding-linux-arm-musleabihf": "0.70.0", "@oxc-parser/binding-linux-arm64-gnu": "0.70.0", "@oxc-parser/binding-linux-arm64-musl": "0.70.0", "@oxc-parser/binding-linux-riscv64-gnu": "0.70.0", "@oxc-parser/binding-linux-s390x-gnu": "0.70.0", "@oxc-parser/binding-linux-x64-gnu": "0.70.0", "@oxc-parser/binding-linux-x64-musl": "0.70.0", "@oxc-parser/binding-wasm32-wasi": "0.70.0", "@oxc-parser/binding-win32-arm64-msvc": "0.70.0", "@oxc-parser/binding-win32-x64-msvc": "0.70.0" } }, "sha512-YbqTuQDDIYwQF/li0VFK5uTbmHV4jWFeQQONkPdf77vz+JMiq7SusmcSVZ4hBrGM+3WyLdKH5S7spnvz4XVVzQ=="],
|
||||
|
||||
"p-event": ["p-event@6.0.1", "", { "dependencies": { "p-timeout": "^6.1.2" } }, "sha512-Q6Bekk5wpzW5qIyUP4gdMEujObYstZl6DMMOSenwBvV0BlE5LkDwkjs5yHbZmdCEq2o4RJx4tE1vwxFVf2FG1w=="],
|
||||
|
||||
@ -2142,7 +2142,7 @@
|
||||
|
||||
"setprototypeof": ["setprototypeof@1.2.0", "", {}, "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="],
|
||||
|
||||
"shadcn-nuxt": ["shadcn-nuxt@2.1.0", "", { "dependencies": { "@nuxt/kit": "^3.15.4", "@oxc-parser/wasm": "^0.50.0", "typescript": "5.6.3" } }, "sha512-Pm9gYOgyReVaj2SeBAvHCo6lcJ2J+bUFWOlCfa3ml8xJd54uHtige4wdG0kJifutabCIKPu6Y+Ik+l94VR3GXQ=="],
|
||||
"shadcn-nuxt": ["shadcn-nuxt@2.2.0", "", { "dependencies": { "@nuxt/kit": "^3.17.3", "oxc-parser": "^0.72.0" } }, "sha512-0GxzEoTwwsn2K+7rXljhvM7T5+FC8RcBbpvr72L2qwfI9aj/oJgYgUKtC7/onIX8vHrGGziJMfA/xyjibD4J4A=="],
|
||||
|
||||
"shebang-command": ["shebang-command@2.0.0", "", { "dependencies": { "shebang-regex": "^3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="],
|
||||
|
||||
@ -2764,7 +2764,7 @@
|
||||
|
||||
"open/is-docker": ["is-docker@2.2.1", "", { "bin": { "is-docker": "cli.js" } }, "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ=="],
|
||||
|
||||
"oxc-parser/@oxc-project/types": ["@oxc-project/types@0.61.2", "", {}, "sha512-rfuwJwvwn9MRthHNXlSo9Eka/u7gC0MhnWAoX3BhE1+rwPOl22nq0K0Y997Hof0tHCOuD7H3/Z8HTfCVhB4c5Q=="],
|
||||
"oxc-parser/@oxc-project/types": ["@oxc-project/types@0.70.0", "", {}, "sha512-ngyLUpUjO3dpqygSRQDx7nMx8+BmXbWOU4oIwTJFV2MVIDG7knIZwgdwXlQWLg3C3oxg1lS7ppMtPKqKFb7wzw=="],
|
||||
|
||||
"parse5/entities": ["entities@6.0.1", "", {}, "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g=="],
|
||||
|
||||
@ -2814,9 +2814,7 @@
|
||||
|
||||
"serve-static/encodeurl": ["encodeurl@2.0.0", "", {}, "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg=="],
|
||||
|
||||
"shadcn-nuxt/@oxc-parser/wasm": ["@oxc-parser/wasm@0.50.0", "", { "dependencies": { "@oxc-project/types": "^0.50.0" } }, "sha512-be/QsKqtXQbKhnIRzezPrV385L6EVaX1GNAGeaQaT+HX6Lny/SfmFetCrEZCRqn2/cAqo+P5rGDNJzv06dY/vw=="],
|
||||
|
||||
"shadcn-nuxt/typescript": ["typescript@5.6.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw=="],
|
||||
"shadcn-nuxt/oxc-parser": ["oxc-parser@0.72.3", "", { "dependencies": { "@oxc-project/types": "^0.72.3" }, "optionalDependencies": { "@oxc-parser/binding-darwin-arm64": "0.72.3", "@oxc-parser/binding-darwin-x64": "0.72.3", "@oxc-parser/binding-freebsd-x64": "0.72.3", "@oxc-parser/binding-linux-arm-gnueabihf": "0.72.3", "@oxc-parser/binding-linux-arm-musleabihf": "0.72.3", "@oxc-parser/binding-linux-arm64-gnu": "0.72.3", "@oxc-parser/binding-linux-arm64-musl": "0.72.3", "@oxc-parser/binding-linux-riscv64-gnu": "0.72.3", "@oxc-parser/binding-linux-s390x-gnu": "0.72.3", "@oxc-parser/binding-linux-x64-gnu": "0.72.3", "@oxc-parser/binding-linux-x64-musl": "0.72.3", "@oxc-parser/binding-wasm32-wasi": "0.72.3", "@oxc-parser/binding-win32-arm64-msvc": "0.72.3", "@oxc-parser/binding-win32-x64-msvc": "0.72.3" } }, "sha512-JYQeJKDcUTTZ/uTdJ+fZBGFjAjkLD1h0p3Tf44ZYXRcoMk+57d81paNPFAAwzrzzqhZmkGvKKXDxwyhJXYZlpg=="],
|
||||
|
||||
"source-map-support/source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="],
|
||||
|
||||
@ -3018,12 +3016,20 @@
|
||||
|
||||
"nuxt/oxc-parser/@oxc-parser/binding-darwin-x64": ["@oxc-parser/binding-darwin-x64@0.75.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-jXOYe/K7YLE8xN2dDBcaZ78dxfXWXtPMZBOzg2j0YignThagLX4KgDCqEVlMbQY4MymzpqrY0TzSXjCI9MCfvA=="],
|
||||
|
||||
"nuxt/oxc-parser/@oxc-parser/binding-freebsd-x64": ["@oxc-parser/binding-freebsd-x64@0.75.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-Qz/iLccz8ecbeH0jterDVZcw9xmbuJn0/Jo+yc3+tqd3Iwirp+UbY/6c7SOkFFciF1dNN4G2FLpmDQSSWFZdjw=="],
|
||||
|
||||
"nuxt/oxc-parser/@oxc-parser/binding-linux-arm-gnueabihf": ["@oxc-parser/binding-linux-arm-gnueabihf@0.75.0", "", { "os": "linux", "cpu": "arm" }, "sha512-OQomvh7PfJjzKSfG0lNcTru+QYXYzETrU4YZsWBWcJyV4pKJ6ZoRn4BOlY9QVH3F8htN890/agTQfNtEAzp23g=="],
|
||||
|
||||
"nuxt/oxc-parser/@oxc-parser/binding-linux-arm-musleabihf": ["@oxc-parser/binding-linux-arm-musleabihf@0.75.0", "", { "os": "linux", "cpu": "arm" }, "sha512-solH8uhoWkqHaVLGdBjB6cxbKugqRjxiEdXOQYeNXJo5d5gJxLW6WFhLhRedajwVtxVaKhcNNW4vrwuhU85OXA=="],
|
||||
|
||||
"nuxt/oxc-parser/@oxc-parser/binding-linux-arm64-gnu": ["@oxc-parser/binding-linux-arm64-gnu@0.75.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-CrYqeI5/TY8x/G/KvprDaxB9V6Wpudby1sXVpncz4Azzoyg+mIRGgWOl+ZbX/O9uwpCrFr0TPf2JY7cl3baLAA=="],
|
||||
|
||||
"nuxt/oxc-parser/@oxc-parser/binding-linux-arm64-musl": ["@oxc-parser/binding-linux-arm64-musl@0.75.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-dQK0rLN6ha5cGahgA4j7zqLH6rtDd5TdNApBo5JFannCLzpr9TQ1QUecYggx70+vLrmm/PMKCMnwR0uuvLbq8g=="],
|
||||
|
||||
"nuxt/oxc-parser/@oxc-parser/binding-linux-riscv64-gnu": ["@oxc-parser/binding-linux-riscv64-gnu@0.75.0", "", { "os": "linux", "cpu": "none" }, "sha512-thRPaGeeKuVFI1fTY+G5zeh5w34eUYszliA/2qpAsb1yWfq+imHgsdloFLi3wW1CiR1mnk6AhKFoj7u3JGVWTA=="],
|
||||
|
||||
"nuxt/oxc-parser/@oxc-parser/binding-linux-s390x-gnu": ["@oxc-parser/binding-linux-s390x-gnu@0.75.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-ku2ckoJeXXLe6ZiWFXXYALpfmAtoPUzsWOlFf7HssOYbhHEm/RH9yw/GoUNRwZdz1uSi6tYzNvLZ915irffK/w=="],
|
||||
|
||||
"nuxt/oxc-parser/@oxc-parser/binding-linux-x64-gnu": ["@oxc-parser/binding-linux-x64-gnu@0.75.0", "", { "os": "linux", "cpu": "x64" }, "sha512-223VDGrX7cnmhSSRimnL+/eOCp/ABU4Iobfnelz5zbQKRpijQQjk8Ohx2kb7aZ5Q0dY09fDSUNjY/iOBBFaRIg=="],
|
||||
|
||||
"nuxt/oxc-parser/@oxc-parser/binding-linux-x64-musl": ["@oxc-parser/binding-linux-x64-musl@0.75.0", "", { "os": "linux", "cpu": "x64" }, "sha512-WVdpo3EA53PTZt3p2fdmPgoF9jIichRcpd2GmuZV58P3wlFWq9iKefdD4M87mskzdxwGUiMQlPiktNcsZZWMkQ=="],
|
||||
@ -3060,7 +3066,35 @@
|
||||
|
||||
"send/mime-types/mime-db": ["mime-db@1.54.0", "", {}, "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ=="],
|
||||
|
||||
"shadcn-nuxt/@oxc-parser/wasm/@oxc-project/types": ["@oxc-project/types@0.50.0", "", {}, "sha512-VGV87PmDCGv1D+57iEmIuDoso3ig8d8D4VIK9AS0H7h2aNiRwFoCpVyp01+3jvIuHjPcEM2wbo3NG5EKyfx6Jw=="],
|
||||
"shadcn-nuxt/oxc-parser/@oxc-parser/binding-darwin-arm64": ["@oxc-parser/binding-darwin-arm64@0.72.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-g6wgcfL7At4wHNHutl0NmPZTAju+cUSmSX5WGUMyTJmozRzhx8E9a2KL4rTqNJPwEpbCFrgC29qX9f4fpDnUpA=="],
|
||||
|
||||
"shadcn-nuxt/oxc-parser/@oxc-parser/binding-darwin-x64": ["@oxc-parser/binding-darwin-x64@0.72.3", "", { "os": "darwin", "cpu": "x64" }, "sha512-pc+tplB2fd0AqdnXY90FguqSF2OwbxXwrMOLAMmsUiK4/ytr8Z/ftd49+d27GgvQJKeg2LfnIbskaQtY/j2tAA=="],
|
||||
|
||||
"shadcn-nuxt/oxc-parser/@oxc-parser/binding-freebsd-x64": ["@oxc-parser/binding-freebsd-x64@0.72.3", "", { "os": "freebsd", "cpu": "x64" }, "sha512-igBR6rOvL8t5SBm1f1rjtWNsjB53HNrM3au582JpYzWxOqCjeA5Jlm9KZbjQJC+J8SPB9xyljM7G+6yGZ2UAkQ=="],
|
||||
|
||||
"shadcn-nuxt/oxc-parser/@oxc-parser/binding-linux-arm-gnueabihf": ["@oxc-parser/binding-linux-arm-gnueabihf@0.72.3", "", { "os": "linux", "cpu": "arm" }, "sha512-/izdr3wg7bK+2RmNhZXC2fQwxbaTH3ELeqdR+Wg4FiEJ/C7ZBIjfB0E734bZGgbDu+rbEJTBlbG77XzY0wRX/Q=="],
|
||||
|
||||
"shadcn-nuxt/oxc-parser/@oxc-parser/binding-linux-arm-musleabihf": ["@oxc-parser/binding-linux-arm-musleabihf@0.72.3", "", { "os": "linux", "cpu": "arm" }, "sha512-Vz7C+qJb22HIFl3zXMlwvlTOR+MaIp5ps78060zsdeZh2PUGlYuUYkYXtGEjJV3kc8aKFj79XKqAY1EPG2NWQA=="],
|
||||
|
||||
"shadcn-nuxt/oxc-parser/@oxc-parser/binding-linux-arm64-gnu": ["@oxc-parser/binding-linux-arm64-gnu@0.72.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-nomoMe2VpVxW767jhF+G3mDGmE0U6nvvi5nw9Edqd/5DIylQfq/lEGUWL7qITk+E72YXBsnwHtpRRlIAJOMyZg=="],
|
||||
|
||||
"shadcn-nuxt/oxc-parser/@oxc-parser/binding-linux-arm64-musl": ["@oxc-parser/binding-linux-arm64-musl@0.72.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-4DswiIK5dI7hFqcMKWtZ7IZnWkRuskh6poI1ad4gkY2p678NOGtl6uOGCCRlDmLOOhp3R27u4VCTzQ6zra977w=="],
|
||||
|
||||
"shadcn-nuxt/oxc-parser/@oxc-parser/binding-linux-riscv64-gnu": ["@oxc-parser/binding-linux-riscv64-gnu@0.72.3", "", { "os": "linux", "cpu": "none" }, "sha512-R9GEiA4WFPGU/3RxAhEd6SaMdpqongGTvGEyTvYCS/MAQyXKxX/LFvc2xwjdvESpjIemmc/12aTTq6if28vHkQ=="],
|
||||
|
||||
"shadcn-nuxt/oxc-parser/@oxc-parser/binding-linux-s390x-gnu": ["@oxc-parser/binding-linux-s390x-gnu@0.72.3", "", { "os": "linux", "cpu": "s390x" }, "sha512-/sEYJQMVqikZO8gK9VDPT4zXo9du3gvvu8jp6erMmW5ev+14PErWRypJjktp0qoTj+uq4MzXro0tg7U+t5hP1w=="],
|
||||
|
||||
"shadcn-nuxt/oxc-parser/@oxc-parser/binding-linux-x64-gnu": ["@oxc-parser/binding-linux-x64-gnu@0.72.3", "", { "os": "linux", "cpu": "x64" }, "sha512-hlyljEZ0sMPKJQCd5pxnRh2sAf/w+Ot2iJecgV9Hl3brrYrYCK2kofC0DFaJM3NRmG/8ZB3PlxnSRSKZTocwCw=="],
|
||||
|
||||
"shadcn-nuxt/oxc-parser/@oxc-parser/binding-linux-x64-musl": ["@oxc-parser/binding-linux-x64-musl@0.72.3", "", { "os": "linux", "cpu": "x64" }, "sha512-T17S8ORqAIq+YDFMvLfbNdAiYHYDM1+sLMNhesR5eWBtyTHX510/NbgEvcNemO9N6BNR7m4A9o+q468UG+dmbg=="],
|
||||
|
||||
"shadcn-nuxt/oxc-parser/@oxc-parser/binding-wasm32-wasi": ["@oxc-parser/binding-wasm32-wasi@0.72.3", "", { "dependencies": { "@napi-rs/wasm-runtime": "^0.2.10" }, "cpu": "none" }, "sha512-x0Ojn/jyRUk6MllvVB/puSvI2tczZBIYweKVYHNv1nBatjPRiqo+6/uXiKrZwSfGLkGARrKkTuHSa5RdZBMOdA=="],
|
||||
|
||||
"shadcn-nuxt/oxc-parser/@oxc-parser/binding-win32-arm64-msvc": ["@oxc-parser/binding-win32-arm64-msvc@0.72.3", "", { "os": "win32", "cpu": "arm64" }, "sha512-kRVAl87ugRjLZTm9vGUyiXU50mqxLPHY81rgnZUP1HtNcqcmTQtM/wUKQL2UdqvhA6xm6zciqzqCgJfU+RW8uA=="],
|
||||
|
||||
"shadcn-nuxt/oxc-parser/@oxc-parser/binding-win32-x64-msvc": ["@oxc-parser/binding-win32-x64-msvc@0.72.3", "", { "os": "win32", "cpu": "x64" }, "sha512-vpVdoGAP5iGE5tIEPJgr7FkQJZA+sKjMkg5x1jarWJ1nnBamfGsfYiZum4QjCfW7jb+pl42rHVSS3lRmMPcyrQ=="],
|
||||
|
||||
"shadcn-nuxt/oxc-parser/@oxc-project/types": ["@oxc-project/types@0.72.3", "", {}, "sha512-CfAC4wrmMkUoISpQkFAIfMVvlPfQV3xg7ZlcqPXPOIMQhdKIId44G8W0mCPgtpWdFFAyJ+SFtiM+9vbyCkoVng=="],
|
||||
|
||||
"string-width-cjs/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
|
||||
|
||||
|
@ -1,224 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
History,
|
||||
Plus,
|
||||
Send,
|
||||
Square,
|
||||
User,
|
||||
BotMessageSquare,
|
||||
} from "lucide-vue-next";
|
||||
import { Input } from "~/components/ui/input";
|
||||
import blurPageBeforeLogin from "~/components/blurPageBeforeLogin.vue";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
const { t } = useI18n();
|
||||
const cookie = useCookie("lastChatId");
|
||||
const cookieChatId = cookie.value;
|
||||
const chatId = ref();
|
||||
const inputMessage = ref();
|
||||
const messageIndex = ref();
|
||||
const aiGenerating = ref(false);
|
||||
const messages = ref<any[]>([]);
|
||||
const newsId = ref("");
|
||||
const isStreaming = ref(false);
|
||||
const streamingMessage = ref("");
|
||||
const messagesContainer = ref(null);
|
||||
|
||||
// Great, there are now no errors ig
|
||||
const emit = defineEmits(["windowopener", "error", "loadValue"]);
|
||||
const props = defineProps<{
|
||||
values?: string;
|
||||
}>();
|
||||
|
||||
const sendChatData = async (event?: KeyboardEvent) => {
|
||||
if (event?.shiftKey) return;
|
||||
if (inputMessage.value === "") return;
|
||||
const userMessage = inputMessage.value;
|
||||
inputMessage.value = "";
|
||||
aiGenerating.value = true;
|
||||
await sendMessage(userMessage);
|
||||
};
|
||||
|
||||
const stopChatGenerate = () => {
|
||||
aiGenerating.value = false;
|
||||
};
|
||||
|
||||
const chatUuid = ref("");
|
||||
|
||||
onMounted(() => {
|
||||
chatUuid.value = uuidv4();
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
/*const {
|
||||
data: getData,
|
||||
pending,
|
||||
error,
|
||||
} = useFetch(`/api/ai/chat/${chatId.value}`);*/
|
||||
});
|
||||
|
||||
const sendMessage = async (newMessage: any) => {
|
||||
if (!newMessage.trim() || !newsId.value.trim() || isStreaming.value) {
|
||||
return;
|
||||
}
|
||||
messages.value.push({
|
||||
index: messageIndex.value,
|
||||
id: uuidv4(),
|
||||
message: newMessage,
|
||||
user: true,
|
||||
timestamp: new Date(),
|
||||
});
|
||||
messageIndex.value += 1;
|
||||
|
||||
try {
|
||||
isStreaming.value = true;
|
||||
streamingMessage.value = "";
|
||||
|
||||
const response = await fetch(`/api/ai/chat/${chatUuid.value}`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
message: newMessage,
|
||||
newsid: newsId.value,
|
||||
}),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
|
||||
const reader = response.body?.getReader();
|
||||
const decoder = new TextDecoder();
|
||||
|
||||
if (reader) {
|
||||
while (true) {
|
||||
const { done, value } = await reader.read();
|
||||
|
||||
if (done) break;
|
||||
|
||||
const chunk = decoder.decode(value, { stream: true });
|
||||
streamingMessage.value += chunk;
|
||||
await scrollToBottom();
|
||||
}
|
||||
}
|
||||
|
||||
// Add the complete assistant message
|
||||
if (streamingMessage.value) {
|
||||
messages.value.push({
|
||||
role: "assistant",
|
||||
content: streamingMessage.value,
|
||||
timestamp: new Date(),
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error sending message:", error);
|
||||
messages.value.push({
|
||||
role: "assistant",
|
||||
content: "Sorry, there was an error processing your message.",
|
||||
timestamp: new Date(),
|
||||
});
|
||||
} finally {
|
||||
isStreaming.value = false;
|
||||
streamingMessage.value = "";
|
||||
await scrollToBottom();
|
||||
}
|
||||
};
|
||||
|
||||
const formatMessage = (content: any) => {
|
||||
// Simple markdown-like formatting
|
||||
return content
|
||||
.replace(/\*\*(.*?)\*\*/g, "<strong>$1</strong>")
|
||||
.replace(/\*(.*?)\*/g, "<em>$1</em>")
|
||||
.replace(/\n/g, "<br>");
|
||||
};
|
||||
const formatTime = (timestamp: any) => {
|
||||
return new Intl.DateTimeFormat("zh-TW", {
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
}).format(timestamp);
|
||||
};
|
||||
const scrollToBottom = () => {};
|
||||
</script>
|
||||
<template>
|
||||
<blurPageBeforeLogin>
|
||||
<div class="flex flex-col h-[100%] w-full">
|
||||
<div>
|
||||
<div
|
||||
class="justify-center align-center text-center flex flex-col sticky top-0 pt-2 min-h-0 border rounded-2xl gray-500/80 backdrop-blur-sm"
|
||||
>
|
||||
<div class="flex flex-row justify-between p-2">
|
||||
<h2 class="text-xl ml-4 text-bold">Chat Name</h2>
|
||||
<div class="flex flex-row justify-center align-center text-center">
|
||||
<div
|
||||
class="flex flex-row justify-center align-center text-center gap-2"
|
||||
>
|
||||
<button
|
||||
class="p-2 rounded-xl hover:bg-gray-300 transition-all duration-400"
|
||||
>
|
||||
<History class="h-4 w-4" />
|
||||
</button>
|
||||
<button
|
||||
class="p-2 rounded-xl hover:bg-gray-300 transition-all duration-400"
|
||||
>
|
||||
<Plus class="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
ref="chatContainerRef"
|
||||
class="flex-1 overflow-y-auto p-4 space-y-4"
|
||||
>
|
||||
<div
|
||||
v-for="message in messages"
|
||||
class="max-w-[80%] p-3 bg-gray-300/70 rounded-xl"
|
||||
>
|
||||
<div v-if="message.user" class="flex flex-row gap-2">
|
||||
<User class="w-5 h-5" />{{ message.message }}
|
||||
</div>
|
||||
<div v-else class="flex flex-row gap-2">
|
||||
<BotMessageSquare class="w-5 h-5" />{{ message.message }}
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="isStreaming" class="">
|
||||
<div></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="h-[75px]"></div>
|
||||
<div
|
||||
class="space-x-2 absolute bottom-2 inset-x-4 border-t p-2 min-h-0 border rounded-xl gray-500/80 backdrop-blur-sm"
|
||||
>
|
||||
<div class="text-black w-full flex flex-row">
|
||||
<Input
|
||||
class="flex-1 rounded-xl"
|
||||
placeholder="Type a message..."
|
||||
v-model="inputMessage"
|
||||
@keyup.enter="sendChatData($event)"
|
||||
:disabled="aiGenerating"
|
||||
/>
|
||||
<button
|
||||
class="pl-2 pr-2 mr-1 ml-1 bg-black text-white rounded-full hover:bg-gray-700 hover:translate-y-[-4px] transition-all duration-300 disabled:cursor-not-allowed disabled:hover:translate-y-0 disabled:bg-color-500"
|
||||
:disabled="!inputMessage?.trim()"
|
||||
@click="sendChatData()"
|
||||
v-if="!aiGenerating"
|
||||
>
|
||||
<Send class="w-5 h-5" />
|
||||
</button>
|
||||
<button
|
||||
class="pl-2 pr-2 mr-1 ml-1 bg-black text-white rounded-full hover:bg-gray-700 hover:translate-y-[-4px] transition-all duration-300 disabled:cursor-not-allowed disabled:hover:translate-y-0 disabled:bg-color-500"
|
||||
@click="stopChatGenerate"
|
||||
v-else
|
||||
>
|
||||
<Square class="w-5 h-5" />
|
||||
</button>
|
||||
</div>
|
||||
<span class="text-xs text-center justify-center align-center w-full"
|
||||
>Note: AI might create imbalanced views.</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</blurPageBeforeLogin>
|
||||
</template>
|
@ -53,7 +53,7 @@ const contentArray = ref([]);
|
||||
const errorr = ref(false);
|
||||
const switchTabs = ref(false);
|
||||
const tabs = ref([]);
|
||||
const primary = ref<string>("domestic"); // Hard code default value as top is just pure garbage.
|
||||
const primary = ref<string>("top"); // This will be later overwritten, so values set here will be useless.
|
||||
const canNotLoadTabUI = ref(false);
|
||||
const isDataCached = ref(false);
|
||||
const pullTabsData = async () => {
|
||||
|
@ -117,7 +117,7 @@ const starArticle = async () => {
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
const req = await fetch(`/user/${slug}/star`);
|
||||
const req = await fetch(`/api/user/${slug}/star`);
|
||||
const res = await req.json();
|
||||
staredStatus.value = res;
|
||||
});
|
||||
@ -164,7 +164,7 @@ onMounted(async () => {
|
||||
class="justify-center align-center text-center flex flex-col md:flex-row flex-wrap"
|
||||
>
|
||||
<div class="flex flex-col">
|
||||
<div class="group">
|
||||
<div class="group translate-y-12">
|
||||
<h2 class="text-3xl text-bold">
|
||||
{{
|
||||
displayTranslatedText
|
||||
@ -212,16 +212,6 @@ onMounted(async () => {
|
||||
<div v-else>{{ summaryText }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--<div class="flex flex-col bg-gray-500">
|
||||
<!--Similar articles-->
|
||||
<!--<div class="flex flex-row" v-for="item in likeart">
|
||||
<img /><!--Image-->
|
||||
<!--<div class="flex flex-col">
|
||||
<h2>title</h2>
|
||||
<span>description</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
<button
|
||||
@click="starArticle"
|
||||
:class="[
|
||||
|
@ -1,9 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
<template>
|
||||
<div class="justify-center align-center text-center">
|
||||
<h1 class="text-2xl text-bold">{{ t("pages.privacypolicy.title") }}</h1>
|
||||
<p>{{ t("pages.privacypolicy.content") }}</p>
|
||||
</div>
|
||||
</template>
|
@ -380,23 +380,6 @@ const submitUserPassword = async () => {
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div
|
||||
class="flex flex-row gap-2 m-1 p-2 justify-center align-center text-center"
|
||||
>
|
||||
<button
|
||||
class="bg-sky-400 p-1 rounded hover:bg-sky-600 transition-all duration-200 w-32"
|
||||
@click="() => emit('windowopener', 'privacypolicy')"
|
||||
>
|
||||
Privacy Policy
|
||||
</button>
|
||||
<button
|
||||
class="bg-sky-400 p-1 rounded hover:bg-sky-600 transition-all duration-200 w-32"
|
||||
@click="() => emit('windowopener', 'tos')"
|
||||
>
|
||||
TOS
|
||||
</button>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="justiy-center align-center text-center">
|
||||
{{ t("app.settings") }} v0.0.3 || Version: {{ getVersionTag() }}
|
||||
</div>
|
||||
|
@ -1,9 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
<template>
|
||||
<div class="justify-center align-center text-center">
|
||||
<h1 class="text-2xl text-bold">{{ t("pages.tos.title") }}</h1>
|
||||
<p>{{ t("pages.tos.content") }}</p>
|
||||
</div>
|
||||
</template>
|
@ -1,78 +0,0 @@
|
||||
<script setup lamng="ts">
|
||||
// Great, there are now no errors ig
|
||||
const emit = defineEmits(["windowopener", "error", "loadValue"]);
|
||||
import sha512 from "crypto-js/sha512";
|
||||
import Input from "~/components/ui/input/Input.vue";
|
||||
const userAccount = ref("");
|
||||
const userPassword = ref("");
|
||||
const error = ref(false);
|
||||
const errormsg = ref("");
|
||||
const success = ref(false);
|
||||
const submitUserPassword = async () => {
|
||||
error.value = false;
|
||||
errormsg.value = "";
|
||||
// Encrypt password during transit
|
||||
const password = sha512(userPassword.value).toString();
|
||||
|
||||
// Send data.
|
||||
const sendData = await fetch("/api/user/login", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
username: userAccount.value,
|
||||
password: password,
|
||||
}),
|
||||
});
|
||||
const res = await sendData.json();
|
||||
|
||||
if (!res.error) {
|
||||
error.value = false;
|
||||
success.value = true;
|
||||
console.log(res);
|
||||
userAccount.value = "";
|
||||
} else {
|
||||
error.value = true;
|
||||
errormsg.value = res.error;
|
||||
}
|
||||
userPassword.value = "";
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<div class="">
|
||||
<form
|
||||
class="flex flex-col items-center justify-center h-full"
|
||||
@submit.prevent="submitUserPassword"
|
||||
v-if="!success"
|
||||
>
|
||||
<span class="text-2xl text-bold mb-0">Login / Register</span>
|
||||
<span class="mb-4 text-sm mt-0"
|
||||
>We will create a account for you if you don't have one.</span
|
||||
>
|
||||
<div class="">
|
||||
<Input
|
||||
type="text"
|
||||
placeholder="Username"
|
||||
class="mb-2 p-2 border rounded"
|
||||
v-model="userAccount"
|
||||
required
|
||||
/>
|
||||
<Input
|
||||
type="password"
|
||||
placeholder="Password"
|
||||
class="p-2 border rounded mb-2"
|
||||
v-model="userPassword"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<span v-if="error" class="text-red-600 text-xs m-2"
|
||||
>Error: {{ errormsg }}</span
|
||||
>
|
||||
<button class="bg-black text-white p-2 rounded transition duration-200">
|
||||
Log In
|
||||
</button>
|
||||
</form>
|
||||
<div v-else>Hi! ${user}</div>
|
||||
</div>
|
||||
</template>
|
@ -45,11 +45,11 @@
|
||||
"apis": "APIs"
|
||||
},
|
||||
"description": {
|
||||
"find": "You can easily find the same topic from different news sources.",
|
||||
"interface": "Use a desktop like interface, the one that you already got used to.",
|
||||
"documentation": "We provide a documentation for you to learn how to use the app.",
|
||||
"opensource": "This platform is open source! minus the database part, but I'm going to try!",
|
||||
"apis": "We use api's that are made via reverse engineering."
|
||||
"find": "You can find the same topic from different news sources.",
|
||||
"interface": "This platform uses a desktop like interface, the one that you already got used to.",
|
||||
"documentation": "We provide a video for you to learn how to use the basics of the application.",
|
||||
"opensource": "This platform is open source!",
|
||||
"apis": "We use api's that are made via reverse engineering, here https://github.com/hpware/reverse_engineering"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -116,16 +116,6 @@
|
||||
"noadlinetoday": "Provides free, no ads Line today."
|
||||
}
|
||||
},
|
||||
"pages": {
|
||||
"privacypolicy": {
|
||||
"title": "Privacy Policy",
|
||||
"content": "Ummmm"
|
||||
},
|
||||
"tos": {
|
||||
"title": "Terms of service",
|
||||
"content": "N/A"
|
||||
}
|
||||
},
|
||||
"about": {
|
||||
"why": "Why make this website?",
|
||||
"bulletpoints": {
|
||||
|
@ -48,7 +48,7 @@
|
||||
"find": "你可以輕鬆地從不同的新聞來源找到相同的主題。",
|
||||
"interface": "這個網站使用類似 Xfce / MacOS / DSM 的介面,讓你可以簡單使用這個網站。",
|
||||
"documentation": "我做了一組教學,讓你可以學會如何使用這個網站 UI。",
|
||||
"opensource": "這個平台的所有程式碼都放在Github上,沒有開源的資料庫,我會想辦法把它用其他方式開源!",
|
||||
"opensource": "這個平台的所有程式碼都放在Github上!",
|
||||
"apis": "我們使用LINE Today 的資訊來做出一個 API。"
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ export default defineNuxtConfig({
|
||||
routeRules: {
|
||||
"/": { redirect: "/home" },
|
||||
"/zh_tw": { redirect: "/zh_tw/home" },
|
||||
"/desktop": { prerender: true },
|
||||
"/desktop": { prerender: true, ssr: false },
|
||||
"/go/**": { ssr: true },
|
||||
"/find/**": { ssr: true },
|
||||
// Send ZIP bombs to troll bots
|
||||
|
@ -1,4 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
"use client";
|
||||
// No layout
|
||||
definePageMeta({
|
||||
layout: false,
|
||||
@ -51,18 +52,14 @@ import translate from "translate";
|
||||
import checkAppVersion from "~/components/checkAppVersion";
|
||||
|
||||
// Import Windows
|
||||
import UserWindow from "~/components/app/windows/user.vue";
|
||||
import SourcesWindow from "~/components/app/windows/sources.vue";
|
||||
import AboutWindow from "~/components/app/windows/about.vue";
|
||||
import ChatbotWindow from "~/components/app/windows/chatbot.vue";
|
||||
import AboutNewsOrgWindow from "~/components/app/windows/aboutNewsOrg.vue";
|
||||
import TTYWindow from "~/components/app/windows/tty.vue";
|
||||
import FavStaredWindow from "~/components/app/windows/fav.vue";
|
||||
import NewsWindow from "~/components/app/windows/news.vue";
|
||||
import NewsViewWindow from "~/components/app/windows/newsView.vue";
|
||||
import SettingsWindow from "~/components/app/windows/settings.vue";
|
||||
import PrivacyPolicyWindow from "~/components/app/windows/privacypolicy.vue";
|
||||
import TOSWindow from "~/components/app/windows/tos.vue";
|
||||
import onBoardingWindow from "~/components/app/windows/onBoarding.vue";
|
||||
|
||||
// Import Icons
|
||||
@ -83,14 +80,12 @@ const route = useRoute();
|
||||
// values
|
||||
const popMessage = ref(null);
|
||||
const menuOpen = ref(false);
|
||||
2;
|
||||
const currentNavBar = ref<currentNavBarInterface[]>([]);
|
||||
const bootingAnimation = ref(true);
|
||||
const activeWindows = ref<associAppWindowInterface[]>([]);
|
||||
const hiddenWindows = ref<minAppWindowInterface[]>([]);
|
||||
const openApp = ref();
|
||||
const openAppId = ref();
|
||||
const openAppNameQuery = ref();
|
||||
const currentOpenAppId = ref(0);
|
||||
const progress = ref(0);
|
||||
const titleAppName = ref("Desktop");
|
||||
@ -101,7 +96,6 @@ const changeLangAnimation = ref(false);
|
||||
const applyForTranslation = ref(false);
|
||||
const langPrefDifferent = ref(false);
|
||||
const notLoggedInState = ref(false);
|
||||
const translateProvider = ref("");
|
||||
const newUpdate = ref(false);
|
||||
|
||||
// Key Data
|
||||
@ -109,7 +103,6 @@ const menuItems = [
|
||||
{ name: t("app.news"), windowName: "news" },
|
||||
{ name: t("app.sources"), windowName: "sources" },
|
||||
{ name: t("app.starred"), windowName: "starred" },
|
||||
{ name: t("app.chatbot"), windowName: "chatbot" },
|
||||
{ name: t("app.about"), windowName: "about" },
|
||||
{ name: t("app.terminal"), windowName: "tty" },
|
||||
{ name: t("app.settings"), windowName: "settings" },
|
||||
@ -117,13 +110,6 @@ const menuItems = [
|
||||
];
|
||||
|
||||
const associAppWindow = [
|
||||
{
|
||||
name: "login",
|
||||
id: "2",
|
||||
title: t("app.login"),
|
||||
component: UserWindow,
|
||||
translatable: false,
|
||||
},
|
||||
{
|
||||
name: "sources",
|
||||
id: "3",
|
||||
@ -163,15 +149,6 @@ const associAppWindow = [
|
||||
component: FavStaredWindow,
|
||||
translatable: true,
|
||||
},
|
||||
{
|
||||
name: "chatbot",
|
||||
id: "8",
|
||||
title: t("app.chatbot"),
|
||||
component: ChatbotWindow,
|
||||
width: "400px",
|
||||
height: "600px",
|
||||
translatable: false,
|
||||
},
|
||||
{
|
||||
name: "aboutNewsOrg",
|
||||
id: "9",
|
||||
@ -194,20 +171,6 @@ const associAppWindow = [
|
||||
component: NewsViewWindow,
|
||||
translatable: true,
|
||||
},
|
||||
{
|
||||
name: "privacypolicy",
|
||||
id: "12",
|
||||
title: t("app.privacypolicy"),
|
||||
component: PrivacyPolicyWindow,
|
||||
translatable: false,
|
||||
},
|
||||
{
|
||||
name: "tos",
|
||||
id: "13",
|
||||
title: t("app.tos"),
|
||||
component: TOSWindow,
|
||||
translatable: false,
|
||||
},
|
||||
{
|
||||
name: "onboard",
|
||||
id: "14",
|
||||
@ -751,7 +714,10 @@ setInterval(async () => {
|
||||
>
|
||||
{{ t("popup.stay") }}
|
||||
</Button>
|
||||
<Button @click="() => switchLocalePath()" variant="outline">
|
||||
<Button
|
||||
@click="() => switchLocalePath(`${locale !== 'en' ? 'en' : 'zh_tw'}`)"
|
||||
variant="outline"
|
||||
>
|
||||
{{ t("popup.change") }}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
@ -822,7 +788,8 @@ setInterval(async () => {
|
||||
</DraggableWindow>
|
||||
</div>
|
||||
</Transition>
|
||||
<div v-if="confetiActive">
|
||||
<!--TODO: ADD CONFETI-->
|
||||
<!-- <div v-if="confetiActive">
|
||||
<div v-ref="successcanvas"></div>
|
||||
</div>
|
||||
</div>-->
|
||||
</template>
|
||||
|
@ -1,95 +0,0 @@
|
||||
import { Groq } from "groq-sdk";
|
||||
import sql from "~/server/components/postgres";
|
||||
|
||||
const groq = new Groq();
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const host = getRequestHost(event);
|
||||
const protocol = getRequestProtocol(event);
|
||||
const hears = getRequestHeaders(event);
|
||||
const slug = getRouterParam(event, "slug");
|
||||
const body = await readBody(event);
|
||||
if (!slug) {
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
message: "A UUID is required for this action.",
|
||||
});
|
||||
}
|
||||
|
||||
const getChatHistory = await sql`
|
||||
select * from chat_history
|
||||
where uuid = ${slug}
|
||||
order by created_at asc
|
||||
`;
|
||||
|
||||
const buildURL = protocol + "://" + host + "/api/news/get/lt/" + "LX30VwG";
|
||||
const data = await fetch(buildURL);
|
||||
const fetchNewsArticle = await data.json();
|
||||
|
||||
// Set headers for Server-Sent Events
|
||||
setHeader(event, "Content-Type", "text/plain; charset=utf-8");
|
||||
setHeader(event, "Cache-Control", "no-cache");
|
||||
setHeader(event, "Connection", "keep-alive");
|
||||
setHeader(event, "Access-Control-Allow-Origin", "*");
|
||||
|
||||
const chatCompletion = await groq.chat.completions.create({
|
||||
messages: [
|
||||
{
|
||||
role: "system",
|
||||
content: `You are a news chat, the following content will be used to chat with the user title: ${fetchNewsArticle.title} article: ${fetchNewsArticle.paragraph} origin: ${fetchNewsArticle.origin} author: ${fetchNewsArticle.author}`,
|
||||
},
|
||||
...getChatHistory.map((chat) => ({
|
||||
role: chat.role,
|
||||
content: chat.content,
|
||||
})),
|
||||
{
|
||||
role: "user",
|
||||
content: body.message,
|
||||
},
|
||||
],
|
||||
model: "gemma2-9b-it",
|
||||
temperature: 0.71,
|
||||
max_completion_tokens: 1024,
|
||||
top_p: 1,
|
||||
stream: true,
|
||||
stop: null,
|
||||
});
|
||||
|
||||
/*
|
||||
await sql`
|
||||
INSERT INTO chat_history (uuid, role, content)
|
||||
VALUES (${slug}, 'user', ${body.message})
|
||||
`; */
|
||||
|
||||
let assistantResponse = "";
|
||||
|
||||
// Create a readable stream
|
||||
const stream = new ReadableStream({
|
||||
async start(controller) {
|
||||
try {
|
||||
for await (const chunk of chatCompletion) {
|
||||
const content = chunk.choices[0]?.delta?.content || "";
|
||||
if (content) {
|
||||
assistantResponse += content;
|
||||
// Send chunk to client
|
||||
controller.enqueue(new TextEncoder().encode(content));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (assistantResponse) {
|
||||
await sql`
|
||||
INSERT INTO chat_history (uuid, role, content)
|
||||
VALUES (${slug}, 'assistant', ${assistantResponse})
|
||||
`;
|
||||
} */
|
||||
|
||||
controller.close();
|
||||
} catch (error) {
|
||||
controller.error(error);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
return sendStream(event, stream);
|
||||
});
|
@ -1,5 +0,0 @@
|
||||
export default defineEventHandler(async (event) => {
|
||||
return {
|
||||
hello: "hello",
|
||||
};
|
||||
});
|
@ -1,6 +1,7 @@
|
||||
import { Groq } from "groq-sdk";
|
||||
import sql from "~/server/components/postgres";
|
||||
import { checkIfUserHasCustomGroqKey } from "~/server/components/customgroqsystem";
|
||||
import getEnvFromDB from "~/server/components/getEnvFromDB";
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const host = getRequestHost(event);
|
||||
@ -16,8 +17,9 @@ export default defineEventHandler(async (event) => {
|
||||
apiKey: doesTheUserHasACustomGroqApiAndWhatIsIt.customApi,
|
||||
});
|
||||
} else {
|
||||
const groq_api_key = await getEnvFromDB("groq_api_key");
|
||||
groqClient = new Groq({
|
||||
apiKey: process.env.GROQ_API_KEY,
|
||||
apiKey: groq_api_key,
|
||||
});
|
||||
}
|
||||
const query = getQuery(event);
|
||||
|
@ -60,6 +60,12 @@ export default defineEventHandler(async (event) => {
|
||||
)
|
||||
`;
|
||||
|
||||
const createGlobalVars = await sql`
|
||||
CREATE TABLE IF NOT EXISTS global_vars (
|
||||
NAME TEXT PRIMARY KEY NOT NULL,
|
||||
VAR TEXT NOT NULL
|
||||
)
|
||||
`;
|
||||
return {
|
||||
createUsers: createUsers,
|
||||
usersList: usersList,
|
||||
@ -67,5 +73,6 @@ export default defineEventHandler(async (event) => {
|
||||
createSources: createSources,
|
||||
createUserOtherData: createUserOtherData,
|
||||
createArticlesArchive: createArticlesArchive,
|
||||
createGlobalVars: createGlobalVars,
|
||||
};
|
||||
});
|
||||
|
@ -1,16 +1,11 @@
|
||||
import sql from "~/server/components/postgres";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import argon2 from "argon2";
|
||||
import getEnvFromDB from "~/server/components/getEnvFromDB";
|
||||
|
||||
const defaultAvatarUrl = "https://s3.yhw.tw/news-analyze/avatar/default.png";
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const salt = process.env.PASSWORD_HASH_SALT;
|
||||
if (!salt) {
|
||||
return {
|
||||
error: "SALT_NOT_FOUND",
|
||||
};
|
||||
}
|
||||
const body = await readBody(event);
|
||||
const { username, password } = body;
|
||||
console.log(password);
|
||||
@ -33,6 +28,7 @@ export default defineEventHandler(async (event) => {
|
||||
where username = ${username}`;
|
||||
console.log(fetchUserInfo[0]);
|
||||
if (fetchUserInfo.length === 0) {
|
||||
const salt = await getEnvFromDB("password_hash_salt");
|
||||
const hashedPassword = await argon2.hash(salt + password);
|
||||
const userUUID = uuidv4();
|
||||
const createNewUser = await sql`
|
||||
|
16
server/components/getEnvFromDB.ts
Normal file
16
server/components/getEnvFromDB.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import sql from "~/server/components/postgres";
|
||||
interface variReturn {
|
||||
name: string;
|
||||
var: string;
|
||||
}
|
||||
export default async function (vari: string) {
|
||||
const fetchVar = await sql<variReturn[]>`
|
||||
SELECT * FROM global_vars
|
||||
WHERE NAME = ${vari}`;
|
||||
if (fetchVar.length === 0) {
|
||||
throw new Error(
|
||||
"Cannot find var in the database. Have you followed this? https://github.com/hpware/news-analyze?tab=readme-ov-file#notes",
|
||||
);
|
||||
}
|
||||
return fetchVar[0].var;
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
# Server Fixed
|
||||
(This file is NOT related to neighbourhood, but it is some stuff I learned during the down time of the server)
|
||||
|
||||
## Timeline
|
||||
Aprox. 10 PM UTC+8 - I found out that the server is running an outdated version of the app and tried using `docker compose pull`, but saw 192.168.1.1:53 is not a Server, and tried to fix it, and broke off the connection to the internet.
|
||||
|
||||
11:40-ish PM UTC+8 Server is back online.
|
||||
|
||||
## So what is the issue?
|
||||
Well, My issue is one of my config files included a "on", which is why the PPPoE conenction does not work anymore.
|
||||
|
||||
Image:
|
||||

|
||||
|
||||
And also I wrote a super stupid cron fix, which is below.
|
||||
|
||||
## My stupid cron fix:
|
||||
Cron Job:
|
||||
```
|
||||
0 * * * * "bun run /hardpushrevolvconf.ts" > /dev/null
|
||||
```
|
||||
|
||||
Here is the script I used to force the change of my resolv.conf file:
|
||||
```typescript
|
||||
import { file, $ } from "bun";
|
||||
|
||||
function sendDataToSlack(text: string) {
|
||||
fetch("{slack_web_hook_to_one_of_my_channels_in_hackclub}", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application-json"
|
||||
},
|
||||
body: JSON.stringify({ text: text })
|
||||
})
|
||||
return;
|
||||
}
|
||||
|
||||
const resolvConfPath = "/etc/resolv.conf";
|
||||
const resolvConf = file(resolvConfPath);
|
||||
const resolvConfText = await resolvConf.text();
|
||||
|
||||
if (resolvConfText.includes("192.168.1.1")) {
|
||||
// Auto git config
|
||||
await $`git add .`
|
||||
await $`git commit -a -m "Auto Commit by the server ${Date().now}, before doing stuff into resolvConf"`
|
||||
try {
|
||||
await resolvConf.write("nameserver 8.8.8.8\n");
|
||||
sendDataToSlack(`${resolvConfPath} updated successfully.`);
|
||||
} catch (error) {
|
||||
sendDataToSlack(`Failed to write to ${resolvConfPath}:`, error);
|
||||
sendDataToSlack(
|
||||
"This likely happened because you didn't run the script with root privileges (e.g., 'sudo bun run script.ts')."
|
||||
);
|
||||
}
|
||||
await $`git add .`
|
||||
await $`git commit -a -m "Auto Commit by the server ${Date().now}, after doing stuff into resolvConf"`
|
||||
await $`git push`
|
||||
} else {
|
||||
sendDataToSlack(
|
||||
"Did not find '192.168.1.1'. No changes have been made."
|
||||
);
|
||||
}
|
||||
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user