smart-chat-asp 2.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +364 -0
  2. package/README.zh.md +367 -0
  3. package/lib/Tableau10-2ff7471d.mjs +9 -0
  4. package/lib/arc-33fcfaff.mjs +86 -0
  5. package/lib/array-2ff2c7a6.mjs +6 -0
  6. package/lib/blockDiagram-38ab4fdb-3c912e88.mjs +1230 -0
  7. package/lib/c4Diagram-3d4e48cf-49908d37.mjs +1580 -0
  8. package/lib/channel-890a888a.mjs +5 -0
  9. package/lib/classDiagram-70f12bd4-ace7b178.mjs +221 -0
  10. package/lib/classDiagram-v2-f2320105-5848085d.mjs +207 -0
  11. package/lib/clone-59a3b16a.mjs +8 -0
  12. package/lib/createText-2e5e7dd3-898a4de3.mjs +2966 -0
  13. package/lib/edges-e0da2a9e-91b210e9.mjs +1083 -0
  14. package/lib/erDiagram-9861fffd-c13b7611.mjs +933 -0
  15. package/lib/favicon.ico +0 -0
  16. package/lib/favicon.svg +1 -0
  17. package/lib/flowDb-956e92f1-56fdcb20.mjs +1126 -0
  18. package/lib/flowDiagram-66a62f08-4023035a.mjs +798 -0
  19. package/lib/flowDiagram-v2-96b9c2cf-d28d8b17.mjs +26 -0
  20. package/lib/flowchart-elk-definition-4a651766-ab5b1391.mjs +48407 -0
  21. package/lib/ganttDiagram-c361ad54-ae59a5e3.mjs +2504 -0
  22. package/lib/gitGraphDiagram-72cf32ee-5bdf46bb.mjs +1265 -0
  23. package/lib/graph-9ea4e80a.mjs +512 -0
  24. package/lib/index-3862675e-b7177fa1.mjs +373 -0
  25. package/lib/index-958a220b.mjs +1470 -0
  26. package/lib/index-c42b0ff4.mjs +40 -0
  27. package/lib/index-f76d9453.mjs +28 -0
  28. package/lib/infoDiagram-f8f76790-5f3835f9.mjs +320 -0
  29. package/lib/init-f9637058.mjs +16 -0
  30. package/lib/journeyDiagram-49397b02-df06b21d.mjs +805 -0
  31. package/lib/layout-d3bc02b9.mjs +1495 -0
  32. package/lib/line-b044df13.mjs +34 -0
  33. package/lib/linear-e60140ad.mjs +447 -0
  34. package/lib/main-740da2e1.mjs +117801 -0
  35. package/lib/mindmap-definition-fc14e90a-3bfaf2a6.mjs +19384 -0
  36. package/lib/ordinal-980380c7.mjs +65 -0
  37. package/lib/path-428ebac9.mjs +91 -0
  38. package/lib/pieDiagram-8a3498a8-a8359c54.mjs +503 -0
  39. package/lib/pwa-192x192.png +0 -0
  40. package/lib/pwa-512x512.png +0 -0
  41. package/lib/quadrantDiagram-120e2f19-367eeae7.mjs +905 -0
  42. package/lib/requirementDiagram-deff3bca-27d1e96b.mjs +770 -0
  43. package/lib/sankeyDiagram-04a897e0-a9e993ee.mjs +818 -0
  44. package/lib/sequenceDiagram-704730f1-05f9d7b1.mjs +2235 -0
  45. package/lib/smart-chat.es.js +5 -0
  46. package/lib/smart-chat.umd.js +5444 -0
  47. package/lib/stateDiagram-587899a1-f3e4a81e.mjs +269 -0
  48. package/lib/stateDiagram-v2-d93cdb3a-763ad0ff.mjs +191 -0
  49. package/lib/style.css +1 -0
  50. package/lib/styles-6aaf32cf-e32ec570.mjs +960 -0
  51. package/lib/styles-9a916d00-18b5fd0d.mjs +1089 -0
  52. package/lib/styles-c10674c1-134300a0.mjs +433 -0
  53. package/lib/svgDrawCommon-08f97a94-f04d54dc.mjs +64 -0
  54. package/lib/timeline-definition-85554ec2-1989252c.mjs +796 -0
  55. package/lib/xychartDiagram-e933f94c-f7d5a550.mjs +1285 -0
  56. package/license +21 -0
  57. package/package.json +79 -0
