Browse Source

Merge branch 'zhayujie:master' into master

master
Haowei GitHub 6 months ago
parent
commit
bc8364d594
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions
  1. +1
    -1
      bot/baidu/baidu_wenxin.py
  2. +1
    -1
      config.py
  3. +1
    -1
      voice/baidu/baidu_voice.py

+ 1
- 1
bot/baidu/baidu_wenxin.py View File

@@ -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):


+ 1
- 1
config.py View File

@@ -102,7 +102,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",


+ 1
- 1
voice/baidu/baidu_voice.py View File

@@ -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"])


Loading…
Cancel
Save