mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-27 04:49:47 +01:00
fixed:消息重发bug
This commit is contained in:
parent
e24b033623
commit
b1798c9dad
2 changed files with 3 additions and 4 deletions
|
|
@ -4,5 +4,5 @@ import logging
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def handleHelloMessage(conn, text):
|
async def handleHelloMessage(conn):
|
||||||
await conn.websocket.send(json.dumps(conn.welcome_msg))
|
await conn.websocket.send(json.dumps(conn.welcome_msg))
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ async def handleTextMessage(conn, message):
|
||||||
try:
|
try:
|
||||||
msg_json = json.loads(message)
|
msg_json = json.loads(message)
|
||||||
if msg_json["type"] == "hello":
|
if msg_json["type"] == "hello":
|
||||||
await handleHelloMessage(conn, "你好")
|
await handleHelloMessage(conn)
|
||||||
elif msg_json["type"] == "abort":
|
elif msg_json["type"] == "abort":
|
||||||
await handleAbortMessage(conn)
|
await handleAbortMessage(conn)
|
||||||
elif msg_json["type"] == "listen":
|
elif msg_json["type"] == "listen":
|
||||||
|
|
@ -33,5 +33,4 @@ async def handleTextMessage(conn, message):
|
||||||
if "text" in msg_json:
|
if "text" in msg_json:
|
||||||
await startToChat(conn, msg_json["text"])
|
await startToChat(conn, msg_json["text"])
|
||||||
except json.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
await handleTextMessage(conn, message)
|
await conn.websocket.send(message)
|
||||||
await conn.websocket.send(message)
|
|
||||||
Loading…
Reference in a new issue