diff --git a/CHANGE_LOG.md b/CHANGE_LOG.md index 87ef140..ec42d1f 100644 --- a/CHANGE_LOG.md +++ b/CHANGE_LOG.md @@ -4,6 +4,18 @@ > 2023-05-16 +### Add + +- Add account system +- Adding login guidance for users who are not logged in +- Multi-language configuration for login email sending page + +### Changed + +- UI optimization +- Cancel response immediately when switching channels if data is being requested or generated. +- Trying to solve: Issue of error log being reported when canceling fetch requests + ## v0.3.0 > 2023-05-11 diff --git a/README.md b/README.md index ec2185f..d743e25 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,6 @@ English / [简体中文](./README_CN.md) L-GPT is an open-source project that helps you improve your learning, work, and life efficiency by providing various AI models. [Demo](https://gpt.ltopx.com) -[QQ 群](./public/screenshots/qq.jpeg) - ## Preview diff --git a/README_CN.md b/README_CN.md index 1857431..0cb0efa 100644 --- a/README_CN.md +++ b/README_CN.md @@ -2,8 +2,6 @@ L-GPT 是一款开源项目,通过提供不同的 AI 模型来帮助你提高学习、工作、生活的效率。 [Demo](https://gpt.ltopx.com) -[QQ 群](./public/screenshots/qq.jpeg) - ## 预览 diff --git a/package.json b/package.json index 6b64124..b5c2064 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "dependencies": { "@emotion/css": "11.11.0", "@next-auth/prisma-adapter": "1.0.6", - "@prisma/client": "4.14.0", + "@prisma/client": "4.14.1", "@radix-ui/react-alert-dialog": "1.0.3", "@radix-ui/react-context-menu": "2.1.3", "@radix-ui/react-dialog": "1.0.3", @@ -23,23 +23,23 @@ "@radix-ui/react-popover": "1.0.5", "@radix-ui/react-select": "1.2.1", "@radix-ui/react-slider": "1.1.1", - "@radix-ui/react-toast": "^1.1.3", + "@radix-ui/react-toast": "1.1.3", "@sentry/nextjs": "7.52.1", "@svgr/webpack": "8.0.1", - "@types/node": "20.1.5", + "@types/node": "20.2.1", "@types/react": "18.2.6", "@types/react-dom": "18.2.4", "@vercel/analytics": "1.0.1", "ahooks": "3.7.7", "autoprefixer": "10.4.14", "clsx": "1.2.1", - "eslint": "8.40.0", - "eslint-config-next": "13.4.2", + "eslint": "8.41.0", + "eslint-config-next": "13.4.3", "file-saver": "2.0.5", - "framer-motion": "10.12.11", + "framer-motion": "10.12.12", "l-hooks": "0.4.5", "math-random": "2.0.1", - "next": "13.4.2", + "next": "13.4.3", "next-auth": "4.22.1", "next-intl": "2.14.2", "next-themes": "0.2.1", @@ -66,6 +66,6 @@ "@types/math-random": "1.0.0", "@types/react-syntax-highlighter": "15.5.6", "@types/uuid": "9.0.1", - "prisma": "4.14.0" + "prisma": "4.14.1" } } \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 078e78e..24f1ea1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,10 +6,10 @@ dependencies: version: 11.11.0 '@next-auth/prisma-adapter': specifier: 1.0.6 - version: 1.0.6(@prisma/client@4.14.0)(next-auth@4.22.1) + version: 1.0.6(@prisma/client@4.14.1)(next-auth@4.22.1) '@prisma/client': - specifier: 4.14.0 - version: 4.14.0(prisma@4.14.0) + specifier: 4.14.1 + version: 4.14.1(prisma@4.14.1) '@radix-ui/react-alert-dialog': specifier: 1.0.3 version: 1.0.3(@types/react@18.2.6)(react-dom@18.2.0)(react@18.2.0) @@ -32,17 +32,17 @@ dependencies: specifier: 1.1.1 version: 1.1.1(react-dom@18.2.0)(react@18.2.0) '@radix-ui/react-toast': - specifier: ^1.1.3 + specifier: 1.1.3 version: 1.1.3(react-dom@18.2.0)(react@18.2.0) '@sentry/nextjs': specifier: 7.52.1 - version: 7.52.1(next@13.4.2)(react@18.2.0) + version: 7.52.1(next@13.4.3)(react@18.2.0) '@svgr/webpack': specifier: 8.0.1 version: 8.0.1 '@types/node': - specifier: 20.1.5 - version: 20.1.5 + specifier: 20.2.1 + version: 20.2.1 '@types/react': specifier: 18.2.6 version: 18.2.6 @@ -62,17 +62,17 @@ dependencies: specifier: 1.2.1 version: 1.2.1 eslint: - specifier: 8.40.0 - version: 8.40.0 + specifier: 8.41.0 + version: 8.41.0 eslint-config-next: - specifier: 13.4.2 - version: 13.4.2(eslint@8.40.0)(typescript@5.0.4) + specifier: 13.4.3 + version: 13.4.3(eslint@8.41.0)(typescript@5.0.4) file-saver: specifier: 2.0.5 version: 2.0.5 framer-motion: - specifier: 10.12.11 - version: 10.12.11(react-dom@18.2.0)(react@18.2.0) + specifier: 10.12.12 + version: 10.12.12(react-dom@18.2.0)(react@18.2.0) l-hooks: specifier: 0.4.5 version: 0.4.5(@types/qs@6.9.7)(qs@6.11.1)(react-dom@18.2.0)(react@18.2.0) @@ -80,17 +80,17 @@ dependencies: specifier: 2.0.1 version: 2.0.1 next: - specifier: 13.4.2 - version: 13.4.2(@babel/core@7.21.8)(react-dom@18.2.0)(react@18.2.0) + specifier: 13.4.3 + version: 13.4.3(@babel/core@7.21.8)(react-dom@18.2.0)(react@18.2.0) next-auth: specifier: 4.22.1 - version: 4.22.1(next@13.4.2)(nodemailer@6.9.2)(react-dom@18.2.0)(react@18.2.0) + version: 4.22.1(next@13.4.3)(nodemailer@6.9.2)(react-dom@18.2.0)(react@18.2.0) next-intl: specifier: 2.14.2 - version: 2.14.2(next@13.4.2)(react@18.2.0) + version: 2.14.2(next@13.4.3)(react@18.2.0) next-themes: specifier: 0.2.1 - version: 0.2.1(next@13.4.2)(react-dom@18.2.0)(react@18.2.0) + version: 0.2.1(next@13.4.3)(react-dom@18.2.0)(react@18.2.0) nodemailer: specifier: 6.9.2 version: 6.9.2 @@ -157,8 +157,8 @@ devDependencies: specifier: 9.0.1 version: 9.0.1 prisma: - specifier: 4.14.0 - version: 4.14.0 + specifier: 4.14.1 + version: 4.14.1 packages: @@ -1535,13 +1535,13 @@ packages: resolution: {integrity: sha512-EsBwpc7hBUJWAsNPBmJy4hxWx12v6bshQsldrVmjxJoc3isbxhOrF2IcCpaXxfvq03NwkI7sbsOLXbYuqF/8Ww==} dev: false - /@eslint-community/eslint-utils@4.4.0(eslint@8.40.0): + /@eslint-community/eslint-utils@4.4.0(eslint@8.41.0): resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 dependencies: - eslint: 8.40.0 + eslint: 8.41.0 eslint-visitor-keys: 3.4.1 dev: false @@ -1567,8 +1567,8 @@ packages: - supports-color dev: false - /@eslint/js@8.40.0: - resolution: {integrity: sha512-ElyB54bJIhXQYVKjDSvCkPO1iU1tSAeVQJbllWJq1XQSmmA4dgFk8CbiBGpiOPxleE48vDogxCtmMYku4HSVLA==} + /@eslint/js@8.41.0: + resolution: {integrity: sha512-LxcyMGxwmTh2lY9FwHPGWOHmYFCZvbrFCBZL4FzSSsxsRPuhrYUg/49/0KDfW8tnIEaEHtfmn6+NPN+1DqaNmA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: false @@ -1691,28 +1691,28 @@ packages: '@jridgewell/resolve-uri': 3.1.0 '@jridgewell/sourcemap-codec': 1.4.14 - /@next-auth/prisma-adapter@1.0.6(@prisma/client@4.14.0)(next-auth@4.22.1): + /@next-auth/prisma-adapter@1.0.6(@prisma/client@4.14.1)(next-auth@4.22.1): resolution: {integrity: sha512-Z7agwfSZEeEcqKqrnisBun7VndRPshd6vyDsoRU68MXbkui8storkHgvN2hnNDrqr/hSCF9aRn56a1qpihaB4A==} peerDependencies: '@prisma/client': '>=2.26.0 || >=3' next-auth: ^4 dependencies: - '@prisma/client': 4.14.0(prisma@4.14.0) - next-auth: 4.22.1(next@13.4.2)(nodemailer@6.9.2)(react-dom@18.2.0)(react@18.2.0) + '@prisma/client': 4.14.1(prisma@4.14.1) + next-auth: 4.22.1(next@13.4.3)(nodemailer@6.9.2)(react-dom@18.2.0)(react@18.2.0) dev: false - /@next/env@13.4.2: - resolution: {integrity: sha512-Wqvo7lDeS0KGwtwg9TT9wKQ8raelmUxt+TQKWvG/xKfcmDXNOtCuaszcfCF8JzlBG1q0VhpI6CKaRMbVPMDWgw==} + /@next/env@13.4.3: + resolution: {integrity: sha512-pa1ErjyFensznttAk3EIv77vFbfSYT6cLzVRK5jx4uiRuCQo+m2wCFAREaHKIy63dlgvOyMlzh6R8Inu8H3KrQ==} dev: false - /@next/eslint-plugin-next@13.4.2: - resolution: {integrity: sha512-ZeFWgrxwckxTpYM+ANeUL9E7LOGPbZKmI94LJIjbDU69iEIgqd4WD0l2pVbOJMr/+vgoZmJ9Dx1m0WJ7WScXHA==} + /@next/eslint-plugin-next@13.4.3: + resolution: {integrity: sha512-5B0uOnh7wyUY9vNNdIA6NUvWozhrZaTMZOzdirYAefqD0ZBK5C/h3+KMYdCKrR7JrXGvVpWnHtv54b3dCzwICA==} dependencies: glob: 7.1.7 dev: false - /@next/swc-darwin-arm64@13.4.2: - resolution: {integrity: sha512-6BBlqGu3ewgJflv9iLCwO1v1hqlecaIH2AotpKfVUEzUxuuDNJQZ2a4KLb4MBl8T9/vca1YuWhSqtbF6ZuUJJw==} + /@next/swc-darwin-arm64@13.4.3: + resolution: {integrity: sha512-yx18udH/ZmR4Bw4M6lIIPE3JxsAZwo04iaucEfA2GMt1unXr2iodHUX/LAKNyi6xoLP2ghi0E+Xi1f4Qb8f1LQ==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] @@ -1720,8 +1720,8 @@ packages: dev: false optional: true - /@next/swc-darwin-x64@13.4.2: - resolution: {integrity: sha512-iZuYr7ZvGLPjPmfhhMl0ISm+z8EiyLBC1bLyFwGBxkWmPXqdJ60mzuTaDSr5WezDwv0fz32HB7JHmRC6JVHSZg==} + /@next/swc-darwin-x64@13.4.3: + resolution: {integrity: sha512-Mi8xJWh2IOjryAM1mx18vwmal9eokJ2njY4nDh04scy37F0LEGJ/diL6JL6kTXi0UfUCGbMsOItf7vpReNiD2A==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] @@ -1729,8 +1729,8 @@ packages: dev: false optional: true - /@next/swc-linux-arm64-gnu@13.4.2: - resolution: {integrity: sha512-2xVabFtIge6BJTcJrW8YuUnYTuQjh4jEuRuS2mscyNVOj6zUZkom3CQg+egKOoS+zh2rrro66ffSKIS+ztFJTg==} + /@next/swc-linux-arm64-gnu@13.4.3: + resolution: {integrity: sha512-aBvtry4bxJ1xwKZ/LVPeBGBwWVwxa4bTnNkRRw6YffJnn/f4Tv4EGDPaVeYHZGQVA56wsGbtA6nZMuWs/EIk4Q==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -1738,8 +1738,8 @@ packages: dev: false optional: true - /@next/swc-linux-arm64-musl@13.4.2: - resolution: {integrity: sha512-wKRCQ27xCUJx5d6IivfjYGq8oVngqIhlhSAJntgXLt7Uo9sRT/3EppMHqUZRfyuNBTbykEre1s5166z+pvRB5A==} + /@next/swc-linux-arm64-musl@13.4.3: + resolution: {integrity: sha512-krT+2G3kEsEUvZoYte3/2IscscDraYPc2B+fDJFipPktJmrv088Pei/RjrhWm5TMIy5URYjZUoDZdh5k940Dyw==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -1747,8 +1747,8 @@ packages: dev: false optional: true - /@next/swc-linux-x64-gnu@13.4.2: - resolution: {integrity: sha512-NpCa+UVhhuNeaFVUP1Bftm0uqtvLWq2JTm7+Ta48+2Uqj2mNXrDIvyn1DY/ZEfmW/1yvGBRaUAv9zkMkMRixQA==} + /@next/swc-linux-x64-gnu@13.4.3: + resolution: {integrity: sha512-AMdFX6EKJjC0G/CM6hJvkY8wUjCcbdj3Qg7uAQJ7PVejRWaVt0sDTMavbRfgMchx8h8KsAudUCtdFkG9hlEClw==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -1756,8 +1756,8 @@ packages: dev: false optional: true - /@next/swc-linux-x64-musl@13.4.2: - resolution: {integrity: sha512-ZWVC72x0lW4aj44e3khvBrj2oSYj1bD0jESmyah3zG/3DplEy/FOtYkMzbMjHTdDSheso7zH8GIlW6CDQnKhmQ==} + /@next/swc-linux-x64-musl@13.4.3: + resolution: {integrity: sha512-jySgSXE48shaLtcQbiFO9ajE9mqz7pcAVLnVLvRIlUHyQYR/WyZdK8ehLs65Mz6j9cLrJM+YdmdJPyV4WDaz2g==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -1765,8 +1765,8 @@ packages: dev: false optional: true - /@next/swc-win32-arm64-msvc@13.4.2: - resolution: {integrity: sha512-pLT+OWYpzJig5K4VKhLttlIfBcVZfr2+Xbjra0Tjs83NQSkFS+y7xx+YhCwvpEmXYLIvaggj2ONPyjbiigOvHQ==} + /@next/swc-win32-arm64-msvc@13.4.3: + resolution: {integrity: sha512-5DxHo8uYcaADiE9pHrg8o28VMt/1kR8voDehmfs9AqS0qSClxAAl+CchjdboUvbCjdNWL1MISCvEfKY2InJ3JA==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] @@ -1774,8 +1774,8 @@ packages: dev: false optional: true - /@next/swc-win32-ia32-msvc@13.4.2: - resolution: {integrity: sha512-dhpiksQCyGca4WY0fJyzK3FxMDFoqMb0Cn+uDB+9GYjpU2K5//UGPQlCwiK4JHxuhg8oLMag5Nf3/IPSJNG8jw==} + /@next/swc-win32-ia32-msvc@13.4.3: + resolution: {integrity: sha512-LaqkF3d+GXRA5X6zrUjQUrXm2MN/3E2arXBtn5C7avBCNYfm9G3Xc646AmmmpN3DJZVaMYliMyCIQCMDEzk80w==} engines: {node: '>= 10'} cpu: [ia32] os: [win32] @@ -1783,8 +1783,8 @@ packages: dev: false optional: true - /@next/swc-win32-x64-msvc@13.4.2: - resolution: {integrity: sha512-O7bort1Vld00cu8g0jHZq3cbSTUNMohOEvYqsqE10+yfohhdPHzvzO+ziJRz4Dyyr/fYKREwS7gR4JC0soSOMw==} + /@next/swc-win32-x64-msvc@13.4.3: + resolution: {integrity: sha512-jglUk/x7ZWeOJWlVoKyIAkHLTI+qEkOriOOV+3hr1GyiywzcqfI7TpFSiwC7kk1scOiH7NTFKp8mA3XPNO9bDw==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -1826,8 +1826,8 @@ packages: tslib: 2.5.0 dev: false - /@prisma/client@4.14.0(prisma@4.14.0): - resolution: {integrity: sha512-MK/XaA2sFdfaOa7I9MjNKz6dxeIEdeZlnpNRoF2w3JuRLlFJLkpp6cD3yaqw2nUUhbrn3Iqe3ZpVV+VuGGil7Q==} + /@prisma/client@4.14.1(prisma@4.14.1): + resolution: {integrity: sha512-TZIswkeX1ccsHG/eN2kICzg/csXll0osK3EHu1QKd8VJ3XLcXozbNELKkCNfsCUvKJAwPdDtFCzF+O+raIVldw==} engines: {node: '>=14.17'} requiresBuild: true peerDependencies: @@ -1837,15 +1837,15 @@ packages: optional: true dependencies: '@prisma/engines-version': 4.14.0-67.d9a4c5988f480fa576d43970d5a23641aa77bc9c - prisma: 4.14.0 + prisma: 4.14.1 dev: false /@prisma/engines-version@4.14.0-67.d9a4c5988f480fa576d43970d5a23641aa77bc9c: resolution: {integrity: sha512-3jum8/YSudeSN0zGW5qkpz+wAN2V/NYCQ+BPjvHYDfWatLWlQkqy99toX0GysDeaUoBIJg1vaz2yKqiA3CFcQw==} dev: false - /@prisma/engines@4.14.0: - resolution: {integrity: sha512-PDNlhP/1vyTgmNyiucGqGCdXIp7HIkkvKO50si3y3PcceeHvqtiKPaH1iJdz63jCWMVMbj2MElSxXPOeBvEVIQ==} + /@prisma/engines@4.14.1: + resolution: {integrity: sha512-APqFddPVHYmWNKqc+5J5SqrLFfOghKOLZxobmguDUacxOwdEutLsbXPVhNnpFDmuQWQFbXmrTTPoRrrF6B1MWA==} requiresBuild: true /@radix-ui/number@1.0.0: @@ -2456,7 +2456,7 @@ packages: tslib: 1.14.1 dev: false - /@sentry/nextjs@7.52.1(next@13.4.2)(react@18.2.0): + /@sentry/nextjs@7.52.1(next@13.4.3)(react@18.2.0): resolution: {integrity: sha512-zd1StGdAn0vSS21l4gVyzCtfnEbJ+e5ZIgLZiaLUOSvKdMAtIlhXTotpn7CILIx+PzjOwiRFWp1XtSoU4FZyZg==} engines: {node: '>=8'} peerDependencies: @@ -2476,7 +2476,7 @@ packages: '@sentry/utils': 7.52.1 '@sentry/webpack-plugin': 1.20.0 chalk: 3.0.0 - next: 13.4.2(@babel/core@7.21.8)(react-dom@18.2.0)(react@18.2.0) + next: 13.4.3(@babel/core@7.21.8)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 rollup: 2.78.0 stacktrace-parser: 0.1.10 @@ -2775,8 +2775,8 @@ packages: resolution: {integrity: sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==} dev: false - /@types/node@20.1.5: - resolution: {integrity: sha512-IvGD1CD/nego63ySR7vrAKEX3AJTcmrAN2kn+/sDNLi1Ff5kBzDeEdqWDplK+0HAEoLYej137Sk0cUU8OLOlMg==} + /@types/node@20.2.1: + resolution: {integrity: sha512-DqJociPbZP1lbZ5SQPk4oag6W7AyaGMO6gSfRwq3PWl4PXTwJpRQJhDq4W0kzrg3w6tJ1SwlvGZ5uKFHY13LIg==} dev: false /@types/parse-json@4.0.0: @@ -2820,7 +2820,7 @@ packages: resolution: {integrity: sha512-rFT3ak0/2trgvp4yYZo5iKFEPsET7vKydKF+VRCxlQ9bpheehyAJH89dAkaLEq/j/RZXJIqcgsmPJKUP1Z28HA==} dev: true - /@typescript-eslint/parser@5.59.5(eslint@8.40.0)(typescript@5.0.4): + /@typescript-eslint/parser@5.59.5(eslint@8.41.0)(typescript@5.0.4): resolution: {integrity: sha512-NJXQC4MRnF9N9yWqQE2/KLRSOLvrrlZb48NGVfBa+RuPMN6B7ZcK5jZOvhuygv4D64fRKnZI4L4p8+M+rfeQuw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2834,7 +2834,7 @@ packages: '@typescript-eslint/types': 5.59.5 '@typescript-eslint/typescript-estree': 5.59.5(typescript@5.0.4) debug: 4.3.4 - eslint: 8.40.0 + eslint: 8.41.0 typescript: 5.0.4 transitivePeerDependencies: - supports-color @@ -3733,8 +3733,8 @@ packages: engines: {node: '>=12'} dev: false - /eslint-config-next@13.4.2(eslint@8.40.0)(typescript@5.0.4): - resolution: {integrity: sha512-zjLJ9B9bbeWSo5q+iHfdt8gVYyT+y2BpWDfjR6XMBtFRSMKRGjllDKxnuKBV1q2Y/QpwLM2PXHJTMRyblCmRAg==} + /eslint-config-next@13.4.3(eslint@8.41.0)(typescript@5.0.4): + resolution: {integrity: sha512-1lXwdFi29fKxzeugof/TUE7lpHyJQt5+U4LaUHyvQfHjvsWO77vFNicJv5sX6k0VDVSbnfz0lw+avxI+CinbMg==} peerDependencies: eslint: ^7.23.0 || ^8.0.0 typescript: '>=3.3.1' @@ -3742,16 +3742,16 @@ packages: typescript: optional: true dependencies: - '@next/eslint-plugin-next': 13.4.2 + '@next/eslint-plugin-next': 13.4.3 '@rushstack/eslint-patch': 1.2.0 - '@typescript-eslint/parser': 5.59.5(eslint@8.40.0)(typescript@5.0.4) - eslint: 8.40.0 + '@typescript-eslint/parser': 5.59.5(eslint@8.41.0)(typescript@5.0.4) + eslint: 8.41.0 eslint-import-resolver-node: 0.3.7 - eslint-import-resolver-typescript: 3.5.5(@typescript-eslint/parser@5.59.5)(eslint-import-resolver-node@0.3.7)(eslint-plugin-import@2.27.5)(eslint@8.40.0) - eslint-plugin-import: 2.27.5(@typescript-eslint/parser@5.59.5)(eslint-import-resolver-typescript@3.5.5)(eslint@8.40.0) - eslint-plugin-jsx-a11y: 6.7.1(eslint@8.40.0) - eslint-plugin-react: 7.32.2(eslint@8.40.0) - eslint-plugin-react-hooks: 4.6.0(eslint@8.40.0) + eslint-import-resolver-typescript: 3.5.5(@typescript-eslint/parser@5.59.5)(eslint-import-resolver-node@0.3.7)(eslint-plugin-import@2.27.5)(eslint@8.41.0) + eslint-plugin-import: 2.27.5(@typescript-eslint/parser@5.59.5)(eslint-import-resolver-typescript@3.5.5)(eslint@8.41.0) + eslint-plugin-jsx-a11y: 6.7.1(eslint@8.41.0) + eslint-plugin-react: 7.32.2(eslint@8.41.0) + eslint-plugin-react-hooks: 4.6.0(eslint@8.41.0) typescript: 5.0.4 transitivePeerDependencies: - eslint-import-resolver-webpack @@ -3768,7 +3768,7 @@ packages: - supports-color dev: false - /eslint-import-resolver-typescript@3.5.5(@typescript-eslint/parser@5.59.5)(eslint-import-resolver-node@0.3.7)(eslint-plugin-import@2.27.5)(eslint@8.40.0): + /eslint-import-resolver-typescript@3.5.5(@typescript-eslint/parser@5.59.5)(eslint-import-resolver-node@0.3.7)(eslint-plugin-import@2.27.5)(eslint@8.41.0): resolution: {integrity: sha512-TdJqPHs2lW5J9Zpe17DZNQuDnox4xo2o+0tE7Pggain9Rbc19ik8kFtXdxZ250FVx2kF4vlt2RSf4qlUpG7bhw==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: @@ -3777,9 +3777,9 @@ packages: dependencies: debug: 4.3.4 enhanced-resolve: 5.14.0 - eslint: 8.40.0 - eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.59.5)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.40.0) - eslint-plugin-import: 2.27.5(@typescript-eslint/parser@5.59.5)(eslint-import-resolver-typescript@3.5.5)(eslint@8.40.0) + eslint: 8.41.0 + eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.59.5)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.41.0) + eslint-plugin-import: 2.27.5(@typescript-eslint/parser@5.59.5)(eslint-import-resolver-typescript@3.5.5)(eslint@8.41.0) get-tsconfig: 4.5.0 globby: 13.1.4 is-core-module: 2.12.0 @@ -3792,7 +3792,7 @@ packages: - supports-color dev: false - /eslint-module-utils@2.8.0(@typescript-eslint/parser@5.59.5)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.40.0): + /eslint-module-utils@2.8.0(@typescript-eslint/parser@5.59.5)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.41.0): resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==} engines: {node: '>=4'} peerDependencies: @@ -3813,16 +3813,16 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 5.59.5(eslint@8.40.0)(typescript@5.0.4) + '@typescript-eslint/parser': 5.59.5(eslint@8.41.0)(typescript@5.0.4) debug: 3.2.7 - eslint: 8.40.0 + eslint: 8.41.0 eslint-import-resolver-node: 0.3.7 - eslint-import-resolver-typescript: 3.5.5(@typescript-eslint/parser@5.59.5)(eslint-import-resolver-node@0.3.7)(eslint-plugin-import@2.27.5)(eslint@8.40.0) + eslint-import-resolver-typescript: 3.5.5(@typescript-eslint/parser@5.59.5)(eslint-import-resolver-node@0.3.7)(eslint-plugin-import@2.27.5)(eslint@8.41.0) transitivePeerDependencies: - supports-color dev: false - /eslint-plugin-import@2.27.5(@typescript-eslint/parser@5.59.5)(eslint-import-resolver-typescript@3.5.5)(eslint@8.40.0): + /eslint-plugin-import@2.27.5(@typescript-eslint/parser@5.59.5)(eslint-import-resolver-typescript@3.5.5)(eslint@8.41.0): resolution: {integrity: sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow==} engines: {node: '>=4'} peerDependencies: @@ -3832,15 +3832,15 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 5.59.5(eslint@8.40.0)(typescript@5.0.4) + '@typescript-eslint/parser': 5.59.5(eslint@8.41.0)(typescript@5.0.4) array-includes: 3.1.6 array.prototype.flat: 1.3.1 array.prototype.flatmap: 1.3.1 debug: 3.2.7 doctrine: 2.1.0 - eslint: 8.40.0 + eslint: 8.41.0 eslint-import-resolver-node: 0.3.7 - eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.59.5)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.40.0) + eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.59.5)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-typescript@3.5.5)(eslint@8.41.0) has: 1.0.3 is-core-module: 2.12.0 is-glob: 4.0.3 @@ -3855,7 +3855,7 @@ packages: - supports-color dev: false - /eslint-plugin-jsx-a11y@6.7.1(eslint@8.40.0): + /eslint-plugin-jsx-a11y@6.7.1(eslint@8.41.0): resolution: {integrity: sha512-63Bog4iIethyo8smBklORknVjB0T2dwB8Mr/hIC+fBS0uyHdYYpzM/Ed+YC8VxTjlXHEWFOdmgwcDn1U2L9VCA==} engines: {node: '>=4.0'} peerDependencies: @@ -3870,7 +3870,7 @@ packages: axobject-query: 3.1.1 damerau-levenshtein: 1.0.8 emoji-regex: 9.2.2 - eslint: 8.40.0 + eslint: 8.41.0 has: 1.0.3 jsx-ast-utils: 3.3.3 language-tags: 1.0.5 @@ -3880,16 +3880,16 @@ packages: semver: 6.3.0 dev: false - /eslint-plugin-react-hooks@4.6.0(eslint@8.40.0): + /eslint-plugin-react-hooks@4.6.0(eslint@8.41.0): resolution: {integrity: sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==} engines: {node: '>=10'} peerDependencies: eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 dependencies: - eslint: 8.40.0 + eslint: 8.41.0 dev: false - /eslint-plugin-react@7.32.2(eslint@8.40.0): + /eslint-plugin-react@7.32.2(eslint@8.41.0): resolution: {integrity: sha512-t2fBMa+XzonrrNkyVirzKlvn5RXzzPwRHtMvLAtVZrt8oxgnTQaYbU6SXTOO1mwQgp1y5+toMSKInnzGr0Knqg==} engines: {node: '>=4'} peerDependencies: @@ -3899,7 +3899,7 @@ packages: array.prototype.flatmap: 1.3.1 array.prototype.tosorted: 1.1.1 doctrine: 2.1.0 - eslint: 8.40.0 + eslint: 8.41.0 estraverse: 5.3.0 jsx-ast-utils: 3.3.3 minimatch: 3.1.2 @@ -3926,15 +3926,15 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: false - /eslint@8.40.0: - resolution: {integrity: sha512-bvR+TsP9EHL3TqNtj9sCNJVAFK3fBN8Q7g5waghxyRsPLIMwL73XSKnZFK0hk/O2ANC+iAoq6PWMQ+IfBAJIiQ==} + /eslint@8.41.0: + resolution: {integrity: sha512-WQDQpzGBOP5IrXPo4Hc0814r4/v2rrIsB0rhT7jtunIalgg6gYXWhRMOejVO8yH21T/FGaxjmFjBMNqcIlmH1Q==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.40.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.41.0) '@eslint-community/regexpp': 4.5.1 '@eslint/eslintrc': 2.0.3 - '@eslint/js': 8.40.0 + '@eslint/js': 8.41.0 '@humanwhocodes/config-array': 0.11.8 '@humanwhocodes/module-importer': 1.0.1 '@nodelib/fs.walk': 1.2.8 @@ -3954,13 +3954,12 @@ packages: find-up: 5.0.0 glob-parent: 6.0.2 globals: 13.20.0 - grapheme-splitter: 1.0.4 + graphemer: 1.4.0 ignore: 5.2.4 import-fresh: 3.3.0 imurmurhash: 0.1.4 is-glob: 4.0.3 is-path-inside: 3.0.3 - js-sdsl: 4.4.0 js-yaml: 4.1.0 json-stable-stringify-without-jsonify: 1.0.1 levn: 0.4.1 @@ -4135,8 +4134,8 @@ packages: resolution: {integrity: sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==} dev: false - /framer-motion@10.12.11(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-uNsJAc/BQZ9V7tYgzRBXSrEdB+YrdJTtRvgn+8lNAQucGKaINJBL8I4aqXxXdw+HzwJZb/uR955jnOrxBy5sTA==} + /framer-motion@10.12.12(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-DDCqp60U6hR7aUrXj/BXc/t0Sd/U4ep6w/NZQkw898K+u7s+Vv/P8yxq4WTNA86kU9QCsqOgn1Qhz2DpYK0Oag==} peerDependencies: react: ^18.0.0 react-dom: ^18.0.0 @@ -4330,8 +4329,8 @@ packages: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} dev: false - /grapheme-splitter@1.0.4: - resolution: {integrity: sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==} + /graphemer@1.4.0: + resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} dev: false /has-bigints@1.0.2: @@ -4802,10 +4801,6 @@ packages: resolution: {integrity: sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ==} dev: false - /js-sdsl@4.4.0: - resolution: {integrity: sha512-FfVSdx6pJ41Oa+CF7RDaFmTnCaFhua+SNYQX74riGOpl96x+2jQCqEfQ2bnXu/5DPCqlRuiqyvTJM0Qjz26IVg==} - dev: false - /js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} dev: false @@ -5496,7 +5491,7 @@ packages: engines: {node: '>= 0.6'} dev: false - /next-auth@4.22.1(next@13.4.2)(nodemailer@6.9.2)(react-dom@18.2.0)(react@18.2.0): + /next-auth@4.22.1(next@13.4.3)(nodemailer@6.9.2)(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-NTR3f6W7/AWXKw8GSsgSyQcDW6jkslZLH8AiZa5PQ09w1kR8uHtR9rez/E9gAq/o17+p0JYHE8QjF3RoniiObA==} peerDependencies: next: ^12.2.5 || ^13 @@ -5511,7 +5506,7 @@ packages: '@panva/hkdf': 1.1.1 cookie: 0.5.0 jose: 4.14.4 - next: 13.4.2(@babel/core@7.21.8)(react-dom@18.2.0)(react@18.2.0) + next: 13.4.3(@babel/core@7.21.8)(react-dom@18.2.0)(react@18.2.0) nodemailer: 6.9.2 oauth: 0.9.15 openid-client: 5.4.2 @@ -5522,7 +5517,7 @@ packages: uuid: 8.3.2 dev: false - /next-intl@2.14.2(next@13.4.2)(react@18.2.0): + /next-intl@2.14.2(next@13.4.3)(react@18.2.0): resolution: {integrity: sha512-JZNxNWWuZoF6wITMuwphND3LAW0IkV0U9YE4xftOX0zx+2MgIbBaRgBgGJ5l8S8Rstc7uPEz9Z0IT4lp0rJoNw==} engines: {node: '>=10'} peerDependencies: @@ -5531,25 +5526,25 @@ packages: dependencies: '@formatjs/intl-localematcher': 0.2.32 negotiator: 0.6.3 - next: 13.4.2(@babel/core@7.21.8)(react-dom@18.2.0)(react@18.2.0) + next: 13.4.3(@babel/core@7.21.8)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 use-intl: 2.14.2(react@18.2.0) dev: false - /next-themes@0.2.1(next@13.4.2)(react-dom@18.2.0)(react@18.2.0): + /next-themes@0.2.1(next@13.4.3)(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-B+AKNfYNIzh0vqQQKqQItTS8evEouKD7H5Hj3kmuPERwddR2TxvDSFZuTj6T7Jfn1oyeUyJMydPl1Bkxkh0W7A==} peerDependencies: next: '*' react: '*' react-dom: '*' dependencies: - next: 13.4.2(@babel/core@7.21.8)(react-dom@18.2.0)(react@18.2.0) + next: 13.4.3(@babel/core@7.21.8)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 react-dom: 18.2.0(react@18.2.0) dev: false - /next@13.4.2(@babel/core@7.21.8)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-aNFqLs3a3nTGvLWlO9SUhCuMUHVPSFQC0+tDNGAsDXqx+WJDFSbvc233gOJ5H19SBc7nw36A9LwQepOJ2u/8Kg==} + /next@13.4.3(@babel/core@7.21.8)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-FV3pBrAAnAIfOclTvncw9dDohyeuEEXPe5KNcva91anT/rdycWbgtu3IjUj4n5yHnWK8YEPo0vrUecHmnmUNbA==} engines: {node: '>=16.8.0'} hasBin: true peerDependencies: @@ -5569,7 +5564,7 @@ packages: sass: optional: true dependencies: - '@next/env': 13.4.2 + '@next/env': 13.4.3 '@swc/helpers': 0.5.1 busboy: 1.6.0 caniuse-lite: 1.0.30001486 @@ -5579,15 +5574,15 @@ packages: styled-jsx: 5.1.1(@babel/core@7.21.8)(react@18.2.0) zod: 3.21.4 optionalDependencies: - '@next/swc-darwin-arm64': 13.4.2 - '@next/swc-darwin-x64': 13.4.2 - '@next/swc-linux-arm64-gnu': 13.4.2 - '@next/swc-linux-arm64-musl': 13.4.2 - '@next/swc-linux-x64-gnu': 13.4.2 - '@next/swc-linux-x64-musl': 13.4.2 - '@next/swc-win32-arm64-msvc': 13.4.2 - '@next/swc-win32-ia32-msvc': 13.4.2 - '@next/swc-win32-x64-msvc': 13.4.2 + '@next/swc-darwin-arm64': 13.4.3 + '@next/swc-darwin-x64': 13.4.3 + '@next/swc-linux-arm64-gnu': 13.4.3 + '@next/swc-linux-arm64-musl': 13.4.3 + '@next/swc-linux-x64-gnu': 13.4.3 + '@next/swc-linux-x64-musl': 13.4.3 + '@next/swc-win32-arm64-msvc': 13.4.3 + '@next/swc-win32-ia32-msvc': 13.4.3 + '@next/swc-win32-x64-msvc': 13.4.3 transitivePeerDependencies: - '@babel/core' - babel-plugin-macros @@ -5975,13 +5970,13 @@ packages: resolution: {integrity: sha512-WuxUnVtlWL1OfZFQFuqvnvs6MiAGk9UNsBostyBOB0Is9wb5uRESevA6rnl/rkksXaGX3GzZhPup5d6Vp1nFew==} dev: false - /prisma@4.14.0: - resolution: {integrity: sha512-+5dMl1uxMQb4RepndY6AwR9xi1cDcaGFICu+ws6/Nmgt93mFPNj8tYxSfTdmfg+rkNrUId9rk/Ac2vTgLe/oXA==} + /prisma@4.14.1: + resolution: {integrity: sha512-z6hxzTMYqT9SIKlzD08dhzsLUpxjFKKsLpp5/kBDnSqiOjtUyyl/dC5tzxLcOa3jkEHQ8+RpB/fE3w8bgNP51g==} engines: {node: '>=14.17'} hasBin: true requiresBuild: true dependencies: - '@prisma/engines': 4.14.0 + '@prisma/engines': 4.14.1 /prismjs@1.27.0: resolution: {integrity: sha512-t13BGPUlFDR7wRB5kQDG4jjl7XeuH6jbJGt11JHPL96qwsEHNX2+68tFXqc1/k+/jALsbSWJKUOT/hcYAZ5LkA==} diff --git a/src/app/[locale]/(authentication)/authVerify/page.tsx b/src/app/[locale]/(authentication)/authVerify/page.tsx index b0e08dc..0bec3a7 100644 --- a/src/app/[locale]/(authentication)/authVerify/page.tsx +++ b/src/app/[locale]/(authentication)/authVerify/page.tsx @@ -1,8 +1,13 @@ +"use client"; + import * as React from "react"; +import { useTranslations } from "next-intl"; import { cn } from "@/lib"; import Logo from "@/components/logo"; const AuthVerify: React.FC = () => { + const t = useTranslations("auth"); + return (
{ )} > -
Check your email
-
A sign in link has been sent to your email address.
+
{t("check-email")}
+
{t("sign-in-link")}
); diff --git a/src/components/announcement/index.tsx b/src/components/announcement/index.tsx index acdf733..0388acc 100644 --- a/src/components/announcement/index.tsx +++ b/src/components/announcement/index.tsx @@ -18,8 +18,6 @@ const Announcement: React.FC = () => { React.useEffect(() => { const announcement_version = localStorage.getItem("announcement_version"); - console.log(version, "version"); - console.log(announcement_version, "announcement_version"); if (version !== announcement_version) setOpen(true); }, []); diff --git a/src/components/auth/avatar.tsx b/src/components/auth/avatar.tsx index a8707a9..84b7cc0 100644 --- a/src/components/auth/avatar.tsx +++ b/src/components/auth/avatar.tsx @@ -78,6 +78,7 @@ const Avatar: React.FC = () => { return ( { ) : (
- +
) } diff --git a/src/components/chatSection/chatFooter/index.tsx b/src/components/chatSection/chatFooter/index.tsx index ebee631..929ffe0 100644 --- a/src/components/chatSection/chatFooter/index.tsx +++ b/src/components/chatSection/chatFooter/index.tsx @@ -1,6 +1,7 @@ import * as React from "react"; import clsx from "clsx"; import { useTranslations } from "next-intl"; +import { useRouter } from "next/navigation"; import { v4 as uuidv4 } from "uuid"; import type { ChatItem } from "@/hooks/useChannel"; import { AiOutlineRedo, AiOutlineClear } from "react-icons/ai"; @@ -20,6 +21,7 @@ const ChatFooter: React.FC = () => { const [newOpenAI] = useOpenAI(); const [channel, setChannel] = useChannel(); const { + loadingResponseStart, loadingResponseFinish, abort: chatAbort, updateStart, @@ -31,11 +33,14 @@ const ChatFooter: React.FC = () => { // ref const inputRef = React.useRef(null); + const router = useRouter(); + const t = useTranslations("chat"); const tMenu = useTranslations("menu"); const tPrompt = useTranslations("prompt"); const tCommon = useTranslations("common"); const tRes = useTranslations("responseErr"); + const tAuth = useTranslations("auth"); const scrollToBottom = useScrollToBottom(); const { decoder } = useStreamDecoder(); @@ -104,6 +109,11 @@ const ChatFooter: React.FC = () => { scrollToBottom(); }; + const handleLogin = () => { + router.push("/login"); + toast.dismiss(); + }; + const sendToGPT = React.useCallback( (chat_list: ChatItem[]) => { const modelType: any = findChannel?.channel_model.type; @@ -172,6 +182,17 @@ const ChatFooter: React.FC = () => { if (streamRes.error === 10001) { errorMessage = tRes("10001"); + return toast( + (t) => ( +
+ {errorMessage} + +
+ ), + { duration: 4000 } + ); } else if (streamRes.error === 10002) { errorMessage = tRes("10002"); } else if (streamRes.error === 10003) { @@ -225,7 +246,8 @@ const ChatFooter: React.FC = () => { // get gpt title if (!channel_name) getChannelNameByGPT(channel_id, channel_chat_list); }) - .catch(() => { + .catch((error) => { + console.log(error, "error"); updateStart(false); updateFinish(false); }); @@ -307,6 +329,14 @@ const ChatFooter: React.FC = () => { }; React.useEffect(() => { + // Cancel response immediately when switching channels if data is being requested or generated. + if (loadingResponseStart || loadingResponseFinish) { + toast.error(t("canceled")); + chatAbort?.abort(); + updateStart(false); + updateFinish(false); + return; + } setInputValue(""); inputRef.current?.reset(); if (!isMobile()) inputRef.current?.focus(); diff --git a/src/components/ui/Dropdown/index.tsx b/src/components/ui/Dropdown/index.tsx index ef5cfa9..65b694a 100644 --- a/src/components/ui/Dropdown/index.tsx +++ b/src/components/ui/Dropdown/index.tsx @@ -12,7 +12,8 @@ export interface IDropdownItems { type?: string; } -interface IDropdownMenuProps { +interface IDropdownMenuProps + extends Omit, "content"> { /** A ReactNode that open the AlertDialog */ trigger: React.ReactNode; @@ -33,6 +34,7 @@ interface IDropdownMenuProps { const LDropdownMenu = React.forwardRef( ( { + className, trigger, align = "center", selectable = false, @@ -52,7 +54,8 @@ const LDropdownMenu = React.forwardRef( className={cn( "z-[2000] bg-white border rounded-lg p-1", "data-[side=top]:animate-fadeInUp data-[side=bottom]:animate-fadeInDown data-[state=closed]:animate-fadeOut", - "dark:bg-slate-800 dark:border-slate-200/30" + "dark:bg-slate-800 dark:border-slate-200/30", + className )} > {!!content && ( diff --git a/src/hooks/useStream.ts b/src/hooks/useStream.ts index 35a4266..fff3e4f 100644 --- a/src/hooks/useStream.ts +++ b/src/hooks/useStream.ts @@ -46,28 +46,32 @@ const useStreamDecoder = () => { }; return new Promise(async (resolve) => { - while (!decoderDone) { - const { done, value } = await reader.read(); - decoderDone = done; - const fragment = textDecoder.decode(value); - const checkIsError = checkFragmentError(fragment); - if (checkIsError) { - decoderDone = true; - return errHandler(checkIsError); - } - const check1 = checkFragment(fragment); - if (!check1) { - errorFragment += fragment; - const check2 = checkFragment(errorFragment); - if (check2) { - handleFragment(errorFragment); - errorFragment = ""; + try { + while (!decoderDone) { + const { done, value } = await reader.read(); + decoderDone = done; + const fragment = textDecoder.decode(value); + const checkIsError = checkFragmentError(fragment); + if (checkIsError) { + decoderDone = true; + return errHandler(checkIsError); + } + const check1 = checkFragment(fragment); + if (!check1) { + errorFragment += fragment; + const check2 = checkFragment(errorFragment); + if (check2) { + handleFragment(errorFragment); + errorFragment = ""; + } + } else { + if (errorFragment) errorFragment = ""; + handleFragment(fragment); } - } else { - if (errorFragment) errorFragment = ""; - handleFragment(fragment); + if (decoderDone) resolve(true); } - if (decoderDone) resolve(true); + } catch (error) { + console.log(error, "stream error"); } }); }; diff --git a/src/locales/en.json b/src/locales/en.json index b1d625a..a23f0ba 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -18,6 +18,7 @@ "auth-failed": "Authentication failed", "auth-success": "Authentication success", "button-text": "Login / Sign up", + "check-email": "Check your email", "configuration": "Server error", "configuration-1": "There is a problem with the server configuration.", "configuration-2": "Check the server logs for more information.", @@ -29,6 +30,7 @@ "log-out": "Log Out", "return-to-home-page": "Return to home page", "sign-in": "Sign in", + "sign-in-link": "A sign in link has been sent to your email address.", "title": "Login/Sign up to L-GPT", "verification": "Unable to sign in", "verification-1": "The sign in link is no longer valid.", diff --git a/src/locales/zh-CN.json b/src/locales/zh-CN.json index b8746ea..fdcb1ca 100644 --- a/src/locales/zh-CN.json +++ b/src/locales/zh-CN.json @@ -18,6 +18,7 @@ "auth-failed": "验证失败", "auth-success": "验证成功", "button-text": "登录 / 注册", + "check-email": "检查您的邮箱", "configuration": "服务错误", "configuration-1": "服务器配置有误。", "configuration-2": "查看服务器日志获取更多信息。", @@ -29,6 +30,7 @@ "log-out": "退出登录", "return-to-home-page": "返回首页", "sign-in": "登录", + "sign-in-link": "一个登录链接已经发送到您的电子邮件地址。", "title": "登录/注册 L-GPT", "verification": "无法登录", "verification-1": "登录链接已失效。",