testmog / src /services /geminiService.ts
wuhp's picture
Upload geminiService.ts
d3e4c00 verified
raw
history blame contribute delete
720 Bytes
import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY || "" });
export async function getMetricExplanation(metric: string) {
const prompt = `Briefly explain the facial metric "${metric}" in the context of "looksmaxxing" culture, then explain why it's a pseudoscientific or unhealthy way to judge beauty. Keep it supportive and objective. Use 2 sentences max.`;
try {
const result = await ai.models.generateContent({
model: "gemini-3-flash-preview",
contents: prompt
});
return result.text || "No explanation available.";
} catch (error) {
console.error("Gemini Error:", error);
return "Error fetching explanation.";
}
}