mirror of
https://github.com/RockChinQ/QChatGPT.git
synced 2024-11-16 03:32:33 +08:00
Merge branch 'master' into fix-289-full-default-compatibility
This commit is contained in:
commit
1cf35f59fd
17
Dockerfile
Normal file
17
Dockerfile
Normal file
|
@ -0,0 +1,17 @@
|
|||
FROM python:3.9-slim
|
||||
WORKDIR /QChatGPT
|
||||
|
||||
RUN sed -i "s/deb.debian.org/mirrors.tencent.com/g" /etc/apt/sources.list \
|
||||
&& sed -i 's|security.debian.org/debian-security|mirrors.tencent.com/debian-security|g' /etc/apt/sources.list \
|
||||
&& apt-get clean \
|
||||
&& apt-get update \
|
||||
&& apt-get -y upgrade \
|
||||
&& apt-get install -y git \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY . /QChatGPT/
|
||||
|
||||
RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
|
||||
CMD [ "python", "main.py" ]
|
|
@ -1 +1 @@
|
|||
Subproject commit 68c4ef5d240877a871044e0b340db183453799bf
|
||||
Subproject commit d7ba01503c9c74254e987ffe53a0c8931f34037a
|
|
@ -149,9 +149,13 @@
|
|||
|
||||
#### Docker方式
|
||||
|
||||
请查看此仓库[mikumifa/QChatGPT-Docker-Installer](https://github.com/mikumifa/QChatGPT-Docker-Installer)
|
||||
请查看[此文档](docker_deploy.md)
|
||||
由[@mikumifa](https://github.com/mikumifa)贡献
|
||||
|
||||
#### 安装器方式
|
||||
|
||||
> 警告:若您主机上已经安装了Python,请不要使用此安装器,否则可能会导致无法导入此程序自带模块的问题。请使用下方的手动部署方式。
|
||||
|
||||
使用[此安装器](https://github.com/RockChinQ/qcg-installer)(若无法访问请到[Gitee](https://gitee.com/RockChin/qcg-installer))进行部署
|
||||
|
||||
- 安装器目前仅支持部分平台,请到仓库文档查看,其他平台请手动部署
|
||||
|
|
|
@ -81,31 +81,9 @@ default_prompt = {
|
|||
|
||||
# 情景预设格式
|
||||
# 参考值:默认方式:normal | 完整情景:full_scenario
|
||||
# 默认的格式为上述default_prompt中的内容,或prompts目录下的文件名
|
||||
#
|
||||
# 完整情景预设的格式为JSON,在scenario目录下的JSON文件中列出对话的每个回合,编写方法见scenario/default-template.json
|
||||
# 编写方法例如:
|
||||
# {
|
||||
# "prompt": [
|
||||
# {
|
||||
# "role": "user",
|
||||
# "content": "之后当我需要帮助时,请说“输入!help获取帮助”"
|
||||
# },{
|
||||
# "role": "assistant",
|
||||
# "content": "好的,当你之后需要帮助时,我会说“输入!help获取帮助”"
|
||||
# },{
|
||||
# "role": "user",
|
||||
# "content": "帮助"
|
||||
# },{
|
||||
# "role": "assistant",
|
||||
# "content": "输入!help获取帮助"
|
||||
# }
|
||||
# ]
|
||||
# }
|
||||
#
|
||||
# 您可以按照上述格式编写自己的情景预设,在prompt中列出对话的每个回合,
|
||||
# role为user或assistant,分别表示用户和机器人的回复
|
||||
# 每个JSON文件是一个情景预设,文件名即为情景预设的名称
|
||||
# 默认方式 的格式为上述default_prompt中的内容,或prompts目录下的文件名
|
||||
# 完整情景方式 的格式为JSON,在scenario目录下的JSON文件中列出对话的每个回合,编写方法见scenario/default-template.json
|
||||
# 编写方法请查看:https://github.com/RockChinQ/QChatGPT/wiki/%E5%8A%9F%E8%83%BD%E4%BD%BF%E7%94%A8#%E9%A2%84%E8%AE%BE%E6%96%87%E5%AD%97full_scenario%E6%A8%A1%E5%BC%8F
|
||||
preset_mode = "normal"
|
||||
|
||||
# 群内响应规则
|
||||
|
|
95
docker_deploy.md
Normal file
95
docker_deploy.md
Normal file
|
@ -0,0 +1,95 @@
|
|||
|
||||
|
||||
## 操作步骤
|
||||
|
||||
### 1.安装docker和docker compose
|
||||
|
||||
[各种设备的安装Docker方法](https://yeasy.gitbook.io/docker_practice/install)
|
||||
|
||||
[安装Compose方法](https://yeasy.gitbook.io/docker_practice/compose)
|
||||
|
||||
> `Docker Desktop for Mac/Windows` 自带 `docker-compose` 二进制文件,安装 Docker 之后可以直接使用。
|
||||
>
|
||||
> 可以选择很多下载方法,反正只要安装了就可以了
|
||||
|
||||
### 2. 登录qq(下面所有步骤建议在项目文件夹下操作)
|
||||
|
||||
#### 2.1 输入指令
|
||||
|
||||
```
|
||||
docker run -d -it -p 8080:8080 --name mcl --network host -v ./qq/plugins:/app/plugins -v ./qq/config:/app/config -v ./qq/data:/app/data -v ./qq/bots:/app/bots --restart unless-stopped kagurazakanyaa/mcl:latest
|
||||
```
|
||||
|
||||
这里使用了[KagurazakaNyaa/mirai-console-loader-docker](https://github.com/KagurazakaNyaa/mirai-console-loader-docker)的镜像
|
||||
|
||||
#### 2.2 进入容器
|
||||
|
||||
```
|
||||
docker ps
|
||||
```
|
||||
在输出中查看容器的ID,例如:
|
||||
```sh
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
bce1e5568f46 kagurazakanyaa/mcl "./mcl -u" 10 minutes ago Up 10 minutes 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp admiring_mendeleev
|
||||
```
|
||||
查看`IMAGE`名为`kagurazakanyaa/mcl`的容器的`CONTAINER ID`,在这里是`bce1e5568f46`,于是使用以下命令将其切到前台:
|
||||
```
|
||||
docker attach bce1e5568f46
|
||||
```
|
||||
如需将其切到后台运行,请使用组合键`Ctrl+P+Q`
|
||||
|
||||
#### 2.3 编写配置文件
|
||||
|
||||
- 在` /qq/config/net.mamoe.mirai-api-http` 文件夹中找到`setting.yml`,这是`mirai-api-http`的配置文件
|
||||
- 将这个文件的内容修改为:
|
||||
|
||||
```
|
||||
adapters:
|
||||
- ws
|
||||
debug: true
|
||||
enableVerify: true
|
||||
verifyKey: yirimirai
|
||||
singleMode: false
|
||||
cacheSize: 4096
|
||||
adapterSettings:
|
||||
ws:
|
||||
host: localhost
|
||||
port: 8080
|
||||
reservedSyncId: -1
|
||||
```
|
||||
|
||||
`verifyKey`要求与`bot`的`config.py`中的`verifyKey`相同
|
||||
|
||||
`port`: 8080要和2.1输入指令的端口号相同
|
||||
|
||||
#### 2.4 登录
|
||||
|
||||
#### 在mirai上登录QQ
|
||||
|
||||
```
|
||||
login <机器人QQ号> <机器人QQ密码>
|
||||
```
|
||||
|
||||
> 具体见[此教程](https://yiri-mirai.wybxc.cc/tutorials/01/configuration#4-登录-qq)
|
||||
|
||||
#### 配置自动登录(可选)
|
||||
|
||||
当机器人账号登录成功以后,执行
|
||||
|
||||
```
|
||||
autologin add <机器人QQ号> <机器人密码>
|
||||
autologin setConfig <机器人QQ号> protocol ANDROID_PAD
|
||||
```
|
||||
|
||||
> 出现`无法登录`报错时候[无法登录的临时处理方案](https://mirai.mamoe.net/topic/223/无法登录的临时处理方案)
|
||||
|
||||
**完成后, `Ctrl+P+Q`退出(不会关掉容器,容器还会运行)**
|
||||
|
||||
### 3. 部署QChatGPT
|
||||
|
||||
配置好config.py,运行下面的
|
||||
|
||||
```
|
||||
docker run -it -p 8080:8080 --name mcl --network host -v ${PWD}/:/QChatGPT mikumifa/qchatgpt-docker
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user