wzpan / wukong-robot

🤖 wukong-robot 是一个简单、灵活、优雅的中文语音对话机器人/智能音箱项目,支持ChatGPT多轮对话能力,还可能是首个支持脑机交互的开源智能音箱项目。
https://wukong.hahack.com/
MIT License
6.27k stars 1.33k forks source link

macOS Catalina 可以运行wukong-robot,但唤醒后在录音时报错:robot.Conversation:ASR识别失败 #190

Closed VVfearless closed 1 year ago

VVfearless commented 1 year ago

确认已寻找过答案

我已确认在 Github issue 页、常见问题页、文档 中都查找过,没有找到类似问题和资料。我也没有 google / bing/ 百度 / duckduckgo 到相关解答。

安装方式

手动安装

操作系统 macOS Catalina version:10.15.7

离线唤醒相关

我已确保录音、播放都正常工作才尝试 wukong-robot 。rec temp.wavplay temp.wav (Mac)已正常工作

问题描述

我在mac电脑上安装wukong-robot,可以正常录音和播放,也在配置文件config.yml添加了百度智能语音的app id、app key、app secret key。python3 wukong-robot.py启动后,用”snowboy“关键词唤醒wukong-robot,可以听到ding的开始录音声。

但是在说话之后,报错:

INFO:snowboy:Keyword 1 detected at time: 2023-02-07 18:37:19
INFO:__main__:开始录音
INFO:robot.Conversation:结束录音
CRITICAL:robot.Conversation:ASR识别失败:'Conversation' object has no attribute 'asr'
CRITICAL:robot.Conversation:回复失败:local variable 'query' referenced before assignment

我把/wukong-robot/robot/Conversation.py里的tensent-asr改成了baidu-asr,仍然还是报错'Conversation' object has no attribute 'asr'

def reInit(self):
        """重新初始化"""
        try:
            self.asr = ASR.get_engine_by_slug(config.get("asr_engine", "baidu-asr"))
            self.ai = AI.get_robot_by_slug(config.get("robot", "tuling"))

请问有什么解决办法吗?

VVfearless commented 1 year ago

申请了讯飞的语音服务,将app id等信息添加到配置文件config.yml,并且引擎选择为讯飞之后,尝试运行wukong-robot,报错:

INFO:snowboy:Keyword 1 detected at time: 2023-02-07 19:29:55
INFO:__main__:开始录音
INFO:robot.Conversation:结束录音
CRITICAL:robot.Conversation:ASR识别失败:module 'websocket' has no attribute 'enableTrace'
CRITICAL:robot.Conversation:回复失败:local variable 'query' referenced before assignment
VVfearless commented 1 year ago

找到原因了,在添加app key、app id、secret key时需要保留引号,然后就可以运行了。谢谢作者!