refactor: cleanup dead code, fix model confusion, streamline CLI
- Remove 3 dead modules: academic/, wechat/, social/ (merged into engines/) - Remove 4 stale news scripts (tech_news.py, wallstreetcn.py, cls.py, rss.py) - scripts/core/base.py: canonical SearchResult + BaseEngine (was in engines/base.py) - scripts/engines/base.py: re-exports from core.base for compatibility - scripts/engines/news_engine.py: Bing News + RSS unified (was in scripts/news/rss.py) - scripts/engines/academic_engine.py: ArXiv + CrossRef unified (was in scripts/academic/arxiv.py) - scripts/cli.py: complete rewrite — 10 commands (search/web/news/academic/wechat/social/rss/baidu/health/sources) - scripts/unified_search.py: clean async Python API (was a stub) - ws.py: lightweight launcher - README.md + SKILL.md: updated to reflect actual 15+ engines - All EngineResult → SearchResult - All engines return list[SearchResult]
This commit is contained in:
1 parent
e20478fcbd
commit
c077a7ae40
31 files changed
+1188
-3148
No files matched your search
@@ -8,7 +8,7 @@ from urllib.parse import quote_plus
|
||||
|
||||
import httpx
|
||||
|
||||
from scripts.engines.base import BaseEngine, EngineResult
|
||||
from scripts.core.base import BaseEngine, SearchResult
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -24,7 +24,7 @@ class GitHubEngine(BaseEngine):
|
||||
name = "github"
|
||||
|
||||
async def search(self, query: str, max_results: int = 10,
|
||||
search_type: str = "repositories", **kwargs) -> list[EngineResult]:
|
||||
search_type: str = "repositories", **kwargs) -> list[SearchResult]:
|
||||
"""search_type: 'repositories' | 'code' | 'issues'"""
|
||||
t0 = time.time()
|
||||
endpoint = f"https://api.github.com/search/{search_type}"
|
||||
@@ -40,7 +40,7 @@ class GitHubEngine(BaseEngine):
|
||||
results = []
|
||||
for item in data.get("items", [])[:max_results]:
|
||||
if search_type == "repositories":
|
||||
results.append(EngineResult(
|
||||
results.append(SearchResult(
|
||||
title=item.get("full_name", ""),
|
||||
url=item.get("html_url", ""),
|
||||
snippet=item.get("description", "") or "",
|
||||
@@ -53,7 +53,7 @@ class GitHubEngine(BaseEngine):
|
||||
},
|
||||
))
|
||||
elif search_type == "code":
|
||||
results.append(EngineResult(
|
||||
results.append(SearchResult(
|
||||
title=item.get("name", ""),
|
||||
url=item.get("html_url", ""),
|
||||
snippet=item.get("text_matches", [{}])[0].get("fragment", "")
|
||||
@@ -66,7 +66,7 @@ class GitHubEngine(BaseEngine):
|
||||
},
|
||||
))
|
||||
elif search_type == "issues":
|
||||
results.append(EngineResult(
|
||||
results.append(SearchResult(
|
||||
title=item.get("title", ""),
|
||||
url=item.get("html_url", ""),
|
||||
snippet=item.get("body", "")[:300] if item.get("body") else "",
|
||||
|
||||
Reference in new issue
Block a user