mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 22:21:22 -07:00
Fix: Align WebSearchTool API key handling with GeminiClient (#474)
This commit is contained in:
@@ -83,13 +83,11 @@ export class WebSearchTool extends BaseTool<
|
||||
},
|
||||
);
|
||||
|
||||
const apiKey = this.config.getApiKey();
|
||||
if (!apiKey) {
|
||||
throw new Error(
|
||||
'Google AI API key is not configured. WebSearchTool cannot be initialized.',
|
||||
);
|
||||
}
|
||||
this.ai = new GoogleGenAI({ apiKey });
|
||||
const apiKeyFromConfig = this.config.getApiKey();
|
||||
// Initialize GoogleGenAI, allowing fallback to environment variables for API key
|
||||
this.ai = new GoogleGenAI({
|
||||
apiKey: apiKeyFromConfig === '' ? undefined : apiKeyFromConfig,
|
||||
});
|
||||
this.modelName = this.config.getModel();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user