feat: 优化搜索广度、深度、效率及可靠性
- 新增百度千帆 AI 搜索 API 引擎 (scripts/engines/baidu_qianfan.py) - CLI 新增 baidu 子命令,支持 --site 站点限定和 --recency 时间过滤 - UnifiedSearch: 引擎并发控制 (Semaphore) + 超时熔断 (wait_for) - UnifiedSearch: 搜索结果按 URL 去重 - CLI 新增 health 健康检查命令 - sources 命令新增 API 引擎类别展示 - 支持 .env 文件读取 BAIDU_API_KEY
This commit is contained in:
1 parent
87935b59ce
commit
7eb1467e07
5 files changed
+322
-17
No files matched your search
@@ -38,6 +38,11 @@ def get_social_sources(path: Optional[str] = None) -> list[dict[str, Any]]:
|
||||
return _load_config(path).get("social_sources", [])
|
||||
|
||||
|
||||
def get_api_engines(path: Optional[str] = None) -> list[dict[str, Any]]:
|
||||
"""Get API-based search engines (Baidu Qianfan, etc.)."""
|
||||
return _load_config(path).get("api_engines", [])
|
||||
|
||||
|
||||
def get_special_engines(path: Optional[str] = None) -> list[dict[str, Any]]:
|
||||
return _load_config(path).get("special_engines", [])
|
||||
|
||||
@@ -45,7 +50,8 @@ def get_special_engines(path: Optional[str] = None) -> list[dict[str, Any]]:
|
||||
def get_engine(name: str, path: Optional[str] = None):
|
||||
config = _load_config(path)
|
||||
for category in ["search_engines", "news_sources", "academic_sources",
|
||||
"wechat_sources", "social_sources", "special_engines"]:
|
||||
"wechat_sources", "social_sources", "api_engines",
|
||||
"special_engines"]:
|
||||
for engine in config.get(category, []):
|
||||
if engine["name"].lower() == name.lower():
|
||||
return engine
|
||||
@@ -56,7 +62,8 @@ def get_all_sources(path: Optional[str] = None) -> list[dict[str, Any]]:
|
||||
config = _load_config(path)
|
||||
all_sources = []
|
||||
for category in ["search_engines", "news_sources", "academic_sources",
|
||||
"wechat_sources", "social_sources", "special_engines"]:
|
||||
"wechat_sources", "social_sources", "api_engines",
|
||||
"special_engines"]:
|
||||
all_sources.extend(config.get(category, []))
|
||||
return all_sources
|
||||
|
||||
@@ -65,6 +72,7 @@ def list_source_categories(path: Optional[str] = None) -> dict[str, int]:
|
||||
config = _load_config(path)
|
||||
categories = [
|
||||
"search_engines", "news_sources", "academic_sources",
|
||||
"wechat_sources", "social_sources", "special_engines",
|
||||
"wechat_sources", "social_sources", "api_engines",
|
||||
"special_engines",
|
||||
]
|
||||
return {cat: len(config.get(cat, [])) for cat in categories}
|
||||
Reference in new issue
Block a user