Spaces:
Runtime error
Runtime error
File size: 1,097 Bytes
cd8bd0a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import { computeTarget } from "../../../../../../open-sse/services/compression/adaptiveCompression/computeTarget.ts";
import type { ContextBudgetConfig } from "../../../../../../open-sse/services/compression/adaptiveCompression/types.ts";
/**
* Read-only label for the compression panel (design D-C1 transparency). Shows the active
* policy and the computed token target for a representative model context window. PURE —
* imports only the pure computeTarget leaf, no DB, no clock. The panel renders this string
* as an informational/diagnostic line, mirroring the derived-pipeline preview.
*/
export function formatAdaptiveTarget(
config: ContextBudgetConfig,
representativeModelContextLimit: number
): string {
if (config.mode === "off") return "Adaptive context budget: off (legacy auto-trigger)";
const target = computeTarget(config.policy, representativeModelContextLimit, null, config);
return `Adaptive (${config.mode}, policy: ${config.policy}) — target ≈ ${target.toLocaleString()} tokens (for a ${representativeModelContextLimit.toLocaleString()}-token window)`;
}
|