mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-15 14:22:43 +00:00
fix(web): handle short extract provider results
This commit is contained in:
parent
459cf3402b
commit
c2a40b2dc9
1 changed files with 13 additions and 1 deletions
|
|
@ -947,7 +947,19 @@ async def web_extract_tool(
|
|||
# provider-processed entries. Providers are expected to preserve the
|
||||
# order of the safe URL list they receive.
|
||||
if invalid_urls or ssrf_blocked:
|
||||
safe_results = dict(zip(safe_indices, results))
|
||||
safe_results = {
|
||||
index: (
|
||||
results[position]
|
||||
if position < len(results)
|
||||
else {
|
||||
"url": safe_urls[position],
|
||||
"title": "",
|
||||
"content": "",
|
||||
"error": "Extract backend returned no result for this URL",
|
||||
}
|
||||
)
|
||||
for position, index in enumerate(safe_indices)
|
||||
}
|
||||
by_index = {**safe_results, **ssrf_blocked, **invalid_urls}
|
||||
results = [by_index[index] for index in range(len(urls))]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue