mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-31 03:43:57 +08:00
refactor(asr): 重构speech_to_text方法以接收artifacts参数
移除各ASR提供者中重复的get_current_artifacts调用,改为通过参数传递artifacts 修改base类中process_audio方法,根据combined_pcm_data长度决定是否创建artifacts 更新所有speech_to_text方法签名,添加artifacts可选参数并更新文档字符串
This commit is contained in:
@@ -24,10 +24,9 @@ class ASRProvider(ASRProviderBase):
|
||||
def requires_file(self) -> bool:
|
||||
return True
|
||||
|
||||
async def speech_to_text(self, opus_data: List[bytes], session_id: str, audio_format="opus") -> Tuple[Optional[str], Optional[str]]:
|
||||
async def speech_to_text(self, opus_data: List[bytes], session_id: str, audio_format="opus", artifacts=None) -> Tuple[Optional[str], Optional[str]]:
|
||||
file_path = None
|
||||
try:
|
||||
artifacts = self.get_current_artifacts()
|
||||
if artifacts is None:
|
||||
return "", None
|
||||
file_path = artifacts.file_path
|
||||
|
||||
Reference in New Issue
Block a user