~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.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
Merge branch 'dev' into feature/research-library-issue-207
LearningCircuit90451925c765
diff --cc src/local_deep_research/web/static/js/components/history.jsindex a2fd78a811,54f191047c..9f0e0cd612--- a/src/local_deep_research/web/static/js/components/history.js+++ b/src/local_deep_research/web/static/js/components/history.js@@@ -345,10 -345,6 +345,10 @@@`<button class="btn btn-sm btn-outline view-btn"><i class="fas fa-eye"></i> View</button>` : ''}+ ${item.status === 'completed' && item.document_count > 0 ?- `<button class="btn btn-sm btn-outline library-btn">++ `<button class="btn btn-sm btn-outline ldr-library-btn">+ <i class="fas fa-book"></i> Library (${item.document_count})+ </button>` : ''}${isNewsItem && item.status === 'completed' ?`<button class="btn btn-sm btn-outline subscribe-btn" data-research-id="${item.id}" data-query="${encodeURIComponent(item.query)}"><i class="fas fa-bell"></i> Subscribe@@@ -364,15 -360,7 +364,15 @@@if (viewBtn) {viewBtn.addEventListener('click', (e) => {e.stopPropagation(); // Prevent item click-- window.location.href = URLBuilder.resultsPage(item.id);++ URLValidator.safeAssign(window.location, 'href', URLBuilder.resultsPage(item.id));+ });+ }+- const libraryBtn = itemEl.querySelector('.library-btn');++ const libraryBtn = itemEl.querySelector('.ldr-library-btn');+ if (libraryBtn) {+ libraryBtn.addEventListener('click', (e) => {+ e.stopPropagation(); // Prevent item click- window.location.href = `/library/?research=${item.id}`;++ URLValidator.safeAssign(window.location, 'href', `/library/?research=${item.id}`);});}@@@ -395,9 -383,9 +395,9 @@@// Add click event to the whole itemitemEl.addEventListener('click', () => {if (item.status === 'completed') {-- window.location.href = URLBuilder.resultsPage(item.id);++ URLValidator.safeAssign(window.location, 'href', URLBuilder.resultsPage(item.id));} else {-- window.location.href = URLBuilder.progressPage(item.id);++ URLValidator.safeAssign(window.location, 'href', URLBuilder.progressPage(item.id));}});@@@ -415,7 -403,7 +415,7 @@@name: item.query.substring(0, 50),source_id: item.id});-- window.location.href = `/news/subscriptions/new?${params.toString()}`;++ URLValidator.safeAssign(window.location, 'href', `/news/subscriptions/new?${params.toString()}`);}// Modal-based subscription removed - now redirects to dedicated form pagediff --cc src/local_deep_research/web/static/js/components/results.jsindex 90afbf8c4a,c363b92a98..3cee00b412--- a/src/local_deep_research/web/static/js/components/results.js+++ b/src/local_deep_research/web/static/js/components/results.js@@@ -66,7 -55,7 +66,7 @@@const metricsBtn = document.getElementById('view-metrics-btn');if (metricsBtn) {metricsBtn.addEventListener('click', () => {-- window.location.href = URLBuilder.detailsPage(researchId);++ URLValidator.safeAssign(window.location, 'href', URLBuilder.detailsPage(researchId));});}@@@ -102,7 -91,7 +102,7 @@@const backBtn = document.getElementById('back-to-history');if (backBtn) {backBtn.addEventListener('click', () => {-- window.location.href = URLS.PAGES.HISTORY;++ URLValidator.safeAssign(window.location, 'href', URLS.PAGES.HISTORY);});}@@@ -714,7 -703,7 +714,7 @@@// Create blob and trigger downloadconst blob = new Blob([fullMarkdown], { type: 'text/markdown' });const link = document.createElement('a');-- link.href = URL.createObjectURL(blob);++ URLValidator.safeAssign(link, 'href', URL.createObjectURL(blob));link.download = `research_${researchId}.md`;// Trigger download@@@ -765,7 -754,7 +765,7 @@@// Create download linkconst link = document.createElement('a');-- link.href = URL.createObjectURL(blob);++ URLValidator.safeAssign(link, 'href', URL.createObjectURL(blob));link.download = `research_${researchId}.${extension}`;// Trigger downloaddiff --cc src/local_deep_research/web/static/js/mobile-navigation.jsindex 0000000000,9f0599ecb1..e9eda00a15mode 000000,100644..100644--- a/src/local_deep_research/web/static/js/mobile-navigation.js+++ b/src/local_deep_research/web/static/js/mobile-navigation.js@@@ -1,0 -1,475 +1,479 @@@+ /**+ * Mobile Navigation - Non-module version+ * Provides bottom tab bar and sheet menu for mobile devices+ */++ (function() {+ 'use strict';++ class MobileNavigation {+ constructor(options = {}) {+ this.options = {+ breakpoint: 768,+ enableGestures: true,+ persistState: true,+ ...options+ };++ this.state = {+ activeTab: 'research',+ sheetOpen: false,+ isVisible: false+ };++ this.elements = {};+ this.initialized = false;+ }++ init() {+ if (this.initialized) return;++ // Check if we should show mobile nav+ this.checkViewport();++ // Create DOM elements+ this.createNavigation();++ // Attach event listeners+ this.attachEventListeners();++ // Handle resize events+ this.handleResize();++ // Restore saved state if enabled+ if (this.options.persistState) {+ this.restoreState();+ }++ this.initialized = true;+ console.log('Mobile navigation initialized');+ }++ checkViewport() {+ this.state.isVisible = window.innerWidth <= this.options.breakpoint;+ return this.state.isVisible;+ }++ createNavigation() {+ // Don't create if already exists- if (document.querySelector('.mobile-bottom-nav')) {- this.elements.nav = document.querySelector('.mobile-bottom-nav');- this.elements.sheet = document.querySelector('.mobile-sheet-menu');- this.elements.overlay = document.querySelector('.mobile-sheet-overlay');++ if (document.querySelector('.ldr-mobile-bottom-nav')) {++ this.elements.nav = document.querySelector('.ldr-mobile-bottom-nav');++ this.elements.sheet = document.querySelector('.ldr-mobile-sheet-menu');++ this.elements.overlay = document.querySelector('.ldr-mobile-sheet-overlay');+ return;+ }++ // Create bottom navigation+ this.createBottomNav();++ // Create sheet menu+ this.createSheetMenu();++ // Create overlay+ this.createOverlay();++ // Append to body+ document.body.appendChild(this.elements.nav);+ document.body.appendChild(this.elements.overlay);+ document.body.appendChild(this.elements.sheet);++ // Show if mobile+ if (this.state.isVisible) {+ this.toggle(true);+ }+ }++ createBottomNav() {+ const nav = document.createElement('nav');- nav.className = 'mobile-bottom-nav';++ nav.className = 'ldr-mobile-bottom-nav';+ nav.setAttribute('role', 'navigation');+ nav.setAttribute('aria-label', 'Mobile navigation');++ const tabs = [+ { id: 'research', icon: 'fas fa-search', label: 'Research', path: '/' },+ { id: 'history', icon: 'fas fa-history', label: 'History', path: '/history/' },- { id: 'metrics', icon: 'fas fa-chart-bar', label: 'Metrics', path: '/metrics/' },++ { id: 'library', icon: 'fas fa-book', label: 'Library', path: '/library/' },+ { id: 'news', icon: 'fas fa-newspaper', label: 'News', path: '/news/' },+ { id: 'more', icon: 'fas fa-bars', label: 'More', action: 'sheet' }+ ];++ nav.innerHTML = tabs.map(tab => `- <button class="mobile-nav-tab ${this.isCurrentPage(tab) ? 'active' : ''}"++ <button class="ldr-mobile-nav-tab ${this.isCurrentPage(tab) ? 'active' : ''}"+ data-tab-id="${tab.id}"+ data-action="${tab.action || 'navigate'}"+ data-path="${tab.path || ''}"+ role="tab"+ aria-selected="${this.isCurrentPage(tab) ? 'true' : 'false'}"+ aria-label="${tab.label}">+ <i class="${tab.icon}"></i>+ <span class="mobile-nav-label">${tab.label}</span>+ </button>+ `).join('');++ this.elements.nav = nav;+ }++ createSheetMenu() {+ const sheet = document.createElement('div');- sheet.className = 'mobile-sheet-menu';++ sheet.className = 'ldr-mobile-sheet-menu';+ sheet.setAttribute('role', 'dialog');+ sheet.setAttribute('aria-label', 'More options menu');+ sheet.setAttribute('aria-hidden', 'true');++ const username = this.getUsername();++ sheet.innerHTML = `- <div class="mobile-sheet-handle" aria-label="Drag to dismiss"></div>++ <div class="ldr-mobile-sheet-handle" aria-label="Drag to dismiss"></div>++ <div class="mobile-sheet-content">+ <!-- User Section -->+ <div class="mobile-sheet-section">+ <h3 class="mobile-sheet-title">Account</h3>+ <div class="mobile-sheet-items">+ <button class="mobile-sheet-item" data-item-id="user" data-action="#">+ <i class="fas fa-user"></i>+ <span class="mobile-sheet-label">${username}</span>+ </button>+ <button class="mobile-sheet-item" data-item-id="settings" data-action="/settings/">+ <i class="fas fa-cog"></i>+ <span class="mobile-sheet-label">Settings</span>+ </button>+ <button class="mobile-sheet-item" data-item-id="logout" data-action="#logout">+ <i class="fas fa-sign-out-alt"></i>+ <span class="mobile-sheet-label">Logout</span>+ </button>+ </div>+ </div>++ <!-- Features Section -->+ <div class="mobile-sheet-section">+ <h3 class="mobile-sheet-title">Features</h3>+ <div class="mobile-sheet-items">++ <button class="mobile-sheet-item" data-item-id="library" data-action="/library/">++ <i class="fas fa-book"></i>++ <span class="mobile-sheet-label">Library</span>++ </button>+ <button class="mobile-sheet-item" data-item-id="subscriptions" data-action="/subscriptions/">+ <i class="fas fa-bell"></i>+ <span class="mobile-sheet-label">Subscriptions</span>+ </button>+ <button class="mobile-sheet-item" data-item-id="benchmark" data-action="/benchmark/">+ <i class="fas fa-tachometer-alt"></i>+ <span class="mobile-sheet-label">Benchmark</span>+ </button>+ <button class="mobile-sheet-item" data-item-id="benchmark-results" data-action="/benchmark/results/">+ <i class="fas fa-chart-line"></i>+ <span class="mobile-sheet-label">Benchmark Results</span>+ </button>+ </div>+ </div>++ <!-- Help Section -->+ <div class="mobile-sheet-section">+ <h3 class="mobile-sheet-title">Help & Info</h3>+ <div class="mobile-sheet-items">+ <button class="mobile-sheet-item" data-item-id="help" data-action="#help">+ <i class="fas fa-question-circle"></i>+ <span class="mobile-sheet-label">Help</span>+ </button>+ <button class="mobile-sheet-item" data-item-id="about" data-action="#about">+ <i class="fas fa-info-circle"></i>+ <span class="mobile-sheet-label">About</span>+ </button>+ </div>+ </div>+ </div>+ `;++ this.elements.sheet = sheet;+ }++ createOverlay() {+ const overlay = document.createElement('div');- overlay.className = 'mobile-sheet-overlay';++ overlay.className = 'ldr-mobile-sheet-overlay';+ overlay.setAttribute('aria-hidden', 'true');+ this.elements.overlay = overlay;+ }++ attachEventListeners() {+ // Tab navigation+ if (this.elements.nav) {+ this.elements.nav.addEventListener('click', (e) => {+ const tab = e.target.closest('.mobile-nav-tab');+ if (!tab) return;++ const action = tab.dataset.action;+ const tabId = tab.dataset.tabId;++ if (action === 'sheet') {+ this.toggleSheet();+ } else {+ this.navigateToTab(tab.dataset.path);+ this.setActiveTab(tabId);+ }+ });+ }++ // Sheet menu items+ if (this.elements.sheet) {+ this.elements.sheet.addEventListener('click', (e) => {+ const item = e.target.closest('.mobile-sheet-item');+ if (!item) return;++ this.handleSheetItem(item.dataset.action, item.dataset.itemId);+ });+ }++ // Overlay click to close+ if (this.elements.overlay) {+ this.elements.overlay.addEventListener('click', () => {+ this.closeSheet();+ });+ }++ // Touch gestures for sheet+ if (this.options.enableGestures) {+ this.attachGestures();+ }+ }++ attachGestures() {+ if (!this.elements.sheet) return;++ let startY = 0;+ let currentY = 0;+ let isDragging = false;+- const handle = this.elements.sheet.querySelector('.mobile-sheet-handle');++ const handle = this.elements.sheet.querySelector('.ldr-mobile-sheet-handle');++ const handleTouchStart = (e) => {+ startY = e.touches[0].clientY;+ isDragging = true;+ this.elements.sheet.style.transition = 'none';+ };++ const handleTouchMove = (e) => {+ if (!isDragging) return;++ currentY = e.touches[0].clientY;+ const deltaY = currentY - startY;++ if (deltaY > 0) {+ this.elements.sheet.style.transform = `translateY(${deltaY}px)`;+ }+ };++ const handleTouchEnd = () => {+ if (!isDragging) return;++ isDragging = false;+ this.elements.sheet.style.transition = '';++ const deltaY = currentY - startY;+ const threshold = Math.min(100, this.elements.sheet.offsetHeight * 0.2);++ if (deltaY > threshold) {+ this.closeSheet();+ } else {+ this.elements.sheet.style.transform = '';+ }+ };++ if (handle) {+ handle.addEventListener('touchstart', handleTouchStart, { passive: true });+ handle.addEventListener('touchmove', handleTouchMove, { passive: true });+ handle.addEventListener('touchend', handleTouchEnd, { passive: true });+ }+ }++ handleResize() {+ let resizeTimer;++ window.addEventListener('resize', () => {+ clearTimeout(resizeTimer);+ resizeTimer = setTimeout(() => {+ const wasVisible = this.state.isVisible;+ this.checkViewport();++ if (wasVisible !== this.state.isVisible) {+ this.toggle(this.state.isVisible);++ if (!this.state.isVisible && this.state.sheetOpen) {+ this.closeSheet();+ }+ }+ }, 250);+ });+ }++ toggle(show) {+ if (show) {+ if (this.elements.nav) {+ this.elements.nav.classList.add('visible');+ }+ document.body.classList.add('has-mobile-nav');+ } else {+ if (this.elements.nav) {+ this.elements.nav.classList.remove('visible');+ }+ document.body.classList.remove('has-mobile-nav');+ }+ }++ navigateToTab(path) {+ if (path && path !== '#') {- window.location.href = path;++ URLValidator.safeAssign(window.location, 'href', path);+ }+ }++ setActiveTab(tabId) {+ if (this.elements.nav) {- this.elements.nav.querySelectorAll('.mobile-nav-tab').forEach(tab => {++ this.elements.nav.querySelectorAll('.ldr-mobile-nav-tab').forEach(tab => {+ tab.classList.remove('active');+ tab.setAttribute('aria-selected', 'false');+ });++ const activeTab = this.elements.nav.querySelector(`[data-tab-id="${tabId}"]`);+ if (activeTab) {+ activeTab.classList.add('active');+ activeTab.setAttribute('aria-selected', 'true');+ }+ }++ this.state.activeTab = tabId;+ this.saveState();+ }++ toggleSheet() {+ if (this.state.sheetOpen) {+ this.closeSheet();+ } else {+ this.openSheet();+ }+ }++ openSheet() {+ if (this.elements.sheet) {+ this.elements.sheet.classList.add('active');+ this.elements.sheet.setAttribute('aria-hidden', 'false');+ }+ if (this.elements.overlay) {+ this.elements.overlay.classList.add('active');+ this.elements.overlay.setAttribute('aria-hidden', 'false');+ }++ document.body.style.overflow = 'hidden';+ this.state.sheetOpen = true;+ }++ closeSheet() {+ if (this.elements.sheet) {+ this.elements.sheet.classList.remove('active');+ this.elements.sheet.setAttribute('aria-hidden', 'true');+ this.elements.sheet.style.transform = '';+ }+ if (this.elements.overlay) {+ this.elements.overlay.classList.remove('active');+ this.elements.overlay.setAttribute('aria-hidden', 'true');+ }++ document.body.style.overflow = '';+ this.state.sheetOpen = false;+ }++ handleSheetItem(action, itemId) {+ this.closeSheet();++ if (action === '#logout') {+ this.handleLogout();+ } else if (action === '#help') {+ alert('Help documentation coming soon!');+ } else if (action === '#about') {+ alert('Local Deep Research - Mobile Navigation v1.0');+ } else if (action && !action.startsWith('#')) {- window.location.href = action;++ URLValidator.safeAssign(window.location, 'href', action);+ }+ }++ handleLogout() {+ const logoutForm = document.getElementById('logout-form');+ if (logoutForm) {+ logoutForm.submit();+ }+ }++ getUsername() {- const userInfo = document.querySelector('.user-info');++ const userInfo = document.querySelector('.ldr-user-info');+ if (userInfo) {+ const text = userInfo.textContent || '';+ return text.trim().replace(/[^\w\s@._-]/g, '').trim() || 'User';+ }+ return 'User';+ }++ isCurrentPage(tab) {+ const currentPath = window.location.pathname;++ if (tab.id === 'research' && currentPath === '/') return true;+ if (tab.id === 'history' && currentPath.startsWith('/history')) return true;+ if (tab.id === 'metrics' && currentPath.startsWith('/metrics')) return true;+ if (tab.id === 'news' && currentPath.startsWith('/news')) return true;++ return false;+ }++ saveState() {+ if (!this.options.persistState) return;++ try {+ localStorage.setItem('mobileNavState', JSON.stringify({+ activeTab: this.state.activeTab+ }));+ } catch (e) {+ console.error('Failed to save mobile nav state:', e);+ }+ }++ restoreState() {+ if (!this.options.persistState) return;++ try {+ const saved = localStorage.getItem('mobileNavState');+ if (saved) {+ const state = JSON.parse(saved);+ if (state.activeTab) {+ this.setActiveTab(state.activeTab);+ }+ }+ } catch (e) {+ console.error('Failed to restore mobile nav state:', e);+ }+ }++ destroy() {+ if (this.elements.nav) this.elements.nav.remove();+ if (this.elements.sheet) this.elements.sheet.remove();+ if (this.elements.overlay) this.elements.overlay.remove();+ document.body.classList.remove('has-mobile-nav');+ this.initialized = false;+ }+ }++ // Initialize when DOM is ready+ function initMobileNav() {+ if (window.mobileNav) {+ window.mobileNav.destroy();+ }+ window.mobileNav = new MobileNavigation();+ window.mobileNav.init();+ }++ if (document.readyState === 'loading') {+ document.addEventListener('DOMContentLoaded', initMobileNav);+ } else {+ initMobileNav();+ }++ // Expose to global scope for debugging+ window.MobileNavigation = MobileNavigation;+ })();diff --cc src/local_deep_research/web/templates/pages/results.htmlindex 82477012b1,2a9c075ca0..3c4c1dbc79--- a/src/local_deep_research/web/templates/pages/results.html+++ b/src/local_deep_research/web/templates/pages/results.html@@@ -2,13 -2,12 +2,13 @@@{% block title %}Research Results - Deep Research System{% endblock %}+{% block content %}- <div class="page active" id="research-results">- <div class="page-header">- <div class="results-header">- <h1 class="page-title">Research Results</h1>- <div class="results-actions">+ <div class="ldr-page active" id="research-results">+ <div class="ldr-page-header">+ <div class="ldr-results-header">+ <h1 class="ldr-page-title">Research Results</h1>+ <div class="ldr-results-actions"><button class="btn btn-primary" id="ask-followup-btn" onclick="window.followUpResearch ? followUpResearch.showFollowUpModal() : alert('Follow-up feature loading...')"><i class="fas fa-question-circle"></i> Ask Follow-up Question</button><button class="btn btn-outline" id="view-metrics-btn"><i class="fas fa-chart-bar"></i> View Metrics</button><button class="btn btn-outline" id="download-pdf-btn"><i class="fas fa-file-pdf"></i> Download PDF</button>