Skip to content

Commit

Permalink
Merge pull request #40 from Yiyuiii/beta
Browse files Browse the repository at this point in the history
0.10.4
  • Loading branch information
Yiyuiii authored Dec 16, 2023
2 parents a991b77 + 2b4c4e8 commit e9ab0cf
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ https://github.com/fumiama/MoeGoe/tree/genshin

## :clipboard: 更新日志

#### 2023.12.12 > v0.10.3 :fire:
#### 2023.12.12 > v0.10.4 :fire:

- 跟随genshinvoice.top更新cnapi以及相关处理流程。
- Fix: 优化了api优先级机制和gradio接口处理机制。

#### 2023.12.11 > v0.10.1
Expand Down
11 changes: 10 additions & 1 deletion nonebot_plugin_moegoe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def getApiConfigs(api_name):
("emotion", "emotion", -1),
("sdp_ratio", "sdp_ratio", 0.5),
("audio_component", "audio_component", ''),
("text_prompt", "text_prompt", 'Happy'),
):
config[k] = d
for name in (api_name, "api"):
Expand Down Expand Up @@ -224,7 +225,7 @@ async def cn_func(
gradioParas = list()
for k in _profileDict["gradio_paralist"]:
gradioParas.append(paras[k])
stat, wav_path = gradioClients.forward(_profileDict["url"], *gradioParas, msg, "Text prompt", fn_index=0)
stat, wav_path = gradioClients.forward(_profileDict["url"], *gradioParas, "Text prompt", fn_index=0)
if stat == 'Success':
message = MessageSegment.record(Path(wav_path))
else:
Expand Down Expand Up @@ -294,6 +295,14 @@ async def _(matcher: Matcher, matched: Tuple[Any, ...] = RegexGroup()):
assert len(matched) >= 6
nation, name, _, para, lang, msg = matched[0:6]
para_dict = para_process(para)
# 通过正则把 -p 从msg中提取出来,并进行判断
match = re.search(r"(-p|--prompt) (.+)", msg)
if match:
para_dict['text_prompt'] = match.groups(1)
msg = msg.replace(match.group(), "")
# 并没有 -p 则把msg当作提示词
else:
para_dict['text_prompt'] = msg
para_dict['nation'] = nationDict[nation]
para_dict['lang'] = langDict[lang]
for en, cn in profileDict["cnapi"]["replace"]:
Expand Down
5 changes: 3 additions & 2 deletions nonebot_plugin_moegoe/profile.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "0.10.3"
version = "0.10.4"
priority = 5

[plugin_meta]
Expand Down Expand Up @@ -50,7 +50,7 @@ regex = "^让(Sua|Mimiru|Arin|Yeonhwa|Yuhwa|Seonbae)(以(.+))?说(?:韩语|韩
[cnapi]
priority = 6
is_gradio = true
gradio_paralist = ["msg", 'name', 'sdp_ratio', 'noise', 'noisew', 'length', 'lang', 'audio_component']
gradio_paralist = ["msg", 'name', 'sdp_ratio', 'noise', 'noisew', 'length', 'lang', 'audio_component', 'text_prompt']
url = "https://v2.genshinvoice.top/"
# url = "https://genshin.azurewebsites.net/api/speak?format=mp3&text=${text}&id=${id}&length=${length}&noise=${noise}&noisew=${noisew}" # 需要apikey
voice_format = "mp3"
Expand All @@ -60,6 +60,7 @@ length = 1 # 整体语速 float (0.1 - 2)
noise = 0.4 # 感情:控制感情变化和稳定程度 float (0.1 - 2)
noisew = 0.8 # 音素长度:控制音节发音长度变化程度 float (0.1 - 2)
audio_component = "https://mirror.ghproxy.com/https://github.com/gradio-app/gradio/raw/main/test/test_files/audio_sample.wav" # 情感参考音频(WAV 格式) str
text_prompt = "Happy"
order = ["派蒙"]
regex = "^让(中配|英配|日配)?([^0-9.]+)(以(.+))?说(国语|汉语|汉文|中文|Chinese|英语|英文|English|日语|日文|日本语|Japanese)?(?:[:|:]*)(.+)$"
replace = [[',', ''], ['.', ''], ['!', ''], ['?', ''], ['0', ''], ['1', ''], ['2', ''], ['3', ''], ['4', ''], ['5', ''], ['6', ''], ['7', ''], ['8', ''], ['9', ''], ]
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "nonebot-plugin-moegoe"
version = "0.10.3"
version = "0.10.4"
description = "VITS AI合成原神角色语音"
license = "MIT"
authors = ["yiyuiii <[email protected]>"]
Expand All @@ -24,4 +24,4 @@ gradio_client = "^0.7.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
build-backend = "poetry.core.masonry.api"

0 comments on commit e9ab0cf

Please sign in to comment.