mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader
synced 2025-08-19 00:26:00 +08:00
serp: use internal provider
This commit is contained in:
parent
1748a5b130
commit
9b02e829bc
@ -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
|
Loading…
x
Reference in New Issue
Block a user