Skip to content

Commit

Permalink
✨ 更新 GitHub Release 工作流,优化发布说明格式;更新 README,添加配置项和离线搭建指南;重构 API 类名并更新版本号
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvandia committed Oct 30, 2024
1 parent 004e82d commit c7e8213
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 20 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ jobs:
release_name: Release ${{ github.ref }}
# 修改发布说明为最新提交的提交信息
body: |
${{ github.event.head_commit.message }} # 使用最新提交的提交信息作为发布说明
${{ github.event.head_commit.url }} # 提供提交的链接
${{ github.event.head_commit.author.name }} # 提供提交的作者
draft: false
最新提交: ${{ github.event.head_commit.message }}
链接: ${{ github.event.head_commit.url }}
作者: ${{ github.event.head_commit.author.name }}
prerelease: false
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ ___
|语音列表||all|获取所有角色列表|all|
|语音余额||all|查询api余额|all|

## 🌙 未来
- 暂无规划
## 🌙 Todo
- [x] 添加更多配置项
- [ ] 暂无计划

<center>喜欢记得点个star⭐</center>

Expand All @@ -128,7 +129,7 @@ ___

## ⭐ 额外帮助

### 离线搭建简略教程
### windows离线搭建简略教程

**准备`fish-speech`**
- 1.将`fish-speech` 仓库 `git clone` 至本地
Expand All @@ -152,5 +153,6 @@ git clone https://github.com/fishaudio/fish-speech
**`API_FLAGS.txt`里添加额外参数**
- 1.`--complie` ->是否启动编译后的模型 (更快的生成tts,但启动较慢)
- 2.`--workers 数字` ->启动`数字`个多协程 (请务必设置,因为默认一个容易阻塞)
- 3.更多参考[官方文档](https://speech.fish.audio/zh)

### linux离线搭建fish-speech
- 更多参考[官方文档](https://speech.fish.audio/zh)
9 changes: 7 additions & 2 deletions nonebot_plugin_fishspeech_tts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
require("nonebot_plugin_alconna")

from nonebot_plugin_alconna import UniMessage, Reply, UniMsg, Text
from .fish_audio_api import fish_audio_api
from .fish_speech_api import fish_speech_api
from .fish_audio_api import FishAudioAPI
from .fish_speech_api import FishSpeechAPI
from .exception import APIException
from .request_params import ChunkLength
from .config import config, Config
Expand Down Expand Up @@ -75,6 +75,8 @@ async def tts_handle(message: UniMsg, match: tuple = RegexGroup()):
speaker = match[0]

try:
fish_audio_api = FishAudioAPI()
fish_speech_api = FishSpeechAPI()
if is_online:
await tts_handler.send("正在通过在线api合成语音, 请稍等")
request = await fish_audio_api.generate_servettsrequest(
Expand All @@ -96,6 +98,8 @@ async def tts_handle(message: UniMsg, match: tuple = RegexGroup()):
@speaker_list.handle()
async def speaker_list_handle(event: Event):
try:
fish_audio_api = FishAudioAPI()
fish_speech_api = FishSpeechAPI()
if is_online:
_list = fish_audio_api.get_speaker_list()
await speaker_list.finish("语音角色列表: " + ", ".join(_list))
Expand All @@ -109,6 +113,7 @@ async def speaker_list_handle(event: Event):
@balance.handle()
async def balance_handle(event: Event):
try:
fish_audio_api = FishAudioAPI()
if is_online:
await balance.send("正在查询在线语音余额, 请稍等")
balance_float = await fish_audio_api.get_balance()
Expand Down
3 changes: 0 additions & 3 deletions nonebot_plugin_fishspeech_tts/fish_audio_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,3 @@ def get_speaker_list(self) -> list[str]:
return get_path_speaker_list(self.path_audio)
except FileHandleException as e:
raise APIException(str(e))


fish_audio_api = FishAudioAPI()
6 changes: 1 addition & 5 deletions nonebot_plugin_fishspeech_tts/fish_speech_api.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from nonebot.log import logger
from pathlib import Path
from .fish_audio_api import ChunkLength
from .config import config
from .exception import APIException, FileHandleException, HTTPException
from .request_params import ServeReferenceAudio, ServeTTSRequest
from .request_params import ServeReferenceAudio, ServeTTSRequest, ChunkLength
from .files import (
extract_text_by_filename,
get_speaker_audio_path,
Expand Down Expand Up @@ -106,6 +105,3 @@ def get_speaker_list(self) -> list[str]:
return get_path_speaker_list(self.path_audio)
except FileHandleException as e:
raise APIException(str(e))


fish_speech_api = FishSpeechAPI()
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[tool.poetry]
name = "nonebot-plugin-fishspeech-tts"
version = "0.2.5"
version = "0.2.6"
description = "小样本TTS,通过调用在线或本地api发送TTS语音"
authors = ["divandia <106718176+Cvandia@users.noreply.github.com>"]
authors = ["Cvandia <106718176+Cvandia@users.noreply.github.com>"]
license = "MIT"
readme = "README.md"
packages = [{include = "nonebot_plugin_fishspeech_tts"}]
Expand Down

0 comments on commit c7e8213

Please sign in to comment.