Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

进入极客模式成功后,开展对话即报错 #259

Closed
0x5446 opened this issue May 4, 2023 · 2 comments
Closed

进入极客模式成功后,开展对话即报错 #259

0x5446 opened this issue May 4, 2023 · 2 comments
Assignees
Labels
bug 我的锅

Comments

@0x5446
Copy link

0x5446 commented May 4, 2023

确认已寻找过答案

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

安装方式

手动安装

操作系统

macOS Monterey Version 12.6.5(21G531)

离线唤醒相关

非离线唤醒相关的问题。
我已确保录音、播放都正常工作才尝试 wukong-robot 。

问题描述

进入极客模式后,对其说话会报错,日志如下:

2023-05-04 14:14:00,785 - robot.ASR - ASR.py - transcribe - line 154 - INFO - tencent-asr 语音识别到了:进入极客模式。
2023-05-04 14:14:03,566 - robot.Brain - Brain.py - query - line 71 - INFO - '进入极客模式。' 命中技能 geek
2023-05-04 14:14:03,566 - robot.Conversation - Conversation.py - say - line 398 - INFO - 即将朗读语音:进入极客模式
2023-05-04 14:14:03,567 - robot.Conversation - Conversation.py - _tts - line 305 - INFO - _tts
2023-05-04 14:14:04,583 - robot.TTS - TTS.py - async_get_speech - line 365 - INFO - edge-tts 语音合成成功,合成路径:/Users/tf/Project/wkrobot/wukong-robot/temp/1ab9d2bc46e54090998bce39a980e0de.mp3
2023-05-04 14:14:04,583 - robot.Conversation - Conversation.py - _ttsAction - line 85 - INFO - 第0段TTS合成成功。msg: 进入极客模式
2023-05-04 14:14:04,583 - robot.Conversation - Conversation.py - _ttsAction - line 90 - INFO - 即将播放第0段TTS。msg: 进入极客模式
2023-05-04 14:14:04,584 - robot.Player - Player.py - playLoop - line 101 - INFO - 开始播放音频:/Users/tf/Project/wkrobot/wukong-robot/temp/1ab9d2bc46e54090998bce39a980e0de.mp3
2023-05-04 14:14:07,255 - robot.Player - Player.py - doPlay - line 125 - INFO - 播放完成:/Users/tf/Project/wkrobot/wukong-robot/temp/1ab9d2bc46e54090998bce39a980e0de.mp3
2023-05-04 14:14:07,259 - robot.Conversation - Conversation.py - activeListen - line 418 - INFO - 进入主动聆听...
2023-05-04 14:14:16,849 - robot.ASR - ASR.py - transcribe - line 154 - INFO - tencent-asr 语音识别到了:what's your name?

