@@ -84,10 +84,8 @@ async function generateReviewTitle() {
8484 outputHTML . innerHTML = `<h2>${ promptTitle . value } </h2><p>${ reviewText } </p>` ;
8585 } else {
8686 // Fallback to Gemini API
87- const genAI = new GoogleGenerativeAI (
88- "AIzaSyA8bYErDRE8xfRAIvZJkL06l0oMp5wHVx8"
89- ) ;
90- const model = await genAI . getGenerativeModel ( { model : "gemini-pro" } ) ;
87+ const genAI = new GoogleGenerativeAI ( GEMINI_API_KEY ) ;
88+ const model = await genAI . getGenerativeModel ( { model : "gemini-2.5-flash" } ) ;
9189 const result = await model . generateContent ( [
9290 `Generate a catchy title for this travel review: ${ reviewText } to ${ placeName } ` ,
9391 ] ) ;
@@ -163,10 +161,8 @@ async function checkToxicity() {
163161 // outputHTML.innerHTML = (`Tone Score: ${toxicityScore}`); // Or display in a more user-friendly way
164162
165163 // Fallback to Gemini API
166- const genAI = new GoogleGenerativeAI (
167- "AIzaSyA8bYErDRE8xfRAIvZJkL06l0oMp5wHVx8"
168- ) ;
169- const model = await genAI . getGenerativeModel ( { model : "gemini-pro" } ) ;
164+ const genAI = new GoogleGenerativeAI ( GEMINI_API_KEY ) ;
165+ const model = await genAI . getGenerativeModel ( { model : "gemini-2.5-flash" } ) ;
170166 const result = await model . generateContent ( [
171167 `Analyze the toxicity level of this text:: ${ reviewText } ` ,
172168 ] ) ;
@@ -199,10 +195,8 @@ async function runBuiltInAIModel(streaming) {
199195
200196// Function to run the Gemini API model
201197async function runGeminiAPIModel ( streaming ) {
202- const genAI = new GoogleGenerativeAI (
203- "AIzaSyA8bYErDRE8xfRAIvZJkL06l0oMp5wHVx8"
204- ) ;
205- const model = await genAI . getGenerativeModel ( { model : "gemini-pro" } ) ;
198+ const genAI = new GoogleGenerativeAI ( GEMINI_API_KEY ) ;
199+ const model = await genAI . getGenerativeModel ( { model : "gemini-2.5-flash" } ) ;
206200 outputHTML . innerHTML = "Generating answer...Please wait..." ;
207201
208202 if ( streaming ) {
0 commit comments