feat: 增加带格式的复制 (#182)

* feat: 增加带格式的复制

* feat: 移除前端超时设定

* chore: update deps

* feat: 添加权限页面

* feat: 设定页面优化

* feat: 更新 chatgpt 以支持 `gpt-3.5-turbo-0301`

* chore: version 2.9.0
main
Redon 2 years ago committed by GitHub
parent 42e320fe35
commit 32ebbec8ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,6 +2,3 @@
VITE_GLOB_API_URL=/api
VITE_APP_API_BASE_URL=http://localhost:3002/
# Glob API Timeout (ms)
VITE_GLOB_API_TIMEOUT=100000

@ -1,3 +1,16 @@
## v2.9.0
`2023-03-02`
### Feature
- 现在能复制带格式的消息文本
- 新设计的设定页面,可以自定义姓名、描述、头像(链接方式)
- 新增`403`和`404`页面以便扩展
## Enhancement
- 更新 `chatgpt` 使 `ChatGPTAPI` 支持 `gpt-3.5-turbo-0301`(默认)
- 取消了前端超时限制设定
## v2.8.3
`2023-03-01`

@ -1,6 +1,6 @@
{
"name": "chatgpt-web",
"version": "2.8.3",
"version": "2.9.0",
"private": false,
"description": "ChatGPT Web",
"author": "ChenZhaoYu <chenzhaoyu1994@gmail.com>",

@ -24,7 +24,7 @@
"common:cleanup": "rimraf node_modules && rimraf pnpm-lock.yaml"
},
"dependencies": {
"chatgpt": "^4.7.2",
"chatgpt": "^5.0.1",
"dotenv": "^16.0.3",
"esno": "^0.16.3",
"express": "^4.18.2",
@ -33,11 +33,11 @@
"socks-proxy-agent": "^7.0.0"
},
"devDependencies": {
"@antfu/eslint-config": "^0.35.2",
"@antfu/eslint-config": "^0.35.3",
"@types/express": "^4.17.17",
"@types/node": "^18.14.0",
"eslint": "^8.34.0",
"rimraf": "^4.1.2",
"@types/node": "^18.14.3",
"eslint": "^8.35.0",
"rimraf": "^4.1.3",
"tsup": "^6.6.3",
"typescript": "^4.9.5"
}

@ -1,23 +1,23 @@
lockfileVersion: 5.4
specifiers:
'@antfu/eslint-config': ^0.35.2
'@antfu/eslint-config': ^0.35.3
'@types/express': ^4.17.17
'@types/node': ^18.14.0
chatgpt: ^4.7.2
'@types/node': ^18.14.3
chatgpt: ^5.0.1
dotenv: ^16.0.3
eslint: ^8.34.0
eslint: ^8.35.0
esno: ^0.16.3
express: ^4.18.2
isomorphic-fetch: ^3.0.0
node-fetch: ^3.3.0
rimraf: ^4.1.2
rimraf: ^4.1.3
socks-proxy-agent: ^7.0.0
tsup: ^6.6.3
typescript: ^4.9.5
dependencies:
chatgpt: 4.7.2
chatgpt: 5.0.1
dotenv: 16.0.3
esno: 0.16.3
express: 4.18.2
@ -26,34 +26,34 @@ dependencies:
socks-proxy-agent: 7.0.0
devDependencies:
'@antfu/eslint-config': 0.35.2_7kw3g6rralp5ps6mg3uyzz6azm
'@antfu/eslint-config': 0.35.3_ycpbpc6yetojsgtrx3mwntkhsu
'@types/express': 4.17.17
'@types/node': 18.14.0
eslint: 8.34.0
rimraf: 4.1.2
'@types/node': 18.14.3
eslint: 8.35.0
rimraf: 4.1.3
tsup: 6.6.3_typescript@4.9.5
typescript: 4.9.5
packages:
/@antfu/eslint-config-basic/0.35.2_khyrr7my4aaa3ssgqabkfgcc24:
resolution: {integrity: sha512-2k7Ovkd8U/q0sgfjuT9KzAUV0q187yGxP7JzD2D4YifuJwL5Bh3JC49KpCv9PXMTeRUMJX2y/kOtGYPetocOug==}
/@antfu/eslint-config-basic/0.35.3_y46c5jzhegju5ppnhbs6d4llxi:
resolution: {integrity: sha512-NbWJKNgd3Ky3/ok2Z88cXNme/6I9otkiaB+FYLFgQE81sfMAhKpLKXtTSwzdcKMzhKDqUchAijt0BxjE/mcTJg==}
peerDependencies:
eslint: '>=7.4.0'
dependencies:
eslint: 8.34.0
eslint-plugin-antfu: 0.35.2_7kw3g6rralp5ps6mg3uyzz6azm
eslint-plugin-eslint-comments: 3.2.0_eslint@8.34.0
eslint: 8.35.0
eslint-plugin-antfu: 0.35.3_ycpbpc6yetojsgtrx3mwntkhsu
eslint-plugin-eslint-comments: 3.2.0_eslint@8.35.0
eslint-plugin-html: 7.1.0
eslint-plugin-import: 2.27.5_mcvs2y73sfmcxqzpjj5lr7a2m4
eslint-plugin-jsonc: 2.6.0_eslint@8.34.0
eslint-plugin-markdown: 3.0.0_eslint@8.34.0
eslint-plugin-n: 15.6.1_eslint@8.34.0
eslint-plugin-import: 2.27.5_ajyizmi44oc3hrc35l6ndh7p4e
eslint-plugin-jsonc: 2.6.0_eslint@8.35.0
eslint-plugin-markdown: 3.0.0_eslint@8.35.0
eslint-plugin-n: 15.6.1_eslint@8.35.0
eslint-plugin-no-only-tests: 3.1.0
eslint-plugin-promise: 6.1.1_eslint@8.34.0
eslint-plugin-unicorn: 45.0.2_eslint@8.34.0
eslint-plugin-unused-imports: 2.0.0_vqeavzxdzk2atb75l6fx3anzpi
eslint-plugin-yml: 1.5.0_eslint@8.34.0
eslint-plugin-promise: 6.1.1_eslint@8.35.0
eslint-plugin-unicorn: 45.0.2_eslint@8.35.0
eslint-plugin-unused-imports: 2.0.0_hlu2tevvfejtijvruutuci6rky
eslint-plugin-yml: 1.5.0_eslint@8.35.0
jsonc-eslint-parser: 2.1.0
yaml-eslint-parser: 1.1.0
transitivePeerDependencies:
@ -65,17 +65,17 @@ packages:
- typescript
dev: true
/@antfu/eslint-config-ts/0.35.2_7kw3g6rralp5ps6mg3uyzz6azm:
resolution: {integrity: sha512-GiJtTCQ83L/vMkJlWWg2l0buH/LIOXl5szrsqtr8/Hl6ssjAMXnug8sDZMCqCIZtztzQCewBPx8ufp/MpzA2cQ==}
/@antfu/eslint-config-ts/0.35.3_ycpbpc6yetojsgtrx3mwntkhsu:
resolution: {integrity: sha512-FS5hir2ghXYlJWAiB2bpT9oAr0kpSNmYbaJWWkztocJG95AORl4tWzxMTkLT+TxaOmhuwJszcrMTHy5RgHL8/w==}
peerDependencies:
eslint: '>=7.4.0'
typescript: '>=3.9'
dependencies:
'@antfu/eslint-config-basic': 0.35.2_khyrr7my4aaa3ssgqabkfgcc24
'@typescript-eslint/eslint-plugin': 5.52.0_6cfvjsbua5ptj65675bqcn6oza
'@typescript-eslint/parser': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm
eslint: 8.34.0
eslint-plugin-jest: 27.2.1_7hfwvekd5cgjoxqyvesymwuacm
'@antfu/eslint-config-basic': 0.35.3_y46c5jzhegju5ppnhbs6d4llxi
'@typescript-eslint/eslint-plugin': 5.54.0_6mj2wypvdnknez7kws2nfdgupi
'@typescript-eslint/parser': 5.54.0_ycpbpc6yetojsgtrx3mwntkhsu
eslint: 8.35.0
eslint-plugin-jest: 27.2.1_aere4n7c7ynvp62ae3ihfxuwhu
typescript: 4.9.5
transitivePeerDependencies:
- eslint-import-resolver-typescript
@ -84,15 +84,15 @@ packages:
- supports-color
dev: true
/@antfu/eslint-config-vue/0.35.2_khyrr7my4aaa3ssgqabkfgcc24:
resolution: {integrity: sha512-98k9D+n0bgr/9OqedAEOsflIWbXz4D92pejXqkUAtnRnB2Nq5dWrrFMJ59oJwTDKnEslpwANlgIXM11qdiTF0Q==}
/@antfu/eslint-config-vue/0.35.3_y46c5jzhegju5ppnhbs6d4llxi:
resolution: {integrity: sha512-BA3vGLyuzqtEUb9gfgE7YzBT+a4oUnQuUPasIUfN/BVXaEhRVYlMmUgxN4ekQLuzOgUjUH13lqplXtkLJ62t9g==}
peerDependencies:
eslint: '>=7.4.0'
dependencies:
'@antfu/eslint-config-basic': 0.35.2_khyrr7my4aaa3ssgqabkfgcc24
'@antfu/eslint-config-ts': 0.35.2_7kw3g6rralp5ps6mg3uyzz6azm
eslint: 8.34.0
eslint-plugin-vue: 9.9.0_eslint@8.34.0
'@antfu/eslint-config-basic': 0.35.3_y46c5jzhegju5ppnhbs6d4llxi
'@antfu/eslint-config-ts': 0.35.3_ycpbpc6yetojsgtrx3mwntkhsu
eslint: 8.35.0
eslint-plugin-vue: 9.9.0_eslint@8.35.0
local-pkg: 0.4.3
transitivePeerDependencies:
- '@typescript-eslint/eslint-plugin'
@ -104,24 +104,24 @@ packages:
- typescript
dev: true
/@antfu/eslint-config/0.35.2_7kw3g6rralp5ps6mg3uyzz6azm:
resolution: {integrity: sha512-bbm7Yh7VgNI9ZaYs/L1oSTQwPMIdvlRtqxPfaBLpYdEvnsOuT4yX84TO0YaZ4RFjE4jqxQCSE/eioxydmWnl4w==}
/@antfu/eslint-config/0.35.3_ycpbpc6yetojsgtrx3mwntkhsu:
resolution: {integrity: sha512-wd0ry/TNqaZmniqkKtZKoCvpl55x9YbHgL5Ug3H9rVuUSqaNi9G9AjYlynQqn4/M1EhYYWO597Lu7f/fC+csrg==}
peerDependencies:
eslint: '>=7.4.0'
dependencies:
'@antfu/eslint-config-vue': 0.35.2_khyrr7my4aaa3ssgqabkfgcc24
'@typescript-eslint/eslint-plugin': 5.52.0_6cfvjsbua5ptj65675bqcn6oza
'@typescript-eslint/parser': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm
eslint: 8.34.0
eslint-plugin-eslint-comments: 3.2.0_eslint@8.34.0
'@antfu/eslint-config-vue': 0.35.3_y46c5jzhegju5ppnhbs6d4llxi
'@typescript-eslint/eslint-plugin': 5.54.0_6mj2wypvdnknez7kws2nfdgupi
'@typescript-eslint/parser': 5.54.0_ycpbpc6yetojsgtrx3mwntkhsu
eslint: 8.35.0
eslint-plugin-eslint-comments: 3.2.0_eslint@8.35.0
eslint-plugin-html: 7.1.0
eslint-plugin-import: 2.27.5_mcvs2y73sfmcxqzpjj5lr7a2m4
eslint-plugin-jsonc: 2.6.0_eslint@8.34.0
eslint-plugin-n: 15.6.1_eslint@8.34.0
eslint-plugin-promise: 6.1.1_eslint@8.34.0
eslint-plugin-unicorn: 45.0.2_eslint@8.34.0
eslint-plugin-vue: 9.9.0_eslint@8.34.0
eslint-plugin-yml: 1.5.0_eslint@8.34.0
eslint-plugin-import: 2.27.5_ajyizmi44oc3hrc35l6ndh7p4e
eslint-plugin-jsonc: 2.6.0_eslint@8.35.0
eslint-plugin-n: 15.6.1_eslint@8.35.0
eslint-plugin-promise: 6.1.1_eslint@8.35.0
eslint-plugin-unicorn: 45.0.2_eslint@8.35.0
eslint-plugin-vue: 9.9.0_eslint@8.35.0
eslint-plugin-yml: 1.5.0_eslint@8.35.0
jsonc-eslint-parser: 2.1.0
yaml-eslint-parser: 1.1.0
transitivePeerDependencies:
@ -150,6 +150,10 @@ packages:
chalk: 2.4.2
js-tokens: 4.0.0
/@dqbd/tiktoken/0.4.0:
resolution: {integrity: sha512-iaHgmwKAOqowBFZKxelyszoeGLoNw62eOULcmyme1aA1Ymr3JgYl0V7jwpuUm7fksalycZajx3loFn9TRUaviw==}
dev: false
/@esbuild-kit/cjs-loader/2.4.2:
resolution: {integrity: sha512-BDXFbYOJzT/NBEtp71cvsrGPwGAMGRB/349rwKuoxNSiKjPraNNnlK6MIIabViCjqZugu6j+xeMDlEkWdHHJSg==}
dependencies:
@ -347,18 +351,18 @@ packages:
requiresBuild: true
optional: true
/@eslint-community/eslint-utils/4.1.2_eslint@8.34.0:
/@eslint-community/eslint-utils/4.1.2_eslint@8.35.0:
resolution: {integrity: sha512-7qELuQWWjVDdVsFQ5+beUl+KPczrEDA7S3zM4QUd/bJl7oXgsmpXaEVqrRTnOBqenOV4rWf2kVZk2Ot085zPWA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
dependencies:
eslint: 8.34.0
eslint: 8.35.0
eslint-visitor-keys: 3.3.0
dev: true
/@eslint/eslintrc/1.4.1:
resolution: {integrity: sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==}
/@eslint/eslintrc/2.0.0:
resolution: {integrity: sha512-fluIaaV+GyV24CCu/ggiHdV+j4RNh85yQnAYS/G2mZODZgGmmlrgCydjUcV3YvxCm9x8nMAfThsqTni4KiXT4A==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dependencies:
ajv: 6.12.6
@ -374,6 +378,11 @@ packages:
- supports-color
dev: true
/@eslint/js/8.35.0:
resolution: {integrity: sha512-JXdzbRiWclLVoD8sNUjR443VVlYqiYmDVT6rGUEIEHU5YJW0gaVZwV2xgM7D4arkvASqD0IlLUVjHiFuxaftRw==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dev: true
/@humanwhocodes/config-array/0.11.8:
resolution: {integrity: sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==}
engines: {node: '>=10.10.0'}
@ -419,19 +428,19 @@ packages:
resolution: {integrity: sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==}
dependencies:
'@types/connect': 3.4.35
'@types/node': 18.14.0
'@types/node': 18.14.3
dev: true
/@types/connect/3.4.35:
resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==}
dependencies:
'@types/node': 18.14.0
'@types/node': 18.14.3
dev: true
/@types/express-serve-static-core/4.17.33:
resolution: {integrity: sha512-TPBqmR/HRYI3eC2E5hmiivIzv+bidAfXofM+sbonAGvyDhySGw9/PQZFt2BLOrjUUR++4eJVpx6KnLQK1Fk9tA==}
dependencies:
'@types/node': 18.14.0
'@types/node': 18.14.3
'@types/qs': 6.9.7
'@types/range-parser': 1.2.4
dev: true
@ -463,8 +472,8 @@ packages:
resolution: {integrity: sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==}
dev: true
/@types/node/18.14.0:
resolution: {integrity: sha512-5EWrvLmglK+imbCJY0+INViFWUHg1AHel1sq4ZVSfdcNqGy9Edv3UB9IIzzg+xPaUcAgZYcfVs2fBcwDeZzU0A==}
/@types/node/18.14.3:
resolution: {integrity: sha512-1y36CC5iL5CMyKALzwX9cwwxcWIxvIBe3gzs4GrXWXEQ8klQnCZ2U/WDGiNrXHmQcUhnaun17XG9TEIDlGj2RA==}
dev: true
/@types/normalize-package-data/2.4.1:
@ -486,15 +495,15 @@ packages:
resolution: {integrity: sha512-z5xyF6uh8CbjAu9760KDKsH2FcDxZ2tFCsA4HIMWE6IkiYMXfVoa+4f9KX+FN0ZLsaMw1WNG2ETLA6N+/YA+cg==}
dependencies:
'@types/mime': 3.0.1
'@types/node': 18.14.0
'@types/node': 18.14.3
dev: true
/@types/unist/2.0.6:
resolution: {integrity: sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==}
dev: true
/@typescript-eslint/eslint-plugin/5.52.0_6cfvjsbua5ptj65675bqcn6oza:
resolution: {integrity: sha512-lHazYdvYVsBokwCdKOppvYJKaJ4S41CgKBcPvyd0xjZNbvQdhn/pnJlGtQksQ/NhInzdaeaSarlBjDXHuclEbg==}
/@typescript-eslint/eslint-plugin/5.54.0_6mj2wypvdnknez7kws2nfdgupi:
resolution: {integrity: sha512-+hSN9BdSr629RF02d7mMtXhAJvDTyCbprNYJKrXETlul/Aml6YZwd90XioVbjejQeHbb3R8Dg0CkRgoJDxo8aw==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
'@typescript-eslint/parser': ^5.0.0
@ -504,12 +513,12 @@ packages:
typescript:
optional: true
dependencies:
'@typescript-eslint/parser': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm
'@typescript-eslint/scope-manager': 5.52.0
'@typescript-eslint/type-utils': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm
'@typescript-eslint/utils': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm
'@typescript-eslint/parser': 5.54.0_ycpbpc6yetojsgtrx3mwntkhsu
'@typescript-eslint/scope-manager': 5.54.0
'@typescript-eslint/type-utils': 5.54.0_ycpbpc6yetojsgtrx3mwntkhsu
'@typescript-eslint/utils': 5.54.0_ycpbpc6yetojsgtrx3mwntkhsu
debug: 4.3.4
eslint: 8.34.0
eslint: 8.35.0
grapheme-splitter: 1.0.4
ignore: 5.2.4
natural-compare-lite: 1.4.0
@ -521,8 +530,8 @@ packages:
- supports-color
dev: true
/@typescript-eslint/parser/5.52.0_7kw3g6rralp5ps6mg3uyzz6azm:
resolution: {integrity: sha512-e2KiLQOZRo4Y0D/b+3y08i3jsekoSkOYStROYmPUnGMEoA0h+k2qOH5H6tcjIc68WDvGwH+PaOrP1XRzLJ6QlA==}
/@typescript-eslint/parser/5.54.0_ycpbpc6yetojsgtrx3mwntkhsu:
resolution: {integrity: sha512-aAVL3Mu2qTi+h/r04WI/5PfNWvO6pdhpeMRWk9R7rEV4mwJNzoWf5CCU5vDKBsPIFQFjEq1xg7XBI2rjiMXQbQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
@ -531,26 +540,26 @@ packages:
typescript:
optional: true
dependencies:
'@typescript-eslint/scope-manager': 5.52.0
'@typescript-eslint/types': 5.52.0
'@typescript-eslint/typescript-estree': 5.52.0_typescript@4.9.5
'@typescript-eslint/scope-manager': 5.54.0
'@typescript-eslint/types': 5.54.0
'@typescript-eslint/typescript-estree': 5.54.0_typescript@4.9.5
debug: 4.3.4
eslint: 8.34.0
eslint: 8.35.0
typescript: 4.9.5
transitivePeerDependencies:
- supports-color
dev: true
/@typescript-eslint/scope-manager/5.52.0:
resolution: {integrity: sha512-AR7sxxfBKiNV0FWBSARxM8DmNxrwgnYMPwmpkC1Pl1n+eT8/I2NAUPuwDy/FmDcC6F8pBfmOcaxcxRHspgOBMw==}
/@typescript-eslint/scope-manager/5.54.0:
resolution: {integrity: sha512-VTPYNZ7vaWtYna9M4oD42zENOBrb+ZYyCNdFs949GcN8Miwn37b8b7eMj+EZaq7VK9fx0Jd+JhmkhjFhvnovhg==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dependencies:
'@typescript-eslint/types': 5.52.0
'@typescript-eslint/visitor-keys': 5.52.0
'@typescript-eslint/types': 5.54.0
'@typescript-eslint/visitor-keys': 5.54.0
dev: true
/@typescript-eslint/type-utils/5.52.0_7kw3g6rralp5ps6mg3uyzz6azm:
resolution: {integrity: sha512-tEKuUHfDOv852QGlpPtB3lHOoig5pyFQN/cUiZtpw99D93nEBjexRLre5sQZlkMoHry/lZr8qDAt2oAHLKA6Jw==}
/@typescript-eslint/type-utils/5.54.0_ycpbpc6yetojsgtrx3mwntkhsu:
resolution: {integrity: sha512-WI+WMJ8+oS+LyflqsD4nlXMsVdzTMYTxl16myXPaCXnSgc7LWwMsjxQFZCK/rVmTZ3FN71Ct78ehO9bRC7erYQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: '*'
@ -559,23 +568,23 @@ packages:
typescript:
optional: true
dependencies:
'@typescript-eslint/typescript-estree': 5.52.0_typescript@4.9.5
'@typescript-eslint/utils': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm
'@typescript-eslint/typescript-estree': 5.54.0_typescript@4.9.5
'@typescript-eslint/utils': 5.54.0_ycpbpc6yetojsgtrx3mwntkhsu
debug: 4.3.4
eslint: 8.34.0
eslint: 8.35.0
tsutils: 3.21.0_typescript@4.9.5
typescript: 4.9.5
transitivePeerDependencies:
- supports-color
dev: true
/@typescript-eslint/types/5.52.0:
resolution: {integrity: sha512-oV7XU4CHYfBhk78fS7tkum+/Dpgsfi91IIDy7fjCyq2k6KB63M6gMC0YIvy+iABzmXThCRI6xpCEyVObBdWSDQ==}
/@typescript-eslint/types/5.54.0:
resolution: {integrity: sha512-nExy+fDCBEgqblasfeE3aQ3NuafBUxZxgxXcYfzYRZFHdVvk5q60KhCSkG0noHgHRo/xQ/BOzURLZAafFpTkmQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dev: true
/@typescript-eslint/typescript-estree/5.52.0_typescript@4.9.5:
resolution: {integrity: sha512-WeWnjanyEwt6+fVrSR0MYgEpUAuROxuAH516WPjUblIrClzYJj0kBbjdnbQXLpgAN8qbEuGywiQsXUVDiAoEuQ==}
/@typescript-eslint/typescript-estree/5.54.0_typescript@4.9.5:
resolution: {integrity: sha512-X2rJG97Wj/VRo5YxJ8Qx26Zqf0RRKsVHd4sav8NElhbZzhpBI8jU54i6hfo9eheumj4oO4dcRN1B/zIVEqR/MQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
typescript: '*'
@ -583,8 +592,8 @@ packages:
typescript:
optional: true
dependencies:
'@typescript-eslint/types': 5.52.0
'@typescript-eslint/visitor-keys': 5.52.0
'@typescript-eslint/types': 5.54.0
'@typescript-eslint/visitor-keys': 5.54.0
debug: 4.3.4
globby: 11.1.0
is-glob: 4.0.3
@ -595,31 +604,31 @@ packages:
- supports-color
dev: true
/@typescript-eslint/utils/5.52.0_7kw3g6rralp5ps6mg3uyzz6azm:
resolution: {integrity: sha512-As3lChhrbwWQLNk2HC8Ree96hldKIqk98EYvypd3It8Q1f8d5zWyIoaZEp2va5667M4ZyE7X8UUR+azXrFl+NA==}
/@typescript-eslint/utils/5.54.0_ycpbpc6yetojsgtrx3mwntkhsu:
resolution: {integrity: sha512-cuwm8D/Z/7AuyAeJ+T0r4WZmlnlxQ8wt7C7fLpFlKMR+dY6QO79Cq1WpJhvZbMA4ZeZGHiRWnht7ZJ8qkdAunw==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
dependencies:
'@types/json-schema': 7.0.11
'@types/semver': 7.3.13
'@typescript-eslint/scope-manager': 5.52.0
'@typescript-eslint/types': 5.52.0
'@typescript-eslint/typescript-estree': 5.52.0_typescript@4.9.5
eslint: 8.34.0
'@typescript-eslint/scope-manager': 5.54.0
'@typescript-eslint/types': 5.54.0
'@typescript-eslint/typescript-estree': 5.54.0_typescript@4.9.5
eslint: 8.35.0
eslint-scope: 5.1.1
eslint-utils: 3.0.0_eslint@8.34.0
eslint-utils: 3.0.0_eslint@8.35.0
semver: 7.3.8
transitivePeerDependencies:
- supports-color
- typescript
dev: true
/@typescript-eslint/visitor-keys/5.52.0:
resolution: {integrity: sha512-qMwpw6SU5VHCPr99y274xhbm+PRViK/NATY6qzt+Et7+mThGuFSl/ompj2/hrBlRP/kq+BFdgagnOSgw9TB0eA==}
/@typescript-eslint/visitor-keys/5.54.0:
resolution: {integrity: sha512-xu4wT7aRCakGINTLGeyGqDn+78BwFlggwBjnHa1ar/KaGagnmwLYmlrXIrgAaQ3AE1Vd6nLfKASm7LrFHNbKGA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dependencies:
'@typescript-eslint/types': 5.52.0
'@typescript-eslint/types': 5.54.0
eslint-visitor-keys: 3.3.0
dev: true
@ -730,10 +739,6 @@ packages:
is-string: 1.0.7
dev: true
/array-keyed-map/2.1.3:
resolution: {integrity: sha512-JIUwuFakO+jHjxyp4YgSiKXSZeC0U+R1jR94bXWBcVlFRBycqXlb+kH9JHxBGcxnVuSqx5bnn0Qz9xtSeKOjiA==}
dev: false
/array-union/2.1.0:
resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==}
engines: {node: '>=8'}
@ -891,15 +896,15 @@ packages:
resolution: {integrity: sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==}
dev: true
/chatgpt/4.7.2:
resolution: {integrity: sha512-c5CNqvB98IMEz/Byopwu5FlXGS3w/3iNiZITdDlcZLue4VSjEfzMRWrOrdGidzcE+ud2My6nO8/sSnY7W04WJA==}
/chatgpt/5.0.1:
resolution: {integrity: sha512-Wy+/2XL0FobiJFaQ6N5WnhRCnOwrUJCpoVCn67qqhiWrM1QW6lgmpvtDDKKDyvj7D1MLMjc2xB/kK8aT27mL/w==}
engines: {node: '>=14'}
hasBin: true
dependencies:
'@dqbd/tiktoken': 0.4.0
cac: 6.7.14
conf: 11.0.1
eventsource-parser: 0.0.5
gpt3-tokenizer: 1.1.5
keyv: 4.5.2
p-timeout: 6.1.1
quick-lru: 6.1.1
@ -1278,7 +1283,7 @@ packages:
- supports-color
dev: true
/eslint-module-utils/2.7.4_npjqex3ey3rgd34fjcuucz7la4:
/eslint-module-utils/2.7.4_qynxowrxvm2kj5rbowcxf5maga:
resolution: {integrity: sha512-j4GT+rqzCoRKHwURX7pddtIPGySnX9Si/cgMI5ztrcqOPtk5dDEeZ34CQVPphnqkJytlc97Vuk05Um2mJ3gEQA==}
engines: {node: '>=4'}
peerDependencies:
@ -1299,43 +1304,43 @@ packages:
eslint-import-resolver-webpack:
optional: true
dependencies:
'@typescript-eslint/parser': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm
'@typescript-eslint/parser': 5.54.0_ycpbpc6yetojsgtrx3mwntkhsu
debug: 3.2.7
eslint: 8.34.0
eslint: 8.35.0
eslint-import-resolver-node: 0.3.7
transitivePeerDependencies:
- supports-color
dev: true
/eslint-plugin-antfu/0.35.2_7kw3g6rralp5ps6mg3uyzz6azm:
resolution: {integrity: sha512-Q6FOcOakafU49PDRlq7jkrWmlTJ4u3AW7aGX+FqeQNaMgjXq0RzPGvS0Vyp7q/XDRLLoe0BjbGkamTeZXg8waw==}
/eslint-plugin-antfu/0.35.3_ycpbpc6yetojsgtrx3mwntkhsu:
resolution: {integrity: sha512-90Xct24s2n3aQhuuFFcPLhF5E6lU5s225B0VXupSjvDTuF+CmSQQLQG6KcqcdpA8O6dMbeXB9zy3SJ4aO7lndw==}
dependencies:
'@typescript-eslint/utils': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm
'@typescript-eslint/utils': 5.54.0_ycpbpc6yetojsgtrx3mwntkhsu
transitivePeerDependencies:
- eslint
- supports-color
- typescript
dev: true
/eslint-plugin-es/4.1.0_eslint@8.34.0:
/eslint-plugin-es/4.1.0_eslint@8.35.0:
resolution: {integrity: sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ==}
engines: {node: '>=8.10.0'}
peerDependencies:
eslint: '>=4.19.1'
dependencies:
eslint: 8.34.0
eslint: 8.35.0
eslint-utils: 2.1.0
regexpp: 3.2.0
dev: true
/eslint-plugin-eslint-comments/3.2.0_eslint@8.34.0:
/eslint-plugin-eslint-comments/3.2.0_eslint@8.35.0:
resolution: {integrity: sha512-0jkOl0hfojIHHmEHgmNdqv4fmh7300NdpA9FFpF7zaoLvB/QeXOGNLIo86oAveJFrfB1p05kC8hpEMHM8DwWVQ==}
engines: {node: '>=6.5.0'}
peerDependencies:
eslint: '>=4.19.1'
dependencies:
escape-string-regexp: 1.0.5
eslint: 8.34.0
eslint: 8.35.0
ignore: 5.2.4
dev: true
@ -1345,7 +1350,7 @@ packages:
htmlparser2: 8.0.1
dev: true
/eslint-plugin-import/2.27.5_mcvs2y73sfmcxqzpjj5lr7a2m4:
/eslint-plugin-import/2.27.5_ajyizmi44oc3hrc35l6ndh7p4e:
resolution: {integrity: sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow==}
engines: {node: '>=4'}
peerDependencies:
@ -1355,15 +1360,15 @@ packages:
'@typescript-eslint/parser':
optional: true
dependencies:
'@typescript-eslint/parser': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm
'@typescript-eslint/parser': 5.54.0_ycpbpc6yetojsgtrx3mwntkhsu
array-includes: 3.1.6
array.prototype.flat: 1.3.1
array.prototype.flatmap: 1.3.1
debug: 3.2.7
doctrine: 2.1.0
eslint: 8.34.0
eslint: 8.35.0
eslint-import-resolver-node: 0.3.7
eslint-module-utils: 2.7.4_npjqex3ey3rgd34fjcuucz7la4
eslint-module-utils: 2.7.4_qynxowrxvm2kj5rbowcxf5maga
has: 1.0.3
is-core-module: 2.11.0
is-glob: 4.0.3
@ -1378,7 +1383,7 @@ packages:
- supports-color
dev: true
/eslint-plugin-jest/27.2.1_7hfwvekd5cgjoxqyvesymwuacm:
/eslint-plugin-jest/27.2.1_aere4n7c7ynvp62ae3ihfxuwhu:
resolution: {integrity: sha512-l067Uxx7ZT8cO9NJuf+eJHvt6bqJyz2Z29wykyEdz/OtmcELQl2MQGQLX8J94O1cSJWAwUSEvCjwjA7KEK3Hmg==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
peerDependencies:
@ -1391,48 +1396,48 @@ packages:
jest:
optional: true
dependencies:
'@typescript-eslint/eslint-plugin': 5.52.0_6cfvjsbua5ptj65675bqcn6oza
'@typescript-eslint/utils': 5.52.0_7kw3g6rralp5ps6mg3uyzz6azm
eslint: 8.34.0
'@typescript-eslint/eslint-plugin': 5.54.0_6mj2wypvdnknez7kws2nfdgupi
'@typescript-eslint/utils': 5.54.0_ycpbpc6yetojsgtrx3mwntkhsu
eslint: 8.35.0
transitivePeerDependencies:
- supports-color
- typescript
dev: true
/eslint-plugin-jsonc/2.6.0_eslint@8.34.0:
/eslint-plugin-jsonc/2.6.0_eslint@8.35.0:
resolution: {integrity: sha512-4bA9YTx58QaWalua1Q1b82zt7eZMB7i+ed8q8cKkbKP75ofOA2SXbtFyCSok7RY6jIXeCqQnKjN9If8zCgv6PA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: '>=6.0.0'
dependencies:
eslint: 8.34.0
eslint-utils: 3.0.0_eslint@8.34.0
eslint: 8.35.0
eslint-utils: 3.0.0_eslint@8.35.0
jsonc-eslint-parser: 2.1.0
natural-compare: 1.4.0
dev: true
/eslint-plugin-markdown/3.0.0_eslint@8.34.0:
/eslint-plugin-markdown/3.0.0_eslint@8.35.0:
resolution: {integrity: sha512-hRs5RUJGbeHDLfS7ELanT0e29Ocyssf/7kBM+p7KluY5AwngGkDf8Oyu4658/NZSGTTq05FZeWbkxXtbVyHPwg==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
dependencies:
eslint: 8.34.0
eslint: 8.35.0
mdast-util-from-markdown: 0.8.5
transitivePeerDependencies:
- supports-color
dev: true
/eslint-plugin-n/15.6.1_eslint@8.34.0:
/eslint-plugin-n/15.6.1_eslint@8.35.0:
resolution: {integrity: sha512-R9xw9OtCRxxaxaszTQmQAlPgM+RdGjaL1akWuY/Fv9fRAi8Wj4CUKc6iYVG8QNRjRuo8/BqVYIpfqberJUEacA==}
engines: {node: '>=12.22.0'}
peerDependencies:
eslint: '>=7.0.0'
dependencies:
builtins: 5.0.1
eslint: 8.34.0
eslint-plugin-es: 4.1.0_eslint@8.34.0
eslint-utils: 3.0.0_eslint@8.34.0
eslint: 8.35.0
eslint-plugin-es: 4.1.0_eslint@8.35.0
eslint-utils: 3.0.0_eslint@8.35.0
ignore: 5.2.4
is-core-module: 2.11.0
minimatch: 3.1.2
@ -1445,27 +1450,27 @@ packages:
engines: {node: '>=5.0.0'}
dev: true
/eslint-plugin-promise/6.1.1_eslint@8.34.0:
/eslint-plugin-promise/6.1.1_eslint@8.35.0:
resolution: {integrity: sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^7.0.0 || ^8.0.0
dependencies:
eslint: 8.34.0
eslint: 8.35.0
dev: true
/eslint-plugin-unicorn/45.0.2_eslint@8.34.0:
/eslint-plugin-unicorn/45.0.2_eslint@8.35.0:
resolution: {integrity: sha512-Y0WUDXRyGDMcKLiwgL3zSMpHrXI00xmdyixEGIg90gHnj0PcHY4moNv3Ppje/kDivdAy5vUeUr7z211ImPv2gw==}
engines: {node: '>=14.18'}
peerDependencies:
eslint: '>=8.28.0'
dependencies:
'@babel/helper-validator-identifier': 7.19.1
'@eslint-community/eslint-utils': 4.1.2_eslint@8.34.0
'@eslint-community/eslint-utils': 4.1.2_eslint@8.35.0
ci-info: 3.8.0
clean-regexp: 1.0.0
eslint: 8.34.0
esquery: 1.4.0
eslint: 8.35.0
esquery: 1.4.2
indent-string: 4.0.0
is-builtin-module: 3.2.1
jsesc: 3.0.2
@ -1479,7 +1484,7 @@ packages:
strip-indent: 3.0.0
dev: true
/eslint-plugin-unused-imports/2.0.0_vqeavzxdzk2atb75l6fx3anzpi:
/eslint-plugin-unused-imports/2.0.0_hlu2tevvfejtijvruutuci6rky:
resolution: {integrity: sha512-3APeS/tQlTrFa167ThtP0Zm0vctjr4M44HMpeg1P4bK6wItarumq0Ma82xorMKdFsWpphQBlRPzw/pxiVELX1A==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
@ -1489,37 +1494,37 @@ packages:
'@typescript-eslint/eslint-plugin':
optional: true
dependencies:
'@typescript-eslint/eslint-plugin': 5.52.0_6cfvjsbua5ptj65675bqcn6oza
eslint: 8.34.0
'@typescript-eslint/eslint-plugin': 5.54.0_6mj2wypvdnknez7kws2nfdgupi
eslint: 8.35.0
eslint-rule-composer: 0.3.0
dev: true
/eslint-plugin-vue/9.9.0_eslint@8.34.0:
/eslint-plugin-vue/9.9.0_eslint@8.35.0:
resolution: {integrity: sha512-YbubS7eK0J7DCf0U2LxvVP7LMfs6rC6UltihIgval3azO3gyDwEGVgsCMe1TmDiEkl6GdMKfRpaME6QxIYtzDQ==}
engines: {node: ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^6.2.0 || ^7.0.0 || ^8.0.0
dependencies:
eslint: 8.34.0
eslint-utils: 3.0.0_eslint@8.34.0
eslint: 8.35.0
eslint-utils: 3.0.0_eslint@8.35.0
natural-compare: 1.4.0
nth-check: 2.1.1
postcss-selector-parser: 6.0.11
semver: 7.3.8
vue-eslint-parser: 9.1.0_eslint@8.34.0
vue-eslint-parser: 9.1.0_eslint@8.35.0
xml-name-validator: 4.0.0
transitivePeerDependencies:
- supports-color
dev: true
/eslint-plugin-yml/1.5.0_eslint@8.34.0:
/eslint-plugin-yml/1.5.0_eslint@8.35.0:
resolution: {integrity: sha512-iygN054g+ZrnYmtOXMnT+sx9iDNXt89/m0+506cQHeG0+5jJN8hY5iOPQLd3yfd50AfK/mSasajBWruf1SoHpQ==}
engines: {node: ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: '>=6.0.0'
dependencies:
debug: 4.3.4
eslint: 8.34.0
eslint: 8.35.0
lodash: 4.17.21
natural-compare: 1.4.0
yaml-eslint-parser: 1.1.0
@ -1555,13 +1560,13 @@ packages:
eslint-visitor-keys: 1.3.0
dev: true
/eslint-utils/3.0.0_eslint@8.34.0:
/eslint-utils/3.0.0_eslint@8.35.0:
resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==}
engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0}
peerDependencies:
eslint: '>=5'
dependencies:
eslint: 8.34.0
eslint: 8.35.0
eslint-visitor-keys: 2.1.0
dev: true
@ -1580,12 +1585,13 @@ packages:
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dev: true
/eslint/8.34.0:
resolution: {integrity: sha512-1Z8iFsucw+7kSqXNZVslXS8Ioa4u2KM7GPwuKtkTFAqZ/cHMcEaR+1+Br0wLlot49cNxIiZk5wp8EAbPcYZxTg==}
/eslint/8.35.0:
resolution: {integrity: sha512-BxAf1fVL7w+JLRQhWl2pzGeSiGqbWumV4WNvc9Rhp6tiCtm4oHnyPBSEtMGZwrQgudFQ+otqzWoPB7x+hxoWsw==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
hasBin: true
dependencies:
'@eslint/eslintrc': 1.4.1
'@eslint/eslintrc': 2.0.0
'@eslint/js': 8.35.0
'@humanwhocodes/config-array': 0.11.8
'@humanwhocodes/module-importer': 1.0.1
'@nodelib/fs.walk': 1.2.8
@ -1596,10 +1602,10 @@ packages:
doctrine: 3.0.0
escape-string-regexp: 4.0.0
eslint-scope: 7.1.1
eslint-utils: 3.0.0_eslint@8.34.0
eslint-utils: 3.0.0_eslint@8.35.0
eslint-visitor-keys: 3.3.0
espree: 9.4.1
esquery: 1.4.0
esquery: 1.4.2
esutils: 2.0.3
fast-deep-equal: 3.1.3
file-entry-cache: 6.0.1
@ -1644,8 +1650,8 @@ packages:
eslint-visitor-keys: 3.3.0
dev: true
/esquery/1.4.0:
resolution: {integrity: sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==}
/esquery/1.4.2:
resolution: {integrity: sha512-JVSoLdTlTDkmjFmab7H/9SL9qGSyjElT3myyKp7krqjVFQCDLmj1QFaCLRFBszBKI0XVZaiiXvuPIX3ZwHe1Ng==}
engines: {node: '>=0.10'}
dependencies:
estraverse: 5.3.0
@ -1981,13 +1987,6 @@ packages:
get-intrinsic: 1.2.0
dev: true
/gpt3-tokenizer/1.1.5:
resolution: {integrity: sha512-O9iCL8MqGR0Oe9wTh0YftzIbysypNQmS5a5JG3cB3M4LMYjlAVvNnf8LUzVY9MrI7tj+YLY356uHtO2lLX2HpA==}
engines: {node: '>=12'}
dependencies:
array-keyed-map: 2.1.3
dev: false
/grapheme-splitter/1.0.4:
resolution: {integrity: sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==}
dev: true
@ -3008,8 +3007,8 @@ packages:
glob: 7.2.3
dev: true
/rimraf/4.1.2:
resolution: {integrity: sha512-BlIbgFryTbw3Dz6hyoWFhKk+unCcHMSkZGrTFVAx2WmttdBSonsdtRlwiuTbDqTKr+UlXIUqJVS4QT5tUzGENQ==}
/rimraf/4.1.3:
resolution: {integrity: sha512-iyzalDLo3l5FZxxaIGUY7xI4Bf90Xt7pCipc1Mr7RsdU7H3538z+M0tlsUDrz0aHeGS9uNqiKHUJyTewwRP91Q==}
engines: {node: '>=14'}
hasBin: true
dev: true
@ -3495,18 +3494,18 @@ packages:
engines: {node: '>= 0.8'}
dev: false
/vue-eslint-parser/9.1.0_eslint@8.34.0:
/vue-eslint-parser/9.1.0_eslint@8.35.0:
resolution: {integrity: sha512-NGn/iQy8/Wb7RrRa4aRkokyCZfOUWk19OP5HP6JEozQFX5AoS/t+Z0ZN7FY4LlmWc4FNI922V7cvX28zctN8dQ==}
engines: {node: ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: '>=6.0.0'
dependencies:
debug: 4.3.4
eslint: 8.34.0
eslint: 8.35.0
eslint-scope: 7.1.1
eslint-visitor-keys: 3.3.0
espree: 9.4.1
esquery: 1.4.0
esquery: 1.4.2
lodash: 4.17.21
semver: 7.3.8
transitivePeerDependencies:

@ -4,8 +4,8 @@ import type { ChatMessage, SendMessageOptions } from 'chatgpt'
import { ChatGPTAPI, ChatGPTUnofficialProxyAPI } from 'chatgpt'
import { SocksProxyAgent } from 'socks-proxy-agent'
import fetch from 'node-fetch'
import { sendResponse } from './utils'
import type { ApiModel, ChatContext, ChatGPTAPIOptions, ChatGPTUnofficialProxyAPIOptions, ModelConfig } from './types'
import { sendResponse } from '../utils'
import type { ApiModel, ChatContext, ChatGPTAPIOptions, ChatGPTUnofficialProxyAPIOptions, ModelConfig } from '../types'
dotenv.config()

@ -2,8 +2,10 @@
import { NConfigProvider } from 'naive-ui'
import { NaiveProvider } from '@/components/common'
import { useTheme } from '@/hooks/useTheme'
import { useLanguage } from '@/hooks/useLanguage'
const { theme, themeOverrides } = useTheme()
const { language } = useLanguage()
</script>
<template>
@ -11,6 +13,7 @@ const { theme, themeOverrides } = useTheme()
class="h-full"
:theme="theme"
:theme-overrides="themeOverrides"
:locale="language"
>
<NaiveProvider>
<RouterView />

@ -0,0 +1,62 @@
<script setup lang='ts'>
import { onMounted, ref } from 'vue'
import { NSpin } from 'naive-ui'
import { fetchChatConfig } from '@/api'
import pkg from '@/../package.json'
interface ConfigState {
timeoutMs?: number
reverseProxy?: string
apiModel?: string
socksProxy?: string
}
const loading = ref(false)
const config = ref<ConfigState>()
async function fetchConfig() {
try {
loading.value = true
const { data } = await fetchChatConfig<ConfigState>()
config.value = data
}
finally {
loading.value = false
}
}
onMounted(() => {
fetchConfig()
})
</script>
<template>
<NSpin :show="loading">
<div class="p-4 space-y-4">
<h2 class="text-xl font-bold">
Version - {{ pkg.version }}
</h2>
<div class="p-2 space-y-2 rounded-md bg-neutral-100 dark:bg-neutral-700">
<p>
此项目开源于
<a
class="text-blue-600 dark:text-blue-500"
href="https://github.com/Chanzhaoyu/chatgpt-web"
target="_blank"
>
Github
</a>
免费并且没有任何形式分付费行为
</p>
<p>
如果你觉得此项目对你有帮助请在 Github 帮我点个 Star 或者给予一点赞助谢谢
</p>
</div>
<p>API方式{{ config?.apiModel ?? '-' }}</p>
<p>反向代理{{ config?.reverseProxy ?? '-' }}</p>
<p>超时时间{{ config?.timeoutMs ?? '-' }}</p>
<p>Socks代理{{ config?.socksProxy ?? '-' }}</p>
</div>
</NSpin>
</template>

@ -0,0 +1,144 @@
<script lang="ts" setup>
import { computed, ref } from 'vue'
import { NButton, NInput, useMessage } from 'naive-ui'
import type { Language, Theme } from '@/store/modules/app/helper'
import { SvgIcon } from '@/components/common'
import { useAppStore, useUserStore } from '@/store'
import type { UserInfo } from '@/store/modules/user/helper'
interface Emit {
(event: 'update'): void
}
const emit = defineEmits<Emit>()
const appStore = useAppStore()
const userStore = useUserStore()
const ms = useMessage()
const theme = computed(() => appStore.theme)
const userInfo = computed(() => userStore.userInfo)
const avatar = ref(userInfo.value.avatar ?? '')
const name = ref(userInfo.value.name ?? '')
const description = ref(userInfo.value.description ?? '')
const language = computed({
get() {
return appStore.language
},
set(value: Language) {
appStore.setLanguage(value)
},
})
const themeOptions: { label: string; key: Theme; icon: string }[] = [
{
label: 'Auto',
key: 'auto',
icon: 'ri:contrast-line',
},
{
label: 'Light',
key: 'light',
icon: 'ri:sun-foggy-line',
},
{
label: 'Dark',
key: 'dark',
icon: 'ri:moon-foggy-line',
},
]
const languageOptions: { label: string; key: Language; value: Language }[] = [
{ label: '中文', key: 'zh-CN', value: 'zh-CN' },
{ label: 'English', key: 'en-US', value: 'en-US' },
]
function updateUserInfo(options: Partial<UserInfo>) {
userStore.updateUserInfo(options)
ms.success('Update success')
}
function handleReset() {
userStore.resetUserInfo()
ms.success('Reset success')
emit('update')
}
</script>
<template>
<div class="p-4 space-y-5 min-h-[200px]">
<div class="space-y-6">
<div class="flex items-center space-x-4">
<span class="flex-shrink-0 w-[100px]">Avatar Link</span>
<div class="flex-1">
<NInput v-model:value="avatar" placeholder="" />
</div>
<NButton size="tiny" text type="primary" @click="updateUserInfo({ avatar })">
Save
</NButton>
</div>
<div class="flex items-center space-x-4">
<span class="flex-shrink-0 w-[100px]">Name</span>
<div class="w-[200px]">
<NInput v-model:value="name" placeholder="" />
</div>
<NButton size="tiny" text type="primary" @click="updateUserInfo({ name })">
Save
</NButton>
</div>
<div class="flex items-center space-x-4">
<span class="flex-shrink-0 w-[100px]">Description</span>
<div class="flex-1">
<NInput v-model:value="description" placeholder="" />
</div>
<NButton size="tiny" text type="primary" @click="updateUserInfo({ description })">
Save
</NButton>
</div>
<div class="flex items-center space-x-4">
<span class="flex-shrink-0 w-[100px]">Reset UserInfo</span>
<NButton text type="primary" @click="handleReset">
Reset
</NButton>
</div>
<div class="flex items-center space-x-4">
<span class="flex-shrink-0 w-[100px]">Theme</span>
<div class="flex items-center space-x-4">
<template v-for="item of themeOptions" :key="item.key">
<a
class="flex items-center justify-center h-8 px-4 border rounded-md cursor-pointer dark:border-neutral-700"
:class="item.key === theme && ['bg-[#4ca85e]', 'border-[#4ca85e]', 'text-white']"
@click="appStore.setTheme(item.key)"
>
<span class="text-xl">
<SvgIcon :icon="item.icon" />
</span>
</a>
</template>
</div>
</div>
<div class="flex items-center space-x-4">
<span class="flex-shrink-0 w-[100px]">Language</span>
<div class="flex items-center space-x-4">
<template v-for="item of languageOptions" :key="item.key">
<a
class="flex items-center justify-center h-8 px-4 border rounded-md cursor-pointer dark:border-neutral-700"
:class="item.key === language && ['bg-[#4ca85e]', 'border-[#4ca85e]', 'text-white']"
@click="appStore.setLanguage(item.key)"
>
<span class="text-sm">
{{ item.label }}
</span>
</a>
</template>
</div>
</div>
</div>
</div>
</template>

@ -1,8 +1,9 @@
<script setup lang='ts'>
import { computed, ref, watch } from 'vue'
import { NCard, NModal } from 'naive-ui'
import pkg from '../../../../package.json'
import { fetchChatConfig } from '@/api'
import { computed, ref } from 'vue'
import { NCard, NModal, NTabPane, NTabs } from 'naive-ui'
import General from './General.vue'
import About from './About.vue'
import { SvgIcon } from '@/components/common'
interface Props {
visible: boolean
@ -12,17 +13,14 @@ interface Emit {
(e: 'update:visible', visible: boolean): void
}
interface ConfigState {
timeoutMs?: number
reverseProxy?: string
apiModel?: string
socksProxy?: string
}
const props = defineProps<Props>()
const emit = defineEmits<Emit>()
const active = ref('General')
const reload = ref(false)
const show = computed({
get() {
return props.visible
@ -32,46 +30,35 @@ const show = computed({
},
})
const config = ref<ConfigState>()
async function fetchConfig() {
try {
const { data } = await fetchChatConfig<ConfigState>()
config.value = data
}
catch (error) {
// ...
}
function handleReload() {
reload.value = true
setTimeout(() => {
reload.value = false
}, 0)
}
watch(
() => props.visible,
(val) => {
if (val)
fetchConfig()
},
)
</script>
<template>
<NModal v-model:show="show" style="width: 80%; max-width: 460px;">
<NCard>
<div class="space-y-4">
<h2 class="text-xl font-bold text-center">
Version - {{ pkg.version }}
</h2>
<hr>
<p>
此项目开源于
<a class="text-blue-600" href="https://github.com/Chanzhaoyu/chatgpt-web" target="_blank">Github</a>
如果你觉得此项目对你有帮助请帮我点个 Star谢谢
</p>
<hr>
<p>API方式{{ config?.apiModel ?? '-' }}</p>
<p>反向代理{{ config?.reverseProxy ?? '-' }}</p>
<p>超时时间{{ config?.timeoutMs ?? '-' }}</p>
<p>Socks代理{{ config?.socksProxy ?? '-' }}</p>
</div>
<NModal v-model:show="show">
<NCard role="dialog" aria-modal="true" :bordered="false" style="width: 100%; max-width: 640px">
<NTabs v-model:value="active" type="line" animated>
<NTabPane name="General" tab="General">
<template #tab>
<SvgIcon class="text-lg" icon="ri:file-user-line" />
<span class="ml-2">General</span>
</template>
<div class="min-h-[100px]">
<General v-if="!reload" @update="handleReload" />
</div>
</NTabPane>
<NTabPane name="Config" tab="Config">
<template #tab>
<SvgIcon class="text-lg" icon="ri:list-settings-line" />
<span class="ml-2">Config</span>
</template>
<About />
</NTabPane>
</NTabs>
</NCard>
</NModal>
</template>

@ -1,18 +1,39 @@
<script setup lang='ts'>
import { GithubSite } from '@/components/custom'
import { computed } from 'vue'
import { NAvatar } from 'naive-ui'
import { useUserStore } from '@/store'
import defaultAvatar from '@/assets/avatar.jpg'
import { isString } from '@/utils/is'
const userStore = useUserStore()
const userInfo = computed(() => userStore.userInfo)
</script>
<template>
<div class="flex items-center">
<div class="w-10 h-10 overflow-hidden rounded-full">
<img class="object-cover" src="@/assets/avatar.jpg" alt="avatar">
<template v-if="isString(userInfo.avatar) && userInfo.avatar.length > 0">
<NAvatar
size="large"
round
:src="userInfo.avatar"
:fallback-src="defaultAvatar"
/>
</template>
<template v-else>
<NAvatar size="large" round :src="defaultAvatar" />
</template>
</div>
<div class="ml-2">
<h2 class="font-bold text-md">
ChenZhaoYu
{{ userInfo.name ?? 'ChenZhaoYu' }}
</h2>
<p class="text-xs text-gray-500">
<GithubSite />
<span
v-if="isString(userInfo.description) && userInfo.description !== ''"
v-html="userInfo.description"
/>
</p>
</div>
</div>

@ -0,0 +1,16 @@
import { computed } from 'vue'
import { enUS, zhCN } from 'naive-ui'
import { useAppStore } from '@/store'
export function useLanguage() {
const appStore = useAppStore()
const language = computed(() => {
if (appStore.language === 'zh-CN')
return zhCN
else
return enUS
})
return { language }
}

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 19 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 28 KiB

@ -17,6 +17,24 @@ const routes: RouteRecordRaw[] = [
},
],
},
{
path: '/403',
name: '403',
component: () => import('@/views/exception/403/index.vue'),
},
{
path: '/404',
name: '404',
component: () => import('@/views/exception/404/index.vue'),
},
{
path: '/:pathMatch(.*)*',
name: 'notFound',
redirect: '/404',
},
]
export const router = createRouter({

@ -4,13 +4,16 @@ const LOCAL_NAME = 'appSetting'
export type Theme = 'light' | 'dark' | 'auto'
export type Language = 'zh-CN' | 'en-US'
export interface AppState {
siderCollapsed: boolean
theme: Theme
language: Language
}
export function defaultSetting(): AppState {
return { siderCollapsed: false, theme: 'light' }
return { siderCollapsed: false, theme: 'light', language: 'zh-CN' }
}
export function getLocalSetting(): AppState {

@ -1,5 +1,5 @@
import { defineStore } from 'pinia'
import type { AppState, Theme } from './helper'
import type { AppState, Language, Theme } from './helper'
import { getLocalSetting, setLocalSetting } from './helper'
export const useAppStore = defineStore('app-store', {
@ -15,6 +15,13 @@ export const useAppStore = defineStore('app-store', {
this.recordState()
},
setLanguage(language: Language) {
if (this.language !== language) {
this.language = language
this.recordState()
}
},
recordState() {
setLocalSetting(this.$state)
},

@ -1,2 +1,3 @@
export * from './app'
export * from './chat'
export * from './user'

@ -0,0 +1,32 @@
import { ss } from '@/utils/storage'
const LOCAL_NAME = 'userStorage'
export interface UserInfo {
avatar: string
name: string
description: string
}
export interface UserState {
userInfo: UserInfo
}
export function defaultSetting(): UserState {
return {
userInfo: {
avatar: 'https://raw.githubusercontent.com/Chanzhaoyu/chatgpt-web/main/src/assets/avatar.jpg',
name: 'ChenZhaoYu',
description: 'Star on <a href="https://github.com/Chanzhaoyu/chatgpt-bot" class="text-blue-500" target="_blank" >Github</a>',
},
}
}
export function getLocalState(): UserState {
const localSetting: UserState | undefined = ss.get(LOCAL_NAME)
return { ...defaultSetting(), ...localSetting }
}
export function setLocalState(setting: UserState): void {
ss.set(LOCAL_NAME, setting)
}

@ -0,0 +1,22 @@
import { defineStore } from 'pinia'
import type { UserInfo, UserState } from './helper'
import { defaultSetting, getLocalState, setLocalState } from './helper'
export const useUserStore = defineStore('user-store', {
state: (): UserState => getLocalState(),
actions: {
updateUserInfo(userInfo: Partial<UserInfo>) {
this.userInfo = { ...this.userInfo, ...userInfo }
this.recordState()
},
resetUserInfo() {
this.userInfo = { ...defaultSetting().userInfo }
this.recordState()
},
recordState() {
setLocalState(this.$state)
},
},
})

@ -1,4 +1,7 @@
// 转义 HTML 字符
/**
* HTML
* @param source
*/
export function encodeHTML(source: string) {
return source
.replace(/&/g, '&amp;')
@ -8,17 +11,31 @@ export function encodeHTML(source: string) {
.replace(/'/g, '&#39;')
}
// 判断是否为代码块
/**
*
* @param text
*/
export function includeCode(text: string | null | undefined) {
const regexp = /^(?:\s{4}|\t).+/gm
return !!(text?.includes(' = ') || text?.match(regexp))
}
// 复制文本
export function copyText(text: string) {
const input = document.createElement('input')
/**
*
* @param options
*/
export function copyText(options: { text: string; origin?: boolean }) {
const props = { origin: true, ...options }
let input: HTMLInputElement | HTMLTextAreaElement
if (props.origin)
input = document.createElement('textarea')
else
input = document.createElement('input')
input.setAttribute('readonly', 'readonly')
input.setAttribute('value', text)
input.value = props.text
document.body.appendChild(input)
input.select()
if (document.execCommand('copy'))

@ -2,7 +2,6 @@ import axios, { type AxiosResponse } from 'axios'
const service = axios.create({
baseURL: import.meta.env.VITE_GLOB_API_URL,
timeout: !isNaN(+import.meta.env.VITE_GLOB_API_TIMEOUT) ? Number(import.meta.env.VITE_GLOB_API_TIMEOUT) : 60 * 1000,
})
service.interceptors.request.use(

@ -1,5 +1,5 @@
<script lang="ts" setup>
import { computed } from 'vue'
import { computed, ref } from 'vue'
import { marked } from 'marked'
import hljs from 'highlight.js'
import { useBasicLayout } from '@/hooks/useBasicLayout'
@ -18,6 +18,8 @@ const { isMobile } = useBasicLayout()
const renderer = new marked.Renderer()
const textRef = ref<HTMLElement>()
renderer.html = (html) => {
return `<p>${encodeHTML(html)}</p>`
}
@ -54,6 +56,8 @@ const text = computed(() => {
return marked(value)
return value
})
defineExpose({ textRef })
</script>
<template>
@ -62,7 +66,7 @@ const text = computed(() => {
<span class="dark:text-white w-[4px] h-[20px] block animate-blink" />
</template>
<template v-else>
<div class="leading-relaxed break-all">
<div ref="textRef" class="leading-relaxed break-all">
<div v-if="!inversion" class="markdown-body" v-html="text" />
<div v-else class="whitespace-pre-wrap" v-text="text" />
</div>

@ -1,4 +1,5 @@
<script setup lang='ts'>
import { ref } from 'vue'
import { NDropdown, useMessage } from 'naive-ui'
import AvatarComponent from './Avatar.vue'
import TextComponent from './Text.vue'
@ -27,32 +28,41 @@ const ms = useMessage()
const { iconRender } = useIconRender()
const textRef = ref<HTMLElement>()
const options = [
{
label: 'Copy',
key: 'copy',
label: 'Copy Raw',
key: 'copyRaw',
icon: iconRender({ icon: 'ri:file-copy-2-line' }),
}, {
},
{
label: 'Copy Text',
key: 'copyText',
icon: iconRender({ icon: 'ri:file-copy-line' }),
},
{
label: 'Delete',
key: 'delete',
icon: iconRender({ icon: 'ri:delete-bin-line' }),
},
]
function handleSelect(key: 'copy' | 'delete') {
if (key === 'copy')
handleCopy()
else
handleDelete()
}
function handleDelete() {
emit('delete')
}
function handleCopy() {
copyText(props.text ?? '')
ms.success('Copied')
function handleSelect(key: 'copyRaw' | 'copyText' | 'delete') {
switch (key) {
case 'copyRaw':
if (textRef.value && (textRef.value as any).textRef) {
copyText({ text: (textRef.value as any).textRef.innerText })
ms.success('Copied Raw')
}
return
case 'copyText':
copyText({ text: props.text ?? '', origin: false })
ms.success('Copied Text')
return
case 'delete':
emit('delete')
}
}
function handleRegenerate() {
@ -73,10 +83,11 @@ function handleRegenerate() {
{{ dateTime }}
</p>
<div
class="flex items-end gap-2 mt-2"
class="flex items-end gap-1 mt-2"
:class="[inversion ? 'flex-row-reverse' : 'flex-row']"
>
<TextComponent
ref="textRef"
:inversion="inversion"
:error="error"
:text="text"
@ -85,14 +96,14 @@ function handleRegenerate() {
<div class="flex flex-col">
<button
v-if="!inversion"
class="mb-2 transition text-neutral-400 hover:text-neutral-800 dark:hover:text-neutral-200"
class="mb-2 transition text-neutral-300 hover:text-neutral-800 dark:hover:text-neutral-300"
@click="handleRegenerate"
>
<SvgIcon icon="ri:restart-line" />
</button>
<NDropdown :options="options" @select="handleSelect">
<NDropdown :placement="!inversion ? 'right' : 'left'" :options="options" @select="handleSelect">
<button class="transition text-neutral-300 hover:text-neutral-800 dark:hover:text-neutral-200">
<SvgIcon icon="ri:function-line" />
<SvgIcon icon="ri:more-2-fill" />
</button>
</NDropdown>
</div>

@ -1,61 +1,22 @@
<script setup lang='ts'>
import { computed, ref } from 'vue'
import { NDropdown } from 'naive-ui'
import { HoverButton, Setting, SvgIcon, UserAvatar } from '@/components/common'
import { useAppStore } from '@/store'
import { useIconRender } from '@/hooks/useIconRender'
import { defineAsyncComponent, ref } from 'vue'
import { HoverButton, SvgIcon, UserAvatar } from '@/components/common'
const appStore = useAppStore()
const { iconRender } = useIconRender()
const Setting = defineAsyncComponent(() => import('@/components/common/Setting/index.vue'))
const show = ref(false)
const theme = computed(() => appStore.theme)
const options = [
{
label: 'Dark',
key: 'dark',
icon: iconRender({ icon: 'ri:moon-foggy-line' }),
},
{
label: 'Light',
key: 'light',
icon: iconRender({ icon: 'ri:sun-foggy-line' }),
},
{
label: 'Auto',
key: 'auto',
icon: iconRender({ icon: 'ri:contrast-line' }),
},
]
function handleThemeChange(key: 'light' | 'dark' | 'auto') {
appStore.setTheme(key)
}
</script>
<template>
<footer class="flex items-center justify-between min-w-0 p-4 overflow-hidden border-t dark:border-neutral-800">
<UserAvatar />
<NDropdown :options="options" placement="top" trigger="click" @select="handleThemeChange">
<HoverButton>
<span class="text-xl text-[#4f555e] dark:text-white">
<SvgIcon v-if="theme === 'dark'" icon="ri:moon-foggy-line" />
<SvgIcon v-if="theme === 'light'" icon="ri:sun-foggy-line" />
<SvgIcon v-if="theme === 'auto'" icon="ri:contrast-line" />
</span>
</HoverButton>
</NDropdown>
<HoverButton tooltip="Setting" @click="show = true">
<span class="text-xl text-[#4f555e] dark:text-white">
<SvgIcon icon="ri:settings-4-line" />
</span>
</HoverButton>
<Setting v-model:visible="show" />
<Setting v-if="show" v-model:visible="show" />
</footer>
</template>

@ -0,0 +1,34 @@
<script lang="ts" setup>
import { NButton } from 'naive-ui'
import { useRouter } from 'vue-router'
const router = useRouter()
function goHome() {
router.push('/')
}
</script>
<template>
<div class="flex h-full">
<div class="px-4 m-auto space-y-4 text-center max-[400px]">
<h1 class="text-4xl text-slate-800 dark:text-neutral-200">
No permission
</h1>
<p class="text-base text-slate-500 dark:text-neutral-400">
The page you're trying access has restricted access.
Please refer to your system administrator
</p>
<div class="flex items-center justify-center text-center">
<div class="w-[300px]">
<div class="w-[300px]">
<img src="../../../icons/403.svg" alt="404">
</div>
</div>
</div>
<NButton type="primary" @click="goHome">
Go to Home
</NButton>
</div>
</div>
</template>

@ -0,0 +1,31 @@
<script lang="ts" setup>
import { NButton } from 'naive-ui'
import { useRouter } from 'vue-router'
const router = useRouter()
function goHome() {
router.push('/')
}
</script>
<template>
<div class="flex h-full">
<div class="px-4 m-auto space-y-4 text-center max-[400px]">
<h1 class="text-4xl text-slate-800 dark:text-neutral-200">
Sorry, page not found!
</h1>
<p class="text-base text-slate-500 dark:text-neutral-400">
Sorry, we couldnt find the page youre looking for. Perhaps youve mistyped the URL? Be sure to check your spelling.
</p>
<div class="flex items-center justify-center text-center">
<div class="w-[300px]">
<img src="../../../icons/404.svg" alt="404">
</div>
</div>
<NButton type="primary" @click="goHome">
Go to Home
</NButton>
</div>
</div>
</template>
Loading…
Cancel
Save