doc: 增删改补多处内容,去除来自2.x时代的插件教程及报错提示,优化部署引导内容

This commit is contained in:
lazy
2024-06-10 14:08:02 +08:00
parent 6b626dbe4f
commit 45fa7b6fae
20 changed files with 118 additions and 390 deletions
+6 -11
View File
@@ -164,20 +164,15 @@ export default sidebar({
prefix: "posts/error/",
children: [
{
text: "Mirai常见报错",
text: "QChatGPT常见报错",
icon: "notice",
link: "mirai",
},
{
text: "go-cqhttp常见报错",
icon: "list",
link: "gocq",
},
{
text: "问题解答",
icon: "blog",
link: "qchatgpt",
},
{
text: "消息平台常见报错",
icon: "list",
link: "platform",
}
],
},
{
+1
View File
@@ -71,6 +71,7 @@ export default hopeTheme({
// 此处开启了很多功能用于演示,你应仅保留用到的功能。
mdEnhance: {
align: true,
hint: true,
attrs: true,
codetabs: true,
component: true,
+1 -1
View File
@@ -58,7 +58,7 @@ category:
目前支持的密钥组:
- `openai`:OpenAI 的密钥组
- `openai`:OpenAI 的密钥组,如果你没有OpenAI API Key,你可以[在此获取](https://thelazy.cn/2024/02/08/%E5%A6%82%E4%BD%95%E8%8E%B7%E5%8F%96%E5%A5%BD%E7%94%A8%E7%A8%B3%E5%AE%9A%E7%9A%84OpenAI%20API%20Key/)
- `anthropic`:Anthropic 的密钥组
- `moonshot`:Moonshot(月之暗面 kimi)的密钥组
- `deepseek`:Deepseek(深度求索)的密钥组
+4
View File
@@ -12,10 +12,14 @@ index: false
## 部署教程
以下三步可以让你快速上手使用QChatGPT
- 第一步: [部署QChatGPT](qchatgpt/)
- 第二步: [部署消息平台](platforms/)
- 第三步: [填写配置信息](config.md)
完成以上三个步骤后,你接下来应该仔细阅读左栏中的[配置详解](../config/README.md)和[元数据配置](../metadata/README.md),实现更多样化的配置需求
## 本项目交流 QQ 群
### 社区群
+11 -2
View File
@@ -9,7 +9,7 @@ author: Lazy
date: 2024-02-18
---
修改以下配置文件即可启用 QChatGPT 的基本功能,更多的配置项详解请查看[配置详解](../config/)。
修改以下配置文件即可启用 QChatGPT 的基本功能,当你阅读完此页面后,建议查看[配置详解](../config/),以了解更多的配置项详解
- `data/config/platform.json`
- `data/config/provider.json`
@@ -136,4 +136,13 @@ date: 2024-02-18
例如需要使用 OpenAI 的模型,则 将 OpenAI 的 api key 填写到 `keys.openai` 下,支持多个key。并修改 `model` 为需要使用的模型名称。若您使用了中转站,或者需要使用反向代理,则设置 `requester.openai-chat-completions` 下的 `base-url` 配置。
具体设置方法请查看 配置详解模块的`provider.json` 页。
如果你没有OpenAI API Key,你可以[在此获取](https://thelazy.cn/2024/02/08/%E5%A6%82%E4%BD%95%E8%8E%B7%E5%8F%96%E5%A5%BD%E7%94%A8%E7%A8%B3%E5%AE%9A%E7%9A%84OpenAI%20API%20Key/)
具体设置方法请查看 配置详解模块的`provider.json` 页。
::: tip
阅读并完成以上教程后,你应该可以成功使用QChatGPT了,如果不能请再次阅读(你或许漏做或错做某些步骤),如果完全阅读并充分理解本文档后仍然确实无法使用,你可以在[这里](./README.md)找到交流群
:::
@@ -18,7 +18,7 @@ onebot介绍:[https://onebot.dev/](https://onebot.dev/)
以下消息框架可以通过 OneBot 11 协议接入,需选择使用`aiocqhttp`作为适配器,修改data下的platform.json文件
![img](https://cos.thelazy.cn/pictures/202405292250017.jpeg)
![data/platform.json](https://cos.thelazy.cn/pictures/202405292250017.jpeg)
当前可用的OneBot 11标准消息平台,你可以选择下方任意
@@ -50,6 +50,6 @@ Lagrange 是一个 QQNT 协议逆向工程框架,比 Shamrock 或 Mirai 更加
配置文件填写示例:
![img](https://cos.thelazy.cn/pictures/202405292250017.jpeg)
![data/platform.json](https://cos.thelazy.cn/pictures/202405292250017.jpeg)
![Lagrange.OneBot](https://cos.thelazy.cn/pictures/202405030020679.png)
![Lagrange.OneBot的配置文件](https://cos.thelazy.cn/pictures/202405030020679.png)
@@ -30,7 +30,7 @@ https://napneko.github.io/zh-CN/guide/getting-started
通过 OneBot 11 协议接入,需选择使用`aiocqhttp`作为适配器,填写配置时可参考 Shamrock 和 Lagrange 的方式。
![img](https://cos.thelazy.cn/pictures/202405292250017.jpeg)
![data/platform.json](https://cos.thelazy.cn/pictures/202405292250017.jpeg)
登录后,可以在config文件夹中,找到并修改文件(数字对应机器人QQ号):![image-20240514231529613](https://cos.thelazy.cn/pictures/image-20240514231529613.png)
@@ -12,6 +12,12 @@ date: 2023-12-21
> 本文档仅为基本步骤,详细操作、答疑解惑及最新信息请前往[OpenShamrock官方文档](https://whitechi73.github.io/OpenShamrock/)。
::: warning
OpenShamrock已归档
:::
## OpenShamrock简介
Mirai、go-cqhttp 之类的是模拟 QQ 的协议进行通信,而 Shamrock 使用的是 安卓的 Hook 来操作 QQ 模拟点击,稳定性较高。
+6
View File
@@ -14,6 +14,12 @@ category:
> 本文档仅为基本步骤,详细操作、答疑解惑及最新信息请前往[go-cqhttp官方文档](https://docs.go-cqhttp.org/)。
::: warning
gocq未归档,但官方表示:[https://github.com/Mrs4s/go-cqhttp/issues/2471](https://github.com/Mrs4s/go-cqhttp/issues/2471)
:::
## 下载go-cqhttp
从[go-cqhttp的Release](https://github.com/Mrs4s/go-cqhttp/releases/latest)下载最新的go-cqhttp可执行文件(建议直接下载可执行文件压缩包,而不是安装器)
+6
View File
@@ -14,6 +14,12 @@ category:
> 本文档仅为基本步骤,详细操作、答疑解惑及最新信息请前往[Mirai官方代码库](https://github.com/mamoe/mirai)、[Mirai官方论坛](https://mirai.mamoe.net/)
::: tip
此消息平台不稳定
:::
## 准备工作
> 注意:由于网络环境多样复杂,很多步骤中,有可能需要使用网络魔法,懂的都懂
+19
View File
@@ -0,0 +1,19 @@
---
head:
- - meta
- name: keywords
content: 部署QChatGPT的常见问题
title: 部署QChatGPT的常见问题
icon: info
author: Lazy
date: 2024-06-10
---
# 部署QChatGPT的常见问题
常见问题主要来自两个部分:
- 消息平台报错
- QChatGPT的报错
两者可在左侧查看各自内容
-13
View File
@@ -1,13 +0,0 @@
---
head:
- - meta
- name: keywords
content: gocq常见报错
title: Go-cqhttp报错
icon: list
order: 1
author: Lazy
date: 2023-12-20
category:
- 常见问题
---
-31
View File
@@ -1,31 +0,0 @@
---
head:
- - meta
- name: keywords
content: Mirai报错
title: Mirai报错
icon: notice
order: 1
author: Lazy,ikun
date: 2023-10-28
category:
- 常见问题
---
> 本人能力有限,报错收集将会逐步完善增补,望广大用户献计献策,众人拾柴火焰高,共同完善
:::info 目录
[[toc]]
:::
> 现在被风控是正常的事情,你懂的
## code=45
![code=45](https://s2.loli.net/2023/08/16/CcJFZiXLw6oGNxI.png)
> **目前由于tx对机器人协议端的打压,所有新号都会登录报错45**
[公共签名服务器](https://qsign.ikunshare.link),密钥114514
解决方案:无
## code=16
![code=16](https://s2.loli.net/2023/08/17/8ONDlwVTbtAQa7H.png)
删除mirai下的bots文件夹,然后重新登录,按要求输入
## code=237
![code=237](https://s2.loli.net/2023/08/17/AW3g2swTJ1aVUfN.png)
打开mirai/config/Console文件夹,打开`AutoLogin.yml`文件
按照下图修改
![解决code_237.png](https://s2.loli.net/2023/08/17/dJ9tCHpiyQ8eusP.png)
+20
View File
@@ -0,0 +1,20 @@
---
head:
- - meta
- name: keywords
content: 消息平台报错解答
title: 消息平台报错解答
icon: list
author: Lazy
date: 2024-06-10
---
# 消息平台报错解答
::: tip
待补充
:::
mirai,gocq报错建议使用aiocqhttp
+12 -49
View File
@@ -2,55 +2,18 @@
head:
- - meta
- name: keywords
content: ChatGPT QQ机器人报错,QChatGPT项目部署报错
title: QChatGPT报错
icon: type
order: 2
author: Lazy,ikun
date: 2023-10-28
category:
- 常见报错
content: QChatGPT的报错解答
title: QChatGPT的报错解答
icon: notice
author: Lazy
date: 2024-06-10
---
:::info 目录
[[toc]]
# QChatGPT的报错解答
::: tip
待补充
:::
## 运行run-bot.bat闪退,检查发现目录下无QChatGPT目录
![Q8_3.png](https://s2.loli.net/2023/08/16/HzTR5dAivUOKNMP.png)
[点击跳转issue页查看解决办法](https://github.com/RockChinQ/qcg-installer/issues/2)
## 启动run-bot.bat闪退,命令行运行报错: No module named 'colorlog'
![Q8_2.png](https://s2.loli.net/2023/08/16/PUXj6mxustQicvH.png)
[点击跳转issue页查看解决办法](https://github.com/RockChinQ/qcg-installer/issues/15)
## 启动主程序后卡住,发送消息不回复
[点击跳转issue页查看解决办法](https://github.com/RockChinQ/QChatGPT/issues/37)
## 运行run-bot.bat,报错ModuleNotFoundError: No module named 'pkg'
[点击跳转issue页查看解决办法](https://github.com/RockChinQ/qcg-installer/issues/40)
## 运行run-bot.bat,报错:捕捉到未知异常
[点击跳转issue页查看解决办法](https://github.com/RockChinQ/qcg-installer/issues/31)
## Websockets版本过低:As of 3.10, the *loop* parameter was removed from Lock() since it is no longer necessary
解决方法:
- 由自动安装器进行部署的,到安装器目录执行以下指令(即run-bot所在目录)
- Windows平台
```python
python\Scripts\pip3 install websockets --upgrade
```
- Linux平台
```python
python/bin/pip install websockets --upgrade
```
- 手动部署的:
```python
pip3 install websockets --upgrade
```
想要查看更多有关Q8_7 问题的,请点击下方:
[点击跳转issue页查看解决办法](https://github.com/RockChinQ/QChatGPT/issues/5)
## Microsoft Virtual C 14.xxx rexxxxxxx
原因:电脑上不存在VC++编译器,这是少数情况,多为系统环境问题
解决方案:暂无,可尝试重装微软原版系统
+22 -3
View File
@@ -14,29 +14,48 @@ category:
插件列表
- [revLibs](https://github.com/RockChinQ/revLibs) - 将ChatGPT网页版、Claude、Bard、Hugging Chat等破解版接入此项目,关于[官方接口和网页版有什么区别](https://github.com/RockChinQ/QChatGPT/wiki/8-%E5%AE%98%E6%96%B9%E6%8E%A5%E5%8F%A3%E3%80%81ChatGPT%E7%BD%91%E9%A1%B5%E7%89%88%E3%80%81ChatGPT-API%E5%8C%BA%E5%88%AB)
- [Switcher](https://github.com/RockChinQ/Switcher) - 支持通过命令切换使用的模型
- [hello_plugin](https://github.com/RockChinQ/hello_plugin) - `hello_plugin` 的储存库形式,插件开发模板
- [oliverkirk-sudo/chat_voice](https://github.com/oliverkirk-sudo/chat_voice) - 文字转语音输出,支持HuggingFace上的[VITS模型](https://huggingface.co/spaces/Plachta/VITS-Umamusume-voice-synthesizer),azure语
音合成,vits本地语音合成,sovits语音合成 **[点我查看插件使用方法](./some-plugin-deploy/voice.md)**
音合成,vits本地语音合成,sovits语音合成
- [RockChinQ/WaitYiYan](https://github.com/RockChinQ/WaitYiYan) - 实时获取百度`文心一言`等待列表人数
- [chordfish-k/QChartGPT_Emoticon_Plugin](https://github.com/chordfish-k/QChartGPT_Emoticon_Plugin) - 使机器人根据回复内容发送表情包
- [oliverkirk-sudo/ChatPoeBot](https://github.com/oliverkirk-sudo/ChatPoeBot) - 接入[Poe](https://poe.com/)上的机器人
- [lieyanqzu/WeatherPlugin](https://github.com/lieyanqzu/WeatherPlugin) - 天气查询插件
- [SysStatPlugin](https://github.com/RockChinQ/SysStatPlugin) - 查看系统状态
- [oliverkirk-sudo/qchat_system_status](https://github.com/oliverkirk-sudo/qchat_system_status) - 以图片的形式输出系统状态
- [oliverkirk-sudo/QChatAIPaint](https://github.com/oliverkirk-sudo/QChatAIPaint) - 基于[Holara](https://holara.ai/)的ai绘图插件
- [oliverkirk-sudo/QChatCodeRunner](https://github.com/oliverkirk-sudo/QChatCodeRunner) - 基于[CodeRunner-Plugin](https://github.com/oliverkirk-sudo/CodeRunner-Plugin)的代码运行与图表生成插件
- [oliverkirk-sudo/QChatWeather](https://github.com/oliverkirk-sudo/QChatWeather) - 生成好看的天气图片,基于和风天气
- [oliverkirk-sudo/QChatMarkdown](https://github.com/oliverkirk-sudo/QChatMarkdown) - 将机器人输出的markdown转换为图片,基于[playwright](https://playwright.dev/python/docs/intro)
- [ruuuux/WikipediaSearch](https://github.com/ruuuux/WikipediaSearch) - Wikipedia 搜索插件
- [the-lazy-me/GenshinVoice](https://github.com/the-lazy-me/GenshinVoice) - 原神语音插件
- [the-lazy-me/RuiShengVoice](https://github.com/the-lazy-me/RuiShengVoice) - 对接睿声语音的插件
**注意:以上均来自QChatGPT 2.x版本时代,在当下的QChatGPT 3.x版本时代,这些插件并不确保使用,而且很大概率不能用,建议等待新插件或提出需求**
**注意:以上均来自QChatGPT 2.x版本时代,在当下的QChatGPT 3.x版本时代,这些插件不能在新版中使用,建议等待新插件或等待上述插件迁移**
- [WebwlkrPlugin](https://github.com/RockChinQ/WebwlkrPlugin) - 让机器人能联网!!
- [the-lazy-me/miHoYoVoice](https://github.com/the-lazy-me/miHoYoVoice) - 一个可以生成原神/星铁语音的插件
- [the-lazy-me/miHoYoVoice](https://github.com/the-lazy-me/miHoYoVoice) - 一个可以生成原神/星铁语音的插件 [查看教程](https://www.bilibili.com/video/BV1nm411y73Q/?share_source=copy_web&vd_source=1335a044d4fd926920999a0e3ba0a731)
- [Yuumi0221/URLMaskerPlugin](https://github.com/Yuumi0221/URLMaskerPlugin) - 用于掩码(替换)URL,以应对QQ官方机器人API对消息中URL的限制
- [查看更多插件](https://github.com/stars/RockChinQ/lists/qchatgpt-%E6%8F%92%E4%BB%B6)这里列出了更多插件
@@ -1,16 +0,0 @@
---
head:
- - meta
- name: keywords
content: QChatGPT的几个插件的使用教程
title: 几个插件的使用教程
icon: list
order: 1
author: Lazy
date: 2023-12-20
category:
- 插件使用
index: false
---
<AutoCatalog base='/posts/plugin/some-plugin-deploy/'/>
@@ -1,40 +0,0 @@
---
head:
- - meta
- name: keywords
content: ChatGPT QQ机器人联网插件,QChatGPT项目联网插件
title: WebwlkrPlugin插件
icon: network
order: 2
author: Lazy
date: 2023-09-30
category:
- 插件使用
---
> 本期教程操作需要网络使用魔法,请自行解决
前提:已经安装了QChatGPT和mirai,没有安装的请根据[部署教程](../deploy/README.md)自行安装
打开这个网页
[https://github.com/RockChinQ/WebwlkrPlugin](https://github.com/RockChinQ/WebwlkrPlugin)
看到提示主程序版本高于要高于v2.5.0,所以发送(管理员向机器人QQ发送,管理员qq号是你自己设置的,在QChatGPT文件夹的config.py文件中可以看到)
```sh
!version
```
如果回复的当前版本符号要求,即可继续本教程,否则先要更新版本(发送`!update`或自行手动安装新版本)
向机器人发送(注意网络要使用魔法)
```sh
!plugin get https://github.com/RockChinQ/WebwlkrPlugin
```
然后安装成功后可以看到机器人回复
![图1.png](https://s2.loli.net/2023/08/12/zmZBc8yfV1NL3vg.png)
重启程序以加载插件。
@@ -1,220 +0,0 @@
---
head:
- - meta
- name: keywords
content: ChatGPT QQ机器人语音插件,QChatGPT项目语音插件
title: chat_voice插件
icon: community
order: 3
author: Lazy
date: 2023-09-30
category:
- 插件使用
---
:::info 目录
[[toc]]
:::
:::tip 建议配合视频使用
<BiliBili bvid="BV16w411D7Sn" />
:::
> 本教程为尽可能地简化部署流程,降低部署难度,特意提供了项目所需的python包(内含所需依赖)和chat_voice包(**已经对内容进行了修改**)
前提:已经安装了QChatGPT和mirai,没有安装的请根据[部署教程](../deploy/README.md)自行安装
## 准备工作
### 使用Huggingface的在线语音生成
> **注意:** Huggingface永久免费但每次限制150字
首先注册一个Huggingface的账户,[点击跳转注册](https://huggingface.co/join)
点击这个链接:[https://huggingface.co/spaces/Plachta/VITS-Umamusume-voice-synthesizer](https://huggingface.co/spaces/Plachta/VITS-Umamusume-voice-synthesizer)
在仓库右上角,点击三个点,选择Duplicate this Space(复制空间)
![图1.png](https://s2.loli.net/2023/08/12/HsxhmKF35BDjbU9.png)
选择公有库Public,私有库会导致连不上,然后点击Duplicate Space
![图2.png](https://s2.loli.net/2023/08/12/QYszWePDgTcxvp9.png)
等待空间创建完毕
打开开发者工具(F12),在工具栏中选择网络,随便选择一个模型(这里的选择应该不会影响的你之后使用Huggingface生成音频时的音色),如图
![使用Huggingface.png](https://s2.loli.net/2023/08/17/KaM8GwchASXkJjI.png)
点击Generate生成一个音频
观察到网络(Network)控制台有一个join包,如图。点击后会出现的websocket链接(以wss开头),复制下来
![复制的wss链接.png](https://s2.loli.net/2023/08/17/ZrJQUXieI2KLamP.png)
将生成的音频点击播放一下
这时观察网络控制台多出来一个wav文件,如图。将链接复制下来,并去掉file=后面的参数
例如:`/tmp/tmptdrqcg0g/tmpjxcvncrq.wav`,留下的链接形式应该是这样的:`https://alazy-vits-umamusume-voice-synthesizer.hf.space/file=`
![复制的https链接.png](https://s2.loli.net/2023/08/17/Tg3K8hVOyJl7xDr.png)
### 使用Azure的在线语音生成
> **注意:** Azure不是永久免费,但每月50万字的免费体验额度
首先在Azure注册账号,[点击注册](https://azure.microsoft.com/zh-cn/)
> 注意:Azure的免费语音生成需要使用外币卡验证
然后在Azure创建语音服务,[点击跳转](https://portal.azure.com/#view/Microsoft_Azure_Marketplace/GalleryItemDetailsBladeNopdl/id/Microsoft.CognitiveServicesSpeechServices)
按要求填写好信息后点击审阅并创建,再次点击创建
创建完成后,点击转到资源,找到下方的密钥(1和2任选一个)和Location/Region,将两个内容复制下来
## 安装并修改配置文件
### 手动安装部署
打开这个网页:
https://github.com/oliverkirk-sudo/chat_voice
点击右上绿色图标`CODE`,点击`Download ZIP`,如图
![修改配置文件图1.png](https://s2.loli.net/2023/08/17/OxFLS8Dc6KE4nYb.png)
将下载的压缩包解压,得到如图文件夹,将文件夹名字修改为`chat_voice`
![修改配置文件图2.png](https://s2.loli.net/2023/08/17/iJgTvDRjFGZ8KfN.png)
将修改后的`chat_voice`文件夹移动到`QChatGPT\plugins`文件夹内,如图
![修改配置文件图3.png](https://s2.loli.net/2023/08/17/3oYw1IjWBl2RkAd.png)
打开`chat_voice`文件夹,双击打开`requirements.txt`文件,把里面的内容修改为以下(直接删除里面的,把下面的复制进去)
```txt
azure-cognitiveservices-speech~=1.26.0
websocket-client~=1.5.1
av~=10.0.0
pilk~=0.2.3
librosa~=0.10.0.post2
torch
torchvision
torchaudio
torchcrepe
```
`Ctrl+S`保存后,打开同目录的`config`文件夹,找到`mapper.py`文件,如图
![修改配置文件图4.png](https://s2.loli.net/2023/08/17/8gqLwiSGCpXnUoj.png)
修改`mapper.py`文件(使用如VScode的代码编辑器或记事本),把里面的内容修改为以下(直接删除里面的,把下面的复制进去)
```python
import logging
import traceback
from plugins.chat_voice.config.voice_config import SoVitsConfig
method_mapping = {
# 'azure': save_azure_wav,
# 'huggingface': get_audio_wav,
# 'vits': save_vits_wav,
# 'sovits': save_sovits_wav
}
voice_type_mapping = {
# 'azu': 'azure',
# 'hgf': 'huggingface',
# 'vits': 'vits',
# 'sovits': 'sovits'
}
sovits_model=''
try:
from plugins.chat_voice.config.voice_config import voice_config,azure_config,huggingface_config,vits_config,SoVitsConfig
except Exception:
logging.error("请正确配置voice_config.py")
traceback.print_exc()
try:
if huggingface_config['open']:
from plugins.chat_voice.pkg.huggingface.huggingface_session_hash import get_audio_wav
method_mapping['huggingface'] = get_audio_wav
voice_type_mapping['hgf'] = 'huggingface'
if azure_config['open']:
from plugins.chat_voice.pkg.azure.azure_text_to_speech import save_azure_wav
method_mapping['azure'] = save_azure_wav
voice_type_mapping['azu'] = 'azure'
# if vits_config['open']:
# from plugins.chat_voice.pkg.vits.vits_text_to_speech import save_vits_wav
# method_mapping['vits'] = save_vits_wav
# voice_type_mapping['vits'] = 'vits'
# if SoVitsConfig().OPEN:
# sovits_config=SoVitsConfig()
# from plugins.chat_voice.pkg.sovits.sovits_text_to_speech import save_sovits_wav,modelAnalysis
# method_mapping['sovits'] = save_sovits_wav
# voice_type_mapping['sovits'] = 'sovits'
# sovits_model=modelAnalysis(sovits_config.MODEL_PATH, sovits_config.CONFIG_PATH, sovits_config.CLUSTER_MODEL_PATH, sovits_config.ENHANCE, sovits_config.DIFF_MODEL_PATH,sovits_config.DIFF_CONFIG_PATH, sovits_config.ONLY_DIFFUSION)
except Exception:
logging.error("包加载错误")
traceback.print_exc()
```
`Ctrl+S`保存并关闭
再打开`voice_config_temp.py`文件,按照注释填写
你需要重点关注的就是
`azure_config`下的`"region"`和`"secret"`
`huggingface_config`下的`"download_url`"和`"websocket"`
并把`vits_config`下的`open: True`改为`open: False`
如果没有Azure的语音生成服务,可以把默认生成模型改为Huggingface,例如
`"voice_type": "azure"`改为`"voice_type": "huggingface"`
其他特殊要求请按注释更改
没有更改后,`Ctrl+S`保存并关闭,并将文件名`voice_config_temp.py`改为`voice_config.py`
下面开始安装插件所需依赖,这里提供两种方式:
- **方式一:推荐新人使用,通过我提供的一个脚本自动一键安装,适合使用自动安装器部署QChatGPT项目的人**
> 脚本下载:[点我下载](https://github.com/the-lazy-me/A-Utility-Room/releases/download/bat%E8%84%9A%E6%9C%AC/run-CVinstall.bat)
将它保存在chat_voice目录,双击运行
程序即可自动加载,安装所需依赖(正是`requirements.txt`里面写的依赖)
运行到下面这样子时就安装成功了(黄字提醒不重要),如图
![installSuccess.png](https://s2.loli.net/2023/08/17/hLwlTyxavczK9fq.png)
然后运行`run-mirai.bat`和`run-bot.bat`
- **方式二:通过手动安装,适合想要多了解有关操作的人**
然后返回的上级`chat_voice`目录,可以看到有一个`requirements.txt`文件
这时,再打开项目根目录(就是`QChatGPT`文件夹的同目录),可以看到`python`文件夹,如图
![pythonFolder.png](https://s2.loli.net/2023/08/17/8djB6FDOeTtM5Pv.png)
打开`python\Scripts`文件夹,可以看到`pip.exe`文件,如图
![pipFile.png](https://s2.loli.net/2023/08/17/s5AcgvPTWFQdynH.png)
然后右击文件,复制`pip.exe`的路径,你将得到一个大致这样的路径
`"F:\test\bot\python\Scripts\pip.exe"`(`F:\test\bot\`取决于你放的位置和文件夹起名),这时再把双引号去除后复制一遍,防止双引号未去除给后面的操作带来影响
然后在`chat_voice`文件夹的上方地址栏,光标移动到路径最前面后,输入`cmd`和一个空格(不是输入汉字,是按一下空格),如图
![cmd1.png](https://s2.loli.net/2023/08/17/qlCfVk8g57ILp4Q.png)
回车就可以看到在当前位置打开了命令提示符,如图
![cmd2.png](https://s2.loli.net/2023/08/17/Y3yXthNmR7nW4fl.png)
在cmd窗口输入以下命令,其中`F:\test\bot\python\Scripts\pip.exe`替换为你刚才复制的路径
> **Tips:** `-r`表示表示遍历,`-i`表示选择使用的镜像,`-i`后面的链接即为镜像源
```cmd
F:\test\bot\python\Scripts\pip.exe install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
```
输入完成确定无误后回车,即可自动安装所需依赖(正是`requirements.txt`里面写的依赖)
运行到下面这样子时就安装成功了(黄字提醒不重要),如图
![installSuccess.png](https://s2.loli.net/2023/08/17/hLwlTyxavczK9fq.png)
### 使用压缩包部署
压缩包使用百度网盘分享,网盘提取码获取方式:
**三连关注后私信[UP主](https://space.bilibili.com/407410594),发送`chat_voice`或`4`,将会自动回复提取码**
- **[点我下载python压缩包](https://pan.baidu.com/s/1ZHeUe8Y79CxGl-81MnVBGg)**
- **[点我下载chat_voice压缩包](https://pan.baidu.com/s/1dwg1akeZRB9suJ7diXPZLA)**
**压缩包使用方法:**
下载好python压缩包后,移动到项目文件夹根目录,并解压到当前位置,如图
![pythonZIP.png](https://s2.loli.net/2023/08/17/57wezGrEPDib2Wh.png)
下载好chat_voice压缩包后,移动到`QChatGPT\plugins`文件夹下,并解压到当前位置,如图
然后修改`chat_voice\config`文件夹下的`voice_config.py`,按照注释填写
你需要重点关注的就是
`azure_config`下的`"region"`和`"secret"`
`huggingface_config`下的`"download_url`"和`"websocket"`
如果没有Azure的语音生成服务,可以把默认生成模型改为Huggingface,例如
`"voice_type": "azure"`改为`"voice_type": "huggingface"`
其他特殊要求请按注释更改
没有更改后,`Ctrl+S`保存并关闭
然后运行`run-mirai.bat`和`run-bot.bat`
## 使用方法
**注意:**
需要使用全局代理,或在`QChatGPT\plugins\chat_voice\config`的`voice_config.py`文件中配置代理(使用时去掉`#`注释,并正确配置)
```python
# "proxy_host": "127.0.0.1", #代理ip
# "proxy_port": 7890, #代理端口
# "proxy_type": "http" #代理方式 http | socks5
```
**包含的指令:**
- `!voice on` 开启输出转语音
- `!voice off` 关闭输出转语音
- `!voice type azu` 切换Azure语音合成
- `!voice type hgf` 切换Huggingface语音合成
- `!voice type vist` 切换VITS语音合成
- `!voice type sovist` 切换VITS语音合成
- `tovoice 文本内容` 将文本内容转换为语音消息
以上指令请以管理员身份向机器人发送