Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix: use formatted_findings from API and proper source format

LearningCircuite2ab7d0f20fb
diff --git a/.github/workflows/e2e-research-test.yml b/.github/workflows/e2e-research-test.yml
index 2eff07d087..b5b23d9178 100644
--- a/.github/workflows/e2e-research-test.yml
+++ b/.github/workflows/e2e-research-test.yml
@@ -109,8 +109,8 @@ jobs:
SUBHEADER="_Analysis of PR code changes_"
fi
- # Extract sources and format them
- SOURCES=$(jq -r '.sources[:10][] | "- [\(.title)](\(.url))"' response.json 2>/dev/null || echo "")
+ # Extract sources and format them (API returns 'link' not 'url')
+ SOURCES=$(jq -r '.sources[:10][] | "- [\(.title // "Source")](\(.link // .url // ""))"' response.json 2>/dev/null || echo "")
# Build comment
{
diff --git a/scripts/ldr-diff-research.py b/scripts/ldr-diff-research.py
index e2b65ea807..82cef8f9df 100755
--- a/scripts/ldr-diff-research.py
+++ b/scripts/ldr-diff-research.py
@@ -84,49 +84,6 @@ def parse_args():
return parser.parse_args()
-def extract_sources(result):
- """Extract source URLs from the result."""
- sources = []
-
- # Get sources directly from result
- for source in result.get("sources", []):
- if isinstance(source, dict):
- sources.append(
- {
- "title": source.get("title", "Unknown"),
- "url": source.get("url", source.get("link", "")),
- }
- )
- elif isinstance(source, str):
- sources.append({"title": source, "url": ""})
-
- # Also check findings for search_results
- for finding in result.get("findings", []):
- if isinstance(finding, dict) and "search_results" in finding:
- for sr in finding.get("search_results", []):
- if isinstance(sr, dict):
- sources.append(
- {
- "title": sr.get("title", "Unknown"),
- "url": sr.get("url", sr.get("link", "")),
- }
- )
-
- # Deduplicate by URL
- seen_urls = set()
- unique_sources = []
- for s in sources:
- url = s.get("url", "")
- if url and url not in seen_urls:
- seen_urls.add(url)
- unique_sources.append(s)
- elif not url and s.get("title") not in seen_urls:
- seen_urls.add(s.get("title", ""))
- unique_sources.append(s)
-
- return unique_sources
-
-
def main():
args = parse_args()
@@ -216,11 +173,18 @@ Research topics to cover:
result = quick_summary(**kwargs)
- # Build output with research and sources
+ # Use formatted_findings if available (already properly formatted with sources)
+ # Fall back to summary if not
+ research_output = result.get("formatted_findings") or result.get(
+ "summary", str(result)
+ )
+
+ # Build output - sources are already extracted by quick_summary
output = {
"mode": args.mode,
- "research": result.get("summary", str(result)),
- "sources": extract_sources(result),
+ "research": research_output,
+ "sources": result.get("sources", []), # Already extracted by API
+ "findings": result.get("findings", []),
"iterations": result.get("iterations", args.iterations),
}