Fix GPT AI
Some checks failed
Notify on Telegram / notify (push) Has been cancelled

Signed-off-by: Yasir Aris M <git@yasir.id>
This commit is contained in:
Yasir Aris M 2025-12-26 20:56:08 +07:00 committed by GitHub
parent 264bd0f393
commit 8adfb935b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -46,7 +46,7 @@ async def get_openai_stream_response(is_stream, key, base_url, model, messages,
disable_web_page_preview=True, disable_web_page_preview=True,
) )
else: else:
await bmsg.edit_msg(f"{html.escape(answer)}\n<b>Powered by:</b> <code>Gemini 3 Flash</code>") await bmsg.edit_msg(f"{html.escape(answer)}\n\n<b>Powered by:</b> <code>Gemini 3 Flash</code>")
else: else:
async for chunk in response: async for chunk in response:
if not chunk.choices or not chunk.choices[0].delta.content: if not chunk.choices or not chunk.choices[0].delta.content:
@ -134,7 +134,7 @@ async def openai_chatbot(self, ctx: Message, strings):
gptai_conversations[uid] = [{"role": "system", "content": "Kamu adalah AI dengan karakter mirip kucing bernama MissKaty AI yang diciptakan oleh Yasir untuk membantu manusia mencari informasi dan gunakan bahasa sesuai yang saya katakan."}, {"role": "user", "content": pertanyaan}] gptai_conversations[uid] = [{"role": "system", "content": "Kamu adalah AI dengan karakter mirip kucing bernama MissKaty AI yang diciptakan oleh Yasir untuk membantu manusia mencari informasi dan gunakan bahasa sesuai yang saya katakan."}, {"role": "user", "content": pertanyaan}]
else: else:
gptai_conversations[uid].append({"role": "user", "content": pertanyaan}) gptai_conversations[uid].append({"role": "user", "content": pertanyaan})
ai_response = await get_openai_stream_response(True, OPENAI_KEY, "https://models.inference.ai.azure.com", "gpt-5", gptai_conversations[uid], msg, strings) ai_response = await get_openai_stream_response(True, OPENAI_KEY, "https://models.inference.ai.azure.com", "gpt-5-mini", gptai_conversations[uid], msg, strings)
if not ai_response: if not ai_response:
gptai_conversations[uid].pop() gptai_conversations[uid].pop()
if len(gptai_conversations[uid]) == 1: if len(gptai_conversations[uid]) == 1:
@ -142,3 +142,4 @@ async def openai_chatbot(self, ctx: Message, strings):
return return
gptai_conversations[uid].append({"role": "assistant", "content": ai_response}) gptai_conversations[uid].append({"role": "assistant", "content": ai_response})