Skip to content

Commit

Permalink
Merge pull request #820 from Ikaros-521/owner
Browse files Browse the repository at this point in the history
优化报错提示
  • Loading branch information
Ikaros-521 authored May 13, 2024
2 parents 1301ece + ff69403 commit 10f9217
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 43 deletions.
2 changes: 1 addition & 1 deletion utils/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ async def voice_change_and_put_to_queue(message, voice_tmp_path):
voice_tmp_path = None

if voice_tmp_path is None:
logging.error(f"{message['tts_type']}合成失败,请排查服务端是否启动、是否正常,配置、网络等问题")
logging.error(f"{message['tts_type']}合成失败,请排查服务端是否启动、是否正常,配置、网络等问题。如果排查后都没有问题,可能是接口改动导致的兼容性问题,可以前往官方仓库提交issue,传送门:https://github.com/Ikaros-521/AI-Vtuber/issues")
self.abnormal_alarm_handle("tts")

return False
Expand Down
89 changes: 47 additions & 42 deletions utils/audio_handle/my_tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -889,49 +889,54 @@ async def websocket_client(data_json):
return None

async def websocket_client_logic(websocket, data_json):
async for message in websocket:
logging.debug(f"ws收到数据: {message}")
try:
async for message in websocket:
logging.debug(f"ws收到数据: {message}")

# 解析收到的消息
data = json.loads(message)
# 检查是否是预期的消息
if "msg" in data:
if data["msg"] == "send_hash":
# 发送响应消息
response = json.dumps({"session_hash":session_hash,"fn_index":3})
await websocket.send(response)
logging.debug(f"Sent message: {response}")
elif data["msg"] == "send_data":
# 发送响应消息
response = json.dumps(
{
"data":[
data_json["content"],
data_json["enable_ref_audio"],
{
"name":data_json["ref_audio_path"],
"data":f'https://fs.firefly.matce.cn/file={data_json["ref_audio_path"]}',
"is_file":True,
"orig_name":"audio.wav"
},
data_json["ref_text"],
data_json["maximum_tokens_per_batch"],
data_json["iterative_prompt_length"],
data_json["top_p"],
data_json["repetition_penalty"],
data_json["temperature"],
data_json["speaker"]
],
"event_data":None,
"fn_index":3,
"session_hash":session_hash
}
)
await websocket.send(response)
logging.debug(f"Sent message: {response}")
elif data["msg"] == "process_completed":
return data["output"]["data"][0]["name"]

# 解析收到的消息
data = json.loads(message)
# 检查是否是预期的消息
if "msg" in data:
if data["msg"] == "send_hash":
# 发送响应消息
response = json.dumps({"session_hash":session_hash,"fn_index":3})
await websocket.send(response)
logging.debug(f"Sent message: {response}")
elif data["msg"] == "send_data":
# 发送响应消息
response = json.dumps(
{
"data":[
data_json["content"],
data_json["enable_ref_audio"],
{
"name":data_json["ref_audio_path"],
"data":f'https://fs.firefly.matce.cn/file={data_json["ref_audio_path"]}',
"is_file":True,
"orig_name":"audio.wav"
},
data_json["ref_text"],
data_json["maximum_tokens_per_batch"],
data_json["iterative_prompt_length"],
data_json["top_p"],
data_json["repetition_penalty"],
data_json["temperature"],
data_json["speaker"]
],
"event_data":None,
"fn_index":3,
"session_hash":session_hash
}
)
await websocket.send(response)
logging.debug(f"Sent message: {response}")
elif data["msg"] == "process_completed":
return data["output"]["data"][0]["name"]
except Exception as e:
logging.error(traceback.format_exc())
logging.error(f"fish_speech 出错:{e}")
return None

voice_tmp_path = await websocket_client(data)
if voice_tmp_path is not None:
file_url = f"https://fs.firefly.matce.cn/file={voice_tmp_path}"
Expand Down
1 change: 1 addition & 0 deletions utils/my_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1254,6 +1254,7 @@ def llm_handle(self, chat_type, data, type="chat", webui_show=True):
# 返回为空,触发异常报警
if resp_content is None:
self.abnormal_alarm_handle("llm")
logging.warning("LLM没有正确返回数据,请排查配置、网络等是否正常。如果排查后都没有问题,可能是接口改动导致的兼容性问题,可以前往官方仓库提交issue,传送门:https://github.com/Ikaros-521/AI-Vtuber/issues")

# 是否启用webui回显
if webui_show:
Expand Down

0 comments on commit 10f9217

Please sign in to comment.