From 9b02e829bcd7a1561ec5b13ab39bf8b7fb77a864 Mon Sep 17 00:00:00 2001 From: Yanlong Wang Date: Wed, 23 Apr 2025 16:09:07 +0800 Subject: [PATCH] serp: use internal provider --- src/api/serp.ts | 7 +++++-- thinapps-shared | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/api/serp.ts b/src/api/serp.ts index e11fc6c..8f12178 100644 --- a/src/api/serp.ts +++ b/src/api/serp.ts @@ -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, opts: CrawlerOptions) { diff --git a/thinapps-shared b/thinapps-shared index a677cbd..c48c226 160000 --- a/thinapps-shared +++ b/thinapps-shared @@ -1 +1 @@ -Subproject commit a677cbd23ffba78ac34d92d732be1945e016b6c7 +Subproject commit c48c226fbb595773cb08baee26a9fce299dc275e