English | 简体中文
A demo repo based on OpenAI GPT-3.5 Turbo API.
🍿 Live preview: https://chatgpt.ddiu.me
🏖️ V2 Version(Beta): https://v2.chatgpt.ddiu.me
⚠️ Notice: Our API Key limit has been exhausted. So the demo site is not available now.
Node v18
or later. You can use nvm to manage multiple node
versions locally。
node -v
npm i -g pnpm
pnpm install
.env.example
file, then rename it to .env
, and add your OpenAI API key to the .env
file.
OPENAI_API_KEY=sk-xxx...
http://localhost:3000/
pnpm run dev
🔒 Need website password?
Deploy with the
SITE_PASSWORD
Step-by-step deployment tutorial:
forked
done, and connect it with your GitHub
account.Deploy Site
button to start deploying the site。Environment variables refer to the documentation below. Docker Hub address.
Direct run
docker run --name=chatgpt-demo -e OPENAI_API_KEY=YOUR_OPEN_API_KEY -p 3000:3000 -d ddiu8081/chatgpt-demo:latest
-e
define environment variables in the container.
Docker compose
version: '3'
services:
chatgpt-demo:
image: ddiu8081/chatgpt-demo:latest
container_name: chatgpt-demo
restart: always
ports:
- '3000:3000'
environment:
- OPENAI_API_KEY=YOUR_OPEN_API_KEY
# - HTTPS_PROXY=YOUR_HTTPS_PROXY
# - OPENAI_API_BASE_URL=YOUR_OPENAI_API_BASE_URL
# - HEAD_SCRIPTS=YOUR_HEAD_SCRIPTS
# - SECRET_KEY=YOUR_SECRET_KEY
# - SITE_PASSWORD=YOUR_SITE_PASSWORD
# - OPENAI_API_MODEL=YOUR_OPENAI_API_MODEL
# start
docker compose up -d
# down
docker-compose down
Please refer to the official deployment documentation:https://docs.astro.build/en/guides/deploy
You can control the website through environment variables.
Name | Description | Default |
---|---|---|
OPENAI_API_KEY |
Your API Key for OpenAI. | null |
HTTPS_PROXY |
Provide proxy for OpenAI API. e.g. http://127.0.0.1:7890
|
null |
OPENAI_API_BASE_URL |
Custom base url for OpenAI API. | https://api.openai.com |
HEAD_SCRIPTS |
Inject analytics or other scripts before </head> of the page |
null |
SECRET_KEY |
Secret string for the project. Use for generating signatures for API calls | null |
SITE_PASSWORD |
Set password for site, support multiple password separated by comma. If not set, site will be public | null |
OPENAI_API_MODEL |
ID of the model to use. List models | gpt-3.5-turbo |
Q: TypeError: fetch failed (can't connect to OpenAI Api)
A: Configure environment variables HTTPS_PROXY
,reference: https://github.com/ddiu8081/chatgpt-demo/issues/34
Q: throw new TypeError(${context} is not a ReadableStream.)
A: The Node version needs to be v18
or later,reference: https://github.com/ddiu8081/chatgpt-demo/issues/65
Q: Accelerate domestic access without the need for proxy deployment tutorial?
A: You can refer to this tutorial: https://github.com/ddiu8081/chatgpt-demo/discussions/270
Q: PWA
is not working?
A: Current PWA
does not support deployment on Netlify, you can choose vercel or node deployment.
This project exists thanks to all those who contributed.
Thank you to all our supporters!🙏
MIT © ddiu8081