AI 综合站使用
· 阅读需 1 分钟
系统:Ubuntu20.04
git clone https://github.com/Chanzhaoyu/chatgpt-web.git
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
# 验证
node -v
# 安装 pnpm
npm install pnpm -g
# 进入文件夹 /service 运行以下命令
pnpm install
# 根目录下运行以下命令
pnpm bootstrap
# service/.env 文件
# OpenAI API Key - https://platform.openai.com/overview
OPENAI_API_KEY=
# change this to an `accessToken` extracted from the ChatGPT site's `https://chat.openai.com/api/auth/session` response
OPENAI_ACCESS_TOKEN=
root@iZt4nbaxzkx16mx9901qpqZ:/etc/systemd/system# cat chatgpt.service
[Unit]
Description=chatgpt
[Service]
Type=simple
WorkingDirectory=/root/chatgpt-web-main
ExecStart=pnpm dev
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
root@iZt4nbaxzkx16mx9901qpqZ:/etc/systemd/system# cat chatgpt_api.service
[Unit]
Description=chatgpt_api
[Service]
Type=simple
WorkingDirectory=/root/chatgpt-web-main/service
ExecStart=pnpm start
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
# 加载配置
systemctl daemon-reload
# 启动应用
systemctl start chatgpt_api.service
systemctl start chatgpt.service
# 设置开机自启
systemctl enable chatgpt_api.service
systemctl enable chatgpt.service