Skip to content

Commit 4a3deb7

Browse files
committed
🐛bug: 修护获取语音角色列表逻辑,简化异常处理并添加警告日志
1 parent 8b2c135 commit 4a3deb7

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

nonebot_plugin_fishspeech_tts/fish_audio_api.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,10 @@ def get_speaker_list(self) -> list[str]:
195195
"""
196196
获取语音角色列表
197197
"""
198-
try:
199-
if is_reference_id_first:
200-
return_list = ["请查看官网了解更多: https://fish.audio/zh-CN/"]
198+
return_list = ["请查看官网了解更多: https://fish.audio/zh-CN/"]
199+
if is_reference_id_first:
200+
try:
201201
return_list.extend(get_path_speaker_list(self.path_audio))
202-
return return_list
203-
else:
204-
return get_path_speaker_list(self.path_audio)
205-
except FileHandleException as e:
206-
raise APIException(str(e))
202+
except FileHandleException:
203+
logger.warning("音频文件夹不存在或无法读取")
204+
return return_list

0 commit comments

Comments
 (0)