diff --git a/services/search/core.py b/services/search/core.py index acc4d5b72..fa0848712 100644 --- a/services/search/core.py +++ b/services/search/core.py @@ -8,6 +8,7 @@ from concurrent.futures import ThreadPoolExecutor, as_completed from datetime import datetime, timedelta from typing import Dict, Any, Optional, List, Set from urllib.parse import urlparse +from src.search_passages import search_excerpt import httpx @@ -1108,9 +1109,7 @@ def comprehensive_web_search( output_parts.append(f"Title: {content['title']}") output_parts.append("-" * 30) - text = content["content"][:3000] - if len(content["content"]) > 3000: - text += "... [truncated]" + text = search_excerpt(content["content"], provider_query, 3000) output_parts.append(text) key_points = extract_key_points(content["content"]) diff --git a/src/clean_agent_preview.py b/src/clean_agent_preview.py index 62dac9d87..7d89fcd8a 100644 --- a/src/clean_agent_preview.py +++ b/src/clean_agent_preview.py @@ -190,7 +190,8 @@ def bounded_search_observation(output, budget=8000): body = output[match.end():end] body = re.split(r'\n(?:Key Points:|TL;DR:|Important Quotes:|Data / Statistics:|={20,}|