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.

Fix collapsing expanded text issue in benchmark results

LearningCircuitbea68b8b3e03
diff --git a/src/local_deep_research/web/templates/pages/benchmark.html b/src/local_deep_research/web/templates/pages/benchmark.html
index de813b2a1e..54f4f8f919 100644
--- a/src/local_deep_research/web/templates/pages/benchmark.html
+++ b/src/local_deep_research/web/templates/pages/benchmark.html
@@ -1578,6 +1578,17 @@ function displayRecentResults(results) {
return;
}
+ // Save expanded states before re-rendering
+ const expandedStates = {};
+ const allToggles = container.querySelectorAll('[id^="toggle-"]');
+ allToggles.forEach(toggle => {
+ const id = toggle.id.replace('toggle-', '');
+ const fullTextElement = document.getElementById(`full-${id}`);
+ if (fullTextElement && fullTextElement.style.display !== 'none') {
+ expandedStates[id] = true;
+ }
+ });
+
const resultsHtml = results.map((result, index) => {
const statusClass = result.is_correct ? 'correct' : 'incorrect';
const statusIcon = result.is_correct ? '<i class="fas fa-check-circle"></i>' : '<i class="fas fa-times-circle"></i>';
@@ -1590,10 +1601,12 @@ function displayRecentResults(results) {
if (text.length <= maxLength) return text;
const truncated = text.substring(0, maxLength) + '...';
+ const isExpanded = expandedStates[id] || false;
+
return `
- <span id="truncated-${id}">${truncated}</span>
- <span id="full-${id}" style="display: none;">${text}</span>
- <a href="#" onclick="toggleText('${id}'); return false;" id="toggle-${id}" style="color: #2196f3; font-size: 0.85rem; margin-left: 5px; text-decoration: underline;">Show more</a>
+ <span id="truncated-${id}" style="display: ${isExpanded ? 'none' : 'inline'};">${truncated}</span>
+ <span id="full-${id}" style="display: ${isExpanded ? 'inline' : 'none'};">${text}</span>
+ <a href="#" onclick="toggleText('${id}'); return false;" id="toggle-${id}" style="color: #2196f3; font-size: 0.85rem; margin-left: 5px; text-decoration: underline;">${isExpanded ? 'Show less' : 'Show more'}</a>
`;
};