yihong0618 / xiaogpt

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

请问这个报错 用哪种解决方式更好? #411

Closed NeoXu954 closed 9 months ago

NeoXu954 commented 9 months ago

以下是小爱的回答: 本设备暂不支持该功能哦 Traceback (most recent call last): File "/home/xjh/xiaogpt/xiaogpt.py", line 502, in asyncio.run(miboy.run_forever()) File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete return future.result() File "/home/xjh/xiaogpt/xiaogpt.py", line 386, in run_forever await self.do_chat_with_xiaoai(last_record, query, key) File "/home/xjh/xiaogpt/xiaogpt.py", line 347, in do_chat_with_xiaoai message = await self.ask_gpt(query) File "/home/xjh/xiaogpt/xiaogpt.py", line 268, in ask_gpt return await self.ask_chatgpt_api(query) File "/home/xjh/xiaogpt/xiaogpt.py", line 272, in ask_chatgpt_api message = await self.chatbot.ask(query) File "/home/xjh/xiaogpt/xiaogpt.py", line 95, in ask completion = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=ms) File "/home/xjh/.local/lib/python3.10/site-packages/openai/lib/_old_api.py", line 39, in call raise APIRemovedInV1(symbol=self._symbol) openai.lib._old_api.APIRemovedInV1:

You tried to access openai.ChatCompletion, but this is no longer supported in openai>=1.0.0 - see the README at https://github.com/openai/openai-python for the API.

You can run openai migrate to automatically upgrade your codebase to use the 1.0.0 interface.

Alternatively, you can pin your installation to the old version, e.g. pip install openai==0.28

A detailed migration guide is available here: https://github.com/openai/openai-python/discussions/742

yihong0618 commented 9 months ago

使用最新版本的 xiaogpt pip install -U openai xiaogpt

NeoXu954 commented 9 months ago

谢谢

yihong0618 commented 9 months ago

不客气