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: Update pre-commit hook to exclude test files and fix JS class prefixes

LearningCircuit47ee96425be3
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 93b1588aba..15b44feff6 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -92,6 +92,7 @@ repos:
entry: .pre-commit-hooks/check-css-class-prefix.py
language: script
files: \.(css|html|js|jsx|ts|tsx|mjs)$
+ exclude: (tests?/|spec\.|test\.|\.test\.|\.spec\.)
description: "Ensure all LDR-specific CSS classes are prefixed with 'ldr-' to prevent conflicts"
- id: check-sensitive-logging
name: Check for sensitive data in logging
diff --git a/fix_final_classes.sh b/fix_final_classes.sh
index 96ea7faf61..9b22b8d4e2 100755
--- a/fix_final_classes.sh
+++ b/fix_final_classes.sh
@@ -107,4 +107,4 @@ find src/local_deep_research/web/templates -name "*.html" -exec grep -l "detail-
sed -i "s/detail-ldr-progress-fill/ldr-detail-progress-fill/g" "$file"
done
-echo "Done!"
\ No newline at end of file
+echo "Done!"
diff --git a/src/local_deep_research/web/static/js/components/news.js b/src/local_deep_research/web/static/js/components/news.js
index 1cb2a33570..09ebea715c 100644
--- a/src/local_deep_research/web/static/js/components/news.js
+++ b/src/local_deep_research/web/static/js/components/news.js
@@ -15,7 +15,7 @@ function initializeSliders() {
const sliders = document.querySelectorAll('input[type="range"]');
sliders.forEach(slider => {
const valueDisplay = slider.nextElementSibling;
- if (valueDisplay && valueDisplay.classList.contains('slider-value')) {
+ if (valueDisplay && valueDisplay.classList.contains('ldr-slider-value')) {
slider.addEventListener('input', function() {
valueDisplay.textContent = this.value;
});
@@ -95,7 +95,7 @@ window.formatTimeAgo = function(timestamp) {
};
// Create tag element
-window.createTag = function(text, className = 'tag') {
+window.createTag = function(text, className = 'ldr-tag') {
const tag = document.createElement('span');
tag.className = className;
tag.textContent = text;
diff --git a/src/local_deep_research/web/static/js/components/settings.js b/src/local_deep_research/web/static/js/components/settings.js
index 16f093ff80..4e514d3f7f 100644
--- a/src/local_deep_research/web/static/js/components/settings.js
+++ b/src/local_deep_research/web/static/js/components/settings.js
@@ -810,7 +810,7 @@
// Check for validation errors in JSON textareas
let hasInvalidJson = false;
- document.querySelectorAll('.json-content').forEach(textarea => {
+ document.querySelectorAll('.ldr-json-content').forEach(textarea => {
try {
// Try to parse JSON to validate
JSON.parse(textarea.value);
@@ -885,7 +885,7 @@
* Initialize accordion behavior
*/
function initAccordions() {
- document.querySelectorAll('.settings-section-header').forEach(header => {
+ document.querySelectorAll('.ldr-settings-section-header').forEach(header => {
const targetId = header.dataset.target;
const target = document.getElementById(targetId);
@@ -899,7 +899,7 @@
target.style.display = header.classList.contains('collapsed') ? 'none' : 'block';
// Rotate chevron icon
- const icon = header.querySelector('.settings-toggle-icon i');
+ const icon = header.querySelector('.ldr-settings-toggle-icon i');
if (icon) {
icon.style.transform = header.classList.contains('collapsed') ? 'rotate(-90deg)' : '';
}
@@ -912,7 +912,7 @@
* Format JSON in textareas
*/
function initJsonFormatting() {
- document.querySelectorAll('.json-content').forEach(textarea => {
+ document.querySelectorAll('.ldr-json-content').forEach(textarea => {
const value = textarea.value.trim();
if (value && (value.startsWith('{') || value.startsWith('['))) {
@@ -971,7 +971,7 @@
const textarea = document.createElement('textarea');
textarea.id = input.id;
textarea.name = input.name;
- textarea.className = 'settings-textarea json-content';
+ textarea.className = 'ldr-settings-textarea ldr-json-content';
textarea.disabled = input.disabled;
try {
@@ -1324,11 +1324,11 @@
let html = `
<div class="settings-section data-location-section">
- <div class="settings-section-header" data-target="${sectionId}">
+ <div class="ldr-settings-section-header" data-target="${sectionId}">
<div class="settings-section-title">
<i class="fas fa-database"></i> Database & Encryption
</div>
- <div class="settings-toggle-icon">
+ <div class="ldr-settings-toggle-icon">
<i class="fas fa-chevron-down"></i>
</div>
</div>
@@ -1763,11 +1763,11 @@
html += `
<div class="settings-section">
- <div class="settings-section-header" data-target="${sectionId}">
+ <div class="ldr-settings-section-header" data-target="${sectionId}">
<div class="settings-section-title" title="${category}">
${category}
</div>
- <div class="settings-toggle-icon">
+ <div class="ldr-settings-toggle-icon">
<i class="fas fa-chevron-down"></i>
</div>
</div>
@@ -1836,14 +1836,14 @@
case 'textarea':
inputElement = `
<textarea id="${settingId}" name="${setting.key}"
- class="settings-textarea"
+ class="ldr-settings-textarea"
${!setting.editable ? 'disabled' : ''}
>${setting.value !== null ? setting.value : ''}</textarea>
`;
break;
case 'json':
- let jsonClass = ' json-content';
+ let jsonClass = ' ldr-json-content';
// Try to format the JSON for better display
try {
@@ -1865,7 +1865,7 @@
inputElement = `
<textarea id="${settingId}" name="${setting.key}"
- class="settings-textarea${jsonClass}"
+ class="ldr-settings-textarea${jsonClass}"
${!setting.editable ? 'disabled' : ''}
>${setting.value !== null ? setting.value : ''}</textarea>
`;
@@ -2166,11 +2166,11 @@
e.preventDefault();
// Clear any previous errors
- document.querySelectorAll('.settings-error').forEach(element => {
+ document.querySelectorAll('.ldr-settings-error').forEach(element => {
element.classList.remove('ldr-settings-error');
});
- document.querySelectorAll('.settings-error-message').forEach(element => {
+ document.querySelectorAll('.ldr-settings-error-message').forEach(element => {
element.remove();
});
@@ -2614,11 +2614,11 @@
html += `
<div class="settings-section">
- <div class="settings-section-header" data-target="${sectionId}">
+ <div class="ldr-settings-section-header" data-target="${sectionId}">
<div class="settings-section-title" title="${category}">
${category}
</div>
- <div class="settings-toggle-icon">
+ <div class="ldr-settings-toggle-icon">
<i class="fas fa-chevron-down"></i>
</div>
</div>
diff --git a/src/local_deep_research/web/static/js/services/socket.js b/src/local_deep_research/web/static/js/services/socket.js
index 3d474cbbbf..aadfcb37e3 100644
--- a/src/local_deep_research/web/static/js/services/socket.js
+++ b/src/local_deep_research/web/static/js/services/socket.js
@@ -727,7 +727,7 @@ window.socket = (function() {
console.log('Using socket.js filtering implementation for:', type);
// Update button UI
- const buttons = document.querySelectorAll('.filter-buttons .small-btn');
+ const buttons = document.querySelectorAll('.ldr-filter-buttons .ldr-small-btn');
buttons.forEach(button => {
button.classList.remove('selected');
if (button.textContent.toLowerCase() === type ||
@@ -764,7 +764,7 @@ window.socket = (function() {
// Update empty state message if needed
const logContainer = document.getElementById('console-log-container');
if (logContainer) {
- const visibleEntries = logContainer.querySelectorAll('.console-log-entry[style="display: ;"], .console-log-entry:not([style])');
+ const visibleEntries = logContainer.querySelectorAll('.ldr-console-log-entry[style="display: ;"], .ldr-console-log-entry:not([style])');
const emptyMessage = logContainer.querySelector('.ldr-empty-log-message');
if (visibleEntries.length === 0 && !emptyMessage) {
diff --git a/tests/ui_tests/test_autocomplete_selection.js b/tests/ui_tests/test_autocomplete_selection.js
index fad184cd48..d31099231d 100644
--- a/tests/ui_tests/test_autocomplete_selection.js
+++ b/tests/ui_tests/test_autocomplete_selection.js
@@ -57,9 +57,9 @@ async function runTests() {
// Wait for dropdown to appear
await page.waitForSelector('#model-dropdown-list', { visible: true });
- await page.waitForSelector('.custom-dropdown-item', { visible: true });
+ await page.waitForSelector('.ldr-custom-dropdown-item', { visible: true });
- const dropdownItems = await page.$$('.custom-dropdown-item');
+ const dropdownItems = await page.$$('.ldr-custom-dropdown-item');
console.log(` Found ${dropdownItems.length} model options`);
if (dropdownItems.length > 0) {
@@ -87,7 +87,7 @@ async function runTests() {
}
// Click the first filtered item
- const filteredItems = await page.$$('.custom-dropdown-item');
+ const filteredItems = await page.$$('.ldr-custom-dropdown-item');
if (filteredItems.length > 0) {
const itemToClick = await page.evaluate(el => el.textContent, filteredItems[0]);
console.log(` Clicking on: "${itemToClick}"`);
@@ -143,11 +143,11 @@ async function runTests() {
await page.waitForSelector('#search-engine-dropdown-list', { visible: true });
await page.waitForFunction(() => {
- const items = document.querySelectorAll('#search-engine-dropdown-list .custom-dropdown-item');
+ const items = document.querySelectorAll('#search-engine-dropdown-list .ldr-custom-dropdown-item');
return items.length > 0;
});
- const dropdownItems = await page.$$('#search-engine-dropdown-list .custom-dropdown-item');
+ const dropdownItems = await page.$$('#search-engine-dropdown-list .ldr-custom-dropdown-item');
console.log(` Found ${dropdownItems.length} search engine options`);
if (dropdownItems.length > 0) {
@@ -163,7 +163,7 @@ async function runTests() {
await page.waitForTimeout(500);
// Click the first filtered item
- const filteredItems = await page.$$('#search-engine-dropdown-list .custom-dropdown-item');
+ const filteredItems = await page.$$('#search-engine-dropdown-list .ldr-custom-dropdown-item');
if (filteredItems.length > 0) {
const itemToClick = await page.evaluate(el => el.textContent, filteredItems[0]);
console.log(` Clicking on: "${itemToClick}"`);
@@ -214,10 +214,10 @@ async function runTests() {
// Test with model dropdown
await page.waitForSelector('#model', { visible: true });
await page.click('#model');
- await page.waitForSelector('#model-dropdown-list .custom-dropdown-item', { visible: true });
+ await page.waitForSelector('#model-dropdown-list .ldr-custom-dropdown-item', { visible: true });
const itemCount = await page.evaluate(() => {
- return document.querySelectorAll('#model-dropdown-list .custom-dropdown-item').length;
+ return document.querySelectorAll('#model-dropdown-list .ldr-custom-dropdown-item').length;
});
console.log(` Found ${itemCount} items in dropdown`);
@@ -227,7 +227,7 @@ async function runTests() {
// Check if first item is highlighted
const firstItemActive = await page.evaluate(() => {
- const items = document.querySelectorAll('#model-dropdown-list .custom-dropdown-item');
+ const items = document.querySelectorAll('#model-dropdown-list .ldr-custom-dropdown-item');
return items[0] && items[0].classList.contains('active');
});
console.log(` First item highlighted: ${firstItemActive}`);
@@ -267,11 +267,11 @@ async function runTests() {
// Open model dropdown
await page.waitForSelector('#model', { visible: true });
await page.click('#model');
- await page.waitForSelector('#model-dropdown-list .custom-dropdown-item', { visible: true });
+ await page.waitForSelector('#model-dropdown-list .ldr-custom-dropdown-item', { visible: true });
// Get a model name to type
const firstModelText = await page.evaluate(() => {
- const firstItem = document.querySelector('#model-dropdown-list .custom-dropdown-item');
+ const firstItem = document.querySelector('#model-dropdown-list .ldr-custom-dropdown-item');
return firstItem ? firstItem.textContent : null;
});
diff --git a/tests/ui_tests/test_check_user_database.js b/tests/ui_tests/test_check_user_database.js
index 8e1385f9cd..4b98957ffd 100644
--- a/tests/ui_tests/test_check_user_database.js
+++ b/tests/ui_tests/test_check_user_database.js
@@ -45,7 +45,7 @@ async function checkUserDatabase() {
const historyContent = await page.evaluate(() => {
return {
- hasHistory: !!document.querySelector('.history-list, .research-item, #history-container'),
+ hasHistory: !!document.querySelector('.ldr-history-list, .research-item, #history-container'),
itemCount: document.querySelectorAll('.history-item, .research-item, .ldr-card').length,
hasError: !!document.querySelector('.alert-danger'),
errorText: document.querySelector('.alert-danger')?.textContent || '',
diff --git a/tests/ui_tests/test_full_navigation.js b/tests/ui_tests/test_full_navigation.js
index ebec81b0ba..e4b9b6c21e 100644
--- a/tests/ui_tests/test_full_navigation.js
+++ b/tests/ui_tests/test_full_navigation.js
@@ -34,7 +34,7 @@ async function testFullNavigation() {
{ path: '/', name: 'Home/Research', waitFor: '#query' },
{ path: '/settings/', name: 'Settings', waitFor: '.setting-item, form' },
{ path: '/metrics/', name: 'Metrics', waitFor: '#metrics-content, #loading' },
- { path: '/history/', name: 'History', waitFor: '#history-container, .history-list, .card' },
+ { path: '/history/', name: 'History', waitFor: '#history-container, .ldr-history-list, .card' },
{ path: '/benchmark/', name: 'Benchmark', waitFor: 'form, .benchmark-form' },
{ path: '/cost-analytics/', name: 'Cost Analytics', waitFor: '.cost-chart, canvas, #costChart' }
];
diff --git a/tests/ui_tests/test_history_page.js b/tests/ui_tests/test_history_page.js
index c24f1545b4..b5d5ca3c68 100644
--- a/tests/ui_tests/test_history_page.js
+++ b/tests/ui_tests/test_history_page.js
@@ -152,7 +152,7 @@ async function testHistoryPage() {
return {
title: document.title,
- hasHistoryContainer: !!document.querySelector('.history-container, .history-list, .research-history'),
+ hasHistoryContainer: !!document.querySelector('.ldr-history-container, .ldr-history-list, .research-history'),
itemCount: historyItems.length,
hasEmptyMessage: !!emptyMessage,
emptyMessageText: emptyMessage?.textContent || '',
diff --git a/tests/ui_tests/test_news_breaking_table.js b/tests/ui_tests/test_news_breaking_table.js
index d9849981be..4fd12d5465 100644
--- a/tests/ui_tests/test_news_breaking_table.js
+++ b/tests/ui_tests/test_news_breaking_table.js
@@ -226,13 +226,13 @@ async function testNewsBreakingTable() {
await new Promise(resolve => setTimeout(resolve, 5000));
// Check for news cards
- const newsCards = await page.$$('.news-card');
+ const newsCards = await page.$$('.ldr-news-card');
console.log(` Found ${newsCards.length} news cards`);
if (newsCards.length > 0) {
// Check if first card has a table
const hasTable = await page.evaluate(() => {
- const firstCard = document.querySelector('.news-card');
+ const firstCard = document.querySelector('.ldr-news-card');
return firstCard && firstCard.querySelector('table') !== null;
});
@@ -240,7 +240,7 @@ async function testNewsBreakingTable() {
if (hasTable) {
const tableInfo = await page.evaluate(() => {
- const firstCard = document.querySelector('.news-card');
+ const firstCard = document.querySelector('.ldr-news-card');
const table = firstCard.querySelector('table');
if (!table) return null;
diff --git a/tests/ui_tests/test_news_features_fixed.js b/tests/ui_tests/test_news_features_fixed.js
index 42ed56e30c..f95302a061 100644
--- a/tests/ui_tests/test_news_features_fixed.js
+++ b/tests/ui_tests/test_news_features_fixed.js
@@ -89,13 +89,13 @@ async function testNewsFeatures() {
await new Promise(resolve => setTimeout(resolve, 5000));
// Check for news items
- const newsItems = await page.$$('.news-item');
+ const newsItems = await page.$$('.ldr-news-item');
console.log(` Found ${newsItems.length} news items`);
if (newsItems.length > 0) {
// Check if Subscribe button exists
const hasSubscribeButton = await page.evaluate(() => {
- const buttons = document.querySelectorAll('.news-item button');
+ const buttons = document.querySelectorAll('.ldr-news-item button');
return Array.from(buttons).some(btn => btn.textContent.includes('Subscribe'));
});
diff --git a/tests/ui_tests/test_pages_browser.js b/tests/ui_tests/test_pages_browser.js
index d0343271dc..da4713baed 100644
--- a/tests/ui_tests/test_pages_browser.js
+++ b/tests/ui_tests/test_pages_browser.js
@@ -187,7 +187,7 @@ const historyPageTests = async (page) => {
const historyChecks = await page.evaluate(() => {
const historyContainer = document.getElementById('history-container') ||
- document.querySelector('.history-list') ||
+ document.querySelector('.ldr-history-list') ||
document.querySelector('[data-testid="history"]');
const searchInput = document.querySelector('input[type="search"]') ||
document.querySelector('input[placeholder*="search"]');
diff --git a/tests/ui_tests/test_research_cancellation.js b/tests/ui_tests/test_research_cancellation.js
index 94688866d8..1864138835 100644
--- a/tests/ui_tests/test_research_cancellation.js
+++ b/tests/ui_tests/test_research_cancellation.js
@@ -231,7 +231,7 @@ async function testCancellation() {
log('\n=== TEST 3: CANCELLED RESEARCH IN HISTORY ===', 'section');
await page.goto(`${BASE_URL}/history`);
- await page.waitForSelector('.history-container, .history-list');
+ await page.waitForSelector('.ldr-history-container, .ldr-history-list');
const cancelledItems = await page.evaluate(() => {
const items = [];
diff --git a/tests/ui_tests/test_research_results.js b/tests/ui_tests/test_research_results.js
index 0faf1548fa..3ca7b599c4 100644
--- a/tests/ui_tests/test_research_results.js
+++ b/tests/ui_tests/test_research_results.js
@@ -124,9 +124,9 @@ async function testResearchResults() {
await new Promise(resolve => setTimeout(resolve, 2000));
const historyPageInfo = await page.evaluate(() => {
- const hasHistoryContainer = !!document.querySelector('.history-container, .research-history, [class*="history"]');
+ const hasHistoryContainer = !!document.querySelector('.ldr-history-container, .research-history, [class*="history"]');
const hasSearchBox = !!document.querySelector('input[type="search"], input[placeholder*="search" i]');
- const hasResultsList = !!document.querySelector('.results-list, .history-list, ul, table');
+ const hasResultsList = !!document.querySelector('.results-list, .ldr-history-list, ul, table');
return {
hasHistoryContainer,