改造 ChatGPT-Next-Web 项目重新生成 Docker 镜像

改造 ChatGPT-Next-Web 项目重新生成 Docker 镜像

0.背景

需要通过 ChatGPT-Next-Web 使用自己搭建的 OpenAI API 兼容的服务器,需要对 ChatGPT-Next-Web 项目的少量代码进行改造。

1. 修改代码

克隆代码,

git clone https://github.com/Yidadaa/ChatGPT-Next-Web; cd ChatGPT-Next-Web

修改代码,

sed -i 's/role: "user"/role: "system"/g' app/masks/cn.ts
sed -i 's/role: "user"/role: "system"/g' app/masks/en.ts

2. 生成 Docker 镜像

docker build -t <your_dockerhub_name>/chatgpt-next-web:v2.9.1 .

3. 上传 Docker 镜像

docker push <your_dockerhub_name>/chatgpt-next-web:v2.9.1

4. 运行 Docker 镜像

docker run -d --restart=always -p 3000:3000 -e OPENAI_API_KEY="<your_openai_key>" -e CODE="<your_password>" -e BASE_URL="<your_base_url>"    <your_dockerhub_name>/chatgpt-next-web:v2.9.1

完结!

猜你喜欢

转载自blog.csdn.net/engchina/article/details/132057542