test: simplify bootstrap cache hit count · openclaw/openclaw@4fb3bd8
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -475,7 +475,12 @@ describe("bootstrap prompt warnings", () => {
|
475 | 475 | injectLegacyWarning(optimizedTurns[2] ?? "", warningLines), |
476 | 476 | ]; |
477 | 477 | const cacheHitRate = (turns: string[]) => { |
478 | | -const hits = turns.slice(1).filter((turn, index) => turn === turns[index]).length; |
| 478 | +let hits = 0; |
| 479 | +for (let index = 1; index < turns.length; index++) { |
| 480 | +if (turns[index] === turns[index - 1]) { |
| 481 | +hits++; |
| 482 | +} |
| 483 | +} |
479 | 484 | return hits / Math.max(1, turns.length - 1); |
480 | 485 | }; |
481 | 486 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。