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