mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-17 04:20:45 +00:00
test: simplify bootstrap cache hit count
This commit is contained in:
@@ -475,7 +475,12 @@ describe("bootstrap prompt warnings", () => {
|
||||
injectLegacyWarning(optimizedTurns[2] ?? "", warningLines),
|
||||
];
|
||||
const cacheHitRate = (turns: string[]) => {
|
||||
const hits = turns.slice(1).filter((turn, index) => turn === turns[index]).length;
|
||||
let hits = 0;
|
||||
for (let index = 1; index < turns.length; index++) {
|
||||
if (turns[index] === turns[index - 1]) {
|
||||
hits++;
|
||||
}
|
||||
}
|
||||
return hits / Math.max(1, turns.length - 1);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user