const fs = require('fs');

const file1 = 'lib/ai/gemini-chat.ts';
let code1 = fs.readFileSync(file1, 'utf8');

// The correct property name for @google/genai ^1.0.0 is `thinkingBudget`.
// `thinkingBudgetTokens` is the old deprecated name that throws the 400 error!
code1 = code1.replace(/thinkingBudgetTokens:/g, 'thinkingBudget:');
fs.writeFileSync(file1, code1);

const file2 = 'lib/ai/gemini-client.ts';
let code2 = fs.readFileSync(file2, 'utf8');
code2 = code2.replace(/thinkingBudgetTokens:/g, 'thinkingBudget:');
fs.writeFileSync(file2, code2);

console.log("Fixed thinkingBudget property error for Gemini");
