File size: 720 Bytes
d3e4c00
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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.";
  }
}