fix(web-search): improve SearXNG test connection error messages

Return provider-specific diagnostics when connectivity tests return zero
results, including SearXNG unresponsive_engines details instead of a
misleading API key hint.
This commit is contained in:
wizardchen
2026-06-24 14:25:10 +08:00
committed by lyingbug
parent 8242b6f298
commit fa8e2bb087
5 changed files with 187 additions and 4 deletions
+3 -2
View File
@@ -422,8 +422,9 @@ func (h *WebSearchProviderHandler) doTestSearch(ctx context.Context, providerTyp
return err
}
if len(results) == 0 {
logger.Warnf(ctx, "[WebSearch][Test] search returned 0 results — API key or configuration may be invalid")
return fmt.Errorf("search returned 0 results, please verify your API key and configuration")
err := infra_web_search.EmptyTestResultsError(providerType, searchProvider)
logger.Warnf(ctx, "[WebSearch][Test] %v", err)
return err
}
logger.Infof(ctx, "[WebSearch][Test] succeeded: type=%s, results=%d", providerType, len(results))
return nil