Skip invalid research service sources (#1583)

This commit is contained in:
red person 2026-06-03 02:57:09 +03:00 committed by GitHub
parent 953305a5af
commit 0ad5cd783b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 0 deletions

View file

@ -92,6 +92,7 @@ class ResearchService:
relevance=s.get("relevance", 0.0), relevance=s.get("relevance", 0.0),
) )
for s in result.get("sources", []) for s in result.get("sources", [])
if isinstance(s, dict)
] ]
return ResearchResult( return ResearchResult(
query=topic, query=topic,

View file

@ -139,6 +139,7 @@ class TestDictBackCompat:
"sources": [ "sources": [
{"url": "https://x.example", "title": "X", {"url": "https://x.example", "title": "X",
"snippet": "s", "relevance": 0.9}, "snippet": "s", "relevance": 0.9},
"bad source row",
], ],
"sections": ["intro"], "sections": ["intro"],
"tokens_used": 42, "tokens_used": 42,