mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00: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();
|
const apiKeyFromConfig = this.config.getApiKey();
|
||||||
if (!apiKey) {
|
// Initialize GoogleGenAI, allowing fallback to environment variables for API key
|
||||||
throw new Error(
|
this.ai = new GoogleGenAI({
|
||||||
'Google AI API key is not configured. WebSearchTool cannot be initialized.',
|
apiKey: apiKeyFromConfig === '' ? undefined : apiKeyFromConfig,
|
||||||
);
|
});
|
||||||
}
|
|
||||||
this.ai = new GoogleGenAI({ apiKey });
|
|
||||||
this.modelName = this.config.getModel();
|
this.modelName = this.config.getModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user