mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-16 17:55:26 -04:00
Research: report empty search provider results clearly
Deep Research surfaced 'Error: unknown error' whenever every search provider returned an empty result set without raising (e.g. SearXNG is reachable but all its engines fail internally). _last_search_error was only set on exceptions, so the empty-but-no-exception path left it unset and the caller fell back to 'unknown error'. Record an actionable reason on that path naming the providers that were tried, so users can tell it's a search-backend problem rather than a model problem. The provider-raised path is unchanged. Re: #344. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+15
-1
@@ -535,7 +535,9 @@ class DeepResearcher:
|
||||
return []
|
||||
|
||||
# Try primary provider, then fallbacks
|
||||
for prov in _build_provider_chain(provider):
|
||||
chain = _build_provider_chain(provider)
|
||||
raised = False
|
||||
for prov in chain:
|
||||
try:
|
||||
results = await asyncio.to_thread(_call_provider, prov, query, 10)
|
||||
if results:
|
||||
@@ -544,8 +546,20 @@ class DeepResearcher:
|
||||
self.providers_used.append(prov)
|
||||
return results
|
||||
except Exception as e:
|
||||
raised = True
|
||||
logger.warning(f"Research search: {prov} failed: {e}")
|
||||
self._last_search_error = f"{prov}: {e}"
|
||||
# Every provider ran but none returned results. If none of them
|
||||
# raised, record an actionable reason here — otherwise this empty
|
||||
# path leaves `_last_search_error` unset and the caller surfaces a
|
||||
# bare "unknown error" (issue #344). This is exactly the SearXNG
|
||||
# case where the service is reachable but all its engines fail, so
|
||||
# each provider returns [] without throwing.
|
||||
if not raised:
|
||||
self._last_search_error = (
|
||||
f"no results from search provider(s): "
|
||||
f"{', '.join(chain) if chain else provider}"
|
||||
)
|
||||
return []
|
||||
except Exception as e:
|
||||
logger.error(f"Search failed for '{query}': {e}")
|
||||
|
||||
Reference in New Issue
Block a user