banner
Geek

Geek

🧠在家居士 | 🥦素食者 | 🏃🏻马拉松爱好者 | 📡AI降临派 | 过🪜技术资深学者 | 🤖科技狂 | 📤更新狂🆅 https://www.igeekbb.com/
twitter
github

How to deploy Chatbot UI locally.

The previously introduced Chatbot UI has been mentioned before, and now it is also the main component of my ChatGPT web application. I usually use the one-click deployment recommended on the project homepage of Github to deploy it on Vercel. However, recently Vercel has been experiencing slower page loading due to an increasing number of users, which affects the user experience. In order to see if it can be deployed on my own VPS or locally, I am documenting my deployment process.


VPS Deployment (Incomplete)#

  • First, I installed all the dependencies and environment required by the project on the VPS, and then ran the command:
docker build -t chatgpt-ui .
  • Then the whole world went quiet, and I punished myself with a glass of wine for my ignorance.

Image 1
Image 2

  • Maybe I should get a more powerful VPS? 😅

Local Deployment#

NameConfiguration
Mac OSVentura 13.3.1
Dockerversion 23.0.3

Open Terminal#

Make sure you have Docker installed for ChatGPT. My Docker projects are stored in the "Documents" folder, which is located at: /Users/geek/Documents/docker

Navigate to the docker folder in the terminal#
cd /Users/geek/Documents/docker 
Clone the chatbot-ui project to your local machine#
git clone https://github.com/mckaywrigley/chatbot-ui.git
Navigate to the chatbot-ui folder#
cd chatbot-ui 
Run the following command to build the Docker image:#
docker build -t chatbot-ui .
  • If the build is successful, you will see the following prompt. If it fails, ask ChatGPT for help. 😂

=> [production 8/8] COPY --from=build /app/next-i18next.config.js ./next 0.0s
=> exporting to image 10.3s
=> => exporting layers 10.3s
=> => writing image sha256.0s
=> => naming to docker.io/library/chatbot-ui

Run Docker#
  • Replace xxxxxxxx with your OpenAI API key
docker run -e OPENAI_API_KEY=xxxxxxxx -p 3000:3000 chatbot-ui

  • To change the Docker container from foreground mode to background mode, use the following command:
docker run -d -e OPENAI_API_KEY=xxxxxxxx -p 3000:3000 chatbot-ui
  • In this command, we added the -d flag, which represents detached mode. This will run the Docker container in the background instead of the foreground.

  • Additionally, if you want to name the container, you can use the --name flag to specify a name, for example:
docker run -d --name my-container -e OPENAI_API_KEY=xxxxxxxx -p 3000:3000 chatbot-ui
  • This will name the container as my-container.

Open the browser (Done)🎉#

http://127.0.0.1:3000/

CleanShot 2023-04-14 at 13.23.15@2x.png

Note: I am using a whitelist for internet access through a software router. This is for use in a domestic environment. Please research chatgptProxyAPI for the Chinese environment.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.