diff --git a/compose-config/test-243-docker-compose.yml b/compose-config/test-243-docker-compose.yml index 06c553c73..883860506 100644 --- a/compose-config/test-243-docker-compose.yml +++ b/compose-config/test-243-docker-compose.yml @@ -13,7 +13,7 @@ services: devices: - driver: nvidia capabilities: [gpu] - device_ids: ['1'] + device_ids: ['0'] environment: - GRADIO_SERVER_NAME=0.0.0.0 - HOSTNAME=192.168.101.243 diff --git a/config.yaml b/config.yaml index 463068edb..cf8066f44 100644 --- a/config.yaml +++ b/config.yaml @@ -68,7 +68,7 @@ LLM: base_url: 你的私有化部署的dify接口地址 api_key: 你的dify api key TTS: - TTS_MAX_WORKERS: 5 + TTS_MAX_WORKERS: 3 EdgeTTS: voice: zh-CN-XiaoxiaoNeural output_file: tmp/ @@ -106,7 +106,7 @@ TTS: normalize: true format: "wav" max_new_tokens: 1024 - chunk_length: 150 + chunk_length: 50 top_p: 0.7 repetition_penalty: 1.2 temperature: 0.7 diff --git a/core/handle/audioHandle.py b/core/handle/audioHandle.py index 0f140ac50..1f6195581 100644 --- a/core/handle/audioHandle.py +++ b/core/handle/audioHandle.py @@ -121,12 +121,14 @@ async def sendAudioMessageStream(conn, audios_queue, duration, text): # 发送音频数据 -获取队列的数据发送 start_time = time.time() + check_index = 0 while True: try: + start_get_queue = time.time() # 尝试获取数据,如果没有数据,则等待一小段时间再试 audio_data_chunke = None try: - audio_data_chunke = audios_queue.get(timeout=2) # 设置超时为1秒 + audio_data_chunke = audios_queue.get(timeout=5) # 设置超时为1秒 except Exception as e: # 如果超时,继续等待 print(f"获取队列超时~{e}") @@ -145,8 +147,10 @@ async def sendAudioMessageStream(conn, audios_queue, duration, text): break if audio_data_chunke_data: + queue_duration = time.time() - start_get_queue - duration + # queue_duration = 0 if queue_duration < 0 else queue_duration opus_datas, duration = conn.tts.wav_to_opus_data_audio(audio_data_chunke_data) - conn.tts_duration = conn.tts_duration + duration + conn.tts_duration = conn.tts_duration+duration+queue_duration for opus_packet in opus_datas: await conn.websocket.send(opus_packet) print(f"已获取音频数据,长度为 {len(audio_data_chunke_data)},总长度为 {len(audio_data_chunke_data)}")