fix: websearch multiple apikeys bug

This commit is contained in:
eeee0717 2025-03-15 18:49:35 +08:00 committed by 亢奋猫
parent c8983f3000
commit 9cb127f14e
2 changed files with 4 additions and 4 deletions

View File

@ -8,10 +8,10 @@ export default class ExaProvider extends BaseWebSearchProvider {
constructor(provider: WebSearchProvider) { constructor(provider: WebSearchProvider) {
super(provider) super(provider)
if (!provider.apiKey) { if (!this.apiKey) {
throw new Error('API key is required for Exa provider') throw new Error('API key is required for Exa provider')
} }
this.exa = new ExaClient({ apiKey: provider.apiKey }) this.exa = new ExaClient({ apiKey: this.apiKey })
} }
public async search(query: string, maxResults: number): Promise<WebSearchResponse> { public async search(query: string, maxResults: number): Promise<WebSearchResponse> {

View File

@ -8,10 +8,10 @@ export default class TavilyProvider extends BaseWebSearchProvider {
constructor(provider: WebSearchProvider) { constructor(provider: WebSearchProvider) {
super(provider) super(provider)
if (!provider.apiKey) { if (!this.apiKey) {
throw new Error('API key is required for Tavily provider') throw new Error('API key is required for Tavily provider')
} }
this.tvly = new TavilyClient({ apiKey: provider.apiKey }) this.tvly = new TavilyClient({ apiKey: this.apiKey })
} }
public async search(query: string, maxResults: number, excludeDomains: string[]): Promise<WebSearchResponse> { public async search(query: string, maxResults: number, excludeDomains: string[]): Promise<WebSearchResponse> {