UNPKG

dragadix

Version:

A flirty, powerful CLI experience built by Aditya 💋

31 lines (28 loc) • 742 B
import axios from "axios"; export async function fetchGithubRepos(username) { try { const { data } = await axios.get(`https://api.github.com/users/${username}/repos`); return data; } catch (err) { return []; } } export async function fetchGeminiReply(apiKey, question) { try { const res = await axios.post( "https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent", { contents: [{ parts: [{ text: question }] }] }, { headers: { "Content-Type": "application/json", "x-goog-api-key": apiKey, }, } ); return res?.data?.candidates?.[0]?.content?.parts?.[0]?.text || null; } catch (e) { return null; } }