Skip to content

feat(routing): 高峰时段动态权重 speed→reliability / time-of-day dynamic ranking (#760) - #909

Open
suantea wants to merge 2 commits into
tashfeenahmed:mainfrom
suantea:feat/timeofday-ranking-760
Open

feat(routing): 高峰时段动态权重 speed→reliability / time-of-day dynamic ranking (#760)#909
suantea wants to merge 2 commits into
tashfeenahmed:mainfrom
suantea:feat/timeofday-ranking-760

Conversation

@suantea

@suantea suantea commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

中文

实现 #843/#760 中的 dynamic ranking(timeOfDayWeights) 切片:

  • scoring.ts 新增 timeOfDayWeights():本地高峰时段(18:00–06:00,免费中继拥塞期)把 speed 权重的 60% 转移到 reliability(如 balanced 0.5/0.25/0.25 → 高峰 0.65/0.1/0.25);非高峰行为不变。新增 isPeakHours() 与可配置常量 PEAK_START_HOUR/PEAK_END_HOUR/PEAK_SPEED_TO_RELIABILITY
  • router.tsweightsFor() 对 bandit 预设应用该调整;priority/custom(操作者显式选择)保持不变;dashboard 显示与路由评分走同一路径。
  • 单测 5 例(scoring.test.ts 新增):高峰/非高峰边界、权重守恒、intelligence 不受影响、各预设 speed 权重不为负、默认取当前时间。

验证:server tsc -b 通过(仅 sharp 缺失的既有报错);vitest scoring 33/33 + match-tier-routing 4/4。

English

Implements the dynamic ranking (timeOfDayWeights) slice of #843/#760:

  • New timeOfDayWeights() in scoring.ts: during local peak hours (18:00–06:00, when free relays are congested) moves 60% of the speed weight onto reliability (e.g. balanced 0.5/0.25/0.25 → peak 0.65/0.1/0.25); off-peak unchanged. Adds isPeakHours() and tunable PEAK_START_HOUR/PEAK_END_HOUR/PEAK_SPEED_TO_RELIABILITY constants.
  • weightsFor() in router.ts applies the adjustment to bandit presets only; priority/custom (operator's explicit choice) are returned untouched; dashboard display and route scoring share the same path.
  • 5 new tests in scoring.test.ts: peak/off-peak boundaries, weight conservation, intelligence untouched, non-negative speed across all presets, default wall-clock time.

Verification: server tsc -b passes (only the pre-existing sharp-missing error); vitest scoring 33/33 + match-tier-routing 4/4.


Closes #760

…during peak hours (tashfeenahmed#760)

New timeOfDayWeights() in scoring.ts: during local peak hours (18:00–06:00)
when free relays are congested, move 60% of the speed weight onto
reliability for bandit strategies (balanced → {0.65, 0.1, 0.25}); off-peak
and priority/custom strategies are unchanged. Applied in router's
weightsFor() so every bandit scoring path (routing + dashboard display)
sees the same adjustment. 5 new tests cover peak/off-peak boundaries,
weight conservation and non-negative speed across all presets.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] AI-driven model intelligence: benchmarks, dynamic ranking, scenario recommendation, MCP diagnostics

1 participant