From bb81cc149c757ee98837198344f6fbbd5df59327 Mon Sep 17 00:00:00 2001 From: lizhongxiang Date: Thu, 27 Feb 2025 10:41:51 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E9=83=A8=E7=BD=B2=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- compose-config/test-243-docker-compose.yml | 3 +++ core/handle/audioHandle.py | 6 +++--- deploy.sh | 21 +++++++++++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 deploy.sh diff --git a/compose-config/test-243-docker-compose.yml b/compose-config/test-243-docker-compose.yml index 883860506..43e348ac1 100644 --- a/compose-config/test-243-docker-compose.yml +++ b/compose-config/test-243-docker-compose.yml @@ -1,6 +1,9 @@ version: '3.8' services: esp32-server: + build: + context: .. + dockerfile: Dockerfile image: 192.168.101.99/yyn/192.168.101.99/yyn/esp32-server:1.0 container_name: esp32-server restart: always diff --git a/core/handle/audioHandle.py b/core/handle/audioHandle.py index f19ddfa55..ac552b9fe 100644 --- a/core/handle/audioHandle.py +++ b/core/handle/audioHandle.py @@ -152,7 +152,7 @@ async def sendAudioMessageStream(conn, audios_queue, duration, text): if last_duration <= 0 : last_duration = 0 opus_datas, duration = conn.tts.wav_to_opus_data_audio(audio_data_chunke_data) - conn.tts_duration = duration + last_duration + conn.tts_duration = duration + last_duration + 0.5 for opus_packet in opus_datas: await conn.websocket.send(opus_packet) print(f"已获取音频数据,长度为 {len(audio_data_chunke_data)},总长度为 {len(audio_data_chunke_data)}") @@ -162,14 +162,14 @@ async def sendAudioMessageStream(conn, audios_queue, duration, text): traceback.print_exc() # 打印错误堆栈 if conn.llm_finish_task and text == conn.tts_last_text: - stop_duration = conn.tts_duration + stop_duration = conn.tts_duration + 0.5 stop_task = asyncio.create_task( schedule_with_interrupt(stop_duration, send_tts_stop(conn, text)) ) conn.scheduled_tasks.append(stop_task) async def sendAudioMessage(conn, audios, duration, text): - base_delay = conn.tts_duration+0.5 + base_delay = conn.tts_duration if text == conn.tts_first_text: conn.tts_start_speak_time = time.time() diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 000000000..00dc38c51 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -x +set -e + +COMPOSE_DIR='compose-config' +server_no=$(ifconfig eno1 | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | awk -F. '{print $4}') +compose_file="${COMPOSE_DIR}/${APP_ENV}-${server_no}-docker-compose.yml" +#判断compose_file是否存在,如果不存在echo后-退出-说明 +if [ ! -f "$compose_file" ]; then + echo "Error: Compose file '$compose_file' not found. Exiting." + exit 1 +fi +echo "Exute compose file: '$compose_file'." + +echo "git pull" +git pull + +docker compose -f ${compose_file} up -d --build + +sleep 3 +docker logs -f -n 30 esp32-server \ No newline at end of file