mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader
synced 2025-08-19 06:56:01 +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 type { JinaEmbeddingsTokenAccount } from '../shared/db/jina-embeddings-token-account';
|
||||||
import { LRUCache } from 'lru-cache';
|
import { LRUCache } from 'lru-cache';
|
||||||
import { API_CALL_STATUS } from '../shared/db/api-roll';
|
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());
|
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 googleSerp: GoogleSERP,
|
||||||
protected serperGoogle: SerperGoogleSearchService,
|
protected serperGoogle: SerperGoogleSearchService,
|
||||||
protected serperBing: SerperBingSearchService,
|
protected serperBing: SerperBingSearchService,
|
||||||
|
protected internalSerp: InternalJinaSerpService,
|
||||||
) {
|
) {
|
||||||
super(...arguments);
|
super(...arguments);
|
||||||
}
|
}
|
||||||
@ -430,6 +432,7 @@ export class SerpHost extends RPCHost {
|
|||||||
*iterProviders(preference?: string) {
|
*iterProviders(preference?: string) {
|
||||||
if (preference === 'bing') {
|
if (preference === 'bing') {
|
||||||
yield this.serperBing;
|
yield this.serperBing;
|
||||||
|
yield this.internalSerp;
|
||||||
yield this.serperGoogle;
|
yield this.serperGoogle;
|
||||||
yield this.googleSerp;
|
yield this.googleSerp;
|
||||||
|
|
||||||
@ -438,15 +441,15 @@ export class SerpHost extends RPCHost {
|
|||||||
|
|
||||||
if (preference === 'google') {
|
if (preference === 'google') {
|
||||||
yield this.googleSerp;
|
yield this.googleSerp;
|
||||||
yield this.googleSerp;
|
yield this.internalSerp;
|
||||||
yield this.serperGoogle;
|
yield this.serperGoogle;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
yield this.internalSerp;
|
||||||
yield this.serperGoogle;
|
yield this.serperGoogle;
|
||||||
yield this.googleSerp;
|
yield this.googleSerp;
|
||||||
yield this.googleSerp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async cachedSearch(variant: 'web' | 'news' | 'images', query: Record<string, any>, opts: CrawlerOptions) {
|
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