From 7a0b437626a238c3d01d910fd5cd23c302562d85 Mon Sep 17 00:00:00 2001 From: yuanliang feng <10550655+fyl080801@users.noreply.github.com> Date: Mon, 10 Jul 2023 17:26:28 +0800 Subject: [PATCH 01/36] Update common.ts --- app/api/common.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/app/api/common.ts b/app/api/common.ts index 30d5e0daf..3bfe208b4 100644 --- a/app/api/common.ts +++ b/app/api/common.ts @@ -40,7 +40,6 @@ export async function requestOpenai(req: NextRequest) { "OpenAI-Organization": process.env.OPENAI_ORG_ID, }), }, - cache: "no-store", method: req.method, body: req.body, // @ts-ignore From c74552c4c58e8e5342e2481612109591c8684d48 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jul 2023 10:46:56 +0000 Subject: [PATCH 02/36] chore(deps): bump react-router-dom from 6.10.0 to 6.14.1 Bumps [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom) from 6.10.0 to 6.14.1. - [Release notes](https://github.com/remix-run/react-router/releases) - [Changelog](https://github.com/remix-run/react-router/blob/main/packages/react-router-dom/CHANGELOG.md) - [Commits](https://github.com/remix-run/react-router/commits/react-router-dom@6.14.1/packages/react-router-dom) --- updated-dependencies: - dependency-name: react-router-dom dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package.json | 2 +- yarn.lock | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 20b76a44f..db7b1ce42 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-markdown": "^8.0.7", - "react-router-dom": "^6.10.0", + "react-router-dom": "^6.14.1", "rehype-highlight": "^6.0.0", "rehype-katex": "^6.0.3", "remark-breaks": "^3.0.2", diff --git a/yarn.lock b/yarn.lock index 1c76bd4e6..fa1e7b818 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1216,10 +1216,10 @@ tiny-glob "^0.2.9" tslib "^2.4.0" -"@remix-run/router@1.5.0": - version "1.5.0" - resolved "https://registry.npmmirror.com/@remix-run/router/-/router-1.5.0.tgz#57618e57942a5f0131374a9fdb0167e25a117fdc" - integrity sha512-bkUDCp8o1MvFO+qxkODcbhSqRa6P2GXgrGZVpt0dCXNW2HCSCqYI0ZoAqEOSAjRWmmlKcYgFvN4B4S+zo/f8kg== +"@remix-run/router@1.7.1": + version "1.7.1" + resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.7.1.tgz#fea7ac35ae4014637c130011f59428f618730498" + integrity sha512-bgVQM4ZJ2u2CM8k1ey70o1ePFXsEzYVZoWghh6WjM8p59jQ7HxzbHW4SbnWFG7V9ig9chLawQxDTZ3xzOF8MkQ== "@rushstack/eslint-patch@^1.1.3": version "1.2.0" @@ -5039,20 +5039,20 @@ react-redux@^8.1.1: react-is "^18.0.0" use-sync-external-store "^1.0.0" -react-router-dom@^6.10.0: - version "6.10.0" - resolved "https://registry.npmmirror.com/react-router-dom/-/react-router-dom-6.10.0.tgz#090ddc5c84dc41b583ce08468c4007c84245f61f" - integrity sha512-E5dfxRPuXKJqzwSe/qGcqdwa18QiWC6f3H3cWXM24qj4N0/beCIf/CWTipop2xm7mR0RCS99NnaqPNjHtrAzCg== +react-router-dom@^6.14.1: + version "6.14.1" + resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.14.1.tgz#0ad7ba7abdf75baa61169d49f096f0494907a36f" + integrity sha512-ssF6M5UkQjHK70fgukCJyjlda0Dgono2QGwqGvuk7D+EDGHdacEN3Yke2LTMjkrpHuFwBfDFsEjGVXBDmL+bWw== dependencies: - "@remix-run/router" "1.5.0" - react-router "6.10.0" + "@remix-run/router" "1.7.1" + react-router "6.14.1" -react-router@6.10.0: - version "6.10.0" - resolved "https://registry.npmmirror.com/react-router/-/react-router-6.10.0.tgz#230f824fde9dd0270781b5cb497912de32c0a971" - integrity sha512-Nrg0BWpQqrC3ZFFkyewrflCud9dio9ME3ojHCF/WLsprJVzkq3q3UeEhMCAW1dobjeGbWgjNn/PVF6m46ANxXQ== +react-router@6.14.1: + version "6.14.1" + resolved "https://registry.yarnpkg.com/react-router/-/react-router-6.14.1.tgz#5e82bcdabf21add859dc04b1859f91066b3a5810" + integrity sha512-U4PfgvG55LdvbQjg5Y9QRWyVxIdO1LlpYT7x+tMAxd9/vmiPuJhIwdxZuIQLN/9e3O4KFDHYfR9gzGeYMasW8g== dependencies: - "@remix-run/router" "1.5.0" + "@remix-run/router" "1.7.1" react@^18.2.0: version "18.2.0" From a7764dc6d559d98cad8cafe82dfd05618a3ca591 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jul 2023 10:47:33 +0000 Subject: [PATCH 03/36] chore(deps-dev): bump eslint from 8.37.0 to 8.44.0 Bumps [eslint](https://github.com/eslint/eslint) from 8.37.0 to 8.44.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.37.0...v8.44.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package.json | 2 +- yarn.lock | 120 ++++++++++++++++++++++++--------------------------- 2 files changed, 58 insertions(+), 64 deletions(-) diff --git a/package.json b/package.json index 20b76a44f..e4374f346 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "@types/react-katex": "^3.0.0", "@types/spark-md5": "^3.0.2", "cross-env": "^7.0.3", - "eslint": "^8.36.0", + "eslint": "^8.44.0", "eslint-config-next": "13.2.3", "eslint-config-prettier": "^8.8.0", "eslint-plugin-prettier": "^4.2.1", diff --git a/yarn.lock b/yarn.lock index 1c76bd4e6..69d862f09 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,11 @@ # yarn lockfile v1 +"@aashutoshrathi/word-wrap@^1.2.3": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" + integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== + "@ampproject/remapping@^2.2.0": version "2.2.0" resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.0.tgz#56c133824780de3174aed5ab6834f3026790154d" @@ -1012,14 +1017,14 @@ resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.5.0.tgz#f6f729b02feee2c749f57e334b7a1b5f40a81724" integrity sha512-vITaYzIcNmjn5tF5uxcZ/ft7/RXGrMUIS9HalWckEOF6ESiwXKoMzAQf2UW0aVd6rnOeExTJVd5hmWXucBKGXQ== -"@eslint/eslintrc@^2.0.2": - version "2.0.2" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.0.2.tgz#01575e38707add677cf73ca1589abba8da899a02" - integrity sha512-3W4f5tDUra+pA+FzgugqL2pRimUTDJWKr7BINqOpkZrC0uYI0NIc0/JFgBROCU07HR6GieA5m3/rsPIhDmCXTQ== +"@eslint/eslintrc@^2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.0.tgz#82256f164cc9e0b59669efc19d57f8092706841d" + integrity sha512-Lj7DECXqIVCqnqjjHMPna4vn6GJcMgul/wuS0je9OZ9gsL0zzDpKPVtcG1HaDVc+9y+qgXneTeUMbCqXJNpH1A== dependencies: ajv "^6.12.4" debug "^4.3.2" - espree "^9.5.1" + espree "^9.6.0" globals "^13.19.0" ignore "^5.2.0" import-fresh "^3.2.1" @@ -1027,10 +1032,10 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@8.37.0": - version "8.37.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.37.0.tgz#cf1b5fa24217fe007f6487a26d765274925efa7d" - integrity sha512-x5vzdtOOGgFVDCUs81QRB2+liax8rFg3+7hqM+QhBG0/G3F1ZsoYl97UrqgHgQ9KKT7G6c4V+aTUCgu/n22v1A== +"@eslint/js@8.44.0": + version "8.44.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.44.0.tgz#961a5903c74139390478bdc808bcde3fc45ab7af" + integrity sha512-Ag+9YM4ocKQx9AarydN0KY2j0ErMHNIocPDrVo8zAE44xLTjEtz81OdR68/cydGtk6m6jDb5Za3r2useMzYmSw== "@fortaine/fetch-event-source@^3.0.6": version "3.0.6" @@ -1050,10 +1055,10 @@ redux "^4.2.1" use-memo-one "^1.1.3" -"@humanwhocodes/config-array@^0.11.8": - version "0.11.8" - resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.8.tgz#03595ac2075a4dc0f191cc2131de14fbd7d410b9" - integrity sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g== +"@humanwhocodes/config-array@^0.11.10": + version "0.11.10" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.10.tgz#5a3ffe32cc9306365fb3fd572596cd602d5e12d2" + integrity sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ== dependencies: "@humanwhocodes/object-schema" "^1.2.1" debug "^4.1.1" @@ -1732,10 +1737,10 @@ acorn@^8.7.1, acorn@^8.8.2: resolved "https://registry.npmmirror.com/acorn/-/acorn-8.9.0.tgz#78a16e3b2bcc198c10822786fa6679e245db5b59" integrity sha512-jaVNAFBHNLXspO543WnNNPZFRtavh3skAkITqD0/2aeMkKZTN+254PyhwxFYrk3vQ1xfY+2wbesJMs/JC8/PwQ== -acorn@^8.8.0: - version "8.8.2" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a" - integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw== +acorn@^8.9.0: + version "8.10.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5" + integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw== aggregate-error@^3.0.0: version "3.1.0" @@ -2999,29 +3004,29 @@ eslint-scope@5.1.1: esrecurse "^4.3.0" estraverse "^4.1.1" -eslint-scope@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.1.1.tgz#fff34894c2f65e5226d3041ac480b4513a163642" - integrity sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw== +eslint-scope@^7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.0.tgz#f21ebdafda02352f103634b96dd47d9f81ca117b" + integrity sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw== dependencies: esrecurse "^4.3.0" estraverse "^5.2.0" -eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz#c7f0f956124ce677047ddbc192a68f999454dedc" - integrity sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ== +eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1: + version "3.4.1" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz#c22c48f48942d08ca824cc526211ae400478a994" + integrity sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA== -eslint@^8.36.0: - version "8.37.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.37.0.tgz#1f660ef2ce49a0bfdec0b0d698e0b8b627287412" - integrity sha512-NU3Ps9nI05GUoVMxcZx1J8CNR6xOvUT4jAUMH5+z8lpp3aEdPVCImKw6PWG4PY+Vfkpr+jvMpxs/qoE7wq0sPw== +eslint@^8.44.0: + version "8.44.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.44.0.tgz#51246e3889b259bbcd1d7d736a0c10add4f0e500" + integrity sha512-0wpHoUbDUHgNCyvFB5aXLiQVfK9B0at6gUvzy83k4kAsQ/u769TQDX6iKC+aO4upIHO9WSaA3QoXYQDHbNwf1A== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@eslint-community/regexpp" "^4.4.0" - "@eslint/eslintrc" "^2.0.2" - "@eslint/js" "8.37.0" - "@humanwhocodes/config-array" "^0.11.8" + "@eslint/eslintrc" "^2.1.0" + "@eslint/js" "8.44.0" + "@humanwhocodes/config-array" "^0.11.10" "@humanwhocodes/module-importer" "^1.0.1" "@nodelib/fs.walk" "^1.2.8" ajv "^6.10.0" @@ -3030,9 +3035,9 @@ eslint@^8.36.0: debug "^4.3.2" doctrine "^3.0.0" escape-string-regexp "^4.0.0" - eslint-scope "^7.1.1" - eslint-visitor-keys "^3.4.0" - espree "^9.5.1" + eslint-scope "^7.2.0" + eslint-visitor-keys "^3.4.1" + espree "^9.6.0" esquery "^1.4.2" esutils "^2.0.2" fast-deep-equal "^3.1.3" @@ -3040,32 +3045,31 @@ eslint@^8.36.0: find-up "^5.0.0" glob-parent "^6.0.2" globals "^13.19.0" - grapheme-splitter "^1.0.4" + graphemer "^1.4.0" ignore "^5.2.0" import-fresh "^3.0.0" imurmurhash "^0.1.4" is-glob "^4.0.0" is-path-inside "^3.0.3" - js-sdsl "^4.1.4" js-yaml "^4.1.0" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.4.1" lodash.merge "^4.6.2" minimatch "^3.1.2" natural-compare "^1.4.0" - optionator "^0.9.1" + optionator "^0.9.3" strip-ansi "^6.0.1" strip-json-comments "^3.1.0" text-table "^0.2.0" -espree@^9.5.1: - version "9.5.1" - resolved "https://registry.yarnpkg.com/espree/-/espree-9.5.1.tgz#4f26a4d5f18905bf4f2e0bd99002aab807e96dd4" - integrity sha512-5yxtHSZXRSW5pvv3hAlXM5+/Oswi1AUFqBmbibKb5s6bp3rGIDkyXU6xCoyuuLhijr4SFwPrXRoZjz0AZDN9tg== +espree@^9.6.0: + version "9.6.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.0.tgz#80869754b1c6560f32e3b6929194a3fe07c5b82f" + integrity sha512-1FH/IiruXZ84tpUlm0aCUEwMl2Ho5ilqVh0VvQXw+byAz/4SAciyHLlfmL5WYqsvD38oymdUwBss0LtK8m4s/A== dependencies: - acorn "^8.8.0" + acorn "^8.9.0" acorn-jsx "^5.3.2" - eslint-visitor-keys "^3.4.0" + eslint-visitor-keys "^3.4.1" esquery@^1.4.2: version "1.5.0" @@ -3402,10 +3406,10 @@ graceful-fs@^4.1.2, graceful-fs@^4.2.4, graceful-fs@^4.2.9: resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== -grapheme-splitter@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e" - integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ== +graphemer@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" + integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== has-bigints@^1.0.1, has-bigints@^1.0.2: version "1.0.2" @@ -3858,11 +3862,6 @@ jest-worker@^27.4.5: merge-stream "^2.0.0" supports-color "^8.0.0" -js-sdsl@^4.1.4: - version "4.4.0" - resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.4.0.tgz#8b437dbe642daa95760400b602378ed8ffea8430" - integrity sha512-FfVSdx6pJ41Oa+CF7RDaFmTnCaFhua+SNYQX74riGOpl96x+2jQCqEfQ2bnXu/5DPCqlRuiqyvTJM0Qjz26IVg== - "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" @@ -4824,17 +4823,17 @@ open@^8.4.0: is-docker "^2.1.1" is-wsl "^2.2.0" -optionator@^0.9.1: - version "0.9.1" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499" - integrity sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw== +optionator@^0.9.3: + version "0.9.3" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64" + integrity sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg== dependencies: + "@aashutoshrathi/word-wrap" "^1.2.3" deep-is "^0.1.3" fast-levenshtein "^2.0.6" levn "^0.4.1" prelude-ls "^1.2.1" type-check "^0.4.0" - word-wrap "^1.2.3" p-limit@^3.0.2: version "3.1.0" @@ -6027,11 +6026,6 @@ which@^2.0.1: dependencies: isexe "^2.0.0" -word-wrap@^1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" - integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== - wrap-ansi@^6.2.0: version "6.2.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" From 38e92cfc62d1abf3a51d9120bb4c9c59ab438e34 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jul 2023 10:47:57 +0000 Subject: [PATCH 04/36] chore(deps-dev): bump @types/react from 18.2.12 to 18.2.14 Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 18.2.12 to 18.2.14. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react) --- updated-dependencies: - dependency-name: "@types/react" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 20b76a44f..56b9f9d2f 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "devDependencies": { "@tauri-apps/cli": "^1.3.1", "@types/node": "^20.3.3", - "@types/react": "^18.2.12", + "@types/react": "^18.2.14", "@types/react-dom": "^18.0.11", "@types/react-katex": "^3.0.0", "@types/spark-md5": "^3.0.2", diff --git a/yarn.lock b/yarn.lock index 1c76bd4e6..c431aacae 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1508,10 +1508,10 @@ dependencies: "@types/react" "*" -"@types/react@*", "@types/react@^18.2.12": - version "18.2.12" - resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.12.tgz#95d584338610b78bb9ba0415e3180fb03debdf97" - integrity sha512-ndmBMLCgn38v3SntMeoJaIrO6tGHYKMEBohCUmw8HoLLQdRMOIGXfeYaBTLe2lsFaSB3MOK1VXscYFnmLtTSmw== +"@types/react@*", "@types/react@^18.2.14": + version "18.2.14" + resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.14.tgz#fa7a6fecf1ce35ca94e74874f70c56ce88f7a127" + integrity sha512-A0zjq+QN/O0Kpe30hA1GidzyFjatVvrpIvWLxD+xv67Vt91TWWgco9IvrJBkeyHm1trGaFS/FSGqPlhyeZRm0g== dependencies: "@types/prop-types" "*" "@types/scheduler" "*" From cbce8b444f8d91212a9427aae2ef10aa1bc38af5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jul 2023 10:48:41 +0000 Subject: [PATCH 05/36] chore(deps-dev): bump @tauri-apps/cli from 1.3.1 to 1.4.0 Bumps [@tauri-apps/cli](https://github.com/tauri-apps/tauri) from 1.3.1 to 1.4.0. - [Release notes](https://github.com/tauri-apps/tauri/releases) - [Commits](https://github.com/tauri-apps/tauri/compare/cli.js-v1.3.1...@tauri-apps/cli-v1.4.0) --- updated-dependencies: - dependency-name: "@tauri-apps/cli" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package.json | 2 +- yarn.lock | 104 +++++++++++++++++++++++++++------------------------ 2 files changed, 56 insertions(+), 50 deletions(-) diff --git a/package.json b/package.json index 20b76a44f..c98c5bfd4 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "zustand": "^4.3.8" }, "devDependencies": { - "@tauri-apps/cli": "^1.3.1", + "@tauri-apps/cli": "^1.4.0", "@types/node": "^20.3.3", "@types/react": "^18.2.12", "@types/react-dom": "^18.0.11", diff --git a/yarn.lock b/yarn.lock index 1c76bd4e6..084ed6a44 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1339,65 +1339,71 @@ dependencies: tslib "^2.4.0" -"@tauri-apps/cli-darwin-arm64@1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@tauri-apps/cli-darwin-arm64/-/cli-darwin-arm64-1.3.1.tgz#ef0fe290e0a6e3e53fa2cc4f1a72a0c87921427c" - integrity sha512-QlepYVPgOgspcwA/u4kGG4ZUijlXfdRtno00zEy+LxinN/IRXtk+6ErVtsmoLi1ZC9WbuMwzAcsRvqsD+RtNAg== +"@tauri-apps/cli-darwin-arm64@1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@tauri-apps/cli-darwin-arm64/-/cli-darwin-arm64-1.4.0.tgz#e76bb8515ae31f03f2cbd440c1a09b237a79b3ac" + integrity sha512-nA/ml0SfUt6/CYLVbHmT500Y+ijqsuv5+s9EBnVXYSLVg9kbPUZJJHluEYK+xKuOj6xzyuT/+rZFMRapmJD3jQ== -"@tauri-apps/cli-darwin-x64@1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@tauri-apps/cli-darwin-x64/-/cli-darwin-x64-1.3.1.tgz#4c84ea0f08a5b636b067943d637a38e091a4aad3" - integrity sha512-fKcAUPVFO3jfDKXCSDGY0MhZFF/wDtx3rgFnogWYu4knk38o9RaqRkvMvqJhLYPuWaEM5h6/z1dRrr9KKCbrVg== +"@tauri-apps/cli-darwin-x64@1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@tauri-apps/cli-darwin-x64/-/cli-darwin-x64-1.4.0.tgz#dd1472460550d0aa0ec6e699b073be2d77e5b962" + integrity sha512-ov/F6Zr+dg9B0PtRu65stFo2G0ow2TUlneqYYrkj+vA3n+moWDHfVty0raDjMLQbQt3rv3uayFMXGPMgble9OA== -"@tauri-apps/cli-linux-arm-gnueabihf@1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-arm-gnueabihf/-/cli-linux-arm-gnueabihf-1.3.1.tgz#a4f1b237189e4f8f89cc890e1dc2eec76d4345be" - integrity sha512-+4H0dv8ltJHYu/Ma1h9ixUPUWka9EjaYa8nJfiMsdCI4LJLNE6cPveE7RmhZ59v9GW1XB108/k083JUC/OtGvA== +"@tauri-apps/cli-linux-arm-gnueabihf@1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-arm-gnueabihf/-/cli-linux-arm-gnueabihf-1.4.0.tgz#325e90e47d260ba71a499850ce769b5a6bdfd48d" + integrity sha512-zwjbiMncycXDV7doovymyKD7sCg53ouAmfgpUqEBOTY3vgBi9TwijyPhJOqoG5vUVWhouNBC08akGmE4dja15g== -"@tauri-apps/cli-linux-arm64-gnu@1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-1.3.1.tgz#e2391326b64dfe13c7442bdcc13c4988ce5e6df9" - integrity sha512-Pj3odVO1JAxLjYmoXKxcrpj/tPxcA8UP8N06finhNtBtBaxAjrjjxKjO4968KB0BUH7AASIss9EL4Tr0FGnDuw== +"@tauri-apps/cli-linux-arm64-gnu@1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-1.4.0.tgz#b5d8f5cba3f8f7c7d44d071681f0ab0a37f2c46e" + integrity sha512-5MCBcziqXC72mMXnkZU68mutXIR6zavDxopArE2gQtK841IlE06bIgtLi0kUUhlFJk2nhPRgiDgdLbrPlyt7fw== -"@tauri-apps/cli-linux-arm64-musl@1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.3.1.tgz#49354349f80f879ffc6950c0c03c0aea1395efa5" - integrity sha512-tA0JdDLPFaj42UDIVcF2t8V0tSha40rppcmAR/MfQpTCxih6399iMjwihz9kZE1n4b5O4KTq9GliYo50a8zYlQ== +"@tauri-apps/cli-linux-arm64-musl@1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.4.0.tgz#f805ab2ee415875900f4b456f17dc4900d2a7911" + integrity sha512-7J3pRB6n6uNYgIfCeKt2Oz8J7oSaz2s8GGFRRH2HPxuTHrBNCinzVYm68UhVpJrL3bnGkU0ziVZLsW/iaOGfUg== -"@tauri-apps/cli-linux-x64-gnu@1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-1.3.1.tgz#9a33ffe9e0d9b1b3825db57cbcfcddeb773682c6" - integrity sha512-FDU+Mnvk6NLkqQimcNojdKpMN4Y3W51+SQl+NqG9AFCWprCcSg62yRb84751ujZuf2MGT8HQOfmd0i77F4Q3tQ== +"@tauri-apps/cli-linux-x64-gnu@1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-1.4.0.tgz#d3f5e69c22420c7ac9e4021b7a94bce2e48cb45d" + integrity sha512-Zh5gfAJxOv5AVWxcwuueaQ2vIAhlg0d6nZui6nMyfIJ8dbf3aZQ5ZzP38sYow5h/fbvgL+3GSQxZRBIa3c2E1w== -"@tauri-apps/cli-linux-x64-musl@1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-1.3.1.tgz#5283731e894c17bc070c499e73145cfe2633ef21" - integrity sha512-MpO3akXFmK8lZYEbyQRDfhdxz1JkTBhonVuz5rRqxwA7gnGWHa1aF1+/2zsy7ahjB2tQ9x8DDFDMdVE20o9HrA== +"@tauri-apps/cli-linux-x64-musl@1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-1.4.0.tgz#2e7f718272ffdd9ace80f57a35023ba0c74767ad" + integrity sha512-OLAYoICU3FaYiTdBsI+lQTKnDHeMmFMXIApN0M+xGiOkoIOQcV9CConMPjgmJQ867+NHRNgUGlvBEAh9CiJodQ== -"@tauri-apps/cli-win32-ia32-msvc@1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@tauri-apps/cli-win32-ia32-msvc/-/cli-win32-ia32-msvc-1.3.1.tgz#f31538abfd94f27ade1f17d01f30da6be1660c6f" - integrity sha512-9Boeo3K5sOrSBAZBuYyGkpV2RfnGQz3ZhGJt4hE6P+HxRd62lS6+qDKAiw1GmkZ0l1drc2INWrNeT50gwOKwIQ== +"@tauri-apps/cli-win32-arm64-msvc@1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@tauri-apps/cli-win32-arm64-msvc/-/cli-win32-arm64-msvc-1.4.0.tgz#85cdb52a06feb92da785def4d02512099464525e" + integrity sha512-gZ05GENFbI6CB5MlOUsLlU0kZ9UtHn9riYtSXKT6MYs8HSPRffPHaHSL0WxsJweWh9nR5Hgh/TUU8uW3sYCzCg== -"@tauri-apps/cli-win32-x64-msvc@1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-1.3.1.tgz#1eb09d55b99916a3cd84cb91c75ef906db67d35d" - integrity sha512-wMrTo91hUu5CdpbElrOmcZEoJR4aooTG+fbtcc87SMyPGQy1Ux62b+ZdwLvL1sVTxnIm//7v6QLRIWGiUjCPwA== +"@tauri-apps/cli-win32-ia32-msvc@1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@tauri-apps/cli-win32-ia32-msvc/-/cli-win32-ia32-msvc-1.4.0.tgz#0b7c921204058215aec9a5a00f735e73909bd330" + integrity sha512-JsetT/lTx/Zq98eo8T5CiRyF1nKeX04RO8JlJrI3ZOYsZpp/A5RJvMd/szQ17iOzwiHdge+tx7k2jHysR6oBlQ== -"@tauri-apps/cli@^1.3.1": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@tauri-apps/cli/-/cli-1.3.1.tgz#4c5259bf1f9c97084dd016e6b34dca53de380e24" - integrity sha512-o4I0JujdITsVRm3/0spfJX7FcKYrYV1DXJqzlWIn6IY25/RltjU6qbC1TPgVww3RsRX63jyVUTcWpj5wwFl+EQ== +"@tauri-apps/cli-win32-x64-msvc@1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-1.4.0.tgz#23abe3f08c0df89111c29602f91c21a23577b908" + integrity sha512-z8Olcnwp5aYhzqUAarFjqF+oELCjuYWnB2HAJHlfsYNfDCAORY5kct3Fklz8PSsubC3U2EugWn8n42DwnThurg== + +"@tauri-apps/cli@^1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@tauri-apps/cli/-/cli-1.4.0.tgz#72732ae61e6b7d097e44a8a2ef5f211b2d01d98b" + integrity sha512-VXYr2i2iVFl98etQSQsqLzXgX96bnWiNZd1YADgatqwy/qecbd6Kl5ZAPB5R4ynsgE8A1gU7Fbzh7dCEQYFfmA== optionalDependencies: - "@tauri-apps/cli-darwin-arm64" "1.3.1" - "@tauri-apps/cli-darwin-x64" "1.3.1" - "@tauri-apps/cli-linux-arm-gnueabihf" "1.3.1" - "@tauri-apps/cli-linux-arm64-gnu" "1.3.1" - "@tauri-apps/cli-linux-arm64-musl" "1.3.1" - "@tauri-apps/cli-linux-x64-gnu" "1.3.1" - "@tauri-apps/cli-linux-x64-musl" "1.3.1" - "@tauri-apps/cli-win32-ia32-msvc" "1.3.1" - "@tauri-apps/cli-win32-x64-msvc" "1.3.1" + "@tauri-apps/cli-darwin-arm64" "1.4.0" + "@tauri-apps/cli-darwin-x64" "1.4.0" + "@tauri-apps/cli-linux-arm-gnueabihf" "1.4.0" + "@tauri-apps/cli-linux-arm64-gnu" "1.4.0" + "@tauri-apps/cli-linux-arm64-musl" "1.4.0" + "@tauri-apps/cli-linux-x64-gnu" "1.4.0" + "@tauri-apps/cli-linux-x64-musl" "1.4.0" + "@tauri-apps/cli-win32-arm64-msvc" "1.4.0" + "@tauri-apps/cli-win32-ia32-msvc" "1.4.0" + "@tauri-apps/cli-win32-x64-msvc" "1.4.0" "@trysound/sax@0.2.0": version "0.2.0" From b182543a21d590203847f28bc4876a63c8d4aef4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jul 2023 10:51:20 +0000 Subject: [PATCH 06/36] chore(deps): bump next from 13.4.6 to 13.4.9 Bumps [next](https://github.com/vercel/next.js) from 13.4.6 to 13.4.9. - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](https://github.com/vercel/next.js/compare/v13.4.6...v13.4.9) --- updated-dependencies: - dependency-name: next dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package.json | 2 +- yarn.lock | 115 ++++++++++++++++++++++++--------------------------- 2 files changed, 56 insertions(+), 61 deletions(-) diff --git a/package.json b/package.json index 20b76a44f..d716bf3ea 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "html-to-image": "^1.11.11", "mermaid": "^10.2.3", "nanoid": "^4.0.2", - "next": "^13.4.6", + "next": "^13.4.9", "node-fetch": "^3.3.1", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/yarn.lock b/yarn.lock index 1c76bd4e6..48c0438a4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1126,10 +1126,10 @@ "@jridgewell/resolve-uri" "3.1.0" "@jridgewell/sourcemap-codec" "1.4.14" -"@next/env@13.4.6": - version "13.4.6" - resolved "https://registry.yarnpkg.com/@next/env/-/env-13.4.6.tgz#3f2041c7758660d7255707ae4cb9166519113dea" - integrity sha512-nqUxEtvDqFhmV1/awSg0K2XHNwkftNaiUqCYO9e6+MYmqNObpKVl7OgMkGaQ2SZnFx5YqF0t60ZJTlyJIDAijg== +"@next/env@13.4.9": + version "13.4.9" + resolved "https://registry.yarnpkg.com/@next/env/-/env-13.4.9.tgz#b77759514dd56bfa9791770755a2482f4d6ca93e" + integrity sha512-vuDRK05BOKfmoBYLNi2cujG2jrYbEod/ubSSyqgmEx9n/W3eZaJQdRNhTfumO+qmq/QTzLurW487n/PM/fHOkw== "@next/eslint-plugin-next@13.2.3": version "13.2.3" @@ -1138,50 +1138,50 @@ dependencies: glob "7.1.7" -"@next/swc-darwin-arm64@13.4.6": - version "13.4.6" - resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.6.tgz#47485f3deaee6681b4a4036c74bb9c4b728d5ddd" - integrity sha512-ahi6VP98o4HV19rkOXPSUu+ovfHfUxbJQ7VVJ7gL2FnZRr7onEFC1oGQ6NQHpm8CxpIzSSBW79kumlFMOmZVjg== +"@next/swc-darwin-arm64@13.4.9": + version "13.4.9" + resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.9.tgz#0ed408d444bbc6b0a20f3506a9b4222684585677" + integrity sha512-TVzGHpZoVBk3iDsTOQA/R6MGmFp0+17SWXMEWd6zG30AfuELmSSMe2SdPqxwXU0gbpWkJL1KgfLzy5ReN0crqQ== -"@next/swc-darwin-x64@13.4.6": - version "13.4.6" - resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.6.tgz#a6a5b232ec0f2079224fb8ed6bf11dc479af1acf" - integrity sha512-13cXxKFsPJIJKzUqrU5XB1mc0xbUgYsRcdH6/rB8c4NMEbWGdtD4QoK9ShN31TZdePpD4k416Ur7p+deMIxnnA== +"@next/swc-darwin-x64@13.4.9": + version "13.4.9" + resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.9.tgz#a08fccdee68201522fe6618ec81f832084b222f8" + integrity sha512-aSfF1fhv28N2e7vrDZ6zOQ+IIthocfaxuMWGReB5GDriF0caTqtHttAvzOMgJgXQtQx6XhyaJMozLTSEXeNN+A== -"@next/swc-linux-arm64-gnu@13.4.6": - version "13.4.6" - resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.6.tgz#2a67144e863d9c45fdbd13c7827370e7f2a28405" - integrity sha512-Ti+NMHEjTNktCVxNjeWbYgmZvA2AqMMI2AMlzkXsU7W4pXCMhrryAmAIoo+7YdJbsx01JQWYVxGe62G6DoCLaA== +"@next/swc-linux-arm64-gnu@13.4.9": + version "13.4.9" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.9.tgz#1798c2341bb841e96521433eed00892fb24abbd1" + integrity sha512-JhKoX5ECzYoTVyIy/7KykeO4Z2lVKq7HGQqvAH+Ip9UFn1MOJkOnkPRB7v4nmzqAoY+Je05Aj5wNABR1N18DMg== -"@next/swc-linux-arm64-musl@13.4.6": - version "13.4.6" - resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.6.tgz#5a191ac3575a70598e9e9c6e7264fc0b8a90b2db" - integrity sha512-OHoC6gO7XfjstgwR+z6UHKlvhqJfyMtNaJidjx3sEcfaDwS7R2lqR5AABi8PuilGgi0BO0O0sCXqLlpp3a0emQ== +"@next/swc-linux-arm64-musl@13.4.9": + version "13.4.9" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.9.tgz#cee04c51610eddd3638ce2499205083656531ea0" + integrity sha512-OOn6zZBIVkm/4j5gkPdGn4yqQt+gmXaLaSjRSO434WplV8vo2YaBNbSHaTM9wJpZTHVDYyjzuIYVEzy9/5RVZw== -"@next/swc-linux-x64-gnu@13.4.6": - version "13.4.6" - resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.6.tgz#d38adf842a8b8f9de492454328fd32a2c53350f3" - integrity sha512-zHZxPGkUlpfNJCboUrFqwlwEX5vI9LSN70b8XEb0DYzzlrZyCyOi7hwDp/+3Urm9AB7YCAJkgR5Sp1XBVjHdfQ== +"@next/swc-linux-x64-gnu@13.4.9": + version "13.4.9" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.9.tgz#1932d0367916adbc6844b244cda1d4182bd11f7a" + integrity sha512-iA+fJXFPpW0SwGmx/pivVU+2t4zQHNOOAr5T378PfxPHY6JtjV6/0s1vlAJUdIHeVpX98CLp9k5VuKgxiRHUpg== -"@next/swc-linux-x64-musl@13.4.6": - version "13.4.6" - resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.6.tgz#74c745774358b78be7f958e7a8b7d93936cd6ebc" - integrity sha512-K/Y8lYGTwTpv5ME8PSJxwxLolaDRdVy+lOd9yMRMiQE0BLUhtxtCWC9ypV42uh9WpLjoaD0joOsB9Q6mbrSGJg== +"@next/swc-linux-x64-musl@13.4.9": + version "13.4.9" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.9.tgz#a66aa8c1383b16299b72482f6360facd5cde3c7a" + integrity sha512-rlNf2WUtMM+GAQrZ9gMNdSapkVi3koSW3a+dmBVp42lfugWVvnyzca/xJlN48/7AGx8qu62WyO0ya1ikgOxh6A== -"@next/swc-win32-arm64-msvc@13.4.6": - version "13.4.6" - resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.6.tgz#1e1e02c175573e64808fc1a7e8650e3e217f1edc" - integrity sha512-U6LtxEUrjBL2tpW+Kr1nHCSJWNeIed7U7l5o7FiKGGwGgIlFi4UHDiLI6TQ2lxi20fAU33CsruV3U0GuzMlXIw== +"@next/swc-win32-arm64-msvc@13.4.9": + version "13.4.9" + resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.9.tgz#39482ee856c867177a612a30b6861c75e0736a4a" + integrity sha512-5T9ybSugXP77nw03vlgKZxD99AFTHaX8eT1ayKYYnGO9nmYhJjRPxcjU5FyYI+TdkQgEpIcH7p/guPLPR0EbKA== -"@next/swc-win32-ia32-msvc@13.4.6": - version "13.4.6" - resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.6.tgz#2b528ae3ec7f6e727f4f0d81a1015f63da55c7a6" - integrity sha512-eEBeAqpCfhdPSlCZCayjCiyIllVqy4tcqvm1xmg3BgJG0G5ITiMM4Cw2WVeRSgWDJqQGRyyb+q8Y2ltzhXOWsQ== +"@next/swc-win32-ia32-msvc@13.4.9": + version "13.4.9" + resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.9.tgz#29db85e34b597ade1a918235d16a760a9213c190" + integrity sha512-ojZTCt1lP2ucgpoiFgrFj07uq4CZsq4crVXpLGgQfoFq00jPKRPgesuGPaz8lg1yLfvafkU3Jd1i8snKwYR3LA== -"@next/swc-win32-x64-msvc@13.4.6": - version "13.4.6" - resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.6.tgz#38620bd68267ff13e50ecd432f1822eac51382a8" - integrity sha512-OrZs94AuO3ZS5tnqlyPRNgfWvboXaDQCi5aXGve3o3C+Sj0ctMUV9+Do+0zMvvLRumR8E0PTWKvtz9n5vzIsWw== +"@next/swc-win32-x64-msvc@13.4.9": + version "13.4.9" + resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.9.tgz#0c2758164cccd61bc5a1c6cd8284fe66173e4a2b" + integrity sha512-QbT03FXRNdpuL+e9pLnu+XajZdm/TtIXVYY4lA9t+9l0fLZbHXDYEKitAqxrOj37o3Vx5ufxiRAniaIebYDCgw== "@nodelib/fs.scandir@2.1.5": version "2.1.5" @@ -2007,12 +2007,7 @@ camelcase@^6.2.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -caniuse-lite@^1.0.30001406, caniuse-lite@^1.0.30001449: - version "1.0.30001473" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001473.tgz#3859898b3cab65fc8905bb923df36ad35058153c" - integrity sha512-ewDad7+D2vlyy+E4UJuVfiBsU69IL+8oVmTuZnH5Q6CIUbxNfI50uVpRHbUPDD6SUaN2o0Lh4DhTrvLG/Tn1yg== - -caniuse-lite@^1.0.30001503: +caniuse-lite@^1.0.30001406, caniuse-lite@^1.0.30001449, caniuse-lite@^1.0.30001503: version "1.0.30001509" resolved "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001509.tgz#2b7ad5265392d6d2de25cd8776d1ab3899570d14" integrity sha512-2uDDk+TRiTX5hMcUYT/7CSyzMZxjfGu0vAUjS2g0LSD8UoXOv0LtpH4LxGMemsiPq6LCVIUjNwVM0erkOkGCDA== @@ -4654,12 +4649,12 @@ neo-async@^2.6.2: resolved "https://registry.npmmirror.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== -next@^13.4.6: - version "13.4.6" - resolved "https://registry.yarnpkg.com/next/-/next-13.4.6.tgz#ebe52f5c74d60176d45b45e73f25a51103713ea4" - integrity sha512-sjVqjxU+U2aXZnYt4Ud6CTLNNwWjdSfMgemGpIQJcN3Z7Jni9xRWbR0ie5fQzCg87aLqQVhKA2ud2gPoqJ9lGw== +next@^13.4.9: + version "13.4.9" + resolved "https://registry.yarnpkg.com/next/-/next-13.4.9.tgz#473de5997cb4c5d7a4fb195f566952a1cbffbeba" + integrity sha512-vtefFm/BWIi/eWOqf1GsmKG3cjKw1k3LjuefKRcL3iiLl3zWzFdPG3as6xtxrGO6gwTzzaO1ktL4oiHt/uvTjA== dependencies: - "@next/env" "13.4.6" + "@next/env" "13.4.9" "@swc/helpers" "0.5.1" busboy "1.6.0" caniuse-lite "^1.0.30001406" @@ -4668,15 +4663,15 @@ next@^13.4.6: watchpack "2.4.0" zod "3.21.4" optionalDependencies: - "@next/swc-darwin-arm64" "13.4.6" - "@next/swc-darwin-x64" "13.4.6" - "@next/swc-linux-arm64-gnu" "13.4.6" - "@next/swc-linux-arm64-musl" "13.4.6" - "@next/swc-linux-x64-gnu" "13.4.6" - "@next/swc-linux-x64-musl" "13.4.6" - "@next/swc-win32-arm64-msvc" "13.4.6" - "@next/swc-win32-ia32-msvc" "13.4.6" - "@next/swc-win32-x64-msvc" "13.4.6" + "@next/swc-darwin-arm64" "13.4.9" + "@next/swc-darwin-x64" "13.4.9" + "@next/swc-linux-arm64-gnu" "13.4.9" + "@next/swc-linux-arm64-musl" "13.4.9" + "@next/swc-linux-x64-gnu" "13.4.9" + "@next/swc-linux-x64-musl" "13.4.9" + "@next/swc-win32-arm64-msvc" "13.4.9" + "@next/swc-win32-ia32-msvc" "13.4.9" + "@next/swc-win32-x64-msvc" "13.4.9" node-domexception@^1.0.0: version "1.0.0" From 5e361f6748f92bdb3261097576c6ed8c38dd034f Mon Sep 17 00:00:00 2001 From: imldy Date: Mon, 10 Jul 2023 18:56:22 +0800 Subject: [PATCH 07/36] =?UTF-8?q?dev:=20=E5=A2=9E=E5=8A=A0=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E8=AE=BE=E7=BD=AE=E9=A1=B9=EF=BC=9A=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E5=90=AF=E7=94=A8=E6=B3=A8=E5=85=A5=E5=85=A8=E5=B1=80=20System?= =?UTF-8?q?=20Prompt=20=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/model-config.tsx | 16 ++++++++++++++++ app/locales/cn.ts | 5 ++++- app/store/config.ts | 7 ++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/app/components/model-config.tsx b/app/components/model-config.tsx index 9603eea0b..76866129b 100644 --- a/app/components/model-config.tsx +++ b/app/components/model-config.tsx @@ -130,6 +130,22 @@ export function ModelConfigList(props: { > + + + props.updateConfig( + (config) => + (config.enableInjectSystemPrompts = e.currentTarget.checked), + ) + } + > + + ()( }), { name: StoreKey.Config, - version: 3.5, + version: 3.6, migrate(persistedState, version) { const state = persistedState as ChatConfig; @@ -165,6 +166,10 @@ export const useAppConfig = create()( state.customModels = "claude,claude-100k"; } + if (version < 3.6) { + state.modelConfig.enableInjectSystemPrompts = true; + } + return state as any; }, }, From 1513881eed064768da907a52d76ae869d771fd09 Mon Sep 17 00:00:00 2001 From: imldy Date: Mon, 10 Jul 2023 18:57:54 +0800 Subject: [PATCH 08/36] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=BA=94=E8=AF=A5=E6=B3=A8=E5=85=A5System=20Prompt?= =?UTF-8?q?=E7=9A=84=E5=88=A4=E6=96=AD=E8=A7=84=E5=88=99=E4=B8=BA=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E8=AE=BE=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/chat.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/store/chat.ts b/app/store/chat.ts index ea2c472f4..6b403dd6a 100644 --- a/app/store/chat.ts +++ b/app/store/chat.ts @@ -387,8 +387,7 @@ export const useChatStore = create()( const contextPrompts = session.mask.context.slice(); // system prompts, to get close to OpenAI Web ChatGPT - // only will be injected if user does not use a mask or set none context prompts - const shouldInjectSystemPrompts = contextPrompts.length === 0; + const shouldInjectSystemPrompts = modelConfig.enableInjectSystemPrompts; const systemPrompts = shouldInjectSystemPrompts ? [ createMessage({ From 2930ba0457777319b05ea305956f86ebcc87a6a7 Mon Sep 17 00:00:00 2001 From: imldy Date: Mon, 10 Jul 2023 20:12:51 +0800 Subject: [PATCH 09/36] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9InjectSystemProm?= =?UTF-8?q?pts.SubTitle=E4=BD=BF=E5=85=B6=E6=9B=B4=E7=AC=A6=E5=90=88?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E8=A1=8C=E4=B8=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/locales/cn.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/locales/cn.ts b/app/locales/cn.ts index 59a620865..e60e468ae 100644 --- a/app/locales/cn.ts +++ b/app/locales/cn.ts @@ -141,7 +141,7 @@ const cn = { }, InjectSystemPrompts: { Title: "注入系统级提示信息", - SubTitle: "强制给每次请求的消息列表开头添加一个系统级提示", + SubTitle: "强制给每次请求的消息列表开头添加一个模拟 ChatGPT 的系统提示", }, InputTemplate: { Title: "用户输入预处理", From f59235bd5ac49d1da28e87ed678c7c0f0a6a90a9 Mon Sep 17 00:00:00 2001 From: imldy Date: Mon, 10 Jul 2023 20:14:10 +0800 Subject: [PATCH 10/36] =?UTF-8?q?feat:=20=E7=BF=BB=E8=AF=91InjectSystemPro?= =?UTF-8?q?mpts=E9=85=8D=E7=BD=AE=E9=A1=B9=E4=B8=BA=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/locales/ar.ts | 5 +++++ app/locales/bn.ts | 6 +++++- app/locales/cs.ts | 5 +++++ app/locales/de.ts | 5 +++++ app/locales/en.ts | 6 +++++- app/locales/es.ts | 5 +++++ app/locales/fr.ts | 5 +++++ app/locales/it.ts | 5 +++++ app/locales/jp.ts | 5 +++++ app/locales/ko.ts | 5 +++++ app/locales/no.ts | 5 +++++ app/locales/ru.ts | 5 +++++ app/locales/tr.ts | 5 +++++ app/locales/tw.ts | 4 ++++ app/locales/vi.ts | 5 +++++ 15 files changed, 74 insertions(+), 2 deletions(-) diff --git a/app/locales/ar.ts b/app/locales/ar.ts index b3b5c0216..a86b1648a 100644 --- a/app/locales/ar.ts +++ b/app/locales/ar.ts @@ -110,6 +110,11 @@ const ar: PartialLocaleType = { Title: "حجم الخط", SubTitle: "ضبط حجم الخط لمحتوى الدردشة", }, + InjectSystemPrompts: { + Title: "حقن تلميحات النظام", + SubTitle: + "قم بإضافة تلميحة نظام محاكاة ChatGPT إلى بداية قائمة الرسائل المُطلَبة في كل طلب", + }, InputTemplate: { Title: "نموذج الإدخال", SubTitle: "سيتم ملء أحدث رسالة في هذا النموذج", diff --git a/app/locales/bn.ts b/app/locales/bn.ts index 065f4276a..9eda157f5 100644 --- a/app/locales/bn.ts +++ b/app/locales/bn.ts @@ -135,7 +135,11 @@ const bn: PartialLocaleType = { Title: "ফন্ট সাইজ", SubTitle: "চ্যাট সামগ্রীর ফন্ট সাইজ সংশোধন করুন", }, - + InjectSystemPrompts: { + Title: "حقن تلميحات النظام", + SubTitle: + "قم بإضافة تلميحة نظام محاكاة ChatGPT إلى بداية قائمة الرسائل المُطلَبة في كل طلب", + }, InputTemplate: { Title: "ইনপুট টেমপ্লেট", SubTitle: "নতুনতম বার্তা এই টেমপ্লেটে পূরণ হবে", diff --git a/app/locales/cs.ts b/app/locales/cs.ts index 348e16afc..63d2c237f 100644 --- a/app/locales/cs.ts +++ b/app/locales/cs.ts @@ -71,6 +71,11 @@ const cs: PartialLocaleType = { Title: "Velikost písma", SubTitle: "Nastavení velikosti písma obsahu chatu", }, + InjectSystemPrompts: { + Title: "Vložit systémové prompty", + SubTitle: + "Vynutit přidání simulovaného systémového promptu ChatGPT na začátek seznamu zpráv každého požadavku", + }, Update: { Version: (x: string) => `Verze: ${x}`, IsLatest: "Aktuální verze", diff --git a/app/locales/de.ts b/app/locales/de.ts index d7e88cc8b..e8d4dc9c7 100644 --- a/app/locales/de.ts +++ b/app/locales/de.ts @@ -71,6 +71,11 @@ const de: PartialLocaleType = { Title: "Schriftgröße", SubTitle: "Schriftgröße des Chat-Inhalts anpassen", }, + InjectSystemPrompts: { + Title: "System-Prompts einfügen", + SubTitle: + "Erzwingt das Hinzufügen eines simulierten systemweiten Prompts von ChatGPT am Anfang der Nachrichtenliste bei jeder Anfrage", + }, Update: { Version: (x: string) => `Version: ${x}`, IsLatest: "Neueste Version", diff --git a/app/locales/en.ts b/app/locales/en.ts index f5d90fd2c..de10ee316 100644 --- a/app/locales/en.ts +++ b/app/locales/en.ts @@ -141,7 +141,11 @@ const en: LocaleType = { Title: "Font Size", SubTitle: "Adjust font size of chat content", }, - + InjectSystemPrompts: { + Title: "Inject System Prompts", + SubTitle: + "Forcefully add a simulated ChatGPT system prompt at the beginning of the message list for every request", + }, InputTemplate: { Title: "Input Template", SubTitle: "Newest message will be filled to this template", diff --git a/app/locales/es.ts b/app/locales/es.ts index 0971f05c5..5f5ffc75d 100644 --- a/app/locales/es.ts +++ b/app/locales/es.ts @@ -71,6 +71,11 @@ const es: PartialLocaleType = { Title: "Tamaño de fuente", SubTitle: "Ajustar el tamaño de fuente del contenido del chat", }, + InjectSystemPrompts: { + Title: "Inyectar Prompts del Sistema", + SubTitle: + "Agregar forzosamente un prompt de sistema simulado de ChatGPT al comienzo de la lista de mensajes en cada solicitud", + }, Update: { Version: (x: string) => `Versión: ${x}`, IsLatest: "Última versión", diff --git a/app/locales/fr.ts b/app/locales/fr.ts index 700ee0eaf..f4cd1490d 100644 --- a/app/locales/fr.ts +++ b/app/locales/fr.ts @@ -111,6 +111,11 @@ const fr: PartialLocaleType = { Title: "Taille des polices", SubTitle: "Ajuste la taille de police du contenu de la conversation", }, + InjectSystemPrompts: { + Title: "Injecter des invites système", + SubTitle: + "Ajoute de force une invite système simulée de ChatGPT au début de la liste des messages pour chaque demande", + }, InputTemplate: { Title: "Template", SubTitle: "Le message le plus récent sera ajouté à ce template.", diff --git a/app/locales/it.ts b/app/locales/it.ts index acd3a7e93..4b74ff3f0 100644 --- a/app/locales/it.ts +++ b/app/locales/it.ts @@ -71,6 +71,11 @@ const it: PartialLocaleType = { Title: "Dimensione carattere", SubTitle: "Regolare la dimensione dei caratteri del contenuto della chat", }, + InjectSystemPrompts: { + Title: "Inserisci Prompts di Sistema", + SubTitle: + "Aggiungi forzatamente un prompt di sistema simulato di ChatGPT all'inizio della lista dei messaggi per ogni richiesta", + }, Update: { Version: (x: string) => `Versione: ${x}`, IsLatest: "Ultima versione", diff --git a/app/locales/jp.ts b/app/locales/jp.ts index 090a428fa..e27a4c6d9 100644 --- a/app/locales/jp.ts +++ b/app/locales/jp.ts @@ -84,6 +84,11 @@ const jp: PartialLocaleType = { Title: "フォントサイズ", SubTitle: "チャット内容のフォントサイズ", }, + InjectSystemPrompts: { + Title: "システムプロンプトの挿入", + SubTitle: + "各リクエストのメッセージリストの先頭に、ChatGPTのシステムプロンプトを強制的に追加します", + }, InputTemplate: { Title: "入力の前処理", SubTitle: "新規入力がこのテンプレートに埋め込まれます", diff --git a/app/locales/ko.ts b/app/locales/ko.ts index 6f5ec7a9a..ac5ee5df2 100644 --- a/app/locales/ko.ts +++ b/app/locales/ko.ts @@ -71,6 +71,11 @@ const ko: PartialLocaleType = { Title: "글꼴 크기", SubTitle: "채팅 내용의 글꼴 크기 조정", }, + InjectSystemPrompts: { + Title: "시스템 프롬프트 주입", + SubTitle: + "각 요청의 메시지 목록의 시작에 ChatGPT 시스템 프롬프트를 강제로 추가합니다", + }, Update: { Version: (x: string) => `버전: ${x}`, IsLatest: "최신 버전", diff --git a/app/locales/no.ts b/app/locales/no.ts index b296bd5cf..e4b834964 100644 --- a/app/locales/no.ts +++ b/app/locales/no.ts @@ -65,6 +65,11 @@ const no: PartialLocaleType = { Title: "Fontstørrelsen", SubTitle: "Juster fontstørrelsen for samtaleinnholdet.", }, + InjectSystemPrompts: { + Title: "Sett inn systemprompter", + SubTitle: + "Tving tillegg av en simulert ChatGPT-systemprompt i begynnelsen av meldingslisten for hver forespørsel", + }, Update: { Version: (x: string) => `Versjon: ${x}`, IsLatest: "Siste versjon", diff --git a/app/locales/ru.ts b/app/locales/ru.ts index 06c945859..76be21a36 100644 --- a/app/locales/ru.ts +++ b/app/locales/ru.ts @@ -71,6 +71,11 @@ const ru: PartialLocaleType = { Title: "Размер шрифта", SubTitle: "Настроить размер шрифта контента чата", }, + InjectSystemPrompts: { + Title: "Вставить системные подсказки", + SubTitle: + "Принудительно добавить симулированную системную подсказку ChatGPT в начало списка сообщений для каждого запроса", + }, Update: { Version: (x: string) => `Версия: ${x}`, IsLatest: "Последняя версия", diff --git a/app/locales/tr.ts b/app/locales/tr.ts index 2383a5494..ad6b66fd4 100644 --- a/app/locales/tr.ts +++ b/app/locales/tr.ts @@ -71,6 +71,11 @@ const tr: PartialLocaleType = { Title: "Yazı Boyutu", SubTitle: "Sohbet içeriğinin yazı boyutunu ayarlayın", }, + InjectSystemPrompts: { + Title: "Sistem İpucu Ekleyin", + SubTitle: + "Her istek için ileti listesinin başına simüle edilmiş bir ChatGPT sistem ipucu ekleyin", + }, Update: { Version: (x: string) => `Sürüm: ${x}`, IsLatest: "En son sürüm", diff --git a/app/locales/tw.ts b/app/locales/tw.ts index 1afb0eb71..d64294fa2 100644 --- a/app/locales/tw.ts +++ b/app/locales/tw.ts @@ -69,6 +69,10 @@ const tw: PartialLocaleType = { Title: "字型大小", SubTitle: "聊天內容的字型大小", }, + InjectSystemPrompts: { + Title: "注入系統提示", + SubTitle: "強制在每個請求的訊息列表開頭添加一個模擬 ChatGPT 的系統提示", + }, Update: { Version: (x: string) => `當前版本:${x}`, IsLatest: "已是最新版本", diff --git a/app/locales/vi.ts b/app/locales/vi.ts index 428f93857..2117734b0 100644 --- a/app/locales/vi.ts +++ b/app/locales/vi.ts @@ -71,6 +71,11 @@ const vi: PartialLocaleType = { Title: "Font chữ", SubTitle: "Thay đổi font chữ của nội dung trò chuyện", }, + InjectSystemPrompts: { + Title: "Tiêm Prompt Hệ thống", + SubTitle: + "Bắt buộc thêm một prompt hệ thống giả lập ChatGPT ở đầu danh sách tin nhắn cho mỗi yêu cầu", + }, Update: { Version: (x: string) => `Phiên bản: ${x}`, IsLatest: "Phiên bản mới nhất", From c00a63e4c3a01efd0e8cb099f87811f062ad7aaf Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Mon, 10 Jul 2023 22:59:12 +0800 Subject: [PATCH 11/36] fix: #2336 resending message should delete origional messages --- app/components/chat.tsx | 53 +++++++++++++++++++++++++++++++++++------ app/store/chat.ts | 1 - 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/app/components/chat.tsx b/app/components/chat.tsx index b6380add3..8a74242ed 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -710,7 +710,7 @@ export function Chat() { }; const findLastUserIndex = (messageId: string) => { - // find last user input message and resend + // find last user input message let lastUserMessageIndex: number | null = null; for (let i = 0; i < session.messages.length; i += 1) { const message = session.messages[i]; @@ -737,17 +737,56 @@ export function Chat() { }; const onResend = (message: ChatMessage) => { - let content = message.content; + // when it is resending a message + // 1. for a user's message, find the next bot response + // 2. for a bot's message, find the last user's input + // 3. delete original user input and bot's message + // 4. resend the user's input - if (message.role === "assistant" && message.id) { - const userIndex = findLastUserIndex(message.id); - if (userIndex) { - content = session.messages.at(userIndex)?.content ?? content; + const resendingIndex = session.messages.findIndex( + (m) => m.id === message.id, + ); + + if (resendingIndex <= 0 || resendingIndex >= session.messages.length) { + console.error("[Chat] failed to find resending message", message); + return; + } + + let userMessage: ChatMessage | undefined; + let botMessage: ChatMessage | undefined; + + if (message.role === "assistant") { + // if it is resending a bot's message, find the user input for it + botMessage = message; + for (let i = resendingIndex; i >= 0; i -= 1) { + if (session.messages[i].role === "user") { + userMessage = session.messages[i]; + break; + } + } + } else if (message.role === "user") { + // if it is resending a user's input, find the bot's response + userMessage = message; + for (let i = resendingIndex; i < session.messages.length; i += 1) { + if (session.messages[i].role === "assistant") { + botMessage = session.messages[i]; + break; + } } } + if (userMessage === undefined) { + console.error("[Chat] failed to resend", message); + return; + } + + // delete the original messages + deleteMessage(userMessage.id); + deleteMessage(botMessage?.id); + + // resend the message setIsLoading(true); - chatStore.onUserInput(content).then(() => setIsLoading(false)); + chatStore.onUserInput(userMessage.content).then(() => setIsLoading(false)); inputRef.current?.focus(); }; diff --git a/app/store/chat.ts b/app/store/chat.ts index 6b403dd6a..9fc7ebfdb 100644 --- a/app/store/chat.ts +++ b/app/store/chat.ts @@ -289,7 +289,6 @@ export const useChatStore = create()( const botMessage: ChatMessage = createMessage({ role: "assistant", streaming: true, - id: userMessage.id! + 1, model: modelConfig.model, }); From 15e063e1b5202ba0e1f9784fb584ec150e5b5240 Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Mon, 10 Jul 2023 23:19:43 +0800 Subject: [PATCH 12/36] feat: #2330 disable /list/models --- app/client/platforms/openai.ts | 7 +++++++ app/components/home.tsx | 2 ++ app/constant.ts | 20 -------------------- app/store/access.ts | 16 +++++++++++----- 4 files changed, 20 insertions(+), 25 deletions(-) diff --git a/app/client/platforms/openai.ts b/app/client/platforms/openai.ts index dfe413002..e140a1ef5 100644 --- a/app/client/platforms/openai.ts +++ b/app/client/platforms/openai.ts @@ -1,5 +1,6 @@ import { DEFAULT_API_HOST, + DEFAULT_MODELS, OpenaiPath, REQUEST_TIMEOUT_MS, } from "@/app/constant"; @@ -23,6 +24,8 @@ export interface OpenAIListModelResponse { } export class ChatGPTApi implements LLMApi { + private disableListModels = true; + path(path: string): string { let openaiUrl = useAccessStore.getState().openaiUrl; if (openaiUrl.length === 0) { @@ -246,6 +249,10 @@ export class ChatGPTApi implements LLMApi { } async models(): Promise { + if (this.disableListModels) { + return DEFAULT_MODELS.slice(); + } + const res = await fetch(this.path(OpenaiPath.ListModelPath), { method: "GET", headers: { diff --git a/app/components/home.tsx b/app/components/home.tsx index 96c1b8382..b3cec893e 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -28,6 +28,7 @@ import { useAppConfig } from "../store/config"; import { AuthPage } from "./auth"; import { getClientConfig } from "../config/client"; import { api } from "../client/api"; +import { useAccessStore } from "../store"; export function Loading(props: { noLogo?: boolean }) { return ( @@ -171,6 +172,7 @@ export function Home() { useEffect(() => { console.log("[Config] got config from build time", getClientConfig()); + useAccessStore.getState().fetch(); }, []); if (!useHasHydrated()) { diff --git a/app/constant.ts b/app/constant.ts index df2bc52a5..250bd1359 100644 --- a/app/constant.ts +++ b/app/constant.ts @@ -108,24 +108,4 @@ export const DEFAULT_MODELS = [ name: "gpt-3.5-turbo-16k-0613", available: true, }, - { - name: "qwen-v1", // 通义千问 - available: false, - }, - { - name: "ernie", // 文心一言 - available: false, - }, - { - name: "spark", // 讯飞星火 - available: false, - }, - { - name: "llama", // llama - available: false, - }, - { - name: "chatglm", // chatglm-6b - available: false, - }, ] as const; diff --git a/app/store/access.ts b/app/store/access.ts index d28064147..c1a802eb1 100644 --- a/app/store/access.ts +++ b/app/store/access.ts @@ -1,6 +1,6 @@ import { create } from "zustand"; import { persist } from "zustand/middleware"; -import { DEFAULT_API_HOST, StoreKey } from "../constant"; +import { DEFAULT_API_HOST, DEFAULT_MODELS, StoreKey } from "../constant"; import { getHeaders } from "../client/api"; import { BOT_HELLO } from "./chat"; import { getClientConfig } from "../config/client"; @@ -11,8 +11,10 @@ export interface AccessControlStore { needCode: boolean; hideUserApiKey: boolean; - openaiUrl: string; hideBalanceQuery: boolean; + disableGPT4: boolean; + + openaiUrl: string; updateToken: (_: string) => void; updateCode: (_: string) => void; @@ -35,8 +37,10 @@ export const useAccessStore = create()( accessCode: "", needCode: true, hideUserApiKey: false, - openaiUrl: DEFAULT_OPENAI_URL, hideBalanceQuery: false, + disableGPT4: false, + + openaiUrl: DEFAULT_OPENAI_URL, enabledAccessControl() { get().fetch(); @@ -75,8 +79,10 @@ export const useAccessStore = create()( console.log("[Config] got config from server", res); set(() => ({ ...res })); - if ((res as any).botHello) { - BOT_HELLO.content = (res as any).botHello; + if (res.disableGPT4) { + DEFAULT_MODELS.forEach( + (m: any) => (m.available = !m.name.startsWith("gpt-4")), + ); } }) .catch(() => { From ad1b9b7f6d623e47377179d39a6c5b24ecc60ce4 Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Mon, 10 Jul 2023 23:21:22 +0800 Subject: [PATCH 13/36] fixup --- app/locales/en.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/locales/en.ts b/app/locales/en.ts index de10ee316..2a8c026f1 100644 --- a/app/locales/en.ts +++ b/app/locales/en.ts @@ -143,8 +143,7 @@ const en: LocaleType = { }, InjectSystemPrompts: { Title: "Inject System Prompts", - SubTitle: - "Forcefully add a simulated ChatGPT system prompt at the beginning of the message list for every request", + SubTitle: "Inject a global system prompt for every request", }, InputTemplate: { Title: "Input Template", From a832cfb343db0d8c2ed91222ce98745265f9c07a Mon Sep 17 00:00:00 2001 From: yuanliang feng <10550655+fyl080801@users.noreply.github.com> Date: Tue, 11 Jul 2023 15:46:40 +0800 Subject: [PATCH 14/36] Update common.ts --- app/api/common.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/app/api/common.ts b/app/api/common.ts index 3bfe208b4..6d6a7d1fb 100644 --- a/app/api/common.ts +++ b/app/api/common.ts @@ -35,6 +35,7 @@ export async function requestOpenai(req: NextRequest) { const fetchOptions: RequestInit = { headers: { "Content-Type": "application/json", + "Cache-Control": "no-store", Authorization: authValue, ...(process.env.OPENAI_ORG_ID && { "OpenAI-Organization": process.env.OPENAI_ORG_ID, From a4d012828c55b308e2ea0c57a250d0ac3709d02c Mon Sep 17 00:00:00 2001 From: imldy Date: Tue, 11 Jul 2023 21:02:09 +0800 Subject: [PATCH 15/36] fix: migrated mask object key --- app/store/mask.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/store/mask.ts b/app/store/mask.ts index 105ca3469..02132b77d 100644 --- a/app/store/mask.ts +++ b/app/store/mask.ts @@ -109,7 +109,7 @@ export const useMaskStore = create()( }), { name: StoreKey.Mask, - version: 3, + version: 3.1, migrate(state, version) { const newState = JSON.parse(JSON.stringify(state)) as MaskState; @@ -119,6 +119,14 @@ export const useMaskStore = create()( Object.values(newState.masks).forEach((m) => (m.id = nanoid())); } + if (version < 3.1) { + const updatedMasks: Record = {}; + Object.values(newState.masks).forEach((m) => { + updatedMasks[m.id] = m; + }); + newState.masks = updatedMasks; + } + return newState as any; }, }, From d275e32e70db5a1747593d8f5b9c52e0ab6c9083 Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Wed, 12 Jul 2023 23:19:46 +0800 Subject: [PATCH 16/36] fix: sharegpt roles --- app/client/api.ts | 2 +- app/components/exporter.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/client/api.ts b/app/client/api.ts index 08c4bb92a..b04dd88b8 100644 --- a/app/client/api.ts +++ b/app/client/api.ts @@ -99,7 +99,7 @@ export class ClientApi { // 敬告二开开发者们,为了开源大模型的发展,请不要修改上述消息,此消息用于后续数据清洗使用 // Please do not modify this message - console.log("[Share]", msgs); + console.log("[Share]", messages, msgs); const clientConfig = getClientConfig(); const proxyUrl = "/sharegpt"; const rawUrl = "https://sharegpt.com/api/conversations"; diff --git a/app/components/exporter.tsx b/app/components/exporter.tsx index 673b61d93..f88965f95 100644 --- a/app/components/exporter.tsx +++ b/app/components/exporter.tsx @@ -244,11 +244,11 @@ export function RenderExport(props: { } const renderMsgs = messages.map((v, i) => { - const [_, role] = v.id.split(":"); + const [role, _] = v.id.split(":"); return { id: i.toString(), role: role as any, - content: v.innerHTML, + content: role === "user" ? v.textContent ?? "" : v.innerHTML, date: "", }; }); From ab0f7cc0c9d82ad9beb410878995e55dcc3eb51b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 13 Jul 2023 01:58:09 +0000 Subject: [PATCH 17/36] chore(deps): bump semver from 6.3.0 to 6.3.1 Bumps [semver](https://github.com/npm/node-semver) from 6.3.0 to 6.3.1. - [Release notes](https://github.com/npm/node-semver/releases) - [Changelog](https://github.com/npm/node-semver/blob/v6.3.1/CHANGELOG.md) - [Commits](https://github.com/npm/node-semver/compare/v6.3.0...v6.3.1) --- updated-dependencies: - dependency-name: semver dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/yarn.lock b/yarn.lock index 42234ec55..fee28f35b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5322,14 +5322,14 @@ schema-utils@^3.1.1, schema-utils@^3.2.0: ajv-keywords "^3.5.2" semver@^6.1.1, semver@^6.1.2, semver@^6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" - integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + version "6.3.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== semver@^7.3.7: - version "7.3.8" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798" - integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A== + version "7.5.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== dependencies: lru-cache "^6.0.0" From fb98050d9f8ea593377aa48bd2f612b212602d61 Mon Sep 17 00:00:00 2001 From: legao <837937787@qq.com> Date: Fri, 14 Jul 2023 18:08:03 +0800 Subject: [PATCH 18/36] feat: drag and drop in contextual prompts --- app/components/mask.tsx | 154 ++++++++++++++++++++++++++-------------- 1 file changed, 101 insertions(+), 53 deletions(-) diff --git a/app/components/mask.tsx b/app/components/mask.tsx index 091f3cdf4..6ff38bc37 100644 --- a/app/components/mask.tsx +++ b/app/components/mask.tsx @@ -42,6 +42,20 @@ import { ModelConfigList } from "./model-config"; import { FileName, Path } from "../constant"; import { BUILTIN_MASK_STORE } from "../masks"; import { nanoid } from "nanoid"; +import { + DragDropContext, + Droppable, + Draggable, + OnDragEndResponder, +} from "@hello-pangea/dnd"; + +// drag and drop helper function +function reorder(list: T[], startIndex: number, endIndex: number): T[] { + const result = [...list]; + const [removed] = result.splice(startIndex, 1); + result.splice(endIndex, 0, removed); + return result; +} export function MaskAvatar(props: { mask: Mask }) { return props.mask.avatar !== DEFAULT_MASK_AVATAR ? ( @@ -192,6 +206,7 @@ export function MaskConfig(props: { } function ContextPromptItem(props: { + index: number; prompt: ChatMessage; update: (prompt: ChatMessage) => void; remove: () => void; @@ -199,53 +214,62 @@ function ContextPromptItem(props: { const [focusingInput, setFocusingInput] = useState(false); return ( -
- {!focusingInput && ( - + {!focusingInput && ( + + )} + setFocusingInput(true)} + onBlur={() => { + setFocusingInput(false); + // If the selection is not removed when the user loses focus, some + // extensions like "Translate" will always display a floating bar + window?.getSelection()?.removeAllRanges(); + }} + onInput={(e) => + props.update({ + ...props.prompt, + content: e.currentTarget.value as any, + }) + } + /> + {!focusingInput && ( + } + className={chatStyle["context-delete-button"]} + onClick={() => props.remove()} + bordered + /> + )} +
)} - setFocusingInput(true)} - onBlur={() => { - setFocusingInput(false); - // If the selection is not removed when the user loses focus, some - // extensions like "Translate" will always display a floating bar - window?.getSelection()?.removeAllRanges(); - }} - onInput={(e) => - props.update({ - ...props.prompt, - content: e.currentTarget.value as any, - }) - } - /> - {!focusingInput && ( - } - className={chatStyle["context-delete-button"]} - onClick={() => props.remove()} - bordered - /> - )} - + ); } @@ -267,17 +291,41 @@ export function ContextPrompts(props: { props.updateContext((context) => (context[i] = prompt)); }; + const onDragEnd: OnDragEndResponder = (result) => { + if (!result.destination) { + return; + } + const newContext = reorder( + context, + result.source.index, + result.destination.index, + ); + props.updateContext((context) => { + context.splice(0, context.length, ...newContext); + }); + }; + return ( <>
- {context.map((c, i) => ( - updateContextPrompt(i, prompt)} - remove={() => removeContextPrompt(i)} - /> - ))} + + + {(provided) => ( +
+ {context.map((c, i) => ( + updateContextPrompt(i, prompt)} + remove={() => removeContextPrompt(i)} + /> + ))} + {provided.placeholder} +
+ )} +
+
Date: Fri, 14 Jul 2023 18:10:42 +0800 Subject: [PATCH 19/36] fixed openai base url if empty --- app/api/common.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/common.ts b/app/api/common.ts index 6d6a7d1fb..5222ee941 100644 --- a/app/api/common.ts +++ b/app/api/common.ts @@ -2,8 +2,8 @@ import { NextRequest, NextResponse } from "next/server"; export const OPENAI_URL = "api.openai.com"; const DEFAULT_PROTOCOL = "https"; -const PROTOCOL = process.env.PROTOCOL ?? DEFAULT_PROTOCOL; -const BASE_URL = process.env.BASE_URL ?? OPENAI_URL; +const PROTOCOL = process.env.PROTOCOL || DEFAULT_PROTOCOL; +const BASE_URL = process.env.BASE_URL || OPENAI_URL; // ?? 仅在 undefined 时候才转向后者,但是环境变量大家都不会去注释掉变量,因此最好用 || const DISABLE_GPT4 = !!process.env.DISABLE_GPT4; export async function requestOpenai(req: NextRequest) { From 3f8b14f5f84cbdb10eb1b1cf683a98cb4b5d0d33 Mon Sep 17 00:00:00 2001 From: markshawn2020 Date: Fri, 14 Jul 2023 21:15:34 +0800 Subject: [PATCH 20/36] fixed react key --- app/components/chat.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 8a74242ed..5084c5688 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -5,6 +5,7 @@ import React, { useEffect, useMemo, useCallback, + Fragment, } from "react"; import SendWhiteIcon from "../icons/send-white.svg"; @@ -975,9 +976,8 @@ export function Chat() { const shouldShowClearContextDivider = i === clearContextIndex - 1; return ( - <> +
{shouldShowClearContextDivider && } - +
); })}
From fd058cc6937d2d1647f07d4d440c68d60cae9f50 Mon Sep 17 00:00:00 2001 From: imldy Date: Sat, 15 Jul 2023 01:32:39 +0800 Subject: [PATCH 21/36] fix: enable `enableInjectSystemPrompts` attribute for old sessions --- app/store/chat.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/store/chat.ts b/app/store/chat.ts index 6b403dd6a..29fa027b0 100644 --- a/app/store/chat.ts +++ b/app/store/chat.ts @@ -590,7 +590,7 @@ export const useChatStore = create()( }), { name: StoreKey.Chat, - version: 3, + version: 3.1, migrate(persistedState, version) { const state = persistedState as any; const newState = JSON.parse(JSON.stringify(state)) as ChatStore; @@ -618,6 +618,18 @@ export const useChatStore = create()( }); } + // Enable `enableInjectSystemPrompts` attribute for old sessions. + // Resolve issue of old sessions not automatically enabling. + if (version < 3.1) { + newState.sessions.forEach((s) => { + if ( + !s.mask.modelConfig.hasOwnProperty("enableInjectSystemPrompts") + ) { + s.mask.modelConfig.enableInjectSystemPrompts = true; + } + }); + } + return newState; }, }, From a9f67a48a1879f50f5f125ac09ff1bddf8edb05a Mon Sep 17 00:00:00 2001 From: imldy Date: Sat, 15 Jul 2023 02:48:47 +0800 Subject: [PATCH 22/36] dev: use current inject configuration --- app/store/chat.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/store/chat.ts b/app/store/chat.ts index 29fa027b0..6bcdc5c77 100644 --- a/app/store/chat.ts +++ b/app/store/chat.ts @@ -623,9 +623,14 @@ export const useChatStore = create()( if (version < 3.1) { newState.sessions.forEach((s) => { if ( + // Exclude those already set by user !s.mask.modelConfig.hasOwnProperty("enableInjectSystemPrompts") ) { - s.mask.modelConfig.enableInjectSystemPrompts = true; + // Because users may have changed this configuration, + // the user's current configuration is used instead of the default + const config = useAppConfig.getState(); + s.mask.modelConfig.enableInjectSystemPrompts = + config.modelConfig.enableInjectSystemPrompts; } }); } From d909b676c57b1fe6266b6915c364141ab40d8b2e Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Sun, 16 Jul 2023 15:08:53 +0800 Subject: [PATCH 23/36] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1ca376562..c4f83c117 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ One-Click to get well-designed cross-platform ChatGPT web UI. [![MacOS][MacOS-image]][download-url] [![Linux][Linux-image]][download-url] -[Web App](https://chatgpt.nextweb.fun/) / [Desktop App](https://github.com/Yidadaa/ChatGPT-Next-Web/releases) / [Issues](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) / [Buy Me a Coffee](https://www.buymeacoffee.com/yidadaa) +[Web App](https://chatgpt.nextweb.fun/) / [Desktop App](https://github.com/Yidadaa/ChatGPT-Next-Web/releases) / [Issues](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) / [Discord](https://discord.gg/YCkeafCafC) / [Buy Me a Coffee](https://www.buymeacoffee.com/yidadaa) [网页版](https://chatgpt.nextweb.fun/) / [客户端](https://github.com/Yidadaa/ChatGPT-Next-Web/releases) / [反馈](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) / [QQ 群](https://github.com/Yidadaa/ChatGPT-Next-Web/discussions/1724) / [打赏开发者](https://user-images.githubusercontent.com/16968934/227772541-5bcd52d8-61b7-488c-a203-0330d8006e2b.jpg) From 3ddedc903e4e10f9d88cd31fadf39440712d741a Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Sun, 16 Jul 2023 15:49:15 +0800 Subject: [PATCH 24/36] feat: improve dnd icon --- app/components/chat.module.scss | 13 +++++++++++ app/components/home.module.scss | 24 +++++++++++++++----- app/components/mask.tsx | 40 +++++++++++++++++++-------------- app/components/sidebar.tsx | 5 ++++- app/icons/drag.svg | 1 + 5 files changed, 59 insertions(+), 24 deletions(-) create mode 100644 app/icons/drag.svg diff --git a/app/components/chat.module.scss b/app/components/chat.module.scss index 99b2d0228..6f4432009 100644 --- a/app/components/chat.module.scss +++ b/app/components/chat.module.scss @@ -101,6 +101,19 @@ width: 100%; margin-bottom: 10px; + &:hover { + .context-drag { + opacity: 1; + } + } + + .context-drag { + display: flex; + align-items: center; + opacity: 0.5; + transition: all ease 0.3s; + } + .context-role { margin-right: 10px; } diff --git a/app/components/home.module.scss b/app/components/home.module.scss index 49ad2bd22..a90b7fd87 100644 --- a/app/components/home.module.scss +++ b/app/components/home.module.scss @@ -61,24 +61,36 @@ } } } + + &:hover, + &:active { + .sidebar-drag { + background-color: rgba($color: #000000, $alpha: 0.01); + + svg { + opacity: 0.2; + } + } + } } .sidebar-drag { - $width: 10px; + $width: 14px; position: absolute; top: 0; right: 0; height: 100%; width: $width; - background-color: var(--black); + background-color: rgba($color: #000000, $alpha: 0); cursor: ew-resize; - opacity: 0; transition: all ease 0.3s; + display: flex; + align-items: center; - &:hover, - &:active { - opacity: 0.2; + svg { + opacity: 0; + margin-left: -2px; } } diff --git a/app/components/mask.tsx b/app/components/mask.tsx index 6ff38bc37..0006793cb 100644 --- a/app/components/mask.tsx +++ b/app/components/mask.tsx @@ -11,6 +11,7 @@ import CloseIcon from "../icons/close.svg"; import DeleteIcon from "../icons/delete.svg"; import EyeIcon from "../icons/eye.svg"; import CopyIcon from "../icons/copy.svg"; +import DragIcon from "../icons/drag.svg"; import { DEFAULT_MASK_AVATAR, Mask, useMaskStore } from "../store/mask"; import { @@ -214,7 +215,7 @@ function ContextPromptItem(props: { const [focusingInput, setFocusingInput] = useState(false); return ( - + {(provided) => (
{!focusingInput && ( - + <> +
+ +
+ + )} onDragMouseDown(e as any)} - >
+ > + +
); } diff --git a/app/icons/drag.svg b/app/icons/drag.svg new file mode 100644 index 000000000..a39157c7e --- /dev/null +++ b/app/icons/drag.svg @@ -0,0 +1 @@ + From 30473ec41e68842bf0eed03f9a308ca8aaa551b5 Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Sun, 16 Jul 2023 16:14:57 +0800 Subject: [PATCH 25/36] fix: #2367 do not copy in async callback after sharing to ShareGPT --- app/api/common.ts | 2 +- app/components/exporter.tsx | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/app/api/common.ts b/app/api/common.ts index 5222ee941..3146b6bd9 100644 --- a/app/api/common.ts +++ b/app/api/common.ts @@ -3,7 +3,7 @@ import { NextRequest, NextResponse } from "next/server"; export const OPENAI_URL = "api.openai.com"; const DEFAULT_PROTOCOL = "https"; const PROTOCOL = process.env.PROTOCOL || DEFAULT_PROTOCOL; -const BASE_URL = process.env.BASE_URL || OPENAI_URL; // ?? 仅在 undefined 时候才转向后者,但是环境变量大家都不会去注释掉变量,因此最好用 || +const BASE_URL = process.env.BASE_URL || OPENAI_URL; const DISABLE_GPT4 = !!process.env.DISABLE_GPT4; export async function requestOpenai(req: NextRequest) { diff --git a/app/components/exporter.tsx b/app/components/exporter.tsx index f88965f95..ab6fad29e 100644 --- a/app/components/exporter.tsx +++ b/app/components/exporter.tsx @@ -8,6 +8,7 @@ import { Modal, Select, showImageModal, + showModal, showToast, } from "./ui-lib"; import { IconButton } from "./button"; @@ -287,7 +288,30 @@ export function PreviewActions(props: { .share(msgs) .then((res) => { if (!res) return; - copyToClipboard(res); + showModal({ + title: Locale.Export.Share, + children: [ + e.currentTarget.select()} + >, + ], + actions: [ + } + text={Locale.Chat.Actions.Copy} + key="copy" + onClick={() => copyToClipboard(res)} + />, + ], + }); setTimeout(() => { window.open(res, "_blank"); }, 800); From af5f67d459185c77d1edefec4fe06bc36dd06e6a Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Sun, 16 Jul 2023 16:32:22 +0800 Subject: [PATCH 26/36] feat: close #2376 add babel polyfill --- .babelrc | 14 ++++++++++++++ app/components/home.tsx | 2 +- next.config.mjs | 3 +++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 .babelrc diff --git a/.babelrc b/.babelrc new file mode 100644 index 000000000..53e4d9b24 --- /dev/null +++ b/.babelrc @@ -0,0 +1,14 @@ +{ + "presets": [ + [ + "next/babel", + { + "preset-env": { + "targets": { + "browsers": ["> 0.25%, not dead"] + } + } + } + ] + ] +} diff --git a/app/components/home.tsx b/app/components/home.tsx index b3cec893e..68853e743 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -1,6 +1,6 @@ "use client"; -require("../polyfill"); +// require("../polyfill"); import { useState, useEffect } from "react"; diff --git a/next.config.mjs b/next.config.mjs index 01d342717..c8f17de8c 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -30,6 +30,9 @@ const nextConfig = { images: { unoptimized: mode === "export", }, + experimental: { + forceSwcTransforms: true, + }, }; if (mode !== "export") { From e1243f3d5946d0ac385e35a0f9dd67b3361bfaea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=B0=E5=A4=A9=E6=B8=B8?= Date: Sun, 16 Jul 2023 21:34:01 +0800 Subject: [PATCH 27/36] feat: add typings for metadata --- app/layout.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/layout.tsx b/app/layout.tsx index 4977afa17..e7aff134c 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -3,8 +3,9 @@ import "./styles/globals.scss"; import "./styles/markdown.scss"; import "./styles/highlight.scss"; import { getClientConfig } from "./config/client"; +import { Metadata } from 'next'; -export const metadata = { +export const metadata: Metadata = { title: "ChatGPT Next Web", description: "Your personal ChatGPT Chat Bot.", viewport: { From 442a529a725c0cf6a780c93f17b02f8742251558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=B0=E5=A4=A9=E6=B8=B8?= Date: Sun, 16 Jul 2023 21:35:13 +0800 Subject: [PATCH 28/36] feat: add type for import --- app/layout.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/layout.tsx b/app/layout.tsx index e7aff134c..883a268d3 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -3,7 +3,7 @@ import "./styles/globals.scss"; import "./styles/markdown.scss"; import "./styles/highlight.scss"; import { getClientConfig } from "./config/client"; -import { Metadata } from 'next'; +import { type Metadata } from 'next'; export const metadata: Metadata = { title: "ChatGPT Next Web", From c916cd1a87a9b3ee5d84fd1b5c0ac69401e450e2 Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Mon, 17 Jul 2023 11:00:45 +0800 Subject: [PATCH 29/36] Update mask.tsx --- app/components/mask.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/mask.tsx b/app/components/mask.tsx index 0006793cb..b90722134 100644 --- a/app/components/mask.tsx +++ b/app/components/mask.tsx @@ -215,7 +215,7 @@ function ContextPromptItem(props: { const [focusingInput, setFocusingInput] = useState(false); return ( - + {(provided) => (
Date: Mon, 17 Jul 2023 11:33:19 +0800 Subject: [PATCH 30/36] Update home.tsx --- app/components/home.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/home.tsx b/app/components/home.tsx index 68853e743..b3cec893e 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -1,6 +1,6 @@ "use client"; -// require("../polyfill"); +require("../polyfill"); import { useState, useEffect } from "react"; From f0abdc80eb67de7fe818c9d376d447651d85ad2b Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Tue, 18 Jul 2023 10:50:44 +0800 Subject: [PATCH 31/36] Update tauri.conf.json --- src-tauri/tauri.conf.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index e1ce64446..8c520eca8 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -9,7 +9,7 @@ }, "package": { "productName": "ChatGPT Next Web", - "version": "2.8.9" + "version": "2.9.0" }, "tauri": { "allowlist": { From 322eb66fdf6a342e615b1d648a141b111a428207 Mon Sep 17 00:00:00 2001 From: liuweijie Date: Tue, 18 Jul 2023 19:38:16 +0800 Subject: [PATCH 32/36] fix: useAccessStore filter spaces --- app/store/access.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/store/access.ts b/app/store/access.ts index c1a802eb1..b60211631 100644 --- a/app/store/access.ts +++ b/app/store/access.ts @@ -48,13 +48,13 @@ export const useAccessStore = create()( return get().needCode; }, updateCode(code: string) { - set(() => ({ accessCode: code })); + set(() => ({ accessCode: code?.trim() })); }, updateToken(token: string) { - set(() => ({ token })); + set(() => ({ token: token?.trim() })); }, updateOpenAiUrl(url: string) { - set(() => ({ openaiUrl: url })); + set(() => ({ openaiUrl: url?.trim() })); }, isAuthorized() { get().fetch(); From 0198c5b7811fff550f0c0014e4781f3c94dd0ebc Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Thu, 20 Jul 2023 22:51:49 +0800 Subject: [PATCH 33/36] feat: close #2445 switch to mit license --- LICENSE | 88 ++++++++++------------------------------------------ README.md | 2 +- README_CN.md | 4 +-- README_ES.md | 14 ++++----- 4 files changed, 25 insertions(+), 83 deletions(-) diff --git a/LICENSE b/LICENSE index 4f00efc87..542e91f4e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,75 +1,21 @@ -版权所有(c)<2023> +MIT License -反996许可证版本1.0 +Copyright (c) 2023 Zhang Yifei -在符合下列条件的情况下, -特此免费向任何得到本授权作品的副本(包括源代码、文件和/或相关内容,以下统称为“授权作品” -)的个人和法人实体授权:被授权个人或法人实体有权以任何目的处置授权作品,包括但不限于使 -用、复制,修改,衍生利用、散布,发布和再许可: +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -1. 个人或法人实体必须在许可作品的每个再散布或衍生副本上包含以上版权声明和本许可证,不 - 得自行修改。 -2. 个人或法人实体必须严格遵守与个人实际所在地或个人出生地或归化地、或法人实体注册地或 - 经营地(以较严格者为准)的司法管辖区所有适用的与劳动和就业相关法律、法规、规则和 - 标准。如果该司法管辖区没有此类法律、法规、规章和标准或其法律、法规、规章和标准不可 - 执行,则个人或法人实体必须遵守国际劳工标准的核心公约。 -3. 个人或法人不得以任何方式诱导或强迫其全职或兼职员工或其独立承包人以口头或书面形式同 - 意直接或间接限制、削弱或放弃其所拥有的,受相关与劳动和就业有关的法律、法规、规则和 - 标准保护的权利或补救措施,无论该等书面或口头协议是否被该司法管辖区的法律所承认,该 - 等个人或法人实体也不得以任何方法限制其雇员或独立承包人向版权持有人或监督许可证合规 - 情况的有关当局报告或投诉上述违反许可证的行为的权利。 - -该授权作品是"按原样"提供,不做任何明示或暗示的保证,包括但不限于对适销性、特定用途适用 -性和非侵权性的保证。在任何情况下,无论是在合同诉讼、侵权诉讼或其他诉讼中,版权持有人均 -不承担因本软件或本软件的使用或其他交易而产生、引起或与之相关的任何索赔、损害或其他责任。 - - -------------------------- ENGLISH ------------------------------ - - -Copyright (c) <2023> - -Anti 996 License Version 1.0 (Draft) - -Permission is hereby granted to any individual or legal entity obtaining a copy -of this licensed work (including the source code, documentation and/or related -items, hereinafter collectively referred to as the "licensed work"), free of -charge, to deal with the licensed work for any purpose, including without -limitation, the rights to use, reproduce, modify, prepare derivative works of, -publish, distribute and sublicense the licensed work, subject to the following -conditions: - -1. The individual or the legal entity must conspicuously display, without - modification, this License on each redistributed or derivative copy of the - Licensed Work. - -2. The individual or the legal entity must strictly comply with all applicable - laws, regulations, rules and standards of the jurisdiction relating to - labor and employment where the individual is physically located or where - the individual was born or naturalized; or where the legal entity is - registered or is operating (whichever is stricter). In case that the - jurisdiction has no such laws, regulations, rules and standards or its - laws, regulations, rules and standards are unenforceable, the individual - or the legal entity are required to comply with Core International Labor - Standards. - -3. The individual or the legal entity shall not induce or force its - employee(s), whether full-time or part-time, or its independent - contractor(s), in any methods, to agree in oral or written form, - to directly or indirectly restrict, weaken or relinquish his or - her rights or remedies under such laws, regulations, rules and - standards relating to labor and employment as mentioned above, - no matter whether such written or oral agreement are enforceable - under the laws of the said jurisdiction, nor shall such individual - or the legal entity limit, in any methods, the rights of its employee(s) - or independent contractor(s) from reporting or complaining to the copyright - holder or relevant authorities monitoring the compliance of the license - about its violation(s) of the said license. - -THE LICENSED WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT -HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ANY WAY CONNECTION -WITH THE LICENSED WORK OR THE USE OR OTHER DEALINGS IN THE LICENSED WORK. \ No newline at end of file +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index c4f83c117..f0f298fb9 100644 --- a/README.md +++ b/README.md @@ -306,4 +306,4 @@ If you want to add a new translation, read this [document](./docs/translation.md ## LICENSE -[Anti 996 License](https://github.com/kattgu7/Anti-996-License/blob/master/LICENSE_CN_EN) +[MIT](https://opensource.org/license/mit/) diff --git a/README_CN.md b/README_CN.md index 990b64424..16d3ec19b 100644 --- a/README_CN.md +++ b/README_CN.md @@ -181,6 +181,4 @@ bash <(curl -s https://raw.githubusercontent.com/Yidadaa/ChatGPT-Next-Web/main/s ## 开源协议 -> 反对 996,从我开始。 - -[Anti 996 License](https://github.com/kattgu7/Anti-996-License/blob/master/LICENSE_CN_EN) +[MIT](https://opensource.org/license/mit/) diff --git a/README_ES.md b/README_ES.md index e9705e402..34e9678f9 100644 --- a/README_ES.md +++ b/README_ES.md @@ -7,7 +7,7 @@ Implemente su aplicación web privada ChatGPT de forma gratuita con un solo clic [Demo demo](https://chat-gpt-next-web.vercel.app/) / [Problemas de comentarios](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) / [Únete a Discord](https://discord.gg/zrhvHCr79N) / [Grupo QQ](https://user-images.githubusercontent.com/16968934/228190818-7dd00845-e9b9-4363-97e5-44c507ac76da.jpeg) / [Desarrolladores de consejos](https://user-images.githubusercontent.com/16968934/227772541-5bcd52d8-61b7-488c-a203-0330d8006e2b.jpg) / [Donar](#捐赠-donate-usdt) -[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web\&env=OPENAI_API_KEY\&env=CODE\&project-name=chatgpt-next-web\&repository-name=ChatGPT-Next-Web) +[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web) [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/Yidadaa/ChatGPT-Next-Web) @@ -19,7 +19,7 @@ Implemente su aplicación web privada ChatGPT de forma gratuita con un solo clic 1. Prepara el tuyo [Clave API OpenAI](https://platform.openai.com/account/api-keys); 2. Haga clic en el botón de la derecha para iniciar la implementación: - [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web\&env=OPENAI_API_KEY\&env=CODE\&project-name=chatgpt-next-web\&repository-name=ChatGPT-Next-Web), inicie sesión directamente con su cuenta de Github y recuerde completar la clave API y la suma en la página de variables de entorno[Contraseña de acceso a la página](#配置页面访问密码) CÓDIGO; + [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web), inicie sesión directamente con su cuenta de Github y recuerde completar la clave API y la suma en la página de variables de entorno[Contraseña de acceso a la página](#配置页面访问密码) CÓDIGO; 3. Una vez implementado, puede comenzar; 4. (Opcional)[Enlazar un nombre de dominio personalizado](https://vercel.com/docs/concepts/projects/domains/add-a-domain): El nombre de dominio DNS asignado por Vercel está contaminado en algunas regiones y puede conectarse directamente enlazando un nombre de dominio personalizado. @@ -28,9 +28,9 @@ Implemente su aplicación web privada ChatGPT de forma gratuita con un solo clic Si sigue los pasos anteriores para implementar su proyecto con un solo clic, es posible que siempre diga "La actualización existe" porque Vercel creará un nuevo proyecto para usted de forma predeterminada en lugar de bifurcar el proyecto, lo que evitará que la actualización se detecte correctamente. Le recomendamos que siga estos pasos para volver a implementar: -* Eliminar el repositorio original; -* Utilice el botón de bifurcación en la esquina superior derecha de la página para bifurcar este proyecto; -* En Vercel, vuelva a seleccionar e implementar,[Echa un vistazo al tutorial detallado](./docs/vercel-cn.md#如何新建项目)。 +- Eliminar el repositorio original; +- Utilice el botón de bifurcación en la esquina superior derecha de la página para bifurcar este proyecto; +- En Vercel, vuelva a seleccionar e implementar,[Echa un vistazo al tutorial detallado](./docs/vercel-cn.md#如何新建项目)。 ### Activar actualizaciones automáticas @@ -170,6 +170,4 @@ bash <(curl -s https://raw.githubusercontent.com/Yidadaa/ChatGPT-Next-Web/main/s ## Licencia de código abierto -> Contra 996, empezando por mí. - -[Licencia Anti 996](https://github.com/kattgu7/Anti-996-License/blob/master/LICENSE_CN_EN) +[MIT](https://opensource.org/license/mit/) From e5f6133127894b68498de0a4d38741bccdba68f1 Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Thu, 20 Jul 2023 23:17:58 +0800 Subject: [PATCH 34/36] feat: close #2447 pre-fill key/code/url --- app/command.ts | 2 ++ app/components/chat.tsx | 35 +++++++++++++++++++++++++++++++++++ app/locales/cn.ts | 5 +++++ app/locales/en.ts | 5 +++++ 4 files changed, 47 insertions(+) diff --git a/app/command.ts b/app/command.ts index 9330d4ff5..e515e5f0b 100644 --- a/app/command.ts +++ b/app/command.ts @@ -7,6 +7,8 @@ interface Commands { fill?: Command; submit?: Command; mask?: Command; + code?: Command; + settings?: Command; } export function useCommand(commands: Commands = {}) { diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 5084c5688..db9f8448a 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -882,6 +882,41 @@ export function Chat() { submit: (text) => { doSubmit(text); }, + code: (text) => { + console.log("[Command] got code from url: ", text); + showConfirm(Locale.URLCommand.Code + `code = ${text}`).then((res) => { + if (res) { + accessStore.updateCode(text); + } + }); + }, + settings: (text) => { + try { + const payload = JSON.parse(text) as { + key?: string; + url?: string; + }; + + console.log("[Command] got settings from url: ", payload); + + if (payload.key || payload.url) { + showConfirm( + Locale.URLCommand.Settings + + `\n${JSON.stringify(payload, null, 4)}`, + ).then((res) => { + if (!res) return; + if (payload.key) { + accessStore.updateToken(payload.key); + } + if (payload.url) { + accessStore.updateOpenAiUrl(payload.url); + } + }); + } + } catch { + console.error("[Command] failed to get settings from url: ", text); + } + }, }); return ( diff --git a/app/locales/cn.ts b/app/locales/cn.ts index e60e468ae..54225e311 100644 --- a/app/locales/cn.ts +++ b/app/locales/cn.ts @@ -326,6 +326,11 @@ const cn = { More: "查看全部", }, + URLCommand: { + Code: "检测到链接中已经包含访问码,是否自动填入?", + Settings: "检测到链接中包含了预制设置,是否自动填入?", + }, + UI: { Confirm: "确认", Cancel: "取消", diff --git a/app/locales/en.ts b/app/locales/en.ts index 2a8c026f1..ebc19f078 100644 --- a/app/locales/en.ts +++ b/app/locales/en.ts @@ -344,6 +344,11 @@ const en: LocaleType = { Topic: "Topic", Time: "Time", }, + + URLCommand: { + Code: "Detected access code from url, confirm to apply? ", + Settings: "Detected settings from url, confirm to apply?", + }, }; export default en; From 7c2fa9f8a4c9b04d534e9bea946fa3e909369240 Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Fri, 21 Jul 2023 00:24:26 +0800 Subject: [PATCH 35/36] feat: close #2449 edit / insert / delete messages modal --- app/components/chat.module.scss | 19 +++- app/components/chat.tsx | 108 ++++++++++++++----- app/components/mask.tsx | 182 ++++++++++++++++++-------------- app/locales/cn.ts | 6 ++ app/locales/en.ts | 6 ++ 5 files changed, 211 insertions(+), 110 deletions(-) diff --git a/app/components/chat.module.scss b/app/components/chat.module.scss index 6f4432009..a3ab56062 100644 --- a/app/components/chat.module.scss +++ b/app/components/chat.module.scss @@ -95,11 +95,28 @@ } .context-prompt { + .context-prompt-insert { + display: flex; + justify-content: center; + padding: 4px; + opacity: 0.2; + transition: all ease 0.3s; + background-color: rgba(0, 0, 0, 0); + cursor: pointer; + border-radius: 4px; + margin-top: 4px; + margin-bottom: 4px; + + &:hover { + opacity: 1; + background-color: rgba(0, 0, 0, 0.05); + } + } + .context-prompt-row { display: flex; justify-content: center; width: 100%; - margin-bottom: 10px; &:hover { .context-drag { diff --git a/app/components/chat.tsx b/app/components/chat.tsx index db9f8448a..7f54a7dd5 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -25,6 +25,8 @@ import SettingsIcon from "../icons/chat-settings.svg"; import DeleteIcon from "../icons/clear.svg"; import PinIcon from "../icons/pin.svg"; import EditIcon from "../icons/rename.svg"; +import ConfirmIcon from "../icons/confirm.svg"; +import CancelIcon from "../icons/cancel.svg"; import LightIcon from "../icons/light.svg"; import DarkIcon from "../icons/dark.svg"; @@ -63,6 +65,7 @@ import { IconButton } from "./button"; import styles from "./chat.module.scss"; import { + List, ListItem, Modal, Selector, @@ -73,7 +76,7 @@ import { import { useLocation, useNavigate } from "react-router-dom"; import { LAST_INPUT_KEY, Path, REQUEST_TIMEOUT_MS } from "../constant"; import { Avatar } from "./emoji"; -import { MaskAvatar, MaskConfig } from "./mask"; +import { ContextPrompts, MaskAvatar, MaskConfig } from "./mask"; import { useMaskStore } from "../store/mask"; import { ChatCommandPrefix, useChatCommand, useCommand } from "../command"; import { prettyObject } from "../utils/format"; @@ -520,6 +523,68 @@ export function ChatActions(props: { ); } +export function EditMessageModal(props: { onClose: () => void }) { + const chatStore = useChatStore(); + const session = chatStore.currentSession(); + const [messages, setMessages] = useState(session.messages.slice()); + + return ( +
+ } + key="cancel" + onClick={() => { + props.onClose(); + }} + />, + } + key="ok" + onClick={() => { + chatStore.updateCurrentSession( + (session) => (session.messages = messages), + ); + props.onClose(); + }} + />, + ]} + > + + + + chatStore.updateCurrentSession( + (session) => (session.topic = e.currentTarget.value), + ) + } + > + + + { + const newMessages = messages.slice(); + updater(newMessages); + setMessages(newMessages); + }} + /> + +
+ ); +} + export function Chat() { type RenderMessage = ChatMessage & { preview?: boolean }; @@ -710,22 +775,6 @@ export function Chat() { } }; - const findLastUserIndex = (messageId: string) => { - // find last user input message - let lastUserMessageIndex: number | null = null; - for (let i = 0; i < session.messages.length; i += 1) { - const message = session.messages[i]; - if (message.role === "user") { - lastUserMessageIndex = i; - } - if (message.id === messageId) { - break; - } - } - - return lastUserMessageIndex; - }; - const deleteMessage = (msgId?: string) => { chatStore.updateCurrentSession( (session) => @@ -859,16 +908,6 @@ export function Chat() { const [showPromptModal, setShowPromptModal] = useState(false); - const renameSession = () => { - showPrompt(Locale.Chat.Rename, session.topic).then((newTopic) => { - if (newTopic && newTopic !== session.topic) { - chatStore.updateCurrentSession( - (session) => (session.topic = newTopic!), - ); - } - }); - }; - const clientConfig = useMemo(() => getClientConfig(), []); const location = useLocation(); @@ -919,6 +958,9 @@ export function Chat() { }, }); + // edit / insert message modal + const [isEditingMessage, setIsEditingMessage] = useState(false); + return (
@@ -938,7 +980,7 @@ export function Chat() {
setIsEditingMessage(true)} > {!session.topic ? DEFAULT_TOPIC : session.topic}
@@ -952,7 +994,7 @@ export function Chat() { } bordered - onClick={renameSession} + onClick={() => setIsEditingMessage(true)} />
)} @@ -1170,6 +1212,14 @@ export function Chat() { {showExport && ( setShowExport(false)} /> )} + + {isEditingMessage && ( + { + setIsEditingMessage(false); + }} + /> + )}
); } diff --git a/app/components/mask.tsx b/app/components/mask.tsx index b90722134..3d8ce3a26 100644 --- a/app/components/mask.tsx +++ b/app/components/mask.tsx @@ -215,67 +215,58 @@ function ContextPromptItem(props: { const [focusingInput, setFocusingInput] = useState(false); return ( - - {(provided) => ( -
- {!focusingInput && ( - <> -
- -
- - - )} - setFocusingInput(true)} - onBlur={() => { - setFocusingInput(false); - // If the selection is not removed when the user loses focus, some - // extensions like "Translate" will always display a floating bar - window?.getSelection()?.removeAllRanges(); - }} - onInput={(e) => +
+ {!focusingInput && ( + <> +
+ +
+ + )} - + setFocusingInput(true)} + onBlur={() => { + setFocusingInput(false); + // If the selection is not removed when the user loses focus, some + // extensions like "Translate" will always display a floating bar + window?.getSelection()?.removeAllRanges(); + }} + onInput={(e) => + props.update({ + ...props.prompt, + content: e.currentTarget.value as any, + }) + } + /> + {!focusingInput && ( + } + className={chatStyle["context-delete-button"]} + onClick={() => props.remove()} + bordered + /> + )} +
); } @@ -285,8 +276,8 @@ export function ContextPrompts(props: { }) { const context = props.context; - const addContextPrompt = (prompt: ChatMessage) => { - props.updateContext((context) => context.push(prompt)); + const addContextPrompt = (prompt: ChatMessage, i: number) => { + props.updateContext((context) => context.splice(i, 0, prompt)); }; const removeContextPrompt = (i: number) => { @@ -319,13 +310,41 @@ export function ContextPrompts(props: { {(provided) => (
{context.map((c, i) => ( - updateContextPrompt(i, prompt)} - remove={() => removeContextPrompt(i)} - /> + > + {(provided) => ( +
+ updateContextPrompt(i, prompt)} + remove={() => removeContextPrompt(i)} + /> +
{ + addContextPrompt( + createMessage({ + role: "user", + content: "", + date: new Date().toLocaleString(), + }), + i + 1, + ); + }} + > + +
+
+ )} + ))} {provided.placeholder}
@@ -333,23 +352,26 @@ export function ContextPrompts(props: { -
- } - text={Locale.Context.Add} - bordered - className={chatStyle["context-prompt-button"]} - onClick={() => - addContextPrompt( - createMessage({ - role: "user", - content: "", - date: "", - }), - ) - } - /> -
+ {props.context.length === 0 && ( +
+ } + text={Locale.Context.Add} + bordered + className={chatStyle["context-prompt-button"]} + onClick={() => + addContextPrompt( + createMessage({ + role: "user", + content: "", + date: "", + }), + props.context.length, + ) + } + /> +
+ )}
); diff --git a/app/locales/cn.ts b/app/locales/cn.ts index 54225e311..656cd5fe3 100644 --- a/app/locales/cn.ts +++ b/app/locales/cn.ts @@ -18,6 +18,12 @@ const cn = { }, Chat: { SubTitle: (count: number) => `共 ${count} 条对话`, + EditMessage: { + Topic: { + Title: "聊天主题", + SubTitle: "更改当前聊天主题", + }, + }, Actions: { ChatList: "查看消息列表", CompressedHistory: "查看压缩后的历史 Prompt", diff --git a/app/locales/en.ts b/app/locales/en.ts index ebc19f078..2d83de929 100644 --- a/app/locales/en.ts +++ b/app/locales/en.ts @@ -20,6 +20,12 @@ const en: LocaleType = { }, Chat: { SubTitle: (count: number) => `${count} messages`, + EditMessage: { + Topic: { + Title: "Topic", + SubTitle: "Change the current topic", + }, + }, Actions: { ChatList: "Go To Chat List", CompressedHistory: "Compressed History Memory Prompt", From b7320e6834f905debf1d2b7e1326f7e8f28d1ccf Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Fri, 21 Jul 2023 00:37:38 +0800 Subject: [PATCH 36/36] Update tauri.conf.json --- src-tauri/tauri.conf.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 8c520eca8..2c7398f0d 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -9,7 +9,7 @@ }, "package": { "productName": "ChatGPT Next Web", - "version": "2.9.0" + "version": "2.9.1" }, "tauri": { "allowlist": {