Signed-off-by: Yasir Aris M <git@yasirdev.my.id>
This commit is contained in:
Yasir Aris M 2024-01-15 06:50:58 +07:00 committed by GitHub
parent 1358f23c2d
commit e070bca202
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -55,8 +55,8 @@ async def gemini_chatbot(_, ctx: Message, strings):
json=json_data, json=json_data,
timeout=20.0, timeout=20.0,
) )
if response.json().get("promptFeedback"): if response.json().get("candidates"):
return await msg.edit_msg("⚠️ Sorry, the prompt you sent contains a forbidden word that is not permitted by AI.") return await msg.edit_msg("⚠️ Sorry, the prompt you sent maybe contains a forbidden word that is not permitted by AI.")
await msg.edit_msg(html.escape(response.json()["candidates"][0]["content"]["parts"][0]["text"])) await msg.edit_msg(html.escape(response.json()["candidates"][0]["content"]["parts"][0]["text"]))
except Exception as e: except Exception as e:
await msg.edit_msg(str(e)) await msg.edit_msg(str(e))