From da6b6e5a4cb883bb1acf8d8f8acb542814c57e8c Mon Sep 17 00:00:00 2001 From: Yasir Aris M Date: Mon, 13 May 2024 13:18:51 +0700 Subject: [PATCH] Use my mirror api for Gemini because my VPS region is not supported Signed-off-by: Yasir Aris M --- misskaty/plugins/chatbot_ai.py | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/misskaty/plugins/chatbot_ai.py b/misskaty/plugins/chatbot_ai.py index ad32f639..6c02c832 100644 --- a/misskaty/plugins/chatbot_ai.py +++ b/misskaty/plugins/chatbot_ai.py @@ -36,25 +36,8 @@ async def gemini_chatbot(_, ctx: Message, strings): return await ctx.reply_msg("GOOGLEAI_KEY env is missing!!!") msg = await ctx.reply_msg(strings("find_answers_str"), quote=True) try: - params = { - 'key': GOOGLEAI_KEY, - } - json_data = { - 'contents': [ - { - 'parts': [ - { - 'text': ctx.text.split(maxsplit=1)[1], - }, - ], - }, - ], - } - response = await fetch.post( - 'https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent', - params=params, - json=json_data, - timeout=20.0, + response = await fetch.get( + f'https://yasirapi.eu.org/gemini?query={ctx.text.split(maxsplit=1)}' ) if not response.json().get("candidates"): await ctx.reply_msg("⚠️ Sorry, the prompt you sent maybe contains a forbidden word that is not permitted by AI.")