Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

1.1 KB
Raw Blame
/**
 * Context Overflow Shared Utilities
 *
 * Shared truncation badge renderer used by details.js and the inline script
 * on context_overflow.html. Single function on purpose — resist scope creep;
 * formatters belong in services/formatting.js.
 */
(function() {
    'use strict';

    /**
     * Render a truncation status badge.
     * @param {number} truncatedCount - Number of truncated requests (0 = no truncation).
     * @returns {string} HTML string, color-coded by status. Numeric coercion only — no user input.
     */
    function renderTruncationBadge(truncatedCount) {
        const count = Number(truncatedCount) || 0;
        if (count > 0) {
            // bearer:disable javascript_lang_dangerous_insert_html
            // eslint-disable-next-line no-unsanitized/property -- numeric coercion only
            return `<span style="color: var(--error-color);">Yes (${count} requests)</span>`;
        }
        return '<span style="color: var(--success-color);">No truncation</span>';
    }

    window.contextOverflowShared = { renderTruncationBadge };
})();