File tree Expand file tree Collapse file tree 3 files changed +45
-8
lines changed
Expand file tree Collapse file tree 3 files changed +45
-8
lines changed Original file line number Diff line number Diff line change @@ -483,6 +483,30 @@ yield event.make_result().message("文本消息")
483483 .file_image(" path/to/image.jpg" )
484484```
485485
486+ ### [ aiocqhttp] 直接调用协议端 API
487+
488+ ``` py
489+ @command (" helloworld" )
490+ async def helloworld (self , event : AstrMessageEvent):
491+ if event.get_platform_name() == " aiocqhttp" :
492+ # qq
493+ from astrbot.core.platform.sources.aiocqhttp.aiocqhttp_message_event import AiocqhttpMessageEvent
494+ assert isinstance (event, AiocqhttpMessageEvent)
495+ client = event.bot # 得到 client
496+ payloads = {
497+ " message_id" : event.message_obj.message_id,
498+ }
499+ ret = await client.api.call_action(' delete_msg' , ** payloads) # 调用 协议端 API
500+ logger.info(f " delete_msg: { ret} " )
501+ ```
502+
503+ 关于 CQHTTP API,请参考如下文档:
504+
505+ Napcat API 文档:https://napcat.apifox.cn/
506+
507+ Lagrange API 文档:https://lagrange-onebot.apifox.cn/
508+
509+
486510### 控制事件传播
487511
488512``` python{6}
Original file line number Diff line number Diff line change 1- # 接入 OpenAI TTS
1+ # 使用文字转语音
22
33> 暂不支持 qq_official,参考 [ AstrBot 适配情况] ( https://github.com/Soulter/AstrBot?tab=readme-ov-file#-%E6%B6%88%E6%81%AF%E5%B9%B3%E5%8F%B0%E6%94%AF%E6%8C%81%E6%83%85%E5%86%B5 )
44
5- AstrBot 支持接入 OpenAI TTS 模型,实现文字转语音。
5+ AstrBot 目前原生支持接入 OpenAI、Fish Audio TTS 模型,实现文字转语音。也支持适配了 OpenAI TTS API 的第三方 TTS 服务。如果你想使用 OpenAI TTS 服务,你需要一个 OpenAI API Key 或者使用中转服务(推荐 chatanywhere 或者 AiHubMix ) 。
66
7- 也支持适配了 OpenAI TTS API 的第三方 TTS 服务。
7+ ## 配置 OpenAI TTS
88
9- 如果你想使用 OpenAI TTS 服务,你需要一个 OpenAI API Key 或者使用中转服务(推荐 chatanywhere 或者 AiHubMix )。
9+ ![ ] ( ../source/images/tts/image.png )
1010
11+ 添加,然后填写相关的配置项。
1112
12- ## 配置 OpenAI TTS
13+ ## 配置 Fish Audio TTS
1314
14- ![ ] ( ../source/images/tts/image.png )
15+ 官网:https://fish-audio.cn/
16+
17+ Fish Audio 是一个小样本 TTS, 能快速生成 TTS 语音, 其团队包含了 GPT-Sovits 的创始人。 Fish Audio 还推出了线上 API。
1518
16- 添加,然后填写相关的配置项,保存即可。
19+ 首先,请登录官网注册账号,然后进入 [ API Key] ( https://fish-audio.cn/zh-CN/go-api/api-keys/ ) 申请一个 API Key。
20+
21+ 进入[ 账单] ( https://fish-audio.cn/zh-CN/go-api/billing/ ) ,可以找到申请试用额度,点击申请即可,如果没有额度,可以充值。
22+
23+ 在 AstrBot:
24+
25+ ![ ] ( ../source/images/tts/image-2.png )
26+
27+ 然后填入你的 API Key。
1728
1829## 启用 TTS
1930
2031![ ] ( ../source/images/tts/image-1.png )
2132
22- 在这里启用即可。
33+ 在这里点击启用,然后保存配置。
34+
35+ 如果启用了 TTS,在请求大模型得到文本回复之后,将会自动调用所启用的 TTS 服务。控制台会输出 ` TTS 请求: xxx ` 的 INFO 级别日志。
You can’t perform that action at this time.
0 commit comments