CNSeniorious000 / free-chat

forked from @anse-app/chatgpt-demo. Index site at https://free-chat.asia
https://endless-chat.vercel.app
MIT License
174 stars 52 forks source link

Vercel Deploy bug #6

Open bean4896 opened 1 year ago

bean4896 commented 1 year ago

image

CNSeniorious000 commented 1 year ago

Simplest solution: set an environment variable PUBLIC_TIKTOKEN_BG_WASM_URL = https://cdn.jsdelivr.net/npm/tiktoken/lite/tiktoken_bg.wasm. Like this:

environment variables

You can download it and upload it to your personal cdn, then put that url as this environment variable as well. As shown in the screenshot above, I use mine for a faster speed for Chinese users.

bean4896 commented 1 year ago

Thank you 谢谢老哥 我想问一下 我部署到vercel和netlify好像都没法在中国访问 有推荐的地方部署可以吗

CNSeniorious000 commented 1 year ago

部署到 Vercel / Netlify 后没法直接在中国访问是因为 .vercel.app.netlify.app 域名在中国被墙了。你在设置中的绑定自己的国内可访问的域名即可。

或者,你有自己的云服务器的话,可以直接 clone 这个仓库,然后:

  1. pnpm i
  2. pnpm dev

以启动开发服务器,如果要构建生产服务器就直接:

  1. pnpm build
  2. HOST=... PORT=... node dist/server/entry.mjs

如果你不用反向代理的话,就把 HOST 设为 0.0.0.0. 默认 PORT 的值为 3000.

修改环境变量的方式就是修改 .env 文件。你可以直接将 .env.example 文件重命名为 .env 然后一项项填写。基本上填写 OPENAI_API_KEY 一项即可。

bean4896 commented 9 months ago

请问这个能接GPT4吗

CNSeniorious000 commented 9 months ago

可以啊 我自己给自己用的就接的 GPT4

Name Description Default
OPENAI_API_MODEL ID of the model to use. Model endpoint compatibility gpt-3.5-turbo-16k

改这个环境变量就行了

bean4896 commented 9 months ago

image 我在vercel加好 gpt-4 环境变量了 还是用的gpt3.5

需要修改这个吗 const model = import.meta.env.OPENAI_API_MODEL || 'gpt-3.5-turbo-16k'

CNSeniorious000 commented 9 months ago

不需要。但你改了配置之后需要重新部署才会生效