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.

chore(metrics): drop dead chart code from context_overflow.html (#3888)

LearningCircuit077925aea722
diff --git a/changelog.d/+context-overflow-drop-dead-charts.misc.md b/changelog.d/+context-overflow-drop-dead-charts.misc.md
new file mode 100644
index 0000000000..5707dd9bcc
--- /dev/null
+++ b/changelog.d/+context-overflow-drop-dead-charts.misc.md
@@ -0,0 +1 @@
+Removed unused chart-rendering JavaScript on the context-overflow analytics page (token-usage-over-time stacked bar, model-token-stats table, context-limits-distribution doughnut, and the configured-limits list). These functions stopped being called when the page was reorganised to focus on truncation diagnosis (#3792); deleting them now drops ~200 lines of dead code without any user-visible change.
diff --git a/src/local_deep_research/web/templates/pages/context_overflow.html b/src/local_deep_research/web/templates/pages/context_overflow.html
index 6ca2f6223f..53f7b9e488 100644
--- a/src/local_deep_research/web/templates/pages/context_overflow.html
+++ b/src/local_deep_research/web/templates/pages/context_overflow.html
@@ -136,10 +136,8 @@
<script defer src="/static/js/components/context-overflow-shared.js"></script>
<script>
(function() {
- let tokenUsageChart = null;
let phaseChart = null;
let contextChart = null;
- let distributionChart = null;
let latencyChart = null;
let currentPeriod = '30d';
let currentPage = 1;
@@ -281,147 +279,6 @@
updatePaginationControls();
}
- // Create token usage over time stacked bar chart
- function createTokenUsageChart(chartData) {
- const ctx = document.getElementById('token-usage-chart').getContext('2d');
-
- if (tokenUsageChart) {
- tokenUsageChart.destroy();
- }
-
- if (!chartData || chartData.length === 0) {
- tokenUsageChart = new Chart(ctx, {
- type: 'bar',
- data: { labels: [], datasets: [] },
- options: {
- responsive: true,
- maintainAspectRatio: false,
- plugins: {
- title: { display: true, text: 'No token data available yet' }
- }
- }
- });
- return;
- }
-
- // Aggregate by day
- const dailyData = {};
- chartData.forEach(d => {
- const day = d.timestamp.substring(0, 10); // YYYY-MM-DD
- if (!dailyData[day]) {
- dailyData[day] = { prompt: 0, completion: 0 };
- }
- dailyData[day].prompt += d.prompt_tokens || 0;
- dailyData[day].completion += d.completion_tokens || 0;
- });
-
- const sortedDays = Object.keys(dailyData).sort();
- const promptTokens = sortedDays.map(d => dailyData[d].prompt);
- const completionTokens = sortedDays.map(d => dailyData[d].completion);
-
- tokenUsageChart = new Chart(ctx, {
- type: 'bar',
- data: {
- labels: sortedDays,
- datasets: [{
- label: 'Prompt Tokens',
- data: promptTokens,
- backgroundColor: 'rgba(54, 162, 235, 0.8)',
- borderColor: 'rgba(54, 162, 235, 1)',
- borderWidth: 1
- }, {
- label: 'Completion Tokens',
- data: completionTokens,
- backgroundColor: 'rgba(255, 99, 132, 0.8)',
- borderColor: 'rgba(255, 99, 132, 1)',
- borderWidth: 1
- }]
- },
- options: {
- responsive: true,
- maintainAspectRatio: false,
- scales: {
- x: {
- stacked: true,
- },
- y: {
- stacked: true,
- beginAtZero: true
- }
- },
- plugins: {
- legend: {
- position: 'bottom'
- },
- tooltip: {
- callbacks: {
- label: function(context) {
- let label = context.dataset.label || '';
- if (label) {
- label += ': ';
- }
- label += formatNumber(context.parsed.y);
- return label;
- }
- }
- }
- }
- }
- });
- }
-
- // Display model token stats as a table
- function displayModelTokenStats(stats) {
- const container = document.getElementById('model-token-stats');
-
- if (!stats || stats.length === 0) {
- container.innerHTML = `
- <div class="ldr-no-data-message">
- <i aria-hidden="true" class="fas fa-robot"></i>
- <p>No model data available yet</p>
- </div>
- `;
- return;
- }
-
- let html = `
- <div style="overflow-x: auto;">
- <table class="ldr-data-table">
- <thead>
- <tr>
- <th>Model</th>
- <th>Provider</th>
- <th style="text-align: right;">Requests</th>
- <th style="text-align: right;">Total Tokens</th>
- <th style="text-align: right;">Avg Prompt</th>
- <th style="text-align: right;">Max Prompt</th>
- <th style="text-align: right;">Avg Response Time</th>
- </tr>
- </thead>
- <tbody>
- `;
-
- stats.forEach(s => {
- const responseTime = s.avg_response_time_ms > 0
- ? `${formatNumber(s.avg_response_time_ms)} ms`
- : '<span class="ldr-text-muted">N/A</span>';
-
- html += `
- <tr>
- <td title="${escapeHtml(s.model)}">${escapeHtml(formatModelName(s.model))}</td>
- <td>${escapeHtml(formatProviderName(s.provider))}</td>
- <td style="text-align: right;">${formatNumber(s.total_requests)}</td>
- <td style="text-align: right; font-weight: bold;">${formatNumber(s.total_tokens)}</td>
- <td style="text-align: right;">${formatNumber(s.avg_prompt)}</td>
- <td style="text-align: right;">${formatNumber(s.max_prompt)}</td>
- <td style="text-align: right;">${responseTime}</td>
- </tr>
- `;
- });
-
- html += '</tbody></table></div>';
- container.innerHTML = html;
- }
// Create phase breakdown: box-plot + jittered scatter per phase
function createPhaseChart(chartData, phaseBreakdown) {
@@ -1077,26 +934,6 @@
container.appendChild(tableContainer);
}
- // Display context limits distribution
- function displayContextLimits(limits) {
- const container = document.getElementById('context-limits-list');
-
- if (limits.length === 0) {
- container.innerHTML = '<p style="color: var(--text-secondary);">No context limit data</p>';
- return;
- }
-
- container.innerHTML = '';
- limits.forEach(limit => {
- const item = document.createElement('div');
- item.style.cssText = 'display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid var(--border-color);';
- item.innerHTML = `
- <span>${formatNumber(limit.limit)} tokens</span>
- <span style="font-weight: 600;">${limit.count} requests</span>
- `;
- container.appendChild(item);
- });
- }
// Create main context scatter chart
function createContextChart(chartData, currentContextWindow) {
@@ -1459,51 +1296,6 @@
});
}
- // Create distribution chart
- function createDistributionChart(limits) {
- const ctx = document.getElementById('distribution-chart').getContext('2d');
-
- if (distributionChart) {
- distributionChart.destroy();
- }
-
- if (!limits || limits.length === 0) {
- return;
- }
-
- distributionChart = new Chart(ctx, {
- type: 'doughnut',
- data: {
- labels: limits.map(l => `${formatNumber(l.limit)} tokens`),
- datasets: [{
- data: limits.map(l => l.count),
- backgroundColor: [
- 'rgba(255, 99, 132, 0.8)',
- 'rgba(54, 162, 235, 0.8)',
- 'rgba(255, 205, 86, 0.8)',
- 'rgba(75, 192, 192, 0.8)',
- 'rgba(153, 102, 255, 0.8)'
- ]
- }]
- },
- options: {
- responsive: true,
- maintainAspectRatio: false,
- plugins: {
- legend: { position: 'right' },
- tooltip: {
- callbacks: {
- label: function(context) {
- const total = context.dataset.data.reduce((a, b) => a + b, 0);
- const percentage = ((context.parsed / total) * 100).toFixed(1);
- return `${context.label}: ${context.parsed} requests (${percentage}%)`;
- }
- }
- }
- }
- }
- });
- }
// Show error state
function showError() {