update:加入测试速度功能

This commit is contained in:
hrz
2025-02-09 16:44:57 +08:00
parent 99f634f929
commit ba2cc8c447
7 changed files with 143 additions and 27 deletions
+1
View File
@@ -56,6 +56,7 @@ async def sendAudioMessage(conn, audios, duration, text):
base_delay = conn.tts_duration
if text == conn.tts_first_text:
logger.info(f"发送第一段语音: {text}")
conn.tts_start_speak_time = time.time()
await conn.websocket.send(json.dumps({
"type": "tts",
+4 -1
View File
@@ -12,6 +12,9 @@ async def handleTextMessage(conn, message):
logger.info(f"收到文本消息:{message}")
try:
msg_json = json.loads(message)
if isinstance(msg_json, int):
await conn.websocket.send(message)
return
if msg_json["type"] == "hello":
await handleHelloMessage(conn)
elif msg_json["type"] == "abort":
@@ -33,4 +36,4 @@ async def handleTextMessage(conn, message):
if "text" in msg_json:
await startToChat(conn, msg_json["text"])
except json.JSONDecodeError:
await conn.websocket.send(message)
await conn.websocket.send(message)