2023-05-04 14:14:19,992 - robot.AI - AI.py - stream_chat - line 238 - INFO - msg: what's your name
2023-05-04 14:14:19,993 - robot.AI - AI.py - stream_chat - line 247 - INFO - 开始流式请求
2023-05-04 14:14:21,556 - robot.Conversation - Conversation.py - _ttsAction - line 99 - ERROR - 语音合成失败:Cannot run the event loop while another loop is running
Stack (most recent call last):
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 995, in _bootstrap
self._bootstrap_inner()
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
self.run()
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 975, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 607, in run_forever
self._run_once()
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 1922, in _run_once
handle._run()
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Player.py", line 91, in executeOnCompleted
res and onCompleted and onCompleted()
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Conversation.py", line 94, in
onCompleted=lambda: self._lastCompleted(index, onCompleted),
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Conversation.py", line 63, in _lastCompleted
onCompleted and onCompleted()
File "/Users/tf/Project/wkrobot/wukong-robot/plugins/Geek.py", line 23, in
onCompleted=lambda: self.onAsk(self.activeListen(silent=True)),
File "/Users/tf/Project/wkrobot/wukong-robot/plugins/Geek.py", line 33, in onAsk
self.con.doResponse(input)
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Conversation.py", line 170, in doResponse
self.stream_say(stream, True, onCompleted=self.checkRestore)
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Conversation.py", line 365, in stream_say
audio = self._tts_line(line.strip(), cache, index, onCompleted)
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Conversation.py", line 293, in _tts_line
result = self._ttsAction(line, cache, index, onCompleted)
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Conversation.py", line 99, in _ttsAction
logger.error(f"语音合成失败:{e}", stack_info=True)
Traceback (most recent call last):
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Conversation.py", line 84, in _ttsAction
voice = self.tts.get_speech(msg)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tf/Project/wkrobot/wukong-robot/robot/TTS.py", line 373, in get_speech
tmpfile = event_loop.run_until_complete(self.async_get_speech(phrase))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 629, in run_until_complete
self._check_running()
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 590, in _check_running
raise RuntimeError(
RuntimeError: Cannot run the event loop while another loop is running
/Users/tf/Project/wkrobot/wukong-robot/robot/Conversation.py:102: RuntimeWarning: coroutine 'EdgeTTS.async_get_speech' was never awaited
return None
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
2023-05-04 14:14:22,716 - robot.Conversation - Conversation.py - _ttsAction - line 99 - ERROR - 语音合成失败:Cannot run the event loop while another loop is running
Stack (most recent call last):
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 995, in _bootstrap
self._bootstrap_inner()
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
self.run()
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 975, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 607, in run_forever
self._run_once()
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 1922, in _run_once
handle._run()
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Player.py", line 91, in executeOnCompleted
res and onCompleted and onCompleted()
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Conversation.py", line 94, in
onCompleted=lambda: self._lastCompleted(index, onCompleted),
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Conversation.py", line 63, in _lastCompleted
onCompleted and onCompleted()
File "/Users/tf/Project/wkrobot/wukong-robot/plugins/Geek.py", line 23, in
onCompleted=lambda: self.onAsk(self.activeListen(silent=True)),
File "/Users/tf/Project/wkrobot/wukong-robot/plugins/Geek.py", line 33, in onAsk
self.con.doResponse(input)
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Conversation.py", line 170, in doResponse
self.stream_say(stream, True, onCompleted=self.checkRestore)
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Conversation.py", line 365, in stream_say
audio = self._tts_line(line.strip(), cache, index, onCompleted)
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Conversation.py", line 293, in _tts_line
result = self._ttsAction(line, cache, index, onCompleted)
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Conversation.py", line 99, in _ttsAction
logger.error(f"语音合成失败:{e}", stack_info=True)
Traceback (most recent call last):
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Conversation.py", line 84, in _ttsAction
voice = self.tts.get_speech(msg)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tf/Project/wkrobot/wukong-robot/robot/TTS.py", line 373, in get_speech
tmpfile = event_loop.run_until_complete(self.async_get_speech(phrase))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 629, in run_until_complete
self._check_running()
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 590, in _check_running
raise RuntimeError(
RuntimeError: Cannot run the event loop while another loop is running
2023-05-04 14:14:23,214 - robot.Conversation - Conversation.py - _ttsAction - line 99 - ERROR - 语音合成失败:Cannot run the event loop while another loop is running
Stack (most recent call last):
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 995, in _bootstrap
self._bootstrap_inner()
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
self.run()
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 975, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 607, in run_forever
self._run_once()
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 1922, in _run_once
handle._run()
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Player.py", line 91, in executeOnCompleted
res and onCompleted and onCompleted()
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Conversation.py", line 94, in
onCompleted=lambda: self._lastCompleted(index, onCompleted),
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Conversation.py", line 63, in _lastCompleted
onCompleted and onCompleted()
File "/Users/tf/Project/wkrobot/wukong-robot/plugins/Geek.py", line 23, in
onCompleted=lambda: self.onAsk(self.activeListen(silent=True)),
File "/Users/tf/Project/wkrobot/wukong-robot/plugins/Geek.py", line 33, in onAsk
self.con.doResponse(input)
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Conversation.py", line 170, in doResponse
self.stream_say(stream, True, onCompleted=self.checkRestore)
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Conversation.py", line 365, in stream_say
audio = self._tts_line(line.strip(), cache, index, onCompleted)
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Conversation.py", line 293, in _tts_line
result = self._ttsAction(line, cache, index, onCompleted)
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Conversation.py", line 99, in _ttsAction
logger.error(f"语音合成失败:{e}", stack_info=True)
Traceback (most recent call last):
File "/Users/tf/Project/wkrobot/wukong-robot/robot/Conversation.py", line 84, in _ttsAction
voice = self.tts.get_speech(msg)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tf/Project/wkrobot/wukong-robot/robot/TTS.py", line 373, in get_speech
tmpfile = event_loop.run_until_complete(self.async_get_speech(phrase))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 629, in run_until_complete
self._check_running()
File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 590, in _check_running
raise RuntimeError(
RuntimeError: Cannot run the event loop while another loop is running

复现步骤

对wukong说“进入极客模式”成功后,再任意向其说一句话,终端就会报错,错误信息见如上日志。

@0x5446 0x5446 added the bug 我的锅 label May 4, 2023
@0x5446 0x5446 changed the title 进入极客模式报错 进入极客模式成功后,开展对话即报错 May 5, 2023
@wzpan
Copy link
Owner

wzpan commented May 17, 2023

主干修复了这个问题,可以试试如下命令:

cd wukong-robot
git checkout master
git pull
pip3 install nest_asyncio

然后重新启动 wukong-robot 看看是否已解决。

@wzpan
Copy link
Owner

wzpan commented Jun 26, 2023

久未回复,先关闭本 issue 。

@wzpan wzpan closed this as completed Jun 26, 2023
weibinke pushed a commit to weibinke/wukong-robot that referenced this issue Sep 8, 2023
* wzpan-master: (29 commits)
  feat:本地音乐支持读取子目录文件
  fix: remove test code light.py
  feat:增加股票插件功能,唤醒词:股票
  fix
  fix
  fix
  Delete hello.py
  Add hello_world plugin
  feat:snowboy支持多个唤醒词
  Update light.py
  add demo plugins
  Feat:新增demo插件light、toutiao、微博
  bump version.
  fix: 修复语音交互回复失败问题
  chore(deps): bump tornado from 5.1.1 to 6.3.2
  chore: 增加第三方教程。
  chore(deps): bump requests from 2.21.0 to 2.31.0
  fix: 修复edgeTTS在极客模式下的问题(wzpan#259)
  Fix error caused by the lack of libffi-dev
  chore: Update README.md
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 我的锅
Projects
None yet
Development

No branches or pull requests

2 participants