MCPcopy Create free account
hub / github.com/microsoft/data-formulator / effectiveEntryCount

Function effectiveEntryCount

src/views/DataThread.tsx:2456–2466  ·  view source on GitHub ↗

Effective rendered row count for an interaction list: data-agent * `summary` entries that are immediately followed by an `instruction` get * folded into that instruction (see `pushInteractionEntries`), so they * shouldn't be double-counted in height estimation.

(interaction: InteractionEntry[] | undefined)

Source from the content-addressed store, hash-verified

2454 * folded into that instruction (see `pushInteractionEntries`), so they
2455 * shouldn't be double-counted in height estimation. */
2456function effectiveEntryCount(interaction: InteractionEntry[] | undefined): number {
2457 if (!interaction || interaction.length === 0) return 1;
2458 let n = 0;
2459 for (let i = 0; i < interaction.length; i++) {
2460 const e = interaction[i];
2461 const next = interaction[i + 1];
2462 if (e.role === 'summary' && e.from === 'data-agent' && next?.role === 'instruction') continue;
2463 n++;
2464 }
2465 return Math.max(1, n);
2466}
2467
2468/** Estimated height of one trigger block: interaction entries + result table + its charts. */
2469function estimateTriggerBlockHeight(

Callers 2

itemsForTriggerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected