Skip to content

Commit 9c0c34f

Browse files
committed
fix(fishspeech): 修复获取语音文件异常处理
- 在获取 speaker_audio_path 时增加异常捕获 - 如果发生 FileHandleException 异常,将异常信息抛出为 APIException
1 parent 618b812 commit 9c0c34f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

nonebot_plugin_fishspeech_tts/fish_speech_api.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ async def generate_servettsrequest(
4646
"""
4747

4848
references = []
49-
speaker_audio_path = get_speaker_audio_path(self.path_audio, speaker_name)
49+
try:
50+
speaker_audio_path = get_speaker_audio_path(self.path_audio, speaker_name)
51+
except FileHandleException as e:
52+
raise APIException(str(e))
5053
for audio in speaker_audio_path:
5154
audio_bytes = audio.read_bytes()
5255
ref_text = extract_text_by_filename(audio.name)

0 commit comments

Comments
 (0)