[button] fix bugs

This commit is contained in:
IrvingGao committed 2024-06-18 22:18:31 +08:00
1 parent 70b3cc9a62
commit cc5009f368
1 file changed
+17 -8
+17 -8
View File
@@ -365,14 +365,19 @@ class WebSocketClinet:
break
audio_dict = queue_data[1]
client.send_per_data(
audio=audio_dict['frames'],
stream=True,
voice_synthesize=True,
is_end=audio_dict['is_end'],
encoding='base64',
)
try:
client.send_per_data(
audio=audio_dict['frames'],
stream=True,
voice_synthesize=True,
is_end=audio_dict['is_end'],
encoding='base64',
)
except BrokenPipeError:
print(f"{datetime.now()}: web socket connection broken, skip send data.")
client.close_client()
break
# is_end后切换播放模式
if audio_dict['is_end']:
self.listening_event.clear()
@@ -381,6 +386,10 @@ class WebSocketClinet:
if not self.wakeup_event.is_set():
continue
if self.listening_event.is_set():
print(f"{datetime.now()}: listening, skip setup web socket connection.")
continue
# 接收数据
while True:
# 当唤醒状态被关闭时,退出循环