acp-kernel 0.0.82-pr.222.212 → 0.0.82-pr.229.213
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/dist/index.js
CHANGED
|
@@ -3870,16 +3870,14 @@ function tierLabel(block) {
|
|
|
3870
3870
|
}
|
|
3871
3871
|
function tierBreakdown(blocks, countTokens) {
|
|
3872
3872
|
const tierTokens = {};
|
|
3873
|
-
const tierCounts = {};
|
|
3874
3873
|
for (const block of blocks) {
|
|
3875
3874
|
tierTokens[block.tier] = (tierTokens[block.tier] ?? 0) + summaryTokensOf(block, countTokens);
|
|
3876
|
-
tierCounts[block.tier] = (tierCounts[block.tier] ?? 0) + 1;
|
|
3877
3875
|
}
|
|
3878
3876
|
const tiers = Object.keys(tierTokens).map(Number);
|
|
3879
3877
|
if (tiers.length <= 1) return null;
|
|
3880
3878
|
const parts = [];
|
|
3881
3879
|
for (const tier of [1, 2, 3]) {
|
|
3882
|
-
if (tierTokens[tier]) parts.push(`T${tier}: ${formatTokens2(tierTokens[tier])}
|
|
3880
|
+
if (tierTokens[tier]) parts.push(`T${tier}: ${formatTokens2(tierTokens[tier])}`);
|
|
3883
3881
|
}
|
|
3884
3882
|
return parts.join(" | ");
|
|
3885
3883
|
}
|
|
@@ -3986,11 +3984,6 @@ function renderOverview(visible, summaryTokens, blocks, state, countTokens, limi
|
|
|
3986
3984
|
` ${block.blockId} (${tierLabel(block)}) ${formatTokens2(eff)}\u2192${formatTokens2(summaryTokensOf(block, countTokens))} ${block.effectiveMessageIds.length} msgs "${topic}"`
|
|
3987
3985
|
);
|
|
3988
3986
|
}
|
|
3989
|
-
if (blocks.length > limit) {
|
|
3990
|
-
lines.push(
|
|
3991
|
-
` ... and ${blocks.length - limit} more blocks not shown (scope:"compressed", limit:${blocks.length} for full list)`
|
|
3992
|
-
);
|
|
3993
|
-
}
|
|
3994
3987
|
}
|
|
3995
3988
|
lines.push("");
|
|
3996
3989
|
lines.push(
|
|
@@ -5384,7 +5377,11 @@ function build(text) {
|
|
|
5384
5377
|
}
|
|
5385
5378
|
function docFeatures(text) {
|
|
5386
5379
|
const hit = cache.get(text);
|
|
5387
|
-
if (hit)
|
|
5380
|
+
if (hit) {
|
|
5381
|
+
cache.delete(text);
|
|
5382
|
+
cache.set(text, hit);
|
|
5383
|
+
return hit;
|
|
5384
|
+
}
|
|
5388
5385
|
const f = build(text);
|
|
5389
5386
|
if (text.length > 0 && text.length <= capChars) {
|
|
5390
5387
|
while (cachedChars + text.length > capChars && cache.size > 0) {
|
|
@@ -5495,8 +5492,8 @@ var hybridAlgorithm = {
|
|
|
5495
5492
|
score(docs, query) {
|
|
5496
5493
|
const bm = bm25Algorithm.score(docs, query);
|
|
5497
5494
|
const fz = fuzzyAlgorithm.score(docs, query);
|
|
5498
|
-
const maxBm =
|
|
5499
|
-
const maxFz =
|
|
5495
|
+
const maxBm = bm.reduce((m, r) => r.score > m ? r.score : m, 1e-9);
|
|
5496
|
+
const maxFz = fz.reduce((m, r) => r.score > m ? r.score : m, 1e-9);
|
|
5500
5497
|
const bmMap = new Map(bm.map((r) => [r.ref, r.score / maxBm]));
|
|
5501
5498
|
const fzMap = new Map(fz.map((r) => [r.ref, r.score / maxFz]));
|
|
5502
5499
|
return docs.map((d) => ({
|