async callGemini()

in src/app/journal.component.ts [251:270]


    async callGemini(prompt: string) {
        const genAI = new GoogleGenerativeAI(this.api_key);

        const model = genAI.getGenerativeModel({
          model: 'gemini-pro'
        });
            
        try {
          const result = await model.generateContent(prompt);
          const response = await result.response;
          const text = response.text();
          return text
        } catch(e: any) {
            if(e.message.toLowerCase().includes("api key")) {
                return "-2"
            } else {
                return "-1"
            }
        }
    }