fix: internal serp does not support variants

This commit is contained in:
Yanlong Wang 2025-04-25 10:24:47 +08:00
parent 1748a5b130
commit 481d1a21af
No known key found for this signature in database
GPG Key ID: C0A623C0BADF9F37
2 changed files with 6 additions and 6 deletions

View File

@ -693,24 +693,24 @@ export class SearcherHost extends RPCHost {
} }
} }
*iterProviders(preference?: string) { *iterProviders(preference?: string, variant?: string) {
if (preference === 'bing') { if (preference === 'bing') {
yield this.serperBing; yield this.serperBing;
yield this.jinaSerp; yield variant === 'web' ? this.jinaSerp : this.serperGoogle;
yield this.serperGoogle; yield this.serperGoogle;
return; return;
} }
if (preference === 'google') { if (preference === 'google') {
yield this.jinaSerp; yield variant === 'web' ? this.jinaSerp : this.serperGoogle;
yield this.serperGoogle; yield this.serperGoogle;
yield this.serperGoogle; yield this.serperGoogle;
return; return;
} }
yield this.jinaSerp; yield variant === 'web' ? this.jinaSerp : this.serperGoogle;
yield this.serperGoogle; yield this.serperGoogle;
yield this.serperGoogle; yield this.serperGoogle;
} }
@ -743,7 +743,7 @@ export class SearcherHost extends RPCHost {
let r: any[] | undefined; let r: any[] | undefined;
let lastError; let lastError;
outerLoop: outerLoop:
for (const client of this.iterProviders(provider)) { for (const client of this.iterProviders(provider, variant)) {
const t0 = Date.now(); const t0 = Date.now();
try { try {
switch (variant) { switch (variant) {

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