summaryrefslogtreecommitdiff
path: root/packages/server/src
diff options
context:
space:
mode:
authorAllen Hutchison <[email protected]>2025-05-21 15:50:53 -0700
committerGitHub <[email protected]>2025-05-21 15:50:53 -0700
commit43da8bc7479b4b9dddb94148cc4c4eeae8908d18 (patch)
tree7652de2bd5a83258bfee06d088a5933ec9ebbfb8 /packages/server/src
parenta0761f0c41942d5981306f99e78aca40588d28fa (diff)
Fix: Align WebSearchTool API key handling with GeminiClient (#474)
Diffstat (limited to 'packages/server/src')
-rw-r--r--packages/server/src/tools/web-search.ts12
1 files changed, 5 insertions, 7 deletions
diff --git a/packages/server/src/tools/web-search.ts b/packages/server/src/tools/web-search.ts
index 3e32ae30..b690146d 100644
--- a/packages/server/src/tools/web-search.ts
+++ b/packages/server/src/tools/web-search.ts
@@ -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();
}