From 4af39b0da63fb2b3282b7e4b9b3183aa43827d00 Mon Sep 17 00:00:00 2001 From: Yasir Aris M Date: Fri, 17 Nov 2023 16:12:17 +0700 Subject: [PATCH] Sync with latest openai lib Signed-off-by: Yasir Aris M --- misskaty/plugins/chatbot_ai.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misskaty/plugins/chatbot_ai.py b/misskaty/plugins/chatbot_ai.py index 27ca4d9b..4a4b5adf 100644 --- a/misskaty/plugins/chatbot_ai.py +++ b/misskaty/plugins/chatbot_ai.py @@ -68,10 +68,10 @@ async def openai_chatbot(_, ctx: Message, strings): stream=True, ) async for chunk in response: - if not chunk.choices[0].delta or chunk.choices[0].delta.get("role"): + if not chunk.choices[0].message or chunk.choices[0].message.get("role"): continue num += 1 - answer += chunk.choices[0].delta.content + answer += chunk.choices[0].message.content if num == 30: await msg.edit_msg(answer) await asyncio.sleep(1.5)