feat: Added Google PSE as an alternative web search provider (#65)

* Added Google PSE as an alternative web search tool

* Removed unecessary comments

* chore(ConfigManager): moved Google PSE input next to API key

---------

Co-authored-by: AnotiaWang <anotia0202@gmail.com>
This commit is contained in:
Jonathan Rampersad
2025-04-05 23:18:08 -04:00
committed by GitHub
parent 651f445803
commit 5097c639d2
6 changed files with 97 additions and 1 deletions

View File

@ -9,7 +9,7 @@ export type ConfigAiProvider =
| 'deepseek'
| 'ollama'
export type ConfigWebSearchProvider = 'tavily' | 'firecrawl'
export type ConfigWebSearchProvider = 'tavily' | 'firecrawl' | 'google-pse'
export interface ConfigAi {
provider: ConfigAiProvider
@ -31,6 +31,7 @@ export interface ConfigWebSearch {
tavilyAdvancedSearch?: boolean
/** Tavily: search topic. Defaults to `general` */
tavilySearchTopic?: 'general' | 'news' | 'finance'
googlePseId?: string; // Google PSE ID
}
export interface Config {
@ -47,6 +48,7 @@ function validateConfig(config: Config) {
if (ws.provider === 'tavily' && !ws.apiKey) return false
// Either apiBase or apiKey is required for firecrawl
if (ws.provider === 'firecrawl' && !ws.apiBase && !ws.apiKey) return false
if (ws.provider === 'google-pse' && (!ws.apiKey || !ws.googlePseId)) return false; // Require API Key and PSE ID
if (typeof ws.concurrencyLimit !== 'undefined' && ws.concurrencyLimit! < 1)
return false
return true