mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-27 01:23:55 +08:00
update:加入测试速度功能
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user