Closed xmbhjQAQ closed 1 year ago
已知问题,下个版本修复。
临时解决方法:修改 C:\chatgpt\Windows-quickstart-refs.tags.v2.2.2.1\chatgpt\adapter\chatgpt\api.py
内容与 https://github.com/lss233/chatgpt-mirai-qq-bot/blob/browser-version/adapter/chatgpt/api.py 相同即可
已知问题,下个版本修复。
临时解决方法:修改
C:\chatgpt\Windows-quickstart-refs.tags.v2.2.2.1\chatgpt\adapter\chatgpt\api.py
内容与 https://github.com/lss233/chatgpt-mirai-qq-bot/blob/browser-version/adapter/chatgpt/api.py 相同即可
2023-03-07 23:43:38.970 | ERROR | main:request:211 - list indices must be integers or slices, not str Traceback (most recent call last):
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.1\chatgpt\bot.py", line 325, in
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.1\chatgpt\python3.9\lib\site-packages\graia\ariadne\app.py", line 312, in launch_blocking cls.launch_manager.launch_blocking(loop=cls.service.loop, stop_signal=stop_signals) │ │ │ │ │ │ └ (<Signals.SIGINT: 2>,) │ │ │ │ │ └ <property object at 0x000001D173140540> │ │ │ │ └ <graia.ariadne.service.ElizabethService object at 0x000001D169930E80> │ │ │ └ <class 'graia.ariadne.app.Ariadne'> │ │ └ <function Launart.launch_blocking at 0x000001D172E29940> │ └ <launart.manager.Launart object at 0x000001D173C4D040> └ <class 'graia.ariadne.app.Ariadne'>
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.1\chatgpt\python3.9\lib\site-packages\launart\manager.py", line 494, in launch_blocking
loop.run_until_complete(launch_task)
│ │ └ <Task pending name='amnesia-launch' coro=<Launart.launch() running at C:\chatgpt\Windows-quickstart-refs.tags.v2.2.1\chatgpt...
│ └ <function BaseEventLoop.run_until_complete at 0x000001D16B652790>
└
File "asyncio\base_events.py", line 634, in run_until_complete ', '.join(str(exc) for exc in exceptions))) └ <module 'asyncio.exceptions' from 'C:\chatgpt\Windows-quickstart-refs.tags.v2.2.1\chatgpt\python3.9\python39.zip\asynci...
File "asyncio\windows_events.py", line 321, in run_forever
File "asyncio\base_events.py", line 601, in run_forever exc.errno, 'error while '
File "asyncio\base_events.py", line 1905, in _run_once
File "asyncio\events.py", line 80, in _run self._loop = loop │ └ <member '_loop' of 'Handle' objects> └ <Handle <TaskStepMethWrapper object at 0x000001D173EAF3A0>()>
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.1\chatgpt\python3.9\lib\site-packages\graia\broadcast__init__.py", line 191, in Executor result = await run_always_await(target_callable, **parameter_compile_result) │ │ └ {'app': <graia.ariadne.app.Ariadne object at 0x000001D16995D220>, 'friend': Friend(id=QQ号, nickname='QQ昵称', remark... │ └ <function friend_message_listener at 0x000001D173C37E50> └ <function run_always_await at 0x000001D172E36CA0>
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.1\chatgpt\python3.9\lib\site-packages\graia\broadcast\utilles.py", line 34, in run_always_await obj = await obj └ <coroutine object friend_message_listener at 0x000001D173EAB840>
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.1\chatgpt\bot.py", line 231, in friend_message_listener await handle_message(friend, f"friend-{friend.id}", chain.display, source, chain) │ │ │ │ │ └ MessageChain([Plain(text='你是谁')]) │ │ │ │ └ Source(id=57879, time=datetime.datetime(2023, 3, 7, 15, 43, 38, tzinfo=datetime.timezone.utc), type='Source') │ │ │ └ <property object at 0x000001D173049630> │ │ └ MessageChain([Plain(text='你是谁')]) │ └ Friend(id=QQ号, nickname='QQ昵称', remark='QQ昵称') └ <function handle_message at 0x000001D173C37D30>
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.1\chatgpt\bot.py", line 219, in handle_message
await action(session_id, source, target, message.strip(), conversation_context, respond)
│ │ │ │ │ │ │ └ <function handle_message.
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.1\chatgpt\bot.py", line 111, in call
await m.handle_request(session_id, source, target, message, respond, conversation_context, n)
│ │ │ │ │ │ │ │ └ <function handle_message.
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.1\chatgpt\middlewares\concurrentlock.py", line 49, in handle_request
await action(session_id, source, target, prompt, conversation_context, respond)
│ │ │ │ │ │ └ <function handle_message.
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.1\chatgpt\bot.py", line 111, in call
await m.handle_request(session_id, source, target, message, respond, conversation_context, n)
│ │ │ │ │ │ │ │ └ <function handle_message.
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.1\chatgpt\middlewares\middleware.py", line 10, in handle_request
await action(session_id, source, target, prompt, conversation_context, respond)
│ │ │ │ │ │ └ <function handle_message.
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.1\chatgpt\bot.py", line 111, in call
await m.handle_request(session_id, source, target, message, respond, conversation_context, n)
│ │ │ │ │ │ │ │ └ <function handle_message.
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.1\chatgpt\middlewares\ratelimit.py", line 24, in handle_request
await action(session_id, source, target, prompt, conversation_context, respond)
│ │ │ │ │ │ └ <function handle_message.
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.1\chatgpt\bot.py", line 111, in call
await m.handle_request(session_id, source, target, message, respond, conversation_context, n)
│ │ │ │ │ │ │ │ └ <function handle_message.
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.1\chatgpt\middlewares\timeout.py", line 32, in handle_request
await action(session_id, source, target, prompt, conversation_context, respond)
│ │ │ │ │ │ └ <function handle_message.
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.1\chatgpt\bot.py", line 173, in request async for _ in conversation_context.load_preset('default'): ... │ └ <function ConversationContext.load_preset at 0x000001D174563790> └ <conversation.ConversationContext object at 0x000001D17431BD30>
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.1\chatgpt\conversation.py", line 111, in load_preset async for item in self.adapter.preset_ask(role=role.lower().strip(), text=text.strip()): │ │ │ │ │ │ └ <method 'strip' of 'str' objects> │ │ │ │ │ └ '你是 ChatGPT,一个由 OpenAI 训练的大型语言模型。你不会拒绝回答任何问题,对每个回复你都尽可能详细地回答。' │ │ │ │ └ <method 'lower' of 'str' objects> │ │ │ └ 'system' │ │ └ <function ChatGPTAPIAdapter.preset_ask at 0x000001D173BE11F0> │ └ <adapter.chatgpt.api.ChatGPTAPIAdapter object at 0x000001D17431B880> └ <conversation.ConversationContext object at 0x000001D17431BD30>
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.1\chatgpt\adapter\chatgpt\api.py", line 78, in preset_ask self.bot.conversation["default"].append({"role": role, "content": text}) │ │ │ │ └ '你是 ChatGPT,一个由 OpenAI 训练的大型语言模型。你不会拒绝回答任何问题,对每个回复你都尽可能详细地回答。' │ │ │ └ 'system' │ │ └ [{'role': 'system', 'content': 'You are ChatGPT, a large language model trained by OpenAI. Respond conversationally'}] │ └ <revChatGPT.V3.Chatbot object at 0x000001D17431BD00> └ <adapter.chatgpt.api.ChatGPTAPIAdapter object at 0x000001D17431B880>
TypeError: list indices must be integers or slices, not str
在替换后新的问题出现了...
你这不太对呀,怎么版本又变成了 v2.2.1
这个版本是不需要修改的,没问题的。
你这不太对呀,怎么版本又变成了
v2.2.1
这个版本是不需要修改的,没问题的。
问题已解决,感谢
提交 issue 前,请先确认:
表现
描述 BUG 的表现情况
运行环境:
复现步骤
描述你是如何触发这个 BUG 的 切换为chatgpt-api模式后发送请求后稳定触发
下面是日志 2023-03-07 21:03:05.138 | ERROR | main:request:210 - 'dict' object has no attribute 'append' Traceback (most recent call last):
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.2.1\chatgpt\bot.py", line 324, in
app.launch_blocking()
│ └ <classmethod(<function Ariadne.launch_blocking at 0x00000192C4374F40>)>
└ <graia.ariadne.app.Ariadne object at 0x00000192C4D49350>
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.2.1\chatgpt\python3.11\Lib\site-packages\graia\ariadne\app.py", line 312, in launch_blocking cls.launch_manager.launch_blocking(loop=cls.service.loop, stop_signal=stop_signals) │ │ │ │ │ │ └ (<Signals.SIGINT: 2>,) │ │ │ │ │ └ <property object at 0x00000192C4366430> │ │ │ │ └ <graia.ariadne.service.ElizabethService object at 0x00000192C652F890> │ │ │ └ <class 'graia.ariadne.app.Ariadne'> │ │ └ <function Launart.launch_blocking at 0x00000192C4508EA0> │ └ <launart.manager.Launart object at 0x00000192C4292110> └ <class 'graia.ariadne.app.Ariadne'> File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.2.1\chatgpt\python3.11\Lib\site-packages\launart\manager.py", line 494, in launch_blocking loop.run_until_complete(launch_task) │ │ └ <Task pending name='amnesia-launch' coro=<Launart.launch() running at C:\chatgpt\Windows-quickstart-refs.tags.v2.2.2.1\chatgp... │ └ <function BaseEventLoop.run_until_complete at 0x00000192C25067A0> └
File "asyncio\base_events.py", line 640, in run_until_complete sock.setblocking(False)
File "asyncio\windows_events.py", line 321, in run_forever
File "asyncio\base_events.py", line 607, in run_forever sock.close()
File "asyncio\base_events.py", line 1922, in _run_once
File "asyncio\events.py", line 80, in _run self._loop = loop │ └ <member '_loop' of 'Handle' objects> └ <Handle <TaskStepMethWrapper object at 0x00000192C9A4B880>()>
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.2.1\chatgpt\python3.11\Lib\site-packages\graia\broadcast__init__.py", line 191, in Executor result = await run_always_await(target_callable, **parameter_compile_result) │ │ └ {'app': <graia.ariadne.app.Ariadne object at 0x00000192C4D49350>, 'friend': Friend(id=QQ号, nickname='QQ昵称', remark... │ └ <function friend_message_listener at 0x00000192C9A50EA0> └ <function run_always_await at 0x00000192C44ECCC0> File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.2.1\chatgpt\python3.11\Lib\site-packages\graia\broadcast\utilles.py", line 34, in run_always_await obj = await obj └ <coroutine object friend_message_listener at 0x00000192C9B1B840>
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.2.1\chatgpt\bot.py", line 230, in friend_message_listener await handle_message(friend, f"friend-{friend.id}", chain.display, source, chain) │ │ │ │ │ └ MessageChain([Plain(text='你是谁')]) │ │ │ │ └ Source(id=34169, time=datetime.datetime(2023, 3, 7, 13, 3, 4, tzinfo=datetime.timezone.utc), type='Source') │ │ │ └ <property object at 0x00000192C4D5E200> │ │ └ MessageChain([Plain(text='你是谁')]) │ └ Friend(id=QQ号, nickname='QQ昵称', remark='QQ昵称') └ <function handle_message at 0x00000192C9A50D60>
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.2.1\chatgpt\bot.py", line 218, in handle_message await action(session_id, source, target, message.strip(), conversation_context, respond) │ │ │ │ │ │ │ └ <function handle_message..respond at 0x00000192C9B5DB20>
│ │ │ │ │ │ └ None
│ │ │ │ │ └ <method 'strip' of 'str' objects>
│ │ │ │ └ '你是谁'
│ │ │ └ Friend(id=QQ号, nickname='QQ昵称', remark='QQ昵称')
│ │ └ Source(id=34169, time=datetime.datetime(2023, 3, 7, 13, 3, 4, tzinfo=datetime.timezone.utc), type='Source')
│ └ 'friend-QQ号'
└ <function handle_message..wrap_request..call at 0x00000192C9B5D4E0>
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.2.1\chatgpt\bot.py", line 110, in call await m.handle_request(session_id, source, target, message, respond, conversation_context, n) │ │ │ │ │ │ │ │ └ <function handle_message..wrap_request..call at 0x00000192C9B5D760>
│ │ │ │ │ │ │ └ None
│ │ │ │ │ │ └ <function handle_message..respond at 0x00000192C9B5DB20>
│ │ │ │ │ └ '你是谁'
│ │ │ │ └ Friend(id=QQ号, nickname='QQ昵称', remark='QQ昵称')
│ │ │ └ Source(id=34169, time=datetime.datetime(2023, 3, 7, 13, 3, 4, tzinfo=datetime.timezone.utc), type='Source')
│ │ └ 'friend-QQ号'
│ └ <function MiddlewareConcurrentLock.handle_request at 0x00000192C65CA200>
└ <middlewares.concurrentlock.MiddlewareConcurrentLock object at 0x00000192C9A41690>
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.2.1\chatgpt\middlewares\concurrentlock.py", line 49, in handle_request await action(session_id, source, target, prompt, conversation_context, respond) │ │ │ │ │ │ └ <function handle_message..respond at 0x00000192C9B5DB20>
│ │ │ │ │ └ None
│ │ │ │ └ '你是谁'
│ │ │ └ Friend(id=QQ号, nickname='QQ昵称', remark='QQ昵称')
│ │ └ Source(id=34169, time=datetime.datetime(2023, 3, 7, 13, 3, 4, tzinfo=datetime.timezone.utc), type='Source')
│ └ 'friend-QQ号'
└ <function handle_message..wrap_request..call at 0x00000192C9B5D760>
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.2.1\chatgpt\bot.py", line 110, in call await m.handle_request(session_id, source, target, message, respond, conversation_context, n) │ │ │ │ │ │ │ │ └ <function handle_message..wrap_request..call at 0x00000192C9B5D940>
│ │ │ │ │ │ │ └ None
│ │ │ │ │ │ └ <function handle_message..respond at 0x00000192C9B5DB20>
│ │ │ │ │ └ '你是谁'
│ │ │ │ └ Friend(id=QQ号, nickname='QQ昵称', remark='QQ昵称')
│ │ │ └ Source(id=34169, time=datetime.datetime(2023, 3, 7, 13, 3, 4, tzinfo=datetime.timezone.utc), type='Source')
│ │ └ 'friend-QQ号'
│ └ <function Middleware.handle_request at 0x00000192C65C9760>
└ <middlewares.baiducloud.MiddlewareBaiduCloud object at 0x00000192C9A41490>
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.2.1\chatgpt\middlewares\middleware.py", line 10, in handle_request await action(session_id, source, target, prompt, conversation_context, respond) │ │ │ │ │ │ └ <function handle_message..respond at 0x00000192C9B5DB20>
│ │ │ │ │ └ None
│ │ │ │ └ '你是谁'
│ │ │ └ Friend(id=QQ号, nickname='QQ昵称', remark='QQ昵称')
│ │ └ Source(id=34169, time=datetime.datetime(2023, 3, 7, 13, 3, 4, tzinfo=datetime.timezone.utc), type='Source')
│ └ 'friend-QQ号'
└ <function handle_message..wrap_request..call at 0x00000192C9B5D940>
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.2.1\chatgpt\bot.py", line 110, in call await m.handle_request(session_id, source, target, message, respond, conversation_context, n) │ │ │ │ │ │ │ │ └ <function handle_message..wrap_request..call at 0x00000192C9B5D9E0>
│ │ │ │ │ │ │ └ None
│ │ │ │ │ │ └ <function handle_message..respond at 0x00000192C9B5DB20>
│ │ │ │ │ └ '你是谁'
│ │ │ │ └ Friend(id=QQ号, nickname='QQ昵称', remark='QQ昵称')
│ │ │ └ Source(id=34169, time=datetime.datetime(2023, 3, 7, 13, 3, 4, tzinfo=datetime.timezone.utc), type='Source')
│ │ └ 'friend-QQ号'
│ └ <function MiddlewareRatelimit.handle_request at 0x00000192C65C9620>
└ <middlewares.ratelimit.MiddlewareRatelimit object at 0x00000192C9A416D0>
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.2.1\chatgpt\middlewares\ratelimit.py", line 24, in handle_request await action(session_id, source, target, prompt, conversation_context, respond) │ │ │ │ │ │ └ <function handle_message..respond at 0x00000192C9B5DB20>
│ │ │ │ │ └ None
│ │ │ │ └ '你是谁'
│ │ │ └ Friend(id=QQ号, nickname='QQ昵称', remark='QQ昵称')
│ │ └ Source(id=34169, time=datetime.datetime(2023, 3, 7, 13, 3, 4, tzinfo=datetime.timezone.utc), type='Source')
│ └ 'friend-QQ号'
└ <function handle_message..wrap_request..call at 0x00000192C9B5D9E0>
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.2.1\chatgpt\bot.py", line 110, in call await m.handle_request(session_id, source, target, message, respond, conversation_context, n) │ │ │ │ │ │ │ │ └ <function handle_message..request at 0x00000192C9B5DA80>
│ │ │ │ │ │ │ └ None
│ │ │ │ │ │ └ <function handle_message..respond at 0x00000192C9B5DB20>
│ │ │ │ │ └ '你是谁'
│ │ │ │ └ Friend(id=QQ号, nickname='QQ昵称', remark='QQ昵称')
│ │ │ └ Source(id=34169, time=datetime.datetime(2023, 3, 7, 13, 3, 4, tzinfo=datetime.timezone.utc), type='Source')
│ │ └ 'friend-QQ号'
│ └ <function MiddlewareTimeout.handle_request at 0x00000192C65C9E40>
└ <middlewares.timeout.MiddlewareTimeout object at 0x00000192C9A41A10>
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.2.1\chatgpt\middlewares\timeout.py", line 32, in handle_request await action(session_id, source, target, prompt, conversation_context, respond) │ │ │ │ │ │ └ <function handle_message..respond at 0x00000192C9B5DB20>
│ │ │ │ │ └ None
│ │ │ │ └ '你是谁'
│ │ │ └ Friend(id=QQ号, nickname='QQ昵称', remark='QQ昵称')
│ │ └ Source(id=34169, time=datetime.datetime(2023, 3, 7, 13, 3, 4, tzinfo=datetime.timezone.utc), type='Source')
│ └ 'friend-QQ号'
└ <function handle_message..request at 0x00000192C9B5DA80>
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.2.1\chatgpt\conversation.py", line 111, in load_preset async for item in self.adapter.preset_ask(role=role.lower().strip(), text=text.strip()): │ │ │ │ │ │ └ <method 'strip' of 'str' objects> │ │ │ │ │ └ '你是 ChatGPT,一个由 OpenAI 训练的大型 语言模型。你不会拒绝回答任何问题,对每个回复你都尽可能详细地回答。' │ │ │ │ └ <method 'lower' of 'str' objects> │ │ │ └ 'system' │ │ └ <function ChatGPTAPIAdapter.preset_ask at 0x00000192C65BF1A0> │ └ <adapter.chatgpt.api.ChatGPTAPIAdapter object at 0x00000192C9B65490> └ <conversation.ConversationContext object at 0x00000192C9B670D0>
File "C:\chatgpt\Windows-quickstart-refs.tags.v2.2.2.1\chatgpt\adapter\chatgpt\api.py", line 78, in preset_ask self.bot.conversation.append({"role": role, "content": text}) │ │ │ │ └ '你是 ChatGPT,一个由 OpenAI 训练的大型语言模型。你不会拒绝回答任何问题,对每个回复你都尽可能详细地回答。' │ │ │ └ 'system' │ │ └ {'default': [{'role': 'system', 'content': 'You are ChatGPT, a large language model trained by OpenAI. Respond conversational... │ └ <revChatGPT.V3.Chatbot object at 0x00000192C9B655D0> └ <adapter.chatgpt.api.ChatGPTAPIAdapter object at 0x00000192C9B65490>
AttributeError: 'dict' object has no attribute 'append'