Spaces:
Paused
Paused
Download plugins/gemini.js from levantermd/lyfe1: direct link, hf CLI and curl.
- Browser
- Download file 855 Bytes
-
https://huggingface.co/spaces/levantermd/lyfe1/resolve/main/plugins/gemini.js
- Command line
-
hf download hf://spaces/levantermd/lyfe1/plugins/gemini.js
-
curl -L -o gemini.js https://huggingface.co/spaces/levantermd/lyfe1/resolve/main/plugins/gemini.js
855 Bytes
| const { bot, gemini } = require('../lib') | |
| bot( | |
| { | |
| pattern: 'gemini ?(.*)', | |
| desc: 'google gemini', | |
| type: 'ai', | |
| }, | |
| async (message, match, ctx) => { | |
| if (!ctx.GEMINI_API_KEY) { | |
| return await message.send( | |
| 'Missing Gemini API key? Get one at https://aistudio.google.com/app/apikey.\nsetvar GEMINI_API_KEY = api_key' | |
| ) | |
| } | |
| if (!match) { | |
| return await message.send( | |
| '*Example :*\ngemini hi\ngemini what is in the picture(reply to a image)' | |
| ) | |
| } | |
| let image | |
| if (message.reply_message && message.reply_message.image) { | |
| image = { | |
| image: await message.reply_message.downloadMediaMessage(), | |
| mimetype: message.reply_message.mimetype, | |
| } | |
| } | |
| const res = await gemini(match, message.id, image) | |
| await message.send(res.data, { quoted: message.data }) | |
| } | |
| ) | |