argo-search 2.9.9 → 2.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +39 -22
- package/README.es.md +39 -22
- package/README.ja.md +38 -21
- package/README.ko.md +38 -21
- package/README.md +41 -22
- package/SKILL.md +13 -12
- package/backends/domain_profiles.json +76 -0
- package/backends/engine_registry.yaml +163 -7
- package/backends/quota_profiles.json +122 -2
- package/backends/source_types_cn.json +9 -0
- package/bin/argo +22 -1
- package/bin/argo.js +3 -3
- package/config.yaml +150 -30
- package/docs/ARGO_INTRO.md +4 -4
- package/docs/ENGINE_CATALOG.md +68 -48
- package/docs/MCP_SETUP.md +1 -1
- package/docs/RELEASE_NOTES_v2.10.0.md +85 -0
- package/docs/RELEASE_NOTES_v2.10.1.md +57 -0
- package/docs/RELEASE_NOTES_v2.9.8.md +1 -1
- package/docs//344/270/272/344/273/200/344/271/210/351/200/211/346/213/251argo.md +9 -9
- package/engines/_template_http.yaml +2 -0
- package/engines/specs/clawhub.yaml +16 -15
- package/engines/specs/deepseek1024.yaml +46 -0
- package/engines/specs/dsh_hub.yaml +44 -0
- package/engines/specs/dshopen.yaml +32 -0
- package/engines/specs/explainx.yaml +32 -0
- package/engines/specs/gbfs_nyc.yaml +6 -1
- package/engines/specs/metaso_doc.yaml +49 -0
- package/engines/specs/metaso_image.yaml +65 -0
- package/engines/specs/metaso_podcast.yaml +60 -0
- package/engines/specs/metaso_scholar.yaml +57 -0
- package/engines/specs/metaso_video.yaml +62 -0
- package/engines/specs/ncpssd.yaml +44 -0
- package/engines/specs/sciverse.yaml +73 -0
- package/engines/specs/skills_sh.yaml +32 -0
- package/engines/specs/skillsmp.yaml +18 -16
- package/package.json +4 -2
- package/packages/dsh-plugin/README.md +3 -2
- package/packages/dsh-plugin/package.json +1 -1
- package/packages/dsh-plugin/test/size-gate.test.js +113 -0
- package/scripts/adaptive.py +41 -14
- package/scripts/article.py +6 -1
- package/scripts/article_meta.py +151 -2
- package/scripts/bench_general_pool.py +145 -0
- package/scripts/candidate_envelope.py +45 -4
- package/scripts/charset_decode.py +127 -0
- package/scripts/ci_drift_gate.py +47 -24
- package/scripts/crawl.py +240 -74
- package/scripts/crawl_frontier.py +217 -0
- package/scripts/crawl_policy.py +174 -0
- package/scripts/engine_dispatch.py +23 -18
- package/scripts/engine_failure.py +15 -0
- package/scripts/engine_status.py +12 -5
- package/scripts/engine_validate.py +8 -0
- package/scripts/engines.py +15 -0
- package/scripts/engines_base.py +43 -15
- package/scripts/engines_builders.py +14 -0
- package/scripts/engines_builders_data.py +10 -3
- package/scripts/engines_builders_dsh.py +330 -0
- package/scripts/engines_builders_skill.py +314 -0
- package/scripts/evidence.py +26 -5
- package/scripts/fetch_v3.py +37 -5
- package/scripts/gen_engine_catalog.py +218 -2
- package/scripts/general_pool.py +162 -0
- package/scripts/http_client.py +38 -42
- package/scripts/image_ops.py +4 -0
- package/scripts/install.ps1 +47 -19
- package/scripts/install.sh +45 -20
- package/scripts/local_seek.py +53 -11
- package/scripts/matrix_search_eval.py +17 -1
- package/scripts/mcp_transport.py +1 -1
- package/scripts/ncpssd_bridge.py +123 -0
- package/scripts/paid_policy.py +109 -13
- package/scripts/pre-commit +19 -4
- package/scripts/query_signals.py +156 -3
- package/scripts/redskill/redskill_engine.py +29 -2
- package/scripts/release.py +398 -0
- package/scripts/release_check.py +209 -0
- package/scripts/retry_policy.py +22 -1
- package/scripts/robots_guard.py +26 -0
- package/scripts/route.py +11 -8
- package/scripts/route_cache.py +6 -0
- package/scripts/route_combo.py +37 -59
- package/scripts/route_domains.py +22 -3
- package/scripts/route_policy.py +6 -0
- package/scripts/search.py +13 -3
- package/scripts/search_cli.py +49 -0
- package/scripts/search_entry.py +9 -0
- package/scripts/search_output.py +43 -0
- package/scripts/search_pipeline.py +43 -3
- package/scripts/search_rank.py +4 -1
- package/scripts/serp_guard.py +11 -0
- package/scripts/social_engines/bilibili_engine.py +163 -26
- package/scripts/social_engines/reddit_engine.py +52 -51
- package/scripts/source_selection.py +302 -0
- package/scripts/url_canon.py +2 -1
- package/scripts/video_fetch.py +303 -0
- package/scripts/video_meta.py +225 -0
- package/scripts/video_route.py +65 -0
- package/scripts/watch.py +123 -0
- package/sub-skills/local-seek/scripts/seek.py +19 -4
- package/engines/specs/_cisa_kev.yaml +0 -54
- package/engines/specs/_osv.yaml +0 -63
- package/scripts/local_engines.py +0 -321
package/scripts/robots_guard.py
CHANGED
|
@@ -241,6 +241,32 @@ def robots_blocked(url: str, timeout: float = 5.0) -> bool:
|
|
|
241
241
|
return False # 解析异常 → 放行
|
|
242
242
|
|
|
243
243
|
|
|
244
|
+
def crawl_delay(url: str, timeout: float = 5.0) -> float | None:
|
|
245
|
+
"""robots.txt 为该站声明的 Crawl-delay(秒);没有声明或取不到返回 None。
|
|
246
|
+
|
|
247
|
+
只取通配 UA 的声明:本技能 UA 轮换,具体 UA 的 delay 会漏掉 `User-agent: *`。
|
|
248
|
+
与 robots_blocked 共用同一个解析器缓存,不会为此多抓一次 robots.txt。
|
|
249
|
+
"""
|
|
250
|
+
if not _robots_enabled():
|
|
251
|
+
return None
|
|
252
|
+
scheme, host = _domain_key(url)
|
|
253
|
+
if not host:
|
|
254
|
+
return None
|
|
255
|
+
rp = _get_parser(scheme, host, timeout)
|
|
256
|
+
if rp is None:
|
|
257
|
+
return None
|
|
258
|
+
try:
|
|
259
|
+
value = rp.crawl_delay("*")
|
|
260
|
+
except Exception:
|
|
261
|
+
return None
|
|
262
|
+
if value is None:
|
|
263
|
+
return None
|
|
264
|
+
try:
|
|
265
|
+
return float(value)
|
|
266
|
+
except (TypeError, ValueError):
|
|
267
|
+
return None
|
|
268
|
+
|
|
269
|
+
|
|
244
270
|
# ─── 测试辅助 ────────────────────────────────────────────────────────────────
|
|
245
271
|
|
|
246
272
|
def clear_cache() -> None:
|
package/scripts/route.py
CHANGED
|
@@ -132,6 +132,7 @@ from paid_policy import insert_hedge
|
|
|
132
132
|
from route_combo import ( # noqa: E402
|
|
133
133
|
_expand_local_search,
|
|
134
134
|
_general_fallback,
|
|
135
|
+
general_kwargs,
|
|
135
136
|
_filter_breaker_blocked,
|
|
136
137
|
_maybe_add_geo_engine,
|
|
137
138
|
_apply_intent_parallelism,
|
|
@@ -425,9 +426,8 @@ def _route_by_domain(ctx: _RouteCtx, domain: dict[str, Any], secondary: list[dic
|
|
|
425
426
|
engines_combo = declared
|
|
426
427
|
if not engines_combo:
|
|
427
428
|
# 域内引擎全被过滤,回退(本地优先 + 通用免费源唯一来源)
|
|
428
|
-
engines_combo = _general_fallback(
|
|
429
|
-
|
|
430
|
-
engines_combo = sorted(enabled)[:2] if enabled else ["anysearch"]
|
|
429
|
+
engines_combo = _general_fallback(
|
|
430
|
+
enabled, **general_kwargs(features, mode, depth, context))
|
|
431
431
|
# 扩展 local_search → 子引擎
|
|
432
432
|
engines_combo = _expand_local_search(engines_combo, features)
|
|
433
433
|
|
|
@@ -599,7 +599,9 @@ def _route_by_domain(ctx: _RouteCtx, domain: dict[str, Any], secondary: list[dic
|
|
|
599
599
|
# 双引擎默认串行,利于 early-stop(答案域)
|
|
600
600
|
parallel = parallel and len(engines_combo) > 2
|
|
601
601
|
|
|
602
|
-
engines_combo = insert_hedge(
|
|
602
|
+
engines_combo = insert_hedge(
|
|
603
|
+
engines_combo, domain.get("name", ""), mode, enabled,
|
|
604
|
+
lang=str((features or {}).get("primary_lang") or ""))
|
|
603
605
|
|
|
604
606
|
return _done(
|
|
605
607
|
engine=engines_combo[0],
|
|
@@ -650,7 +652,9 @@ def _route_by_tfidf(ctx: _RouteCtx) -> dict[str, Any]:
|
|
|
650
652
|
_done = ctx.done
|
|
651
653
|
domain = None # 能走到这里说明没有域命中(含兜底域)
|
|
652
654
|
# 弱证据推荐只作辅源跟跑、通用保底领队;强证据维持推荐领队(route_combo)
|
|
653
|
-
engines_combo = tfidf_lead_combo(
|
|
655
|
+
engines_combo = tfidf_lead_combo(
|
|
656
|
+
tfidf_best, tfidf_best_score, enabled,
|
|
657
|
+
**general_kwargs(features, mode, depth, context))
|
|
654
658
|
# 🔑 展开 local_search → 子引擎
|
|
655
659
|
engines_combo = _expand_local_search(engines_combo, features)
|
|
656
660
|
# 🔑 为中文/学术查询追加本地引擎
|
|
@@ -724,9 +728,8 @@ def _route_by_fallback(ctx: _RouteCtx) -> dict[str, Any]:
|
|
|
724
728
|
tfidf_scores = ctx.tfidf_scores
|
|
725
729
|
_done = ctx.done
|
|
726
730
|
# 保底:免费通用引擎(零分 TF-IDF 也走这里)——本地优先 + 通用免费源唯一来源
|
|
727
|
-
fallback_combo = _general_fallback(
|
|
728
|
-
|
|
729
|
-
fallback_combo = sorted(enabled)[:2] if enabled else ["anysearch"]
|
|
731
|
+
fallback_combo = _general_fallback(
|
|
732
|
+
enabled, **general_kwargs(features, mode, depth, context))
|
|
730
733
|
# 日/韩主查询:优先 anysearch(多语言源对日/韩结果语言匹配更好),
|
|
731
734
|
# 再并语言专用本地引擎;避免旧逻辑只锁 local_bing(zh 参数)返回中文站。
|
|
732
735
|
# 注:byted 经实测对 ja/ko 也可,但其被 test_multilingual 定义为中文引擎,
|
package/scripts/route_cache.py
CHANGED
|
@@ -111,6 +111,12 @@ def _route_state_fingerprint() -> str:
|
|
|
111
111
|
_get_env = lambda k, d="": os.environ.get(k, d) # noqa: E731
|
|
112
112
|
parts.append("lead=" + (_get_env("ARGO_GENERAL_FALLBACK_LEAD") or ""))
|
|
113
113
|
parts.append("legacy=" + (_get_env("ARGO_GENERAL_FALLBACK_LEGACY") or ""))
|
|
114
|
+
# 静态臂同样是「改通用兜底链顺序」的开关(2026-10-26 新增)。不进指纹
|
|
115
|
+
# 会让「设了 STATIC=1 但缓存命中」读到动态排序,A/B 两臂变成同一臂。
|
|
116
|
+
parts.append("static=" + (_get_env("ARGO_GENERAL_FALLBACK_STATIC") or ""))
|
|
117
|
+
# 付费对冲位置同样改变 combo:常驻第二位 vs 第三位(免费源先跑)。
|
|
118
|
+
# 不进指纹会让 A/B 两臂在缓存命中时读到同一组合。
|
|
119
|
+
parts.append("hedge_defer=" + (_get_env("ARGO_PAID_HEDGE_DEFER") or ""))
|
|
114
120
|
# 付费对冲开关与月度预算同样改变 combo;不纳入指纹会让开关或预算变更在缓存命中时静默不生效。
|
|
115
121
|
parts.append("paid=" + (_get_env("ARGO_PAID_SEARCH") or ""))
|
|
116
122
|
try:
|
package/scripts/route_combo.py
CHANGED
|
@@ -12,11 +12,15 @@
|
|
|
12
12
|
|
|
13
13
|
from __future__ import annotations
|
|
14
14
|
|
|
15
|
-
import
|
|
16
|
-
from typing import Any
|
|
15
|
+
from typing import Any, Callable
|
|
17
16
|
|
|
18
17
|
from config import get_engines
|
|
18
|
+
from general_pool import (configured_general_pool as _configured_general_pool,
|
|
19
|
+
general_fallback as _general_fallback,
|
|
20
|
+
general_kwargs,
|
|
21
|
+
ranked_general as _ranked_general)
|
|
19
22
|
from quota import get_quota_manager
|
|
23
|
+
from source_selection import candidate_allowed
|
|
20
24
|
from route_lang import (_enabled_local_engines, _filter_lang_bound_family,
|
|
21
25
|
_get_registry, _lang_must_keep, _specs_snapshot,
|
|
22
26
|
lang_allows)
|
|
@@ -81,46 +85,8 @@ def _expand_local_search(engine_list: list[str], features: dict | None = None) -
|
|
|
81
85
|
return result
|
|
82
86
|
|
|
83
87
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
域内引擎全被过滤 / 无匹配域时的回退组合。通用免费源在前、local_search 殿后,
|
|
88
|
-
清单与 recovery L3 共用同一常量,避免两处清单漂移。
|
|
89
|
-
|
|
90
|
-
local_search 殿后而非领队(2026-10-15 实测定案):日常档 combo_budget=2
|
|
91
|
-
(见 engine_policy.combo_budget,fast/auto+fast 都只取前 2 位),
|
|
92
|
-
`_expand_local_search` 又把展开出的本地子引擎**追加尾部**——它一旦占住前排,
|
|
93
|
-
尾部子引擎必被预算截断,只剩 local_search 聚合器**独跑**。1059 条真实查询里
|
|
94
|
-
它独跑 109 次、中位 2.9s、45% 超 3s,占全部查询墙钟 369s,而其中纯英文
|
|
95
|
-
技术查询("zig comptime explained" 类)占 82%——本地文件检索对这类 query
|
|
96
|
-
语义上无效,纯亏延迟。改为通用源领队后:常规查询直接落 anysearch/local_bing
|
|
97
|
-
(实测 ~1.1-1.7s),local_search 只在通用源全部不可用(熔断/配额耗尽)时
|
|
98
|
-
才顶上前预算位,本地检索能力不减,只是不再无条件霸占首轮。
|
|
99
|
-
"""
|
|
100
|
-
try:
|
|
101
|
-
from engine_policy import GENERAL_FREE_FALLBACK
|
|
102
|
-
except ImportError:
|
|
103
|
-
GENERAL_FREE_FALLBACK = ("anysearch", "octen", "local_bing")
|
|
104
|
-
order = list(GENERAL_FREE_FALLBACK)
|
|
105
|
-
# 领队覆盖(2026-10-21):A/B 与线上回退都走这里,避免为了复测改常量。
|
|
106
|
-
# 传引擎名即把它提到首位(例:ARGO_GENERAL_FALLBACK_LEAD=anysearch 复现
|
|
107
|
-
# 2026-10-21 之前的顺位);传空/未知值不生效。与下面的 LEGACY 开关正交。
|
|
108
|
-
lead_override = (os.environ.get("ARGO_GENERAL_FALLBACK_LEAD") or "").strip()
|
|
109
|
-
if lead_override and lead_override in order:
|
|
110
|
-
order = [lead_override] + [e for e in order if e != lead_override]
|
|
111
|
-
# 逃生开关:A/B 与线上回退都走这条,避免为了复测改常量。
|
|
112
|
-
# 2026-10-17 对拍(交错、随机序):octen 入第二顺位后,anysearch 抖动
|
|
113
|
-
# 窗口 p90 3273→1614ms、max 6266→1928ms、错误 9→0;健康窗口中位无差。
|
|
114
|
-
try:
|
|
115
|
-
from engine_env import env_flag
|
|
116
|
-
if env_flag("ARGO_GENERAL_FALLBACK_LEGACY", default=False):
|
|
117
|
-
order = [e for e in order if e != "octen"]
|
|
118
|
-
except ImportError:
|
|
119
|
-
pass
|
|
120
|
-
lead = [e for e in order if e in enabled]
|
|
121
|
-
# 保底项同样受 enabled 约束:不在 enabled 说明本机压根没注册/被禁用,
|
|
122
|
-
# 选它只会在执行层撞 "未知引擎" 空跑。
|
|
123
|
-
return lead + (["local_search"] if "local_search" in enabled else [])
|
|
88
|
+
# 通用候选池的顺序策略在 general_pool.py(route_combo 曾因它逼近 1000 行)。
|
|
89
|
+
# 顶部别名保留,既有调用方与测试的 import 路径不变。
|
|
124
90
|
|
|
125
91
|
|
|
126
92
|
def _breaker_blocked(engine_id: str) -> bool:
|
|
@@ -269,37 +235,49 @@ TFIDF_STRONG_SCORE = 0.15
|
|
|
269
235
|
|
|
270
236
|
|
|
271
237
|
def tfidf_lead_combo(tfidf_best: str | None, tfidf_best_score: float,
|
|
272
|
-
enabled: set[str]
|
|
273
|
-
|
|
238
|
+
enabled: set[str], *, mode: str = "auto",
|
|
239
|
+
depth: str = "fast", context: str = "search",
|
|
240
|
+
lang: str = "",
|
|
241
|
+
score_fn: Callable[[str, str, str, str],
|
|
242
|
+
tuple[float, int]] | None = None
|
|
243
|
+
) -> list[str]:
|
|
244
|
+
"""TF-IDF 分支的初始 combo:强证据推荐领队 + 通用源对冲。
|
|
274
245
|
|
|
275
246
|
弱证据(≤TFIDF_STRONG_SCORE)时反过来:通用保底领队,推荐引擎殿后
|
|
276
247
|
作辅源——仍在 combo 里并行竞速,能力不减,只是不再占 primary 位
|
|
277
248
|
(含 primary 宽限/充分性判定对它的偏袒)。
|
|
249
|
+
|
|
250
|
+
2026-10-26:对冲位不再写死 octen/anysearch,改由 `_ranked_general`
|
|
251
|
+
给出当前最优的通用源。静态清单与实测排序的分叉此前导致「走 TF-IDF
|
|
252
|
+
分支的查询永远用不到 tavily/yuanbao」,同一个无匹配域查询换条路径
|
|
253
|
+
就换了源。两条路径现在共用同一排序。
|
|
278
254
|
"""
|
|
279
255
|
strong = bool(tfidf_best and tfidf_best_score > TFIDF_STRONG_SCORE)
|
|
256
|
+
generals = _ranked_general(
|
|
257
|
+
enabled, mode=mode, depth=depth, context=context, lang=lang,
|
|
258
|
+
score_fn=score_fn)
|
|
280
259
|
lead: list[str] = []
|
|
281
260
|
if strong:
|
|
282
261
|
lead = [tfidf_best]
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
if e in enabled and e not in lead:
|
|
262
|
+
for e in generals:
|
|
263
|
+
if len(lead) >= 3:
|
|
264
|
+
break
|
|
265
|
+
if e not in lead:
|
|
288
266
|
lead.append(e)
|
|
289
267
|
else:
|
|
290
|
-
#
|
|
291
|
-
# tests/test_route_tfidf_weak_score.py
|
|
292
|
-
# budget=2
|
|
293
|
-
#
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
if tfidf_best and tfidf_best not in lead:
|
|
268
|
+
# 弱证据/无推荐:通用保底领队,弱推荐作为辅源紧跟其后(既有契约,
|
|
269
|
+
# tests/test_route_tfidf_weak_score.py 锁死)。弱推荐占第二槽而不是
|
|
270
|
+
# 第三槽:日常 budget=2 时它仍能参与竞速,与改动前逐位一致;第二个
|
|
271
|
+
# 通用源顺延到第三位。
|
|
272
|
+
lead = list(generals[:1])
|
|
273
|
+
if tfidf_best and tfidf_best not in lead and tfidf_best in enabled:
|
|
297
274
|
lead.append(tfidf_best)
|
|
298
|
-
|
|
299
|
-
lead.append("octen")
|
|
275
|
+
lead.extend(e for e in generals[1:] if e not in lead)
|
|
300
276
|
out: list[str] = []
|
|
301
277
|
for e in lead:
|
|
302
|
-
|
|
278
|
+
# 与 source_selection 同一判据:enabled 成员,或预算内的白名单付费源。
|
|
279
|
+
# 只查 `e in enabled` 会把池排序里已放行的 DeepSeek 在装配阶段再剔掉。
|
|
280
|
+
if candidate_allowed(e, enabled, mode) and e not in out:
|
|
303
281
|
out.append(e)
|
|
304
282
|
return out
|
|
305
283
|
|
package/scripts/route_domains.py
CHANGED
|
@@ -220,10 +220,26 @@ def _pattern_entries(domain: dict[str, Any]) -> list[Any]:
|
|
|
220
220
|
return list(patterns) if isinstance(patterns, list) else []
|
|
221
221
|
|
|
222
222
|
|
|
223
|
+
# 声明式否决宏(2026-10-29,issue #34.1):蛋白/化合物/通用医疗词汇在「市场规模/
|
|
224
|
+
# 销售额/集采/医保」等商业研报语境下不是查生信/化学/临床试验库。把公共商业否决集
|
|
225
|
+
# 抽成命名宏 `@commercial_market`,在 config.yaml 的 unless 字段按需引用,消除多域
|
|
226
|
+
# 重复粘贴并保持 `_split_pattern_entry` 单点展开。
|
|
227
|
+
_UNLESS_MACROS: dict[str, str] = {
|
|
228
|
+
"@commercial_market": (
|
|
229
|
+
r"(?i)(市场规模|市场份额|销售额|营收|市值|融资|财报|竞争格局|集采|医保|报销|"
|
|
230
|
+
r"价格|多少钱|商业化|市场预测|行情|股价|龙头股|概念股|"
|
|
231
|
+
r"market\s+size|market\s+share|sales|revenue|valuation|market\s+forecast|pricing)"
|
|
232
|
+
),
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
|
|
223
236
|
def _split_pattern_entry(entry: Any) -> tuple[Any, Any]:
|
|
224
|
-
"""触发词条目的两种形态:字符串,或 `{match, unless}
|
|
237
|
+
"""触发词条目的两种形态:字符串,或 `{match, unless}`(unless 支持 @宏名 展开)。"""
|
|
225
238
|
if isinstance(entry, dict):
|
|
226
|
-
|
|
239
|
+
unless = entry.get("unless")
|
|
240
|
+
if isinstance(unless, str) and unless in _UNLESS_MACROS:
|
|
241
|
+
unless = _UNLESS_MACROS[unless]
|
|
242
|
+
return entry.get("match"), unless
|
|
227
243
|
return entry, None
|
|
228
244
|
|
|
229
245
|
|
|
@@ -323,7 +339,10 @@ def _social_domain_first(hits: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
|
|
323
339
|
idx_first_social = hits.index(social[0])
|
|
324
340
|
# 「热搜/热榜」是比泛 social 更具体的意图:查询里带微博/抖音这类平台名时,
|
|
325
341
|
# social 会被提前,把 hot_trending 顶掉——用户问的是榜单,不是社交帖子。
|
|
326
|
-
|
|
342
|
+
# video 同理:「抖音视频 红烧肉」要的是视频,不是社交帖子;2026-10-27
|
|
343
|
+
# 加 video 域时一并登记,否则 social 提权会把它压回第二位。
|
|
344
|
+
_SPECIFIC_BEFORE_SOCIAL = ("redskill_search", "zhihu_user_data",
|
|
345
|
+
"hot_trending", "video")
|
|
327
346
|
idx_specific = next(
|
|
328
347
|
(i for i, h in enumerate(hits)
|
|
329
348
|
if h.get("name") in _SPECIFIC_BEFORE_SOCIAL), None
|
package/scripts/route_policy.py
CHANGED
|
@@ -44,6 +44,12 @@ _VERTICAL_NEW_SOURCE: dict[str, tuple[str, ...]] = {
|
|
|
44
44
|
# cinii 声明 langs=ja,靠 engines_demote_for_lang 的语言专用源降级,
|
|
45
45
|
# 只在日语查询里占位;zbmath 语言中立,数学查询与 deep 档可达。
|
|
46
46
|
"soil_agri": ("openfoodfacts",), # 食品成分库:补 usda(单一国别)之外的多国食品数据
|
|
47
|
+
# 2026-10-26:技能域两个新专源。explainx 给「安装量 + 分类 + 官方标记」,
|
|
48
|
+
# skills.sh 给 Vercel 官方安装遥测——两者都是「这个技能多少人在用」的硬
|
|
49
|
+
# 指标,而此前三个技能源(skillsmp 只有仓库星数、clawhub 只有生态下载量、
|
|
50
|
+
# redskill 只有小红书站内口径)都给不出。声明在既有源之后,由本表加槽,
|
|
51
|
+
# 不挤掉 skillsmp/clawhub/redskill 的位次。
|
|
52
|
+
"skill_search": ("explainx", "skills_sh"),
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
|
package/scripts/search.py
CHANGED
|
@@ -563,11 +563,15 @@ def super_search(query: str, engine: str = "auto", n: int = 5, explain: bool = F
|
|
|
563
563
|
since: str | None = None,
|
|
564
564
|
until: str | None = None,
|
|
565
565
|
sort: str = "relevance",
|
|
566
|
+
video_only: bool = False,
|
|
567
|
+
min_duration: int | None = None,
|
|
568
|
+
max_duration: int | None = None,
|
|
566
569
|
include_local: bool | None = None,
|
|
567
570
|
include_domains: list[str] | None = None,
|
|
568
571
|
exclude_domains: list[str] | None = None,
|
|
569
572
|
engine_domain: str | None = None,
|
|
570
573
|
engine_sub_domain: str | None = None,
|
|
574
|
+
quiet: bool = False,
|
|
571
575
|
timing: StageTiming | None = None) -> dict[str, Any]:
|
|
572
576
|
"""统一搜索便捷入口。
|
|
573
577
|
|
|
@@ -735,7 +739,10 @@ def super_search(query: str, engine: str = "auto", n: int = 5, explain: bool = F
|
|
|
735
739
|
from route import route_query_cached
|
|
736
740
|
|
|
737
741
|
_op_langs = (decision_operators or {}).get("langs") or None
|
|
738
|
-
if local_first:
|
|
742
|
+
if video_only and not local_first and engine == "auto":
|
|
743
|
+
from video_route import video_decision
|
|
744
|
+
decision = video_decision(min_duration, max_duration)
|
|
745
|
+
elif local_first:
|
|
739
746
|
_tk_route = _tick(timing)
|
|
740
747
|
decision = route_query_cached(
|
|
741
748
|
original_query, engine_override="local_search", mode=mode,
|
|
@@ -751,6 +758,8 @@ def super_search(query: str, engine: str = "auto", n: int = 5, explain: bool = F
|
|
|
751
758
|
lang_override=_op_langs,
|
|
752
759
|
)
|
|
753
760
|
_tock(timing, "route", _tk_route)
|
|
761
|
+
decision.update(video_only=video_only, min_duration=min_duration,
|
|
762
|
+
max_duration=max_duration)
|
|
754
763
|
if decision_operators:
|
|
755
764
|
decision["operators"] = decision_operators
|
|
756
765
|
if context == "research":
|
|
@@ -779,7 +788,8 @@ def super_search(query: str, engine: str = "auto", n: int = 5, explain: bool = F
|
|
|
779
788
|
_local_seek_future = None
|
|
780
789
|
if include_local:
|
|
781
790
|
_local_seek_future = _get_local_seek_executor().submit(
|
|
782
|
-
_run_local_seek, query, n, warn=_local_seek_explicit
|
|
791
|
+
_run_local_seek, query, n, warn=_local_seek_explicit,
|
|
792
|
+
echo=not quiet)
|
|
783
793
|
|
|
784
794
|
result = execute_search(
|
|
785
795
|
query=search_query, decision=decision, max_results=n,
|
|
@@ -913,7 +923,7 @@ def super_search(query: str, engine: str = "auto", n: int = 5, explain: bool = F
|
|
|
913
923
|
timeout=max(_local_deadline - time.monotonic(), 0))
|
|
914
924
|
except Exception:
|
|
915
925
|
return []
|
|
916
|
-
return _run_local_seek(q, max_n, search_dir)
|
|
926
|
+
return _run_local_seek(q, max_n, search_dir, echo=not quiet)
|
|
917
927
|
|
|
918
928
|
result = shape_response(_ShapeContext(
|
|
919
929
|
query=query, kind=kind, tier=tier, envelope=envelope, decision=decision,
|
package/scripts/search_cli.py
CHANGED
|
@@ -102,6 +102,17 @@ def _max_results_arg(value: str) -> int:
|
|
|
102
102
|
return n
|
|
103
103
|
|
|
104
104
|
|
|
105
|
+
def _non_negative_int(value: str) -> int:
|
|
106
|
+
"""argparse 的 `type=`:时长等非负整数(负值不是「不限」,是坏输入)。"""
|
|
107
|
+
try:
|
|
108
|
+
n = int(value)
|
|
109
|
+
except (TypeError, ValueError):
|
|
110
|
+
raise argparse.ArgumentTypeError(f"必须是整数,收到 {value!r}") from None
|
|
111
|
+
if n < 0:
|
|
112
|
+
raise argparse.ArgumentTypeError(f"不能为负(收到 {n})")
|
|
113
|
+
return n
|
|
114
|
+
|
|
115
|
+
|
|
105
116
|
def build_parser() -> argparse.ArgumentParser:
|
|
106
117
|
"""构造 CLI 参数解析器。
|
|
107
118
|
|
|
@@ -159,6 +170,16 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
159
170
|
parser.add_argument("--sort", default="relevance",
|
|
160
171
|
choices=["relevance", "oldest", "newest"],
|
|
161
172
|
help="时间排序:relevance=相关度(默认), oldest=最早在前(溯源), newest=最新在前")
|
|
173
|
+
parser.add_argument("--video", action="store_true",
|
|
174
|
+
help="只搜视频源(B 站 + anysearch),并只保留视频结果;"
|
|
175
|
+
"不带此开关时视频源只按显式意图路由进入 combo")
|
|
176
|
+
parser.add_argument("--min-duration", type=_non_negative_int, default=None,
|
|
177
|
+
metavar="SEC",
|
|
178
|
+
help="视频最短时长(秒);B 站下推 duration 档位,"
|
|
179
|
+
"其他源按已返回的时长字段后过滤,时长未知的保留")
|
|
180
|
+
parser.add_argument("--max-duration", type=_non_negative_int, default=None,
|
|
181
|
+
metavar="SEC",
|
|
182
|
+
help="视频最长时长(秒);语义同 --min-duration")
|
|
162
183
|
parser.add_argument("--include-domains", default="",
|
|
163
184
|
help="仅保留这些域名(含子域),逗号分隔,如 github.com,arxiv.org")
|
|
164
185
|
parser.add_argument("--exclude-domains", default="",
|
|
@@ -286,6 +307,7 @@ def _summarize_engine_rows(rows: list[dict[str, Any]]) -> dict[str, Any]:
|
|
|
286
307
|
blocked.append({
|
|
287
308
|
"engine_id": name,
|
|
288
309
|
"reason": reason,
|
|
310
|
+
**({"disabled_reason": row["disabled_reason"]} if row.get("disabled_reason") else {}),
|
|
289
311
|
**({"missing_env": row["missing_env"]} if row.get("missing_env") else {}),
|
|
290
312
|
**({"missing_deps": row["missing_deps"]} if row.get("missing_deps") else {}),
|
|
291
313
|
**({"status": row["status"]} if row.get("status") else {}),
|
|
@@ -357,6 +379,14 @@ def main():
|
|
|
357
379
|
parser = build_parser()
|
|
358
380
|
args = parser.parse_args()
|
|
359
381
|
|
|
382
|
+
if args.json_output:
|
|
383
|
+
# issue #34 第 7 条:引擎 builder 的 logger.warning(如「OCTEN_API_KEY
|
|
384
|
+
# 未设置」)经 logging 的最后兜底 handler 打到 stderr,调用方一旦
|
|
385
|
+
# 2>&1 合并就解析失败。JSON 模式只留 ERROR:非致命告警静默,可行动
|
|
386
|
+
# 的告警走响应里的 warnings[] 字段(见 search.super_search 的 quiet)。
|
|
387
|
+
import logging
|
|
388
|
+
logging.disable(logging.WARNING)
|
|
389
|
+
|
|
360
390
|
if args.list_engines:
|
|
361
391
|
# --engine 兼作清单过滤(`--engine auto` 是搜索默认值,不算过滤)。
|
|
362
392
|
# 全量详细行 2026-09-16 实测 151 KB(runtime/admission 嵌套是大头),
|
|
@@ -414,6 +444,15 @@ def main():
|
|
|
414
444
|
if _wanted:
|
|
415
445
|
names = [n for n in names if n in set(_wanted)]
|
|
416
446
|
print(dumps(names))
|
|
447
|
+
# issue #34 第 6 条:本档只回答「有多少个有实现的源」,与
|
|
448
|
+
# `paths --check` 的 engines=<总收录> 天然不等——差额里是
|
|
449
|
+
# 停用/缺密钥/别名 spec。以前这层口径差没有任何对外说明,
|
|
450
|
+
# 被当成计数错误。提示走 stderr,stdout 保持纯 JSON 名单。
|
|
451
|
+
if not _wanted:
|
|
452
|
+
print(f"[list-engines] 有实现的源 {len(names)} 个(routes 实际可用数)"
|
|
453
|
+
";总收录与每个不可用项的成因见 --list-engines --detail,"
|
|
454
|
+
"逐条全量清单加 --all;paths --check 的 engines= 是总收录口径",
|
|
455
|
+
file=sys.stderr)
|
|
417
456
|
return
|
|
418
457
|
|
|
419
458
|
# 入口级引擎名校验(2026-10-10 方案甲):无效名字此前只在执行层补 errors,
|
|
@@ -438,6 +477,9 @@ def main():
|
|
|
438
477
|
|
|
439
478
|
if not args.query:
|
|
440
479
|
parser.error("必须提供搜索关键词")
|
|
480
|
+
if (args.min_duration is not None and args.max_duration is not None
|
|
481
|
+
and args.min_duration > args.max_duration):
|
|
482
|
+
parser.error("--min-duration 不能大于 --max-duration")
|
|
441
483
|
|
|
442
484
|
# envelope 默认**关**,要时显式开(--envelope / --archive)。
|
|
443
485
|
#
|
|
@@ -499,6 +541,9 @@ def main():
|
|
|
499
541
|
since=args.since,
|
|
500
542
|
until=args.until,
|
|
501
543
|
sort=args.sort,
|
|
544
|
+
video_only=args.video,
|
|
545
|
+
min_duration=args.min_duration,
|
|
546
|
+
max_duration=args.max_duration,
|
|
502
547
|
include_domains=[d for d in args.include_domains.split(",") if d.strip()] or None,
|
|
503
548
|
exclude_domains=[d for d in args.exclude_domains.split(",") if d.strip()] or None,
|
|
504
549
|
engine_domain=engine_domain,
|
|
@@ -511,6 +556,10 @@ def main():
|
|
|
511
556
|
# 交回 super_search 后自动获得 L1 并行提交(与主搜索同时跑)。
|
|
512
557
|
include_local=(True if args.include_local
|
|
513
558
|
else (False if args.no_local else None)),
|
|
559
|
+
# --json 时 stderr 会被调用方 2>&1 合并,非致命告警(缺 key、宽根跳过
|
|
560
|
+
# 等)一律不进 stderr(issue #34 第 7 条);可行动的告警随响应
|
|
561
|
+
# 的 warnings[] 字段返回。
|
|
562
|
+
quiet=args.json_output,
|
|
514
563
|
)
|
|
515
564
|
|
|
516
565
|
# 固定开销(import + argparse + 收尾):缓存命中时它占墙钟大头,而它不出现
|
package/scripts/search_entry.py
CHANGED
|
@@ -209,6 +209,15 @@ def prepare(query: str, decision: dict[str, Any], max_results: int,
|
|
|
209
209
|
cache_engine_key += f"|since={since_iso}"
|
|
210
210
|
if until_iso and time_aware:
|
|
211
211
|
cache_engine_key += f"|until={until_iso}"
|
|
212
|
+
# 视频模式与时长过滤进缓存键:--video 与 auto 的结果集不同(前者强制
|
|
213
|
+
# 只留视频),--min-duration 也会改变最终条数;不隔离就会把未过滤的
|
|
214
|
+
# 旧结果当成带条件的答案发回去。
|
|
215
|
+
if (decision or {}).get("video_only"):
|
|
216
|
+
cache_engine_key += "|video=1"
|
|
217
|
+
_min_d = (decision or {}).get("min_duration")
|
|
218
|
+
_max_d = (decision or {}).get("max_duration")
|
|
219
|
+
if _min_d is not None or _max_d is not None:
|
|
220
|
+
cache_engine_key += f"|dur={_min_d or 0}-{_max_d or 0}"
|
|
212
221
|
|
|
213
222
|
if on_progress:
|
|
214
223
|
on_progress(Stage.ROUTING, {"domain": domain, "engine": engine_label, "engines": engines})
|
package/scripts/search_output.py
CHANGED
|
@@ -85,6 +85,31 @@ _AGENT_RESULT_FIELDS = (
|
|
|
85
85
|
)
|
|
86
86
|
|
|
87
87
|
|
|
88
|
+
def _ensure_authority_levels(results: list[dict[str, Any]]) -> None:
|
|
89
|
+
"""把上游原生 authority(DeepSeek 0-4)转成离散等级,补齐非精排路径。
|
|
90
|
+
|
|
91
|
+
`search_rank.local_five_dim_rerank` 只在五维精排里写 `authority_level`;
|
|
92
|
+
单引擎 `--engine`、付费对冲的第二位、以及部分 fast 路径不走精排,于是
|
|
93
|
+
`upstream_authority` 明明在结果里,agent 档的 `authority_level` 却是空。
|
|
94
|
+
DeepSeek 搜索最大的差异点就是这套结构化字段(v2.9.6 接入时的定位),
|
|
95
|
+
输出层丢掉它等于把价值重新埋回去。这里按 `authority_level` 的唯一实现
|
|
96
|
+
回填:上游 0-4 优先,缺失/不可解析再走自有分数映射。
|
|
97
|
+
"""
|
|
98
|
+
try:
|
|
99
|
+
from rank_signals import authority_level
|
|
100
|
+
except Exception:
|
|
101
|
+
return
|
|
102
|
+
for r in results:
|
|
103
|
+
if not isinstance(r, dict):
|
|
104
|
+
continue
|
|
105
|
+
if r.get("authority_level") is not None:
|
|
106
|
+
continue
|
|
107
|
+
upstream = r.get("upstream_authority")
|
|
108
|
+
if upstream in (None, ""):
|
|
109
|
+
continue
|
|
110
|
+
r["authority_level"] = authority_level(r.get("authority"), upstream)
|
|
111
|
+
|
|
112
|
+
|
|
88
113
|
def _slim_verify(v: Any) -> dict[str, Any] | None:
|
|
89
114
|
"""verify 块的 agent 精简版:保留「核验后改了什么」,丢掉逐条细节。
|
|
90
115
|
|
|
@@ -136,6 +161,10 @@ def _strip_for_agent(payload: dict[str, Any]) -> dict[str, Any]:
|
|
|
136
161
|
# limitations/recovery/time_filter_warning 一并剥掉,agent 无从判断
|
|
137
162
|
# 「这批结果能用到什么程度」(2026-09-15 输出契约审查)。
|
|
138
163
|
"limitations", "recovery", "time_filter_warning",
|
|
164
|
+
# 搜索期告警(issue #34 第 7 条):--json 管道场景默认走 agent 档,
|
|
165
|
+
# 告警只在 warnings[] 里——剥掉它等于「静默跳过」再次发生,且调用方
|
|
166
|
+
# 从 JSON 里永远看不到「本机检索没执行/缺 seek.py」的原因。
|
|
167
|
+
"warnings",
|
|
139
168
|
# 阶段耗时:默认就带(--no-timing 才没有)。剥掉会让使用者看不到
|
|
140
169
|
# 「这次慢在哪」,也拿不到自己动手优化所需的依据。
|
|
141
170
|
"timing",
|
|
@@ -600,6 +629,10 @@ def shape_response(ctx: _ShapeContext, result: dict[str, Any]) -> dict[str, Any]
|
|
|
600
629
|
except Exception:
|
|
601
630
|
pass
|
|
602
631
|
|
|
632
|
+
# 上游权威等级回填(DeepSeek 0-4):单引擎/对冲路径不走五维精排,
|
|
633
|
+
# 不补这一步 agent 档只能看到空 authority_level。
|
|
634
|
+
_ensure_authority_levels(result.get("results") or [])
|
|
635
|
+
|
|
603
636
|
# 域过滤(后置,引擎无关):融合排序之后裁剪,sources 与 results 保持一致。
|
|
604
637
|
# 裁剪导致不足 n 条是调用方过滤条件的诚实结果,不回填。
|
|
605
638
|
if include_domains or exclude_domains:
|
|
@@ -687,4 +720,14 @@ def shape_response(ctx: _ShapeContext, result: dict[str, Any]) -> dict[str, Any]
|
|
|
687
720
|
result["content_trust"] = CONTENT_TRUST_UNTRUSTED
|
|
688
721
|
except Exception:
|
|
689
722
|
pass
|
|
723
|
+
# 搜索期告警(issue #34 第 7 条):--json 下告警不能留在 stderr(调用方
|
|
724
|
+
# 2>&1 合并会破坏 JSON 解析),统一收进响应的 warnings[] 字段。住在
|
|
725
|
+
# 响应契约层而不是 search.py:所有入口共享同一收口。空账不加键。
|
|
726
|
+
try:
|
|
727
|
+
from local_seek import drain_search_warnings
|
|
728
|
+
warns = [w.strip() for w in drain_search_warnings() if w.strip()]
|
|
729
|
+
if warns:
|
|
730
|
+
result.setdefault("warnings", []).extend(warns)
|
|
731
|
+
except Exception:
|
|
732
|
+
pass
|
|
690
733
|
return result
|
|
@@ -384,8 +384,10 @@ def postprocess(req: _SearchRequest, run: _SearchRun, hooks: Any) -> _SearchRun:
|
|
|
384
384
|
_funnel_deduped = len(merged)
|
|
385
385
|
if merged:
|
|
386
386
|
try:
|
|
387
|
-
from serp_guard import
|
|
388
|
-
|
|
387
|
+
from serp_guard import is_unusable_row as _is_unusable_row # SERP + 内容农场,标定见 test_content_farm_guard.py
|
|
388
|
+
# url_kind: none(issue #29 口径 B):spec 显式声明条目不以 url 为身份,
|
|
389
|
+
# 缺 url 的题录/语义片段不再被当壳页整批吞
|
|
390
|
+
merged = [r for r in merged if not _is_unusable_row(r)]
|
|
389
391
|
except ImportError:
|
|
390
392
|
pass # serp_guard 不可用时跳过(本地五维 rerank 已对 SERP 降权)
|
|
391
393
|
|
|
@@ -433,6 +435,27 @@ def postprocess(req: _SearchRequest, run: _SearchRun, hooks: Any) -> _SearchRun:
|
|
|
433
435
|
except OPT_IMPORT + SHAPE_BENIGN: # 软排序增强,任何失败按「不排序」处理
|
|
434
436
|
pass
|
|
435
437
|
|
|
438
|
+
# ── 视频模式/时长过滤(--video / --min-duration)──
|
|
439
|
+
# 必须在 _pool_limit 截断之前:--video 的候选池同时混着 anysearch 的
|
|
440
|
+
# 网页结果,若先截 top-N 再过滤,B 站结果可能整批落在池外(实测
|
|
441
|
+
# --video --min-duration 600 时 6 条 B 站结果在过滤前就被截掉,只剩
|
|
442
|
+
# 1 条 YouTube)。先过滤再截断,池里才都是候选视频。
|
|
443
|
+
video_filtered = 0
|
|
444
|
+
duration_filtered = 0
|
|
445
|
+
duration_unknown = 0
|
|
446
|
+
_video_only = bool((decision or {}).get("video_only"))
|
|
447
|
+
_min_d = (decision or {}).get("min_duration")
|
|
448
|
+
_max_d = (decision or {}).get("max_duration")
|
|
449
|
+
if merged and (_video_only or _min_d is not None or _max_d is not None):
|
|
450
|
+
from video_meta import filter_duration, filter_video_results
|
|
451
|
+
if _video_only:
|
|
452
|
+
merged, video_filtered = filter_video_results(merged)
|
|
453
|
+
if _min_d is not None or _max_d is not None:
|
|
454
|
+
merged, duration_filtered, duration_unknown = filter_duration(
|
|
455
|
+
merged, _min_d, _max_d)
|
|
456
|
+
_log(f"视频过滤:非视频 {video_filtered},时长不符 {duration_filtered},"
|
|
457
|
+
f"时长未知保留 {duration_unknown}")
|
|
458
|
+
|
|
436
459
|
# 放宽截断:rerank 阶段看到 _pool_limit 条,最终输出再截断 max_results
|
|
437
460
|
merged = merged[:_pool_limit]
|
|
438
461
|
|
|
@@ -511,7 +534,11 @@ def postprocess(req: _SearchRequest, run: _SearchRun, hooks: Any) -> _SearchRun:
|
|
|
511
534
|
_echo_triggered = _echo_needed(merged, query)
|
|
512
535
|
except OPT_IMPORT + SHAPE_BENIGN: # 守卫不可用不设卡(fail-open)
|
|
513
536
|
_echo_triggered = False
|
|
514
|
-
|
|
537
|
+
# 视频/时长模式不做恢复链:恢复链会跨域补搜普通网页,补进来的结果要么
|
|
538
|
+
# 被 video_only 过滤掉(白付一轮网络),要么绕过时长过滤(把已筛掉的
|
|
539
|
+
# 长/短视频重新带回来)。0 条就直接返回空,条件由调用方自己放宽。
|
|
540
|
+
_video_scope = (_video_only or _min_d is not None or _max_d is not None)
|
|
541
|
+
if (not merged or _echo_triggered) and not _video_scope:
|
|
515
542
|
from recovery_runner import run_pipeline_recovery
|
|
516
543
|
_dk = {k: v for k in ("domain", "sub_domain") if (v := getattr(req, "engine_" + k, None))}
|
|
517
544
|
merged, _rec_info = run_pipeline_recovery(
|
|
@@ -671,6 +698,14 @@ def postprocess(req: _SearchRequest, run: _SearchRun, hooks: Any) -> _SearchRun:
|
|
|
671
698
|
"noise_dropped": _noise_dropped,
|
|
672
699
|
"funnel": funnel,
|
|
673
700
|
}
|
|
701
|
+
# 只有真的用了视频/时长过滤才输出这三个账;普通搜索不塞无意义的 0
|
|
702
|
+
# (输出契约:不适用就整个键缺席)。
|
|
703
|
+
if _video_only or _min_d is not None or _max_d is not None:
|
|
704
|
+
result_payload.update(
|
|
705
|
+
video_filtered=video_filtered,
|
|
706
|
+
duration_filtered=duration_filtered,
|
|
707
|
+
duration_unknown=duration_unknown,
|
|
708
|
+
)
|
|
674
709
|
if _site_include or _site_exclude:
|
|
675
710
|
result_payload["site_filter"] = {
|
|
676
711
|
"sites": _site_include, "exclude_sites": _site_exclude,
|
|
@@ -914,6 +949,11 @@ def finalize(req: _SearchRequest, run: _SearchRun, hooks: Any) -> dict[str, Any]
|
|
|
914
949
|
if result_payload.get("site_filter") is not None:
|
|
915
950
|
out["site_filter"] = result_payload["site_filter"]
|
|
916
951
|
out["site_filtered"] = result_payload.get("site_filtered", 0)
|
|
952
|
+
# 视频/时长过滤账:用于解释「--min-duration 后为什么只剩 N 条」,
|
|
953
|
+
# duration_unknown 明确告诉调用方有多少条没有时长、未被严格过滤。
|
|
954
|
+
for _key in ("video_filtered", "duration_filtered", "duration_unknown"):
|
|
955
|
+
if _key in result_payload:
|
|
956
|
+
out[_key] = result_payload[_key]
|
|
917
957
|
if lang_pref_info is not None:
|
|
918
958
|
out["lang_pref"] = lang_pref_info
|
|
919
959
|
if timing is not None:
|
package/scripts/search_rank.py
CHANGED
|
@@ -102,6 +102,7 @@ _ENGINE_FUSION_WEIGHTS: dict[str, float] = {
|
|
|
102
102
|
"core": 1.3, "openreview": 1.3, "zenodo": 1.2, "datacite": 1.2,
|
|
103
103
|
"sec_edgar": 1.3, "federal_register": 1.3, "eu_opendata": 1.3,
|
|
104
104
|
"egov_law": 1.3, "openstd": 1.3, "who_gho": 1.3, "usgs": 1.3, "nasa_cmr": 1.3,
|
|
105
|
+
"dshopen": 1.2, "deepseek1024": 1.2, "dsh_hub": 1.15, # DSH 插件目录三源(答案型;理由见 config.yaml dsh_plugin_search.score_floors)
|
|
105
106
|
# 通用引擎(基线)
|
|
106
107
|
"duckduckgo": 1.0, "local_bing": 1.0, "local_duckduckgo": 1.0,
|
|
107
108
|
"local_google": 1.0, "anysearch": 1.05, "byted": 1.1, "bocha": 1.0,
|
|
@@ -724,7 +725,9 @@ def local_five_dim_rerank(query: str, results: list[dict[str, Any]],
|
|
|
724
725
|
relevance = max(relevance, fl["relevance"])
|
|
725
726
|
if _has_evidence:
|
|
726
727
|
try:
|
|
727
|
-
|
|
728
|
+
# 传 query:有条件降权(如裁判文书站只在法律语境保留高分)要
|
|
729
|
+
# 看提问本身,而不是只看域名。
|
|
730
|
+
authority = float(score_authority(url, source, query).get("score", 0.5))
|
|
728
731
|
except Exception:
|
|
729
732
|
authority = 0.5
|
|
730
733
|
try:
|