serp: use internal provider

This commit is contained in:
Yanlong Wang 2025-04-23 16:09:07 +08:00
parent 1748a5b130
commit 9b02e829bc
No known key found for this signature in database
GPG Key ID: C0A623C0BADF9F37
2 changed files with 6 additions and 3 deletions

View File

@ -26,6 +26,7 @@ import { SerperBingSearchService, SerperGoogleSearchService } from '../services/
import type { JinaEmbeddingsTokenAccount } from '../shared/db/jina-embeddings-token-account';
import { LRUCache } from 'lru-cache';
import { API_CALL_STATUS } from '../shared/db/api-roll';
import { InternalJinaSerpService } from '../services/serp/internal';
const WORLD_COUNTRY_CODES = Object.keys(WORLD_COUNTRIES).map((x) => x.toLowerCase());
@ -90,6 +91,7 @@ export class SerpHost extends RPCHost {
protected googleSerp: GoogleSERP,
protected serperGoogle: SerperGoogleSearchService,
protected serperBing: SerperBingSearchService,
protected internalSerp: InternalJinaSerpService,
) {
super(...arguments);
}
@ -430,6 +432,7 @@ export class SerpHost extends RPCHost {
*iterProviders(preference?: string) {
if (preference === 'bing') {
yield this.serperBing;
yield this.internalSerp;
yield this.serperGoogle;
yield this.googleSerp;
@ -438,15 +441,15 @@ export class SerpHost extends RPCHost {
if (preference === 'google') {
yield this.googleSerp;
yield this.googleSerp;
yield this.internalSerp;
yield this.serperGoogle;
return;
}
yield this.internalSerp;
yield this.serperGoogle;
yield this.googleSerp;
yield this.googleSerp;
}
async cachedSearch(variant: 'web' | 'news' | 'images', query: Record<string, any>, opts: CrawlerOptions) {

@ -1 +1 @@
Subproject commit a677cbd23ffba78ac34d92d732be1945e016b6c7
Subproject commit c48c226fbb595773cb08baee26a9fce299dc275e