yihong0618 / xiaogpt

Play ChatGPT and other LLM with Xiaomi AI Speaker
MIT License
5.85k stars 815 forks source link

报错:MiNAService类缺少player_get_status这个方法 #503

Closed KanoSang closed 1 month ago

KanoSang commented 1 month ago

我运行环境的python版本是python3.9,且装好了所有所需的库,下面是我的config:


{ "hardware": "L05C", "account": "1xxxxxxxxx8", "password": "xxxxxx", "openai_key": "fastgpt-xxxxxx", "glm_key": "", "gemini_key": "", "gemini_api_domain": "", "qwen_key": "", "serpapi_api_key": "", "cookie": "", "mi_did": "6xxxxxxx", "use_command": true, "mute_xiaoai": true, "verbose": false, "bot": "chatgptapi", "tts": "mi", "tts_options": {}, "prompt": "请用100字以内回答", "keyword": ["请","帮","我","问"], "change_prompt_keyword": ["更改提示词"], "start_conversation": "开始持续对话", "end_conversation": "结束持续对话", "stream": true, "proxy": "http://127.0.0.1:7890", "gpt_options": {}, "bing_cookie_path": "", "bing_cookies": {}, "api_base": "https://xxx:3000/api/openapi/v1", "deployment_id": "", "volc_access_key": "", "volc_secret_key": "" }


我以“问”开头提问后,后台如下:


(xiaogpt) E:\project\xiaogpt-5.07>python xiaogpt.py --config xiao_config.json C:\Users\AI\miniconda3\envs\xiaogpt\lib\site-packages\langchain_api\module_import.py:87: LangChainDeprecationWarning: Importing GuardrailsOutputParser from langchain.output_parsers is deprecated. Please replace the import with the following: from langchain_community.output_parsers.rail_parser import GuardrailsOutputParser warnings.warn( Running xiaogpt now, 用请/帮/我/问开头来提问 或用开始持续对话开始持续对话

问题:问我今晚吃什么蛋糕好? Traceback (most recent call last): File "E:\project\xiaogpt-5.07\xiaogpt.py", line 5, in main() File "E:\project\xiaogpt-5.07\xiaogpt\cli.py", line 241, in main loop.run_until_complete(main(config)) File "C:\Users\AI\miniconda3\envs\xiaogpt\lib\asyncio\base_events.py", line 647, in run_until_complete return future.result() File "E:\project\xiaogpt-5.07\xiaogpt\cli.py", line 236, in main await miboy.run_forever() File "E:\project\xiaogpt-5.07\xiaogpt\xiaogpt.py", line 399, in run_forever await self.stop_if_xiaoai_is_playing() File "E:\project\xiaogpt-5.07\xiaogpt\xiaogpt.py", line 333, in stop_if_xiaoai_is_playing is_playing = await self.get_if_xiaoai_is_playing() File "E:\project\xiaogpt-5.07\xiaogpt\xiaogpt.py", line 324, in get_if_xiaoai_is_playing playing_info = await self.mina_service.player_get_status(self.device_id) AttributeError: 'MiNAService' object has no attribute 'player_get_status' Task exception was never retrieved future: <Task finished name='Task-7' coro=<MiGPT.poll_latest_ask() done, defined at E:\project\xiaogpt-5.07\xiaogpt\xiaogpt.py:58> exception=AttributeError("'MiNAService' object has no attribute 'player_get_status'")> Traceback (most recent call last): File "E:\project\xiaogpt-5.07\xiaogpt\xiaogpt.py", line 76, in poll_latest_ask await self.stop_if_xiaoai_is_playing() File "E:\project\xiaogpt-5.07\xiaogpt\xiaogpt.py", line 333, in stop_if_xiaoai_is_playing is_playing = await self.get_if_xiaoai_is_playing() File "E:\project\xiaogpt-5.07\xiaogpt\xiaogpt.py", line 324, in get_if_xiaoai_is_playing playing_info = await self.mina_service.player_get_status(self.device_id) AttributeError: 'MiNAService' object has no attribute 'player_get_status'


程序便报错自动退出了,于是我去查看这个MiNAService类的的help:


(xiaogpt) E:\project\xiaogpt-5.07>python Python 3.9.19 (main, May 6 2024, 20:12:36) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

from miservice import MiNAService File "", line 1 from miservice import MiNAService IndentationError: unexpected indent help(MiNAService) File "", line 1 help(MiNAService) IndentationError: unexpected indent from miservice import MiNAService help(MiNAService) Help on class MiNAService in module miservice.minaservice:

class MiNAService(builtins.object) MiNAService(account: miservice.miaccount.MiAccount)
Methods defined here:
init(self, account: miservice.miaccount.MiAccount)
Initialize self. See help(type(self)) for accurate signature.
async device_list(self, master=0)
async mina_request(self, uri, data=None)
async player_set_volume(self, deviceId, volume)
async send_message(self, devices, devno, message, volume=None)
async text_to_speech(self, deviceId, text)
async ubus_request(self, deviceId, method, path, message)
----------------------------------------------------------------------
Data descriptors defined here:
dict
dictionary for instance variables (if defined)
weakref
list of weak references to the object (if defined)

发现确实好像没有这个方法?不清楚如何解决这个报错了

KanoSang commented 1 month ago

自己已解决

MrThorOdinson commented 1 month ago

怎么解决的啊?大佬

yihong0618 commented 1 month ago

python3 -m pip uninstall miservice python3 -m pip install miservice-fork

怎么解决的啊?大佬

python3 -m pip uninstall miservice python3 -m pip install miservice-fork if no pip

pip uninstall miservice pip install miservice-fork