From e19a8b479c8bc2909d3b9072cb7b75feffdd8c3f Mon Sep 17 00:00:00 2001 From: 6vision Date: Tue, 21 May 2024 22:32:35 +0800 Subject: [PATCH 1/4] fix: baidu voice bug --- config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.py b/config.py index 7d07379..bda5fab 100644 --- a/config.py +++ b/config.py @@ -95,7 +95,7 @@ available_setting = { "baidu_api_key": "", "baidu_secret_key": "", # 1536普通话(支持简单的英文识别) 1737英语 1637粤语 1837四川话 1936普通话远场 - "baidu_dev_pid": "1536", + "baidu_dev_pid": 1536, # azure 语音api配置, 使用azure语音识别和语音合成时需要 "azure_voice_api_key": "", "azure_voice_region": "japaneast", From 93a32ae5ff27a9df61379d9831f4c050c9787d61 Mon Sep 17 00:00:00 2001 From: 6vision Date: Wed, 22 May 2024 15:57:22 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E5=BC=82=E5=B8=B8=E6=97=B6=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bot/baidu/baidu_wenxin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/baidu/baidu_wenxin.py b/bot/baidu/baidu_wenxin.py index f35e0fa..f00b5ff 100644 --- a/bot/baidu/baidu_wenxin.py +++ b/bot/baidu/baidu_wenxin.py @@ -94,7 +94,7 @@ class BaiduWenxinBot(Bot): logger.warn("[BAIDU] Exception: {}".format(e)) need_retry = False self.sessions.clear_session(session.session_id) - result = {"completion_tokens": 0, "content": "出错了: {}".format(e)} + result = {"total_tokens":0, "completion_tokens": 0, "content": "出错了: {}".format(e)} return result def get_access_token(self): From 071709d2630451daaf3195092776f9b29e3818e3 Mon Sep 17 00:00:00 2001 From: 6vision Date: Wed, 22 May 2024 16:01:46 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=201959-=E7=99=BE=E5=BA=A6=E6=96=87?= =?UTF-8?q?=E5=BF=83=E5=81=B6=E5=8F=91=E6=8A=A5=E9=94=99336006?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bot/baidu/baidu_wenxin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/baidu/baidu_wenxin.py b/bot/baidu/baidu_wenxin.py index f00b5ff..81b5748 100644 --- a/bot/baidu/baidu_wenxin.py +++ b/bot/baidu/baidu_wenxin.py @@ -94,7 +94,7 @@ class BaiduWenxinBot(Bot): logger.warn("[BAIDU] Exception: {}".format(e)) need_retry = False self.sessions.clear_session(session.session_id) - result = {"total_tokens":0, "completion_tokens": 0, "content": "出错了: {}".format(e)} + result = {"total_tokens": 0, "completion_tokens": 0, "content": "出错了: {}".format(e)} return result def get_access_token(self): From be13cc3194c25195ba2a89718ac7f821f590332d Mon Sep 17 00:00:00 2001 From: 6vision Date: Thu, 23 May 2024 01:34:20 +0800 Subject: [PATCH 4/4] Changed sampling rate --- voice/baidu/baidu_voice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/voice/baidu/baidu_voice.py b/voice/baidu/baidu_voice.py index 66ba4d8..fbf53ce 100644 --- a/voice/baidu/baidu_voice.py +++ b/voice/baidu/baidu_voice.py @@ -62,7 +62,7 @@ class BaiduVoice(Voice): # 识别本地文件 logger.debug("[Baidu] voice file name={}".format(voice_file)) pcm = get_pcm_from_wav(voice_file) - res = self.client.asr(pcm, "pcm", 8000, {"dev_pid": self.dev_id}) + res = self.client.asr(pcm, "pcm", 16000, {"dev_pid": self.dev_id}) if res["err_no"] == 0: logger.info("百度语音识别到了:{}".format(res["result"])) text = "".join(res["result"])