瀏覽代碼

Merge branch 'zhayujie:master' into master

master
Haowei GitHub 5 月之前
父節點
當前提交
bc8364d594
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: B5690EEEBB952194
共有 3 個檔案被更改,包括 3 行新增3 行删除
  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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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…
取消
儲存