package/README.md ADDED
@@ -0,0 +1,364 @@
1
+ # ChatGPT Web
2
+
3
+ > Disclaimer: This project is only published on GitHub, based on the MIT license, free and for open source learning usage. And there will be no any form of account selling, paid service, discussion group, discussion group and other behaviors. Beware of being deceived.
4
+
5
+ [中文](README.zh.md)
6
+
7
+ ![cover](./docs/c1.png)
8
+ ![cover2](./docs/c2.png)
9
+
10
+ - [ChatGPT Web](#chatgpt-web)
11
+ - [Introduction](#introduction)
12
+ - [Roadmap](#roadmap)
13
+ - [Prerequisites](#prerequisites)
14
+ - [Node](#node)
15
+ - [PNPM](#pnpm)
16
+ - [Filling in the Key](#filling-in-the-key)
17
+ - [Install Dependencies](#install-dependencies)
18
+ - [Backend](#backend)
19
+ - [Frontend](#frontend)
20
+ - [Run in Test Environment](#run-in-test-environment)
21
+ - [Backend Service](#backend-service)
22
+ - [Frontend Webpage](#frontend-webpage)
23
+ - [Environment Variables](#environment-variables)
24
+ - [Packaging](#packaging)
25
+ - [Use Docker](#use-docker)
26
+ - [Docker Parameter Examples](#docker-parameter-examples)
27
+ - [Docker build \& Run](#docker-build--run)
28
+ - [Docker compose](#docker-compose)
29
+ - [Prevent Crawlers](#prevent-crawlers)
30
+ - [Deploy with Railway](#deploy-with-railway)
31
+ - [Railway Environment Variables](#railway-environment-variables)
32
+ - [Deploy with Sealos](#deploy-with-sealos)
33
+ - [Package Manually](#package-manually)
34
+ - [Backend Service](#backend-service-1)
35
+ - [Frontend Webpage](#frontend-webpage-1)
36
+ - [FAQ](#faq)
37
+ - [Contributing](#contributing)
38
+ - [Acknowledgements](#acknowledgements)
39
+ - [Sponsors](#sponsors)
40
+ - [License](#license)
41
+ ## Introduction
42
+
43
+ Supports dual models and provides two unofficial `ChatGPT API` methods
44
+
45
+ | Method | Free? | Reliability | Quality |
46
+ | ---------------------------------- | ----- | ----------- | ------- |
47
+ | `ChatGPTAPI(gpt-3.5-turbo-0301)` | No | Reliable | Relatively stupid |
48
+ | `ChatGPTUnofficialProxyAPI(web accessToken)` | Yes | Relatively unreliable | Smart |
49
+
50
+ Comparison:
51
+ 1. `ChatGPTAPI` uses `gpt-3.5-turbo` through `OpenAI` official `API` to call `ChatGPT`
52
+ 2. `ChatGPTUnofficialProxyAPI` uses unofficial proxy server to access `ChatGPT`'s backend `API`, bypass `Cloudflare` (dependent on third-party servers, and has rate limits)
53
+
54
+ Warnings:
55
+ 1. You should first use the `API` method
56
+ 2. When using the `API`, if the network is not working, it is blocked in China, you need to build your own proxy, never use someone else's public proxy, which is dangerous.
57
+ 3. When using the `accessToken` method, the reverse proxy will expose your access token to third parties. This should not have any adverse effects, but please consider the risks before using this method.
58
+ 4. When using `accessToken`, whether you are a domestic or foreign machine, proxies will be used. The default proxy is [pengzhile](https://github.com/pengzhile)'s `https://ai.fakeopen.com/api/conversation`. This is not a backdoor or monitoring unless you have the ability to flip over `CF` verification yourself. Use beforehand acknowledge. [Community Proxy](https://github.com/transitive-bullshit/chatgpt-api#reverse-proxy) (Note: Only these two are recommended, other third-party sources, please identify for yourself)
59
+ 5. When publishing the project to public network, you should set the `AUTH_SECRET_KEY` variable to add your password access, you should also modify the `title` in `index. html` to prevent it from being searched by keywords.
60
+
61
+ Switching methods:
62
+ 1. Enter the `service/.env.example` file, copy the contents to the `service/.env` file
63
+ 2. To use `OpenAI API Key`, fill in the `OPENAI_API_KEY` field [(get apiKey)](https://platform.openai.com/overview)
64
+ 3. To use `Web API`, fill in the `OPENAI_ACCESS_TOKEN` field [(get accessToken)](https://chat.openai.com/api/auth/session)
65
+ 4. `OpenAI API Key` takes precedence when both exist
66
+
67
+ Environment variables:
68
+
69
+ See all parameter variables [here](#environment-variables)
70
+
71
+ ## Roadmap
72
+ [✓] Dual models
73
+
74
+ [✓] Multi-session storage and context logic
75
+
76
+ [✓] Formatting and beautification of code and other message types
77
+
78
+ [✓] Access control
79
+
80
+ [✓] Data import/export
81
+
82
+ [✓] Save messages as local images
83
+
84
+ [✓] Multilingual interface
85
+
86
+ [✓] Interface themes
87
+
88
+ [✗] More...
89
+
90
+ ## Prerequisites
91
+
92
+ ### Node
93
+
94
+ `node` requires version `^16 || ^18 || ^19` (`node >= 14` needs [fetch polyfill](https://github.com/developit/unfetch#usage-as-a-polyfill) installation), use [nvm](https://github.com/nvm-sh/nvm) to manage multiple local `node` versions
95
+
96
+ ```shell
97
+ node -v
98
+ ```
99
+
100
+ ### PNPM
101
+ If you haven't installed `pnpm`
102
+ ```shell
103
+ npm install pnpm -g
104
+ ```
105
+
106
+ ### Filling in the Key
107
+ Get `Openai Api Key` or `accessToken` and fill in the local environment variables [Go to Introduction](#introduction)
108
+
109
+ ```
110
+ # service/.env file
111
+
112
+ # OpenAI API Key - https://platform.openai.com/overview
113
+ OPENAI_API_KEY=
114
+
115
+ # change this to an `accessToken` extracted from the ChatGPT site's `https://chat.openai.com/api/auth/session` response
116
+ OPENAI_ACCESS_TOKEN=
117
+ ```
118
+
119
+ ## Install Dependencies
120
+
121
+ > For the convenience of "backend developers" to understand the burden, the front-end "workspace" mode is not adopted, but separate folders are used to store them. If you only need to do secondary development of the front-end page, delete the `service` folder.
122
+
123
+ ### Backend
124
+
125
+ Enter the folder `/service` and run the following commands
126
+
127
+ ```shell
128
+ pnpm install
129
+ ```
130
+
131
+ ### Frontend
132
+ Run the following commands at the root directory
133
+ ```shell
134
+ pnpm bootstrap
135
+ ```
136
+
137
+ ## Run in Test Environment
138
+ ### Backend Service
139
+
140
+ Enter the folder `/service` and run the following commands
141
+
142
+ ```shell
143
+ pnpm start
144
+ ```
145
+
146
+ ### Frontend Webpage
147
+ Run the following commands at the root directory
148
+ ```shell
149
+ pnpm dev
150
+ ```
151
+
152
+ ## Environment Variables
153
+
154
+ `API` available:
155
+
156
+ - `OPENAI_API_KEY` and `OPENAI_ACCESS_TOKEN` choose one
157
+ - `OPENAI_API_MODEL` Set model, optional, default: `gpt-3.5-turbo`
158
+ - `OPENAI_API_BASE_URL` Set interface address, optional, default: `https://api.openai.com`
159
+ - `OPENAI_API_DISABLE_DEBUG` Set interface to close debug logs, optional, default: empty does not close
160
+
161
+ `ACCESS_TOKEN` available:
162
+
163
+ - `OPENAI_ACCESS_TOKEN` and `OPENAI_API_KEY` choose one, `OPENAI_API_KEY` takes precedence when both exist
164
+ - `API_REVERSE_PROXY` Set reverse proxy, optional, default: `https://ai.fakeopen.com/api/conversation`, [Community](https://github.com/transitive-bullshit/chatgpt-api#reverse-proxy) (Note: Only these two are recommended, other third party sources, please identify for yourself)
165
+
166
+ Common:
167
+
168
+ - `AUTH_SECRET_KEY` Access permission key, optional
169
+ - `MAX_REQUEST_PER_HOUR` Maximum number of requests per hour, optional, unlimited by default
170
+ - `TIMEOUT_MS` Timeout, unit milliseconds, optional
171
+ - `SOCKS_PROXY_HOST` and `SOCKS_PROXY_PORT` take effect together, optional
172
+ - `SOCKS_PROXY_PORT` and `SOCKS_PROXY_HOST` take effect together, optional
173
+ - `HTTPS_PROXY` Support `http`, `https`, `socks5`, optional
174
+ - `ALL_PROXY` Support `http`, `https`, `socks5`, optional
175
+
176
+ ## Packaging
177
+
178
+ ### Use Docker
179
+
180
+ #### Docker Parameter Examples
181
+
182
+ ![docker](./docs/docker.png)
183
+
184
+ #### Docker build & Run
185
+
186
+ ```bash
187
+ docker build -t chatgpt-web .
188
+
189
+ # Foreground running
190
+ docker run --name chatgpt-web --rm -it -p 127.0.0.1:3002:3002 --env OPENAI_API_KEY=your_api_key chatgpt-web
191
+
192
+ # Background running
193
+ docker run --name chatgpt-web -d -p 127.0.0.1:3002:3002 --env OPENAI_API_KEY=your_api_key chatgpt-web
194
+
195
+ # Run address
196
+ http://localhost:3002/
197
+ ```
198
+
199
+ #### Docker compose
200
+
201
+ [Hub address](https://hub.docker.com/repository/docker/chenzhaoyu94/chatgpt-web/general)
202
+
203
+ ```yml
204
+ version: '3'
205
+
206
+ services:
207
+ app:
208
+ image: chenzhaoyu94/chatgpt-web # always use latest, pull the tag image again to update
209
+ ports:
210
+ - 127.0.0.1:3002:3002
211
+ environment:
212
+ # choose one
213
+ OPENAI_API_KEY: sk-xxx
214
+ # choose one
215
+ OPENAI_ACCESS_TOKEN: xxx
216
+ # API interface address, optional, available when OPENAI_API_KEY is set
217
+ OPENAI_API_BASE_URL: xxx
218
+ # API model, optional, available when OPENAI_API_KEY is set, https://platform.openai.com/docs/models
219
+ # gpt-4, gpt-4o, gpt-4o-mini, gpt-4-turbo, gpt-4-turbo-preview, gpt-4-0125-preview, gpt-4-1106-preview, gpt-4-0314, gpt-4-0613, gpt-4-32k, gpt-4-32k-0314, gpt-4-32k-0613, gpt-3.5-turbo-16k, gpt-3.5-turbo-16k-0613, gpt-3.5-turbo, gpt-3.5-turbo-0301, gpt-3.5-turbo-0613, text-davinci-003, text-davinci-002, code-davinci-002
220
+ OPENAI_API_MODEL: xxx
221
+ # reverse proxy, optional
222
+ API_REVERSE_PROXY: xxx
223
+ # access permission key, optional
224
+ AUTH_SECRET_KEY: xxx
225
+ # maximum number of requests per hour, optional, unlimited by default
226
+ MAX_REQUEST_PER_HOUR: 0
227
+ # timeout, unit milliseconds, optional
228
+ TIMEOUT_MS: 60000
229
+ # Socks proxy, optional, take effect with SOCKS_PROXY_PORT
230
+ SOCKS_PROXY_HOST: xxx
231
+ # Socks proxy port, optional, take effect with SOCKS_PROXY_HOST
232
+ SOCKS_PROXY_PORT: xxx
233
+ # HTTPS proxy, optional, support http,https,socks5
234
+ HTTPS_PROXY: http://xxx:7890
235
+ ```
236
+
237
+ - `OPENAI_API_BASE_URL` Optional, available when `OPENAI_API_KEY` is set
238
+ - `OPENAI_API_MODEL` Optional, available when `OPENAI_API_KEY` is set
239
+
240
+ #### Prevent Crawlers
241
+
242
+ **nginx**
243
+
244
+ Fill in the following configuration in the nginx configuration file to prevent crawlers. You can refer to the `docker-compose/nginx/nginx.conf` file to add anti-crawler methods
245
+
246
+ ```
247
+ # Prevent crawlers
248
+ if ($http_user_agent ~* "360Spider|JikeSpider|Spider|spider|bot|Bot|2345Explorer|curl|wget|webZIP|qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo! Slurp|Yahoo! Slurp China|YoudaoBot|Sosospider|Sogou spider|Sogou web spider|MSNBot|ia_archiver|Tomato Bot|NSPlayer|bingbot")
249
+ {
250
+ return 403;
251
+ }
252
+ ```
253
+
254
+ ### Deploy with Railway
255
+
256
+ [![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new/template/yytmgc)
257
+
258
+ #### Railway Environment Variables
259
+
260
+ | Environment variable name | Required | Remarks |
261
+ | --------------------- | ---------------------- | -------------------------------------------------------------------------------------------------- |
262
+ | `PORT` | Required | Default `3002` |
263
+ | `AUTH_SECRET_KEY` | Optional | Access permission key |
264
+ | `MAX_REQUEST_PER_HOUR` | Optional | Maximum number of requests per hour, optional, unlimited by default |
265
+ | `TIMEOUT_MS` | Optional | Timeout, unit milliseconds |
266
+ | `OPENAI_API_KEY` | `OpenAI API` choose one | `apiKey` required for `OpenAI API` [(get apiKey)](https://platform.openai.com/overview) |
267
+ | `OPENAI_ACCESS_TOKEN` | `Web API` choose one | `accessToken` required for `Web API` [(get accessToken)](https://chat.openai.com/api/auth/session) |
268
+ | `OPENAI_API_BASE_URL` | Optional, available when `OpenAI API` | `API` interface address |
269
+ | `OPENAI_API_MODEL` | Optional, available when `OpenAI API` | `API` model |
270
+ | `API_REVERSE_PROXY` | Optional, available when `Web API` | `Web API` reverse proxy address [Details](https://github.com/transitive-bullshit/chatgpt-api#reverse-proxy) |
271
+ | `SOCKS_PROXY_HOST` | Optional, take effect with `SOCKS_PROXY_PORT` | Socks proxy |
272
+ | `SOCKS_PROXY_PORT` | Optional, take effect with `SOCKS_PROXY_HOST` | Socks proxy port |
273
+ | `SOCKS_PROXY_USERNAME` | Optional, take effect with `SOCKS_PROXY_HOST` | Socks proxy username |
274
+ | `SOCKS_PROXY_PASSWORD` | Optional, take effect with `SOCKS_PROXY_HOST` | Socks proxy password |
275
+ | `HTTPS_PROXY` | Optional | HTTPS proxy, support http,https, socks5 |
276
+ | `ALL_PROXY` | Optional | All proxies, support http,https, socks5 |
277
+
278
+ > Note: Modifying environment variables on `Railway` will re-`Deploy`
279
+
280
+ ### Deploy with Sealos
281
+
282
+ [![](https://raw.githubusercontent.com/labring-actions/templates/main/Deploy-on-Sealos.svg)](https://cloud.sealos.io/?openapp=system-fastdeploy%3FtemplateName%3Dchatgpt-web)
283
+
284
+ > Environment variables are consistent with Docker environment variables
285
+
286
+ ### Package Manually
287
+ #### Backend Service
288
+ > If you don't need the `node` interface of this project, you can omit the following operations
289
+
290
+ Copy the `service` folder to the server where you have the `node` service environment.
291
+
292
+ ```shell
293
+ # Install
294
+ pnpm install
295
+
296
+ # Pack
297
+ pnpm build
298
+
299
+ # Run
300
+ pnpm prod
301
+ ```
302
+
303
+ PS: It is also okay to run `pnpm start` directly on the server without packing
304
+
305
+ #### Frontend Webpage
306
+
307
+ 1. Modify the `VITE_GLOB_API_URL` field in the `.env` file at the root directory to your actual backend interface address
308
+
309
+ 2. Run the following commands at the root directory, then copy the files in the `dist` folder to the root directory of your website service
310
+
311
+ [Reference](https://cn.vitejs.dev/guide/static -deploy.html#building-the-app)
312
+
313
+ ```shell
314
+ pnpm build
315
+ ```
316
+
317
+ ## FAQ
318
+ Q: Why does `Git` commit always report errors?
319
+
320
+ A: Because there is a commit message verification, please follow the [Commit Guide](./CONTRIBUTING.md)
321
+
322
+ Q: Where to change the request interface if only the front-end page is used?
323
+
324
+ A: The `VITE_GLOB_API_URL` field in the `.env` file at the root directory.
325
+
326
+ Q: All files explode red when saving?
327
+
328
+ A: `vscode` please install the recommended plug-ins for the project, or manually install the `Eslint` plug-in.
329
+
330
+ Q: No typewriter effect on the front end?
331
+
332
+ A: One possible reason is that after Nginx reverse proxy, buffer is turned on, then Nginx will try to buffer some data from the backend before sending it to the browser. Please try adding `proxy_buffering off; ` after the reverse proxy parameter, then reload Nginx. Other web server configurations are similar.
333
+
334
+ ## Contributing
335
+
336
+ Please read the [Contributing Guide](./CONTRIBUTING.md) before contributing
337
+
338
+ Thanks to everyone who has contributed!
339
+
340
+ <a href="https://github.com/Chanzhaoyu/chatgpt-web/graphs/contributors">
341
+ <img src="https://contrib.rocks/image?repo=Chanzhaoyu/chatgpt-web" />
342
+ </a>
343
+
344
+ ## Acknowledgements
345
+
346
+ Thanks to [JetBrains](https://www.jetbrains.com/) SoftWare for providing free Open Source license for this project.
347
+
348
+ ## Sponsors
349
+
350
+ If you find this project helpful and can afford it, you can give me a little support. Anyway, thanks for your support~
351
+
352
+ <div style="display: flex; gap: 20px;">
353
+ <div style="text-align: center">
354
+ <img style="max-width: 100%" src="./docs/wechat.png" alt="WeChat" />
355
+ <p>WeChat Pay</p>
356
+ </div>
357
+ <div style="text-align: center">
358
+ <img style="max-width: 100%" src="./docs/alipay.png" alt="Alipay" />
359
+ <p>Alipay</p>
360
+ </div>
361
+ </div>
362
+
363
+ ## License
364
+ MIT © [ChenZhaoYu]