This commit is contained in:
Yasir Aris M 2024-08-14 10:16:47 +07:00 committed by GitHub
parent 9be13c3d8d
commit c03b732a30
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -129,9 +129,10 @@ async def openai_chatbot(self, ctx: Message, strings):
user_conversations[uid] = [{"role": "user", "content": pertanyaan}] user_conversations[uid] = [{"role": "user", "content": pertanyaan}]
else: else:
user_conversations[uid].append({"role": "user", "content": pertanyaan}) user_conversations[uid].append({"role": "user", "content": pertanyaan})
ai_response = await get_openai_stream_response(user_conversations[uid], bmsg) ai_response = await get_openai_stream_response(user_conversations[uid], msg)
if not ai_response: if not ai_response:
user_conversations[user_id].pop() user_conversations[user_id].pop()
if len(user_conversations[user_id]) == 1: if len(user_conversations[user_id]) == 1:
user_conversations.pop(user_id) user_conversations.pop(user_id)
return
user_conversations[uid].append({"role": "assistant", "content": ai_response}) user_conversations[uid].append({"role": "assistant", "content": ai_response})