# chatgpt-vercel **Repository Path**: thinkopenai/chatgpt-vercel ## Basic Information - **Project Name**: chatgpt-vercel - **Description**: https://github.com/ourongxing/chatgpt-vercel 镜像 Powered by OpenAI API (gpt-3.5-turbo) and Vercel - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: https://www.aitoolgpt.com/ - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 3 - **Created**: 2023-03-18 - **Last Updated**: 2023-03-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ChatGPT-Vercel ![](assets/preview-light.png#gh-light-mode-only) ![](assets/preview-dark.png#gh-dark-mode-only) > 本项目基于 [chatgpt-demo](https://github.com/ddiu8081/chatgpt-demo) 开发。 在线预览: 1. [aitoolgpt.com](https://www.aitoolgpt.com),由 [@AUDI_GUZZ](https://m.okjike.com/users/4af3cfb4-1291-4a8b-b210-f515c86934a9) 免费提供。 2. [chatsverse.xyz](https://www.chatsverse.xyz),由 [@Airyland](https://m.okjike.com/users/C6C8DE3A-E89D-4978-9E7D-B2E167D835A9) 免费提供。 API Key 由 [@AUDI_GUZZ](https://m.okjike.com/users/4af3cfb4-1291-4a8b-b210-f515c86934a9) 和 [@ourongxing](https://github.com/ourongxing) 免费提供。 ## 部署一个你自己的 ChatGPT 网站(免费) 如果你只需要部署一个你自己用的网站,而不需要定制,那么你完全不需要在本地跑起来,你可以直接点击下面的按钮,然后按照提示操作,然后在 Vercel 中填入环境变量即可。vercel.app 域名已经被墙,但 vercel 本身没有被墙,所以你绑定自己的域名就可以了。 [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/ourongxing/chatgpt-vercel&env=OPENAI_API_KEY) 如果你需要部署给更多人用,需要修改一些代码,那么你可能需要将上面创建的你自己的仓库 `git clone` 到本地。改完了 `git commit & push` 即可重新部署,vscode 上点几下就可以了。也可以用 vercel 的 cli,`vercel deploy --prod`。 如果你需要在本地开发和调试,有点麻烦: 1. 升级到 `node18`,要用到原生的 `fetch`。 2. API 被墙了,自己想办法开代理,不然要报错。也可以直接 `vercel deploy` 部署到 vercel 开发环境上调试。 3. `pnpm i` 安装依赖。 4. `pnpm dev` 启动项目。 ### 更多部署方案 Astro 提供了很多部署方案,自行 [查看设置方法](https://docs.astro.build/zh-cn/guides/server-side-rendering/),本项目主要针对 Vercel,故不多做解释。你也可以查看 [ddiu8081/chatgpt-demo](https://github.com/ddiu8081/chatgpt-demo/blob/main/astro.config.mjs) 的设置方法。 - [Cloudflare](https://github.com/withastro/astro/tree/main/packages/integrations/cloudflare) - [Deno](https://github.com/withastro/astro/tree/main/packages/integrations/deno) - [Netlify](https://github.com/withastro/astro/tree/main/packages/integrations/netlify) - [Node.js](https://github.com/withastro/astro/tree/main/packages/integrations/node) - [Vercel](https://github.com/withastro/astro/tree/main/packages/integrations/vercel) ### 环境变量 | 环境变量 | 说明 | 默认值 | | ---------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | | `OPENAI_API_KEY` | OpenAI API Key,可以填写多个,用 `|` 或者 `换行` 隔开,随机调用。最好是多填几个,API 有并发上的限制。如果用户不填自己的 key,那么就会使用你的 key。 | 无 | | `DEFAULT_MESSAGE` | 默认提示信息 | - 由 [OpenAI API (gpt-3.5-turbo)](https://platform.openai.com/docs/guides/chat) 和 [Vercel](http://vercel.com/) 提供支持。
- 由 [@ourongxing](https://github.com/ourongxing) 基于 [chatgpt-demo](https://github.com/ddiu8081/chatgpt-demo) 开发,查看 [源码](https://github.com/ourongxing/chatgpt-vercel),欢迎自部署。
- 如果本项目对你有所帮助,可以给小猫 [买点零食](https://cdn.jsdelivr.net/gh/ourongxing/chatgpt-vercel/assets/reward.gif),但不接受任何付费功能请求。
- 该预览页面域名由 [@AUDI_GUZZ](https://m.okjike.com/users/4af3cfb4-1291-4a8b-b210-f515c86934a9) 和 [@Airyland](https://m.okjike.com/users/C6C8DE3A-E89D-4978-9E7D-B2E167D835A9) 免费提供,API Key 由 [@AUDI_GUZZ](https://m.okjike.com/users/4af3cfb4-1291-4a8b-b210-f515c86934a9) 和 [@ourongxing](https://github.com/ourongxing) 免费提供,感谢。
- [[Shift]] + [[Enter]] 换行。开头输入 [[/]] 或者 [[空格]] 搜索 Prompt 预设。点击输入框滚动到底部。 | | `DEFAULT_SETTING` | 默认设置 | {
"continuousDialogue": true,
"archiveSession": false,
"openaiAPIKey": "",
"openaiAPITemperature": 60,
"systemRule": ""
"password": ""
} | | `RESET_CONTINUOUS_DIALOGUE_OPTION` | 刷新时重置 `开启连续对话` 选项,在分享给很多人用的时候可以有效避免大量消耗。 | false | | `OPENAI_API_BASE_URL` | 本地开发时可以填写 OpenAI 的代理服务器,但是 Vercel 不需要。 | api.openai.com | | `PASSWORD` | 网站密码 | 无 | | `MAX_INPUT_TOKENS` | 输入的 token 最大值,如果开启 `连续对话`,将计算之前的所有对话内容。OpenAI 限制 token 最大值为 4096,但这是输入和输出之和,所以可以将这个值设置为 3072, 留 1024 作为输出。如果不想被滥用,可以将这个值设置的再小一点。 | 3072 | 有两种设置方式 1. 将 `.env.example` 文件修改为 `.env`,在 `.env` 中设置。 2. Vercel 中设置 `Environment Variables`。尽量使用这种方式,比较方便。会在下次部署时生效。 ![](assets/environment.png) ### 默认设置 > 记得删除注释,或者直接复制上面表格里的。 ```json5 { "continuousDialogue": true, // 开启连续对话,每次都需要将上下文传给 API,比较费钱,而且同样有 4096 token 的限制 "archiveSession": false, // 记录对话内容,刷新后不会清空对话 "openaiAPIKey": "", // 默认填写的 key,不需要填写,否则其他人看得到。 "password": "",// 默认填写的密码,不需要填写,否则其他人看得到。 "openaiAPITemperature": 60, // 0-100 越高 ChatGPT 思维就越发散,开始乱答 "systemRule": "" // 系统角色指令,会在每次提问时添加。主要用于对 ChatGPT 的语气,口头禅这些进行定制。 } ``` ## 提交你的 Prompts 1. Fork 本项目。 2. 修改 `prompts.md`。 3. Pull Request 即可。 如果你不懂这个操作,也可以直接在 Issues 提交你的 Prompts。目前大部分 Prompts 来自于 [awesome-chatgpt-prompts-zh](https://github.com/PlexPt/awesome-chatgpt-prompts-zh),当然,这个仓库大多数也是翻译的 [awesome-chatgpt-prompts](https://github.com/f/awesome-chatgpt-prompts),一并感谢。 ### 要求 - 把需要输入的内容放在最后,可以提示 ChatGPT 开始输入了,比如 “我的第一句话是:”。 - 尽可能去优化已有的 Prompts,而不是重复添加。 - 添加到结尾,我会定期整理。 ## 赞赏 如果本项目对你有所帮助,可以给小猫买点零食,但不接受任何付费功能请求。 ![](./assets/reward.gif) ## License [MIT](./LICENSE)