Update ke github models, duckduckgo ai api is broken

Signed-off-by: Yasir Aris M <git@yasir.id>
This commit is contained in:
Yasir Aris M 2025-01-29 11:12:10 +07:00 committed by GitHub
parent 4a49a32c44
commit 25b301e79e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -113,6 +113,9 @@ async def gemini_chatbot(_, ctx: Message, strings):
gemini_conversations[uid].append({"role": "assistant", "content": ai_response}) gemini_conversations[uid].append({"role": "assistant", "content": ai_response})
@app.on_message(filters.command("ask", COMMAND_HANDLER) & pyro_cooldown.wait(10)) @app.on_message(filters.command("ask", COMMAND_HANDLER) & pyro_cooldown.wait(10))
@app.on_bot_business_message(
filters.command("ask", COMMAND_HANDLER) & pyro_cooldown.wait(10)
)
@use_chat_lang() @use_chat_lang()
async def openai_chatbot(self, ctx: Message, strings): async def openai_chatbot(self, ctx: Message, strings):
if len(ctx.command) == 1: if len(ctx.command) == 1:
@ -131,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" if uid == OWNER_ID else "https://duckai.yasirapi.eu.org/v1", "gpt-4o" if uid == OWNER_ID else "gpt-4o-mini", gptai_conversations[uid], msg, strings) ai_response = await get_openai_stream_response(True, OPENAI_KEY, "https://models.inference.ai.azure.com", "gpt-4o-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: