mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +01:00
feat: rollback turn detection
This commit is contained in:
parent
e210e0d5e4
commit
d8df5f7f1c
2 changed files with 17 additions and 9 deletions
|
|
@ -259,13 +259,21 @@ class ASRProviderBase(ABC):
|
||||||
conn.asr_text_buffer = raw_text
|
conn.asr_text_buffer = raw_text
|
||||||
|
|
||||||
# Turn Detection: let turn detection handle end of turn
|
# Turn Detection: let turn detection handle end of turn
|
||||||
if conn.turn_detection:
|
# if conn.turn_detection:
|
||||||
# Turn detection will wait for endpoint delay, then call on_end_of_turn
|
# # Turn detection will wait for endpoint delay, then call on_end_of_turn
|
||||||
conn.turn_detection.check_end_of_turn(conn)
|
# conn.turn_detection.check_end_of_turn(conn)
|
||||||
return
|
# return
|
||||||
|
|
||||||
# No Turn Detection: process immediately
|
# # No Turn Detection: process immediately
|
||||||
await conn.on_end_of_turn()
|
# await conn.on_end_of_turn()
|
||||||
|
enhanced_text = self._build_enhanced_text(raw_text, speaker_name)
|
||||||
|
|
||||||
|
asr_report_time = int(time.time())
|
||||||
|
|
||||||
|
await startToChat(conn, enhanced_text)
|
||||||
|
# Note: For report, we need to convert PCM back to opus or use PCM directly
|
||||||
|
# For now, pass empty list as audio data for report
|
||||||
|
enqueue_asr_report(conn, enhanced_text, [], report_time=asr_report_time)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.bind(tag=TAG).error(f"Process speech segment failed: {e}")
|
logger.bind(tag=TAG).error(f"Process speech segment failed: {e}")
|
||||||
|
|
|
||||||
|
|
@ -1129,9 +1129,9 @@ TTS:
|
||||||
# ============================= Module Selection ================================
|
# ============================= Module Selection ================================
|
||||||
# ===============================================================================
|
# ===============================================================================
|
||||||
selected_module:
|
selected_module:
|
||||||
# VAD: FsmnVAD
|
VAD: FsmnVAD
|
||||||
VAD: SileroVAD
|
# VAD: SileroVAD
|
||||||
TurnDetection: NoopTurnDetection # Set to TenTurnDetection to enable
|
TurnDetection: TenTurnDetection # Set to TenTurnDetection to enable
|
||||||
ASR: GroqASR
|
ASR: GroqASR
|
||||||
# ASR: ByteplusStreamASR
|
# ASR: ByteplusStreamASR
|
||||||
# LLM: GroqLLM
|
# LLM: GroqLLM
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue