~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
feat: Add comprehensive in-tool documentation with tooltips and help panels (#1503)
LearningCircuitae25a24af489
diff --git a/src/local_deep_research/web/static/css/help-system.css b/src/local_deep_research/web/static/css/help-system.cssnew file mode 100644index 0000000000..60dcd77d2d--- /dev/null+++ b/src/local_deep_research/web/static/css/help-system.css@@ -0,0 +1,544 @@+/* ============================================+ LDR Help System Styles+ Tooltips, Help Panels, and Documentation UI+ ============================================ */++/* ---------------------------------------------+ TOOLTIP SYSTEM+ --------------------------------------------- */++/* Base tooltip - text that shows tooltip on hover */+.ldr-help-tooltip {+ position: relative;+ cursor: help;+ /* No visual styling change - text looks normal */+}++/* Tooltip content - hidden by default, shown on hover */+.ldr-help-tooltip[data-tooltip]::after {+ content: attr(data-tooltip);+ position: absolute;+ bottom: calc(100% + 8px);+ left: 50%;+ transform: translateX(-50%);+ background-color: var(--bg-primary);+ color: var(--text-primary);+ padding: 0.6rem 0.85rem;+ border-radius: 8px;+ border: 1px solid var(--border-color);+ font-size: 0.82rem;+ font-weight: 400;+ line-height: 1.5;+ text-align: left;+ white-space: normal;+ width: max-content;+ max-width: 300px;+ z-index: 10000;+ opacity: 0;+ visibility: hidden;+ pointer-events: none;+ transition: opacity 0.2s ease, visibility 0.2s ease;+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);+}++/* Tooltip arrow */+.ldr-help-tooltip[data-tooltip]::before {+ content: '';+ position: absolute;+ bottom: calc(100% + 2px);+ left: 50%;+ transform: translateX(-50%);+ border: 6px solid transparent;+ border-top-color: var(--border-color);+ z-index: 10001;+ opacity: 0;+ visibility: hidden;+ pointer-events: none;+ transition: opacity 0.2s ease, visibility 0.2s ease;+}++/* Show tooltip on hover/focus */+.ldr-help-tooltip:hover::after,+.ldr-help-tooltip:hover::before,+.ldr-help-tooltip:focus::after,+.ldr-help-tooltip:focus::before {+ opacity: 1;+ visibility: visible;+}++/* Focus outline for accessibility */+.ldr-help-tooltip:focus-visible {+ outline: 2px solid var(--accent-primary);+ outline-offset: 2px;+ border-radius: 50%;+}++/* ---------------------------------------------+ TOOLTIP POSITION VARIANTS+ --------------------------------------------- */++/* Right position */+.ldr-help-tooltip--right[data-tooltip]::after {+ bottom: auto;+ top: 50%;+ left: calc(100% + 10px);+ transform: translateY(-50%);+}++.ldr-help-tooltip--right[data-tooltip]::before {+ bottom: auto;+ top: 50%;+ left: calc(100% + 4px);+ transform: translateY(-50%);+ border: 6px solid transparent;+ border-right-color: var(--border-color);+ border-top-color: transparent;+}++/* Left position */+.ldr-help-tooltip--left[data-tooltip]::after {+ bottom: auto;+ top: 50%;+ left: auto;+ right: calc(100% + 10px);+ transform: translateY(-50%);+}++.ldr-help-tooltip--left[data-tooltip]::before {+ bottom: auto;+ top: 50%;+ left: auto;+ right: calc(100% + 4px);+ transform: translateY(-50%);+ border: 6px solid transparent;+ border-left-color: var(--border-color);+ border-top-color: transparent;+}++/* Bottom position */+.ldr-help-tooltip--bottom[data-tooltip]::after {+ bottom: auto;+ top: calc(100% + 8px);+}++.ldr-help-tooltip--bottom[data-tooltip]::before {+ bottom: auto;+ top: calc(100% + 2px);+ border: 6px solid transparent;+ border-bottom-color: var(--border-color);+ border-top-color: transparent;+}++/* ---------------------------------------------+ INLINE TOOLTIP (for use inside text)+ --------------------------------------------- */++.ldr-inline-tooltip {+ border-bottom: 1px dashed var(--text-muted);+ cursor: help;+ position: relative;+}++.ldr-inline-tooltip:hover {+ border-bottom-color: var(--accent-tertiary);+ color: var(--accent-tertiary);+}++/* ---------------------------------------------+ HELP PANEL (Collapsible "How it works" sections)+ --------------------------------------------- */++.ldr-help-panel {+ background: linear-gradient(135deg, rgba(110, 79, 246, 0.06) 0%, rgba(64, 191, 255, 0.04) 100%);+ border: 1px solid var(--border-color);+ border-left: 3px solid var(--accent-primary);+ border-radius: 10px;+ margin-bottom: 1.5rem;+ overflow: hidden;+ transition: all 0.3s ease;+}++.ldr-help-panel:hover {+ border-color: rgba(110, 79, 246, 0.3);+}++/* Panel Header - clickable to toggle */+.ldr-help-panel-header {+ display: flex;+ align-items: center;+ justify-content: space-between;+ padding: 0.85rem 1.1rem;+ cursor: pointer;+ user-select: none;+ transition: background-color 0.2s ease;+}++.ldr-help-panel-header:hover {+ background-color: rgba(110, 79, 246, 0.08);+}++.ldr-help-panel-title {+ display: flex;+ align-items: center;+ gap: 0.6rem;+ font-weight: 500;+ font-size: 0.95rem;+ color: var(--text-primary);+}++.ldr-help-panel-title i {+ color: var(--accent-primary);+ font-size: 1rem;+}++.ldr-help-panel-toggle {+ color: var(--text-muted);+ font-size: 0.75rem;+ transition: transform 0.3s ease;+}++/* Collapsed state */+.ldr-help-panel.collapsed .ldr-help-panel-toggle {+ transform: rotate(-90deg);+}++/* Panel Content */+.ldr-help-panel-content {+ padding: 1rem 1.25rem 1.25rem;+ color: var(--text-secondary);+ font-size: 0.9rem;+ line-height: 1.65;+ border-top: 1px solid var(--border-color);+ max-height: 800px;+ opacity: 1;+ transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease;+}++.ldr-help-panel.collapsed .ldr-help-panel-content {+ max-height: 0;+ padding-top: 0;+ padding-bottom: 0;+ opacity: 0;+ border-top: none;+ overflow: hidden;+}++/* Content styling */+.ldr-help-panel-content p {+ margin: 0 0 0.75rem 0;+}++.ldr-help-panel-content p:last-child {+ margin-bottom: 0;+}++.ldr-help-panel-content ul {+ margin: 0.5rem 0;+ padding-left: 1.25rem;+}++.ldr-help-panel-content li {+ margin-bottom: 0.4rem;+}++.ldr-help-panel-content strong {+ color: var(--text-primary);+}++.ldr-help-panel-content code {+ background-color: var(--bg-tertiary);+ padding: 0.15rem 0.4rem;+ border-radius: 4px;+ font-size: 0.85em;+ color: var(--accent-secondary);+}++/* ---------------------------------------------+ HELP PANEL STEP LAYOUT+ --------------------------------------------- */++.ldr-help-steps {+ display: flex;+ flex-direction: column;+ gap: 0.9rem;+}++.ldr-help-step {+ display: flex;+ gap: 0.85rem;+ align-items: flex-start;+}++.ldr-help-step-num {+ width: 26px;+ height: 26px;+ min-width: 26px;+ background: var(--accent-primary);+ color: white;+ border-radius: 50%;+ display: flex;+ align-items: center;+ justify-content: center;+ font-size: 0.8rem;+ font-weight: 600;+}++.ldr-help-step-content {+ flex: 1;+}++.ldr-help-step-content strong {+ display: block;+ margin-bottom: 0.2rem;+ color: var(--text-primary);+}++.ldr-help-step-content p {+ margin: 0;+ color: var(--text-secondary);+}++/* ---------------------------------------------+ HELP TIP CALLOUT+ --------------------------------------------- */++.ldr-help-tip {+ display: flex;+ align-items: flex-start;+ gap: 0.7rem;+ padding: 0.85rem 1rem;+ background: rgba(64, 191, 255, 0.1);+ border-radius: 8px;+ margin-top: 0.75rem;+ font-size: 0.88rem;+}++.ldr-help-tip i {+ color: var(--accent-tertiary);+ margin-top: 0.1rem;+ flex-shrink: 0;+}++.ldr-help-tip strong {+ color: var(--accent-tertiary);+}++/* Warning variant */+.ldr-help-tip--warning {+ background: rgba(249, 188, 11, 0.1);+}++.ldr-help-tip--warning i,+.ldr-help-tip--warning strong {+ color: var(--warning-color);+}++/* ---------------------------------------------+ HELP CARDS (for storage modes, etc.)+ --------------------------------------------- */++.ldr-help-cards {+ display: grid;+ grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));+ gap: 0.75rem;+ margin: 0.75rem 0;+}++.ldr-help-card {+ padding: 0.85rem;+ border-radius: 8px;+ border-left: 3px solid;+}++.ldr-help-card-title {+ display: flex;+ align-items: center;+ gap: 0.4rem;+ font-weight: 600;+ margin-bottom: 0.35rem;+ font-size: 0.88rem;+}++.ldr-help-card-desc {+ font-size: 0.82rem;+ color: var(--text-secondary);+ line-height: 1.45;+ margin: 0;+}++/* Card variants */+.ldr-help-card--success {+ background: rgba(10, 207, 151, 0.1);+ border-left-color: var(--success-color);+}++.ldr-help-card--success .ldr-help-card-title {+ color: var(--success-color);+}++.ldr-help-card--warning {+ background: rgba(249, 188, 11, 0.1);+ border-left-color: var(--warning-color);+}++.ldr-help-card--warning .ldr-help-card-title {+ color: var(--warning-color);+}++.ldr-help-card--neutral {+ background: rgba(138, 138, 160, 0.1);+ border-left-color: var(--text-muted);+}++.ldr-help-card--neutral .ldr-help-card-title {+ color: var(--text-secondary);+}++.ldr-help-card--info {+ background: rgba(64, 191, 255, 0.1);+ border-left-color: var(--accent-tertiary);+}++.ldr-help-card--info .ldr-help-card-title {+ color: var(--accent-tertiary);+}++/* ---------------------------------------------+ PANEL DISMISS OPTION+ --------------------------------------------- */++.ldr-help-panel-dismiss {+ margin-top: 0.9rem;+ padding-top: 0.75rem;+ border-top: 1px dashed var(--border-color);+ font-size: 0.82rem;+ color: var(--text-muted);+}++.ldr-help-panel-dismiss label {+ display: flex;+ align-items: center;+ gap: 0.5rem;+ cursor: pointer;+ transition: color 0.2s;+}++.ldr-help-panel-dismiss label:hover {+ color: var(--text-secondary);+}++.ldr-help-panel-dismiss input[type="checkbox"] {+ width: 14px;+ height: 14px;+ cursor: pointer;+}++/* ---------------------------------------------+ LABEL WITH TOOLTIP+ --------------------------------------------- */++.ldr-label-with-tooltip {+ display: inline-flex;+ align-items: center;+ gap: 0.1rem;+}++/* ---------------------------------------------+ GLOSSARY TERM+ --------------------------------------------- */++.ldr-glossary-term {+ color: var(--accent-secondary);+ border-bottom: 1px dotted var(--accent-secondary);+ cursor: help;+ position: relative;+}++.ldr-glossary-term:hover {+ color: var(--accent-primary);+ border-bottom-color: var(--accent-primary);+}++/* ---------------------------------------------+ RESPONSIVE ADJUSTMENTS+ --------------------------------------------- */++@media (max-width: 767px) {+ /* Make tooltips work better on mobile */+ .ldr-help-tooltip[data-tooltip]::after {+ position: fixed;+ bottom: 70px;+ left: 1rem;+ right: 1rem;+ top: auto;+ transform: none;+ max-width: none;+ width: auto;+ text-align: center;+ }++ .ldr-help-tooltip[data-tooltip]::before {+ display: none;+ }++ /* Help panel adjustments */+ .ldr-help-panel-content {+ padding: 0.85rem 1rem 1rem;+ }++ .ldr-help-cards {+ grid-template-columns: 1fr;+ }++ /* Touch-friendly targets */+ .ldr-help-tooltip {+ min-width: 32px;+ min-height: 32px;+ display: inline-flex;+ align-items: center;+ justify-content: center;+ }++ .ldr-help-panel-header {+ padding: 1rem;+ }+}++/* ---------------------------------------------+ KEYBOARD HINTS DISPLAY+ --------------------------------------------- */++.ldr-keyboard-hint {+ display: inline-flex;+ align-items: center;+ gap: 0.3rem;+}++.ldr-keyboard-hint kbd {+ background: var(--bg-secondary);+ border: 1px solid var(--border-color);+ border-radius: 4px;+ padding: 0.1rem 0.35rem;+ font-size: 0.75rem;+ font-family: inherit;+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);+}++/* ---------------------------------------------+ PRIVACY NOTE+ --------------------------------------------- */++.ldr-privacy-note {+ display: flex;+ align-items: center;+ gap: 0.5rem;+ padding: 0.6rem 0.85rem;+ background: rgba(10, 207, 151, 0.08);+ border-radius: 6px;+ font-size: 0.82rem;+ color: var(--text-secondary);+}++.ldr-privacy-note i {+ color: var(--success-color);+}diff --git a/src/local_deep_research/web/static/js/services/help.js b/src/local_deep_research/web/static/js/services/help.jsnew file mode 100644index 0000000000..0e3c16ecaa--- /dev/null+++ b/src/local_deep_research/web/static/js/services/help.js@@ -0,0 +1,309 @@+/**+ * Help System Service+ * Manages collapsible help panels and dismissal preferences+ *+ * URL Security Note: This service only uses internal relative URLs (/settings/api/*)+ * for the SettingsManager API. No external URLs are handled.+ * URLValidator is not required as all URLs are hardcoded internal API paths.+ *+ * Dismissal preferences are stored in the backend via SettingsManager API+ * for consistency with other UI dismissals and encrypted storage.+ * Collapsed state uses localStorage for session persistence only.+ */++const HelpService = (function() {+ 'use strict';++ // Storage key prefix for dismissed panels (backend setting key)+ const STORAGE_PREFIX = 'app.ui.help_dismissed_';++ // Internal API base path (relative URL - no external URLs)+ const SETTINGS_API_BASE = '/settings/api/';++ // Cache for dismissed panel states+ let dismissedCache = {};+ let initialized = false;++ /**+ * Toggle a help panel's collapsed state+ * @param {string} panelId - The panel ID to toggle+ */+ function togglePanel(panelId) {+ const panel = document.getElementById('help-panel-' + panelId);+ if (!panel) {+ console.warn('Help panel not found:', panelId);+ return;+ }++ const isCollapsed = panel.classList.toggle('collapsed');+ const header = panel.querySelector('.ldr-help-panel-header');++ if (header) {+ header.setAttribute('aria-expanded', !isCollapsed);+ }++ // Store collapsed preference in localStorage for session persistence+ // (this is UI state, not a user preference, so localStorage is appropriate)+ try {+ localStorage.setItem('ldr_panel_collapsed_' + panelId, isCollapsed ? 'true' : 'false');+ } catch (e) {+ console.warn('Failed to save panel state:', e);+ }+ }++ /**+ * Dismiss a help panel permanently using the SettingsManager API+ * @param {string} panelId - The panel ID to dismiss+ */+ async function dismissPanel(panelId) {+ const settingKey = STORAGE_PREFIX + panelId;++ try {+ // Get CSRF token+ const csrfMeta = document.querySelector('meta[name="csrf-token"]');+ const csrfToken = csrfMeta ? csrfMeta.getAttribute('content') : '';++ if (!csrfToken) {+ console.warn('CSRF token not found, dismissal may fail');+ }++ // Save to settings via internal API (relative URL only)+ const apiUrl = SETTINGS_API_BASE + encodeURIComponent(settingKey);+ const response = await fetch(apiUrl, {+ method: 'PUT',+ headers: {+ 'Content-Type': 'application/json',+ 'X-CSRFToken': csrfToken+ },+ body: JSON.stringify({ value: true })+ });++ if (response.ok) {+ // Update cache+ dismissedCache[panelId] = true;++ // Hide the panel+ const panel = document.getElementById('help-panel-' + panelId);+ if (panel) {+ panel.style.display = 'none';+ }++ // Show confirmation+ if (window.ui && window.ui.showMessage) {+ window.ui.showMessage('Help panel dismissed', 'info');+ }+ } else {+ console.error('Failed to dismiss panel:', response.status);+ if (window.ui && window.ui.showMessage) {+ window.ui.showMessage('Failed to save preference', 'error');+ }+ }+ } catch (error) {+ console.error('Error dismissing panel:', error);+ if (window.ui && window.ui.showMessage) {+ window.ui.showMessage('Failed to save preference', 'error');+ }+ }+ }++ /**+ * Check if a panel has been dismissed (from cache)+ * @param {string} panelId - The panel ID to check+ * @returns {boolean} - True if dismissed+ */+ function isPanelDismissed(panelId) {+ // Check cache+ if (dismissedCache.hasOwnProperty(panelId)) {+ return dismissedCache[panelId];+ }++ return false;+ }++ /**+ * Load dismissed states from backend+ * @param {Array<string>} panelIds - List of panel IDs to check+ */+ async function loadDismissedStates(panelIds) {+ for (const panelId of panelIds) {+ const settingKey = STORAGE_PREFIX + panelId;+ try {+ const apiUrl = SETTINGS_API_BASE + encodeURIComponent(settingKey);+ const response = await fetch(apiUrl);+ if (response.ok) {+ const data = await response.json();+ if (data.value === true) {+ dismissedCache[panelId] = true;+ }+ }+ } catch (e) {+ // Ignore fetch errors for individual settings+ }+ }+ }++ /**+ * Initialize panel states from backend and localStorage+ */+ async function initPanelStates() {+ const panels = document.querySelectorAll('.ldr-help-panel');+ const panelIds = [];++ panels.forEach(panel => {+ const panelId = panel.getAttribute('data-panel-id');+ if (panelId) {+ panelIds.push(panelId);+ }+ });++ // Load dismissed states from backend+ await loadDismissedStates(panelIds);++ panels.forEach(panel => {+ const panelId = panel.getAttribute('data-panel-id');+ if (!panelId) return;++ // Check if panel was dismissed+ if (isPanelDismissed(panelId)) {+ panel.style.display = 'none';+ return;+ }++ // Restore collapsed state from localStorage (UI state only)+ try {+ const collapsed = localStorage.getItem('ldr_panel_collapsed_' + panelId);+ if (collapsed === 'true') {+ panel.classList.add('collapsed');+ const header = panel.querySelector('.ldr-help-panel-header');+ if (header) {+ header.setAttribute('aria-expanded', 'false');+ }+ } else if (collapsed === 'false') {+ panel.classList.remove('collapsed');+ const header = panel.querySelector('.ldr-help-panel-header');+ if (header) {+ header.setAttribute('aria-expanded', 'true');+ }+ }+ } catch (e) {+ // Ignore localStorage errors+ }+ });+ }++ /**+ * Reset all dismissed panels (for testing or user request)+ */+ async function resetDismissedPanels() {+ const panels = document.querySelectorAll('.ldr-help-panel');++ // Get CSRF token+ const csrfMeta = document.querySelector('meta[name="csrf-token"]');+ const csrfToken = csrfMeta ? csrfMeta.getAttribute('content') : '';++ for (const panel of panels) {+ const panelId = panel.getAttribute('data-panel-id');+ if (!panelId) continue;++ const settingKey = STORAGE_PREFIX + panelId;++ try {+ // Delete from backend+ const apiUrl = SETTINGS_API_BASE + encodeURIComponent(settingKey);+ await fetch(apiUrl, {+ method: 'DELETE',+ headers: {+ 'X-CSRFToken': csrfToken+ }+ });+ } catch (e) {+ console.warn('Failed to reset panel dismissal:', panelId, e);+ }+ }++ // Clear cache+ dismissedCache = {};++ // Show all hidden panels+ panels.forEach(panel => {+ panel.style.display = '';+ });++ if (window.ui && window.ui.showMessage) {+ window.ui.showMessage('Help panels reset', 'success');+ }+ }++ /**+ * Expand all help panels on the page+ */+ function expandAll() {+ document.querySelectorAll('.ldr-help-panel.collapsed').forEach(panel => {+ panel.classList.remove('collapsed');+ const header = panel.querySelector('.ldr-help-panel-header');+ if (header) {+ header.setAttribute('aria-expanded', 'true');+ }+ });+ }++ /**+ * Collapse all help panels on the page+ */+ function collapseAll() {+ document.querySelectorAll('.ldr-help-panel:not(.collapsed)').forEach(panel => {+ panel.classList.add('collapsed');+ const header = panel.querySelector('.ldr-help-panel-header');+ if (header) {+ header.setAttribute('aria-expanded', 'false');+ }+ });+ }++ /**+ * Initialize the help system+ */+ async function init() {+ if (initialized) return;++ // Initialize panel states (async to load from backend)+ await initPanelStates();++ // Add keyboard navigation for tooltips+ document.querySelectorAll('.ldr-help-tooltip').forEach(tooltip => {+ tooltip.addEventListener('keydown', function(e) {+ // Show tooltip on Enter or Space+ if (e.key === 'Enter' || e.key === ' ') {+ e.preventDefault();+ // Toggle aria-expanded for screen readers+ const expanded = this.getAttribute('aria-expanded') === 'true';+ this.setAttribute('aria-expanded', !expanded);+ }+ });+ });++ initialized = true;+ }++ // Auto-initialize when DOM is ready+ if (document.readyState === 'loading') {+ document.addEventListener('DOMContentLoaded', init);+ } else {+ // DOM is already ready+ init();+ }++ // Public API+ return {+ init: init,+ togglePanel: togglePanel,+ dismissPanel: dismissPanel,+ isPanelDismissed: isPanelDismissed,+ resetDismissedPanels: resetDismissedPanels,+ expandAll: expandAll,+ collapseAll: collapseAll+ };+})();++// Export for global access+window.HelpService = HelpService;diff --git a/src/local_deep_research/web/templates/base.html b/src/local_deep_research/web/templates/base.htmlindex 48489133bd..f2f993c6d7 100644--- a/src/local_deep_research/web/templates/base.html+++ b/src/local_deep_research/web/templates/base.html@@ -14,6 +14,7 @@<!-- Keep local styles that aren't in npm packages --><link rel="stylesheet" href="/static/css/styles.css">+ <link rel="stylesheet" href="/static/css/help-system.css"><link rel="stylesheet" href="/static/css/mobile-navigation.css"><link rel="stylesheet" href="/static/css/mobile-responsive.css">@@ -110,6 +111,7 @@<script src="/static/js/services/api.js"></script><script src="/static/js/services/socket.js"></script><script src="/static/js/services/keyboard.js"></script>+ <script src="/static/js/services/help.js"></script><!-- Security Utilities --><script src="/static/js/security/xss-protection.js"></script>diff --git a/src/local_deep_research/web/templates/components/help_macros.html b/src/local_deep_research/web/templates/components/help_macros.htmlnew file mode 100644index 0000000000..7abf06b3b6--- /dev/null+++ b/src/local_deep_research/web/templates/components/help_macros.html@@ -0,0 +1,183 @@+{# ============================================+ Help System Macros+ Reusable tooltip and help panel components+ ============================================ #}++{# ---------------------------------------------+ TOOLTIP MACRO+ Wraps text with hover tooltip++ Parameters:+ - label: The visible text to display+ - tip: The tooltip text shown on hover+ - position: 'top' (default), 'right', 'left', 'bottom'+ --------------------------------------------- #}+{% macro tooltip(label, tip, position='top') %}+<span class="ldr-help-tooltip{% if position != 'top' %} ldr-help-tooltip--{{ position }}{% endif %}"+ data-tooltip="{{ tip }}"+ tabindex="0"+ role="tooltip"+ aria-label="{{ tip }}">{{ label }}</span>+{%- endmacro %}++{# ---------------------------------------------+ LABEL WITH TOOLTIP MACRO+ Renders a label where the text itself has a tooltip++ Parameters:+ - label_text: The label text (will have tooltip on hover)+ - tooltip_text: The tooltip text shown on hover+ - for_id: The ID of the input (for label's 'for' attribute)+ - position: Tooltip position+ --------------------------------------------- #}+{% macro label_with_tooltip(label_text, tooltip_text, for_id=none, position='top') %}+<label{% if for_id %} for="{{ for_id }}"{% endif %}>{{ tooltip(label_text, tooltip_text, position) }}</label>+{%- endmacro %}++{# ---------------------------------------------+ HELP PANEL MACRO+ Renders a collapsible help panel++ Parameters:+ - panel_id: Unique ID for the panel+ - title: Panel title+ - icon: FontAwesome icon (default: 'question-circle')+ - collapsed: Start collapsed (default: true)+ - dismissible: Show "don't show again" option (default: false)++ Usage:+ {% call help_panel('research-how', 'How Research Works') %}+ <p>Your content here...</p>+ {% endcall %}+ --------------------------------------------- #}+{% macro help_panel(panel_id, title, icon='question-circle', collapsed=true, dismissible=false) %}+<div class="ldr-help-panel{% if collapsed %} collapsed{% endif %}"+ id="help-panel-{{ panel_id }}"+ data-panel-id="{{ panel_id }}">+ <div class="ldr-help-panel-header"+ role="button"+ tabindex="0"+ aria-expanded="{{ 'false' if collapsed else 'true' }}"+ aria-controls="help-panel-content-{{ panel_id }}"+ onclick="HelpService.togglePanel('{{ panel_id }}')"+ onkeydown="if(event.key==='Enter'||event.key===' '){event.preventDefault();HelpService.togglePanel('{{ panel_id }}');}">+ <div class="ldr-help-panel-title">+ <i class="{{ 'fas fa-' ~ icon }}" aria-hidden="true"></i>+ <span>{{ title }}</span>+ </div>+ <i class="fas fa-chevron-down ldr-help-panel-toggle" aria-hidden="true"></i>+ </div>+ <div class="ldr-help-panel-content" id="help-panel-content-{{ panel_id }}">+ {{ caller() }}+ {% if dismissible %}+ <div class="ldr-help-panel-dismiss">+ <label>+ <input type="checkbox"+ onchange="HelpService.dismissPanel('{{ panel_id }}')"+ aria-label="Don't show this help panel again">+ <span>Don't show this again</span>+ </label>+ </div>+ {% endif %}+ </div>+</div>+{%- endmacro %}++{# ---------------------------------------------+ HELP STEP MACRO+ Renders a numbered step in a help panel++ Parameters:+ - num: Step number+ - title: Step title+ - description: Step description+ --------------------------------------------- #}+{% macro help_step(num, title, description) %}+<div class="ldr-help-step">+ <span class="ldr-help-step-num">{{ num }}</span>+ <div class="ldr-help-step-content">+ <strong>{{ title }}</strong>+ <p>{{ description }}</p>+ </div>+</div>+{%- endmacro %}++{# ---------------------------------------------+ HELP TIP MACRO+ Renders a tip/note callout++ Parameters:+ - text: The tip text (can include HTML)+ - variant: 'info' (default), 'warning'+ --------------------------------------------- #}+{% macro help_tip(text, variant='info') %}+<div class="ldr-help-tip{% if variant == 'warning' %} ldr-help-tip--warning{% endif %}">+ <i class="fas fa-{% if variant == 'warning' %}exclamation-triangle{% else %}lightbulb{% endif %}" aria-hidden="true"></i>+ <span>{{ text|safe }}</span>+</div>+{%- endmacro %}++{# ---------------------------------------------+ HELP CARD MACRO+ Renders a help card (for storage modes, etc.)++ Parameters:+ - title: Card title+ - description: Card description+ - icon: FontAwesome icon+ - variant: 'success', 'warning', 'neutral', 'info'+ --------------------------------------------- #}+{% macro help_card(title, description, icon='circle', variant='neutral') %}+<div class="ldr-help-card ldr-help-card--{{ variant }}">+ <div class="ldr-help-card-title">+ <i class="{{ 'fas fa-' ~ icon }}" aria-hidden="true"></i>+ <span>{{ title }}</span>+ </div>+ <p class="ldr-help-card-desc">{{ description }}</p>+</div>+{%- endmacro %}++{# ---------------------------------------------+ PRIVACY NOTE MACRO+ Renders a privacy assurance note++ Parameters:+ - text: The privacy note text+ --------------------------------------------- #}+{% macro privacy_note(text='All data is stored locally on your device only.') %}+<div class="ldr-privacy-note">+ <i class="fas fa-shield-alt" aria-hidden="true"></i>+ <span>{{ text }}</span>+</div>+{%- endmacro %}++{# ---------------------------------------------+ GLOSSARY TERM MACRO+ Renders an inline term with tooltip definition++ Parameters:+ - term: The term to display+ - definition: The definition to show in tooltip+ --------------------------------------------- #}+{% macro glossary_term(term, definition) %}+<span class="ldr-glossary-term ldr-help-tooltip"+ data-tooltip="{{ definition }}"+ tabindex="0">{{ term }}</span>+{%- endmacro %}++{# ---------------------------------------------+ KEYBOARD HINT MACRO+ Renders a keyboard shortcut hint++ Parameters:+ - keys: List of keys, e.g., ['Ctrl', 'Enter']+ - description: What the shortcut does+ --------------------------------------------- #}+{% macro keyboard_hint(keys, description='') %}+<span class="ldr-keyboard-hint">+ {% for key in keys %}+ <kbd>{{ key }}</kbd>{% if not loop.last %}+{% endif %}+ {% endfor %}+ {% if description %}<span class="ldr-keyboard-hint-desc"> {{ description }}</span>{% endif %}+</span>+{%- endmacro %}diff --git a/src/local_deep_research/web/templates/pages/benchmark.html b/src/local_deep_research/web/templates/pages/benchmark.htmlindex 4a35b3f37e..40756afc92 100644--- a/src/local_deep_research/web/templates/pages/benchmark.html+++ b/src/local_deep_research/web/templates/pages/benchmark.html@@ -1,5 +1,6 @@{% extends "base.html" %}{% from "components/custom_dropdown.html" import render_dropdown %}+{% from "components/help_macros.html" import tooltip, help_panel, help_step, help_tip %}{% set active_page = 'benchmark' %}@@ -568,59 +569,23 @@</div><!-- Benchmark Usage Guidelines -->- <div class="ldr-benchmark-guidelines">- <div class="ldr-guidelines-content">- <div class="ldr-guidelines-text">- <h3 style="color: var(--primary-color); margin-bottom: 15px; font-size: 1.3rem;">- <i class="fas fa-info-circle"></i> Benchmark Guidelines- </h3>- <p style="margin-bottom: 12px; line-height: 1.6; color: #e0e0e0;">- <strong>Purpose:</strong> Benchmarks are designed to help you evaluate if your configuration works well, not for research papers or production use.- </p>- <p style="margin-bottom: 12px; line-height: 1.6; color: #e0e0e0;">- <strong>Responsible Usage:</strong> Please use reasonable example counts to avoid overwhelming search engines. The default of 75 examples provides a good balance for configuration testing.- </p>- <p style="margin-bottom: 18px; line-height: 1.6; color: #e0e0e0;">- <strong>Requirements:</strong> Benchmarks require an evaluation model for grading results. You can configure your preferred provider and model in the Evaluation Settings below. The default uses OpenRouter with Claude 3.7 Sonnet, but you can choose from various providers including OpenAI, Anthropic, or local models.- </p>- <div style="background: rgba(255, 167, 38, 0.1); border: 1px solid rgba(255, 167, 38, 0.3); padding: 15px; border-radius: 8px; margin-top: 15px;">- <h4 style="color: #ffa726; margin-bottom: 10px; font-size: 1rem; display: flex; align-items: center; gap: 8px;">- <i class="fas fa-search"></i> Search Engine Recommendations- </h4>- <ul style="margin: 0; padding-left: 20px; font-size: 0.95rem; line-height: 1.5; color: #e0e0e0;">- <li style="margin-bottom: 8px;"><strong style="color: #4caf50;">Tavily:</strong> Recommended for general knowledge benchmarks - AI-optimized search API, reliable results</li>- <li style="margin-bottom: 8px;"><strong style="color: #2196f3;">Brave:</strong> Independent search engine but unknown why performance is lower - could be smaller index, different ranking algorithm, or API limitations</li>- <li style="margin-bottom: 8px;"><strong style="color: #ff9800;">SearXNG:</strong> Often outperforms commercial APIs by aggregating multiple sources - shared resource, use moderate example counts</li>- <li style="margin-bottom: 8px;"><strong style="color: #f44336;">Specialized engines (ArXiv, PubMed, Wikipedia):</strong> Shared resources that are useless for general SimpleQA questions - should not be used for this test</li>- </ul>- <div style="background: rgba(33, 150, 243, 0.1); border: 1px solid rgba(33, 150, 243, 0.3); padding: 12px; border-radius: 6px; margin-top: 12px;">- <p style="margin: 0; font-size: 0.9rem; color: #e0e0e0;">- <strong style="color: #2196f3;">🔧 For Shared Resources:</strong> When using SearXNG or other shared engines, reduce iterations and questions per iteration in Settings to minimize load on shared infrastructure.- </p>- </div>- <div id="context-window-warning" style="display: none; background: rgba(255, 152, 0, 0.1); border: 1px solid rgba(255, 152, 0, 0.3); padding: 12px; border-radius: 6px; margin-top: 12px;">- <p style="margin: 0; font-size: 0.9rem; color: #e0e0e0;">- <strong style="color: #ff9800;">⚠️ Context Window Requirement:</strong> The "Focused Iteration" search strategy requires a high context window (probably 15k+ tokens) even for local models. Lower context windows may cause failures or incomplete results.- </p>- </div>- </div>- </div>- <div class="ldr-guidelines-sidebar">- <div style="font-size: 2.5rem; color: var(--primary-color); margin-bottom: 12px;">- <i class="fas fa-tachometer-alt"></i>- </div>- <div style="font-size: 1.2rem; font-weight: 600; color: #e0e0e0; margin-bottom: 8px;">- Quick Check- </div>- <div style="font-size: 0.9rem; color: #a0a0a0; line-height: 1.4; margin-bottom: 15px;">- Test your config with reasonable limits- </div>- <div style="background: rgba(var(--primary-color-rgb), 0.2); padding: 8px 12px; border-radius: 6px; font-size: 0.85rem; color: var(--primary-color); font-weight: 500;">- 🎯 Configuration Testing- </div>- </div>- </div>+ {% call help_panel('benchmark-guidelines', 'Benchmark Guidelines', icon='info-circle', collapsed=true) %}+ <p><strong>Purpose:</strong> Benchmarks help you evaluate if your configuration works well, not for research papers or production use.</p>+ <p><strong>Responsible Usage:</strong> Use reasonable example counts to avoid overwhelming search engines. Default of 75 examples is good for testing.</p>+ <p><strong>Requirements:</strong> Benchmarks require an evaluation model for grading. Configure in Evaluation Settings below. Default: OpenRouter with Claude 3.7 Sonnet.</p>++ <h4 style="margin-top: 1rem; margin-bottom: 0.5rem;"><i class="fas fa-search"></i> Search Engine Recommendations</h4>+ <ul style="margin: 0; padding-left: 20px;">+ <li><strong style="color: #4caf50;">Tavily:</strong> Recommended - AI-optimized, reliable results</li>+ <li><strong style="color: #2196f3;">Brave:</strong> Independent but lower performance</li>+ <li><strong style="color: #ff9800;">SearXNG:</strong> Aggregates multiple sources - shared resource, use moderate counts</li>+ <li><strong style="color: #f44336;">Specialized (ArXiv, PubMed, Wikipedia):</strong> Not useful for general SimpleQA</li>+ </ul>+ {{ help_tip("<strong>Shared Resources:</strong> When using SearXNG, reduce iterations and questions per iteration to minimize load.") }}+ <div id="context-window-warning" style="display: none; margin-top: 0.75rem; padding: 0.75rem; background: rgba(255, 152, 0, 0.1); border: 1px solid rgba(255, 152, 0, 0.3); border-radius: 6px;">+ <strong style="color: #ff9800;">⚠️ Context Window:</strong> "Focused Iteration" strategy requires 15k+ token context window.</div>+ {% endcall %}<!-- Alert container --><div id="benchmark-alert" class="ldr-settings-alert-container" style="display:none"></div>diff --git a/src/local_deep_research/web/templates/pages/collection_details.html b/src/local_deep_research/web/templates/pages/collection_details.htmlindex 27ee948d73..1272902f99 100644--- a/src/local_deep_research/web/templates/pages/collection_details.html+++ b/src/local_deep_research/web/templates/pages/collection_details.html@@ -1,4 +1,5 @@{% extends "base.html" %}+{% from "components/help_macros.html" import tooltip, help_panel, help_step, help_tip %}{% block title %}Collection Details{% endblock %}@@ -26,16 +27,16 @@</div><div class="ldr-collection-actions-grid">- <a href="/library/collections/{{ collection_id }}/upload" class="ldr-btn-collections ldr-btn-collections-primary ldr-btn-lg ldr-btn-featured">+ <a href="/library/collections/{{ collection_id }}/upload" class="ldr-btn-collections ldr-btn-collections-primary ldr-btn-lg ldr-btn-featured" title="Add PDF, TXT, MD, or HTML files to this collection"><i class="fas fa-upload"></i> Upload Files</a>- <button id="index-collection-btn" class="ldr-btn-collections ldr-btn-collections-success ldr-btn-lg">+ <button id="index-collection-btn" class="ldr-btn-collections ldr-btn-collections-success ldr-btn-lg" title="Create searchable embeddings for unindexed documents"><i class="fas fa-sync"></i> Index All Documents</button>- <button id="reindex-collection-btn" class="ldr-btn-collections ldr-btn-collections-warning ldr-btn-lg">+ <button id="reindex-collection-btn" class="ldr-btn-collections ldr-btn-collections-warning ldr-btn-lg" title="Re-process all documents. Use after changing embedding settings."><i class="fas fa-redo"></i> Re-Index All Documents</button>- <button id="delete-collection-btn" class="ldr-btn-collections ldr-btn-collections-danger ldr-btn-lg">+ <button id="delete-collection-btn" class="ldr-btn-collections ldr-btn-collections-danger ldr-btn-lg" title="Delete this collection. Documents remain in library but embeddings are removed."><i class="fas fa-trash"></i> Delete Collection</button></div>@@ -48,29 +49,40 @@</div><div class="ldr-stats-grid">- <div class="ldr-stat-card">+ <div class="ldr-stat-card" title="All documents in this collection (indexed + unindexed)"><div class="ldr-stat-value" id="stat-total-docs">-</div><div class="ldr-stat-label">Total Documents</div></div>- <div class="ldr-stat-card ldr-stat-success">+ <div class="ldr-stat-card ldr-stat-success" title="Documents processed and searchable via semantic search"><div class="ldr-stat-value" id="stat-indexed-docs">-</div><div class="ldr-stat-label">Indexed Documents</div></div>- <div class="ldr-stat-card ldr-stat-warning">+ <div class="ldr-stat-card ldr-stat-warning" title="Documents waiting to be indexed. Click 'Index All' to process."><div class="ldr-stat-value" id="stat-unindexed-docs">-</div><div class="ldr-stat-label">Not Indexed</div></div>- <div class="ldr-stat-card">+ <div class="ldr-stat-card" title="Text chunks created for search. More chunks = more granular search results."><div class="ldr-stat-value" id="stat-total-chunks">-</div><div class="ldr-stat-label">Total Chunks</div></div></div></div>+ <!-- Understanding RAG Indexing Help Panel -->+ {% call help_panel('rag-indexing', 'Understanding RAG Indexing', icon='brain', collapsed=true, dismissible=true) %}+ <div class="ldr-help-steps">+ {{ help_step(1, "Text Extraction", "Documents are parsed and text content is extracted from PDFs, HTML, Markdown, etc.") }}+ {{ help_step(2, "Chunking", "Text is split into smaller pieces (chunks) for more precise search results.") }}+ {{ help_step(3, "Embedding", "Each chunk is converted to a vector (list of numbers) that captures its meaning.") }}+ {{ help_step(4, "Semantic Search", "When you search, your query is also converted to a vector, and the most similar chunks are returned.") }}+ </div>+ {{ help_tip("<strong>Why index?</strong> Semantic search finds content by meaning, not just keywords. 'car' matches 'automobile', 'vehicle', etc.") }}+ {% endcall %}+<!-- Embedding Settings --><div class="ldr-rag-section"><div class="ldr-section-header">- <h2><i class="fas fa-brain"></i> Embedding Settings</h2>+ <h2><i class="fas fa-brain"></i> {{ tooltip("Embedding Settings", "Locked because changing these requires re-processing ALL documents (can take hours). Set globally in Settings → Embeddings before creating collections.") }}</h2></div><div class="ldr-embedding-settings-card">diff --git a/src/local_deep_research/web/templates/pages/collections.html b/src/local_deep_research/web/templates/pages/collections.htmlindex 417ca0dfef..48321c8dc8 100644--- a/src/local_deep_research/web/templates/pages/collections.html+++ b/src/local_deep_research/web/templates/pages/collections.html@@ -1,4 +1,5 @@{% extends "base.html" %}+{% from "components/help_macros.html" import tooltip, help_panel, help_step, help_tip %}{% block extra_head %}<link rel="stylesheet" href="/static/css/collections.css">@@ -8,9 +9,20 @@<div class="ldr-rag-manager-container"><div class="ldr-rag-header"><h1><i class="fas fa-folder-open"></i> Document Collections</h1>- <p class="ldr-subtitle">Manage your document collections for RAG-enabled searches</p>+ <p class="ldr-subtitle">Manage your document collections for {{ tooltip("RAG-enabled searches", "Upload your documents, index them, then select a collection as 'search engine' when researching. AI will search YOUR files instead of the web.") }}</p></div>+ <!-- How Collections Work Help Panel -->+ {% call help_panel('collections-how', 'Understanding Document Collections', icon='folder-open', collapsed=true, dismissible=true) %}+ <div class="ldr-help-steps">+ {{ help_step(1, "Create Collections", "Collections are folders for organizing your documents by topic, project, or any criteria you choose.") }}+ {{ help_step(2, "Upload Documents", "Add PDF, TXT, MD, or HTML files. Text is extracted and stored securely in your database.") }}+ {{ help_step(3, "Index for Search", "Indexing converts documents into searchable embeddings. This enables semantic search by meaning, not just keywords.") }}+ {{ help_step(4, "Use in Research", "Select a collection as your search engine when starting research to search your own documents instead of the web.") }}+ </div>+ {{ help_tip("<strong>Tip:</strong> The default 'Library' collection automatically contains all documents. Create custom collections for specific topics.") }}+ {% endcall %}+<!-- Collections Section --><div class="ldr-rag-section"><div class="ldr-section-header">diff --git a/src/local_deep_research/web/templates/pages/context_overflow.html b/src/local_deep_research/web/templates/pages/context_overflow.htmlindex 9ae648ef66..fe0dc299da 100644--- a/src/local_deep_research/web/templates/pages/context_overflow.html+++ b/src/local_deep_research/web/templates/pages/context_overflow.html@@ -1,4 +1,5 @@{% extends "base.html" %}+{% from "components/help_macros.html" import tooltip, help_panel, help_step, help_tip %}{% set active_page = 'metrics' %}@@ -299,6 +300,16 @@</div></div>+ <!-- Understanding Context Limits Help Panel -->+ {% call help_panel('context-how', 'Understanding Context Limits', icon='exclamation-triangle', collapsed=true, dismissible=true) %}+ <div class="ldr-help-steps">+ {{ help_step(1, "Context Window", "Every AI model has a limit on how much text it can process at once (measured in tokens). This is the 'context window'.") }}+ {{ help_step(2, "Truncation", "When your input exceeds the limit, text is cut off (truncated). High truncation means lost information.") }}+ {{ help_step(3, "Prevention", "Use larger-context models, reduce query size, or be more specific in your research questions.") }}+ </div>+ {{ help_tip("<strong>Color guide:</strong> Green (<10% truncation) = Good. Orange (10-20%) = Monitor. Red (>20%) = Action needed.") }}+ {% endcall %}+<div id="loading" class="ldr-loading-spinner" style="text-align: center; padding: 3rem;"><i class="fas fa-spinner fa-spin fa-2x"></i><p>Loading context overflow data...</p>diff --git a/src/local_deep_research/web/templates/pages/cost_analytics.html b/src/local_deep_research/web/templates/pages/cost_analytics.htmlindex 4789cd8f13..7dccb6203e 100644--- a/src/local_deep_research/web/templates/pages/cost_analytics.html+++ b/src/local_deep_research/web/templates/pages/cost_analytics.html@@ -1,4 +1,5 @@{% extends "base.html" %}+{% from "components/help_macros.html" import tooltip, help_panel, help_step, help_tip, privacy_note %}{% set active_page = 'metrics' %}@@ -482,6 +483,16 @@</div></div>+ <!-- Cost Analytics Help Panel -->+ {% call help_panel('cost-how', 'Understanding Cost Estimates', icon='dollar-sign', collapsed=true, dismissible=true) %}+ <div class="ldr-help-steps">+ {{ help_step(1, "Estimation Only", "Costs are calculated from token counts and public pricing. Refer to your provider's billing for exact charges.") }}+ {{ help_step(2, "Local = Free", "Models running locally (Ollama, LM Studio) show $0.00 - they use your hardware, not API calls.") }}+ {{ help_step(3, "Input vs Output", "Input tokens = your query + context. Output tokens = AI response. Output tokens typically cost 2-4x more.") }}+ </div>+ {{ help_tip("<strong>Save money:</strong> Use local models for exploratory research, and cloud models for final reports needing maximum quality.") }}+ {% endcall %}+<!-- Loading State --><div id="loading" class="ldr-loading"><i class="fas fa-spinner fa-spin"></i>diff --git a/src/local_deep_research/web/templates/pages/download_manager.html b/src/local_deep_research/web/templates/pages/download_manager.htmlindex 301b5a1ec5..f674d60a32 100644--- a/src/local_deep_research/web/templates/pages/download_manager.html+++ b/src/local_deep_research/web/templates/pages/download_manager.html@@ -1,4 +1,5 @@{% extends "base.html" %}+{% from "components/help_macros.html" import tooltip, help_panel, help_step, help_tip %}{% block title %}Download Manager{% endblock %}@@ -47,6 +48,17 @@</div></div>+ <!-- Download Manager Help Panel -->+ {% call help_panel('download-how', 'Using the Download Manager', icon='download', collapsed=true, dismissible=true) %}+ <div class="ldr-help-steps">+ {{ help_step(1, "Source Tracking", "Research sessions automatically track all cited sources (PDFs, papers, articles).") }}+ {{ help_step(2, "Bulk Download", "Select multiple research sessions and download all their PDFs at once.") }}+ {{ help_step(3, "Text Only Option", "Extract just the text without saving PDFs. Saves storage while keeping content searchable.") }}+ {{ help_step(4, "Target Collection", "Choose which collection to add downloaded documents to for organized searching.") }}+ </div>+ {{ help_tip("<strong>Tip:</strong> Use 'Text Only' for initial exploration, then download PDFs for papers you want to keep permanently.") }}+ {% endcall %}+<!-- Library Storage Settings Info --><div class="ldr-library-settings-info"><div class="ldr-info-banner">diff --git a/src/local_deep_research/web/templates/pages/embedding_settings.html b/src/local_deep_research/web/templates/pages/embedding_settings.htmlindex 4f847b93c0..7fef065ce4 100644--- a/src/local_deep_research/web/templates/pages/embedding_settings.html+++ b/src/local_deep_research/web/templates/pages/embedding_settings.html@@ -1,4 +1,5 @@{% extends "base.html" %}+{% from "components/help_macros.html" import tooltip, help_panel, help_step, help_tip, glossary_term %}{% block title %}Embedding Settings{% endblock %}@@ -9,6 +10,17 @@<p class="ldr-subtitle">Configure default embedding models for new collections and semantic search</p></div>+ <!-- Understanding Embeddings Help Panel -->+ {% call help_panel('embedding-how', 'Understanding Embeddings', icon='brain', collapsed=true, dismissible=true) %}+ <div class="ldr-help-steps">+ {{ help_step(1, "What are Embeddings?", "Embeddings convert text into numbers (vectors) that capture meaning. Similar concepts have similar vectors.") }}+ {{ help_step(2, "Chunk Size", "Larger chunks = more context per search result but less precision. Smaller = more granular but may lose context.") }}+ {{ help_step(3, "Text Splitter", "Recursive: uses natural breaks. Semantic: AI-powered grouping (slower). Token-based: respects LLM limits.") }}+ {{ help_step(4, "Why Lock Settings?", "Mixing different embedding models causes inconsistent search results. Each collection uses one model.") }}+ </div>+ {{ help_tip("<strong>Recommended:</strong> Start with defaults. Only change if you understand the trade-offs.") }}+ {% endcall %}+<!-- Important Warning --><div class="ldr-alert ldr-alert-warning" style="margin-bottom: 2rem;"><div style="display: flex; align-items: flex-start; gap: 1rem;">@@ -76,12 +88,12 @@<div class="ldr-form-row"><div class="ldr-form-group ldr-col-md-6">- <label for="chunk-size">Chunk Size</label>+ <label for="chunk-size">{{ tooltip("Chunk Size", "Larger chunks (1000+) keep more context but search is less precise. Smaller chunks (500-) are more granular but may cut off important context.") }}</label><input type="number" id="chunk-size" class="ldr-form-control" value="1000" min="100" max="5000" step="100"><small class="ldr-form-text ldr-text-muted">Characters per chunk</small></div><div class="ldr-form-group ldr-col-md-6">- <label for="chunk-overlap">Chunk Overlap</label>+ <label for="chunk-overlap">{{ tooltip("Chunk Overlap", "Characters shared between adjacent chunks. Prevents important info from being cut at boundaries. Usually 10-20% of chunk size.") }}</label><input type="number" id="chunk-overlap" class="ldr-form-control" value="200" min="0" max="1000" step="50"><small class="ldr-form-text ldr-text-muted">Overlap between chunks</small></div>@@ -89,7 +101,7 @@<div class="ldr-form-row"><div class="ldr-form-group ldr-col-md-6">- <label for="splitter-type">Text Splitter Type</label>+ <label for="splitter-type">{{ tooltip("Text Splitter Type", "How to divide documents. Recursive: natural breaks (paragraphs, sentences). Semantic: AI groups related content (slow but smart). Token: respects model limits.") }}</label><select id="splitter-type" class="ldr-form-control"><option value="recursive">Recursive (Default - uses separators)</option><option value="token">Token-based (Good for LLM context)</option>@@ -112,7 +124,7 @@</small></div><div class="ldr-form-group ldr-col-md-6">- <label for="index-type">Index Type</label>+ <label for="index-type">{{ tooltip("Index Type", "Flat: exact but slow for large collections. HNSW: approximate but 50x faster for >10K docs. IVF: good balance for frequently updated collections.") }}</label><select id="index-type" class="ldr-form-control"><option value="flat">Flat (Exact search, <10K docs)</option><option value="hnsw">HNSW (Fast, large collections)</option>diff --git a/src/local_deep_research/web/templates/pages/library.html b/src/local_deep_research/web/templates/pages/library.htmlindex 3f24601c08..df685df619 100644--- a/src/local_deep_research/web/templates/pages/library.html+++ b/src/local_deep_research/web/templates/pages/library.html@@ -1,4 +1,5 @@{% extends "base.html" %}+{% from "components/help_macros.html" import tooltip, help_panel, help_step, help_tip, help_card %}{% block title %}Research Library{% endblock %}@@ -61,7 +62,7 @@</div><div class="status-item">- <span class="status-label">PDF Storage:</span>+ <span class="status-label">{{ tooltip("PDF Storage:", "Database: Encrypted, most secure. Filesystem: Unencrypted files on disk - use only if you need external tool access. Text Only: Smallest footprint, no original PDFs kept.") }}</span>{% if pdf_storage_mode == 'database' %}<button class="btn btn-sm btn-success" onclick="showStorageModeModal()" title="Click to change storage mode"><i class="fas fa-database"></i> Database (Encrypted)@@ -84,6 +85,22 @@</div></div>+ <!-- How Library Works Help Panel -->+ {% call help_panel('library-how', 'How the Research Library Works', icon='book', collapsed=true, dismissible=true) %}+ <div class="ldr-help-steps">+ {{ help_step(1, "Research Sources", "When you run research, all discovered sources (PDFs, papers, articles) are automatically tracked.") }}+ {{ help_step(2, "Download to Library", "Use 'Get All Research PDFs' to download PDFs from tracked sources. Use 'Text Only' for just searchable text.") }}+ {{ help_step(3, "Organize with Collections", "Create collections to group documents by topic. The Library shows all documents; Collections are custom groupings.") }}+ {{ help_step(4, "Search via RAG", "Index collections to enable semantic search. When researching, select a collection as your search engine to search your documents.") }}+ </div>+ <div class="ldr-help-cards">+ {{ help_card("Database Storage", "PDFs encrypted in your database. Most secure and portable.", icon="database", variant="success") }}+ {{ help_card("Filesystem Storage", "PDFs stored on disk. Faster for large files but unencrypted.", icon="hdd", variant="warning") }}+ {{ help_card("Text Only", "Only extracted text is stored. Smallest footprint, no PDF viewing.", icon="file-alt", variant="neutral") }}+ </div>+ {{ help_tip("<strong>Tip:</strong> Use 'Sync Library' after moving or deleting files manually to update the database.") }}+ {% endcall %}+<!-- Filters Section --><div class="filters-section"><div class="filter-row">diff --git a/src/local_deep_research/web/templates/pages/link_analytics.html b/src/local_deep_research/web/templates/pages/link_analytics.htmlindex 8ebbe95150..a0428bea85 100644--- a/src/local_deep_research/web/templates/pages/link_analytics.html+++ b/src/local_deep_research/web/templates/pages/link_analytics.html@@ -1,4 +1,5 @@{% extends "base.html" %}+{% from "components/help_macros.html" import tooltip, help_panel, help_step, help_tip %}{% block title %}Link Analytics - Deep Research System{% endblock %}@@ -503,6 +504,16 @@</div></div>+ <!-- Understanding Link Analytics Help Panel -->+ {% call help_panel('links-how', 'Understanding Link Analytics', icon='link', collapsed=true, dismissible=true) %}+ <div class="ldr-help-steps">+ {{ help_step(1, "Source Tracking", "Every source cited in your research is tracked, showing which domains provide the most information.") }}+ {{ help_step(2, "Domain Diversity", "Higher diversity means your research draws from many different sources, reducing single-source bias.") }}+ {{ help_step(3, "AI Classification", "Classify domains as academic, news, reference, etc. to understand your source composition.") }}+ </div>+ {{ help_tip("<strong>Tip:</strong> If one domain dominates your research, consider adding more diverse search engines to get varied perspectives.") }}+ {% endcall %}+<div id="loading" class="ldr-loading"><div>Loading link analytics data...</div></div>diff --git a/src/local_deep_research/web/templates/pages/metrics.html b/src/local_deep_research/web/templates/pages/metrics.htmlindex dc689fee9b..1fbb8d21b3 100644--- a/src/local_deep_research/web/templates/pages/metrics.html+++ b/src/local_deep_research/web/templates/pages/metrics.html@@ -1,4 +1,5 @@{% extends "base.html" %}+{% from "components/help_macros.html" import tooltip, help_panel, help_step, help_tip, privacy_note %}{% set active_page = 'metrics' %}@@ -424,6 +425,17 @@</div></div>+ <!-- Understanding Metrics Help Panel -->+ {% call help_panel('metrics-how', 'Understanding Metrics', icon='tachometer-alt', collapsed=true, dismissible=true) %}+ <div class="ldr-help-steps">+ {{ help_step(1, "Token Usage", "Tokens are pieces of text (roughly 4 characters or 3/4 of a word). Higher token counts = longer research but more thorough results.") }}+ {{ help_step(2, "Cost Estimates", "Costs are calculated from token usage and model pricing. Local models (Ollama) show $0.00 as they run on your hardware.") }}+ {{ help_step(3, "Performance", "Response time and success rate help identify slow or problematic model configurations.") }}+ {{ help_step(4, "Ratings", "Your satisfaction ratings help track which models and settings produce the best results for your needs.") }}+ </div>+ {{ privacy_note("All metrics are calculated locally. Your usage data never leaves your device.") }}+ {% endcall %}+<div id="loading" class="ldr-loading-spinner"><i class="fas fa-spinner fa-spin fa-2x"></i><p>Loading metrics...</p>diff --git a/src/local_deep_research/web/templates/pages/news.html b/src/local_deep_research/web/templates/pages/news.htmlindex 31453d41b5..a63355a3b9 100644--- a/src/local_deep_research/web/templates/pages/news.html+++ b/src/local_deep_research/web/templates/pages/news.html@@ -1,5 +1,6 @@{% extends "base.html" %}{% from "components/custom_dropdown.html" import render_dropdown %}+{% from "components/help_macros.html" import tooltip, help_panel, help_step, help_tip %}{% block title %}LDR News - AI-Powered Research Feed{% endblock %}diff --git a/src/local_deep_research/web/templates/pages/research.html b/src/local_deep_research/web/templates/pages/research.htmlindex 81334961b7..2f167224c7 100644--- a/src/local_deep_research/web/templates/pages/research.html+++ b/src/local_deep_research/web/templates/pages/research.html@@ -1,5 +1,6 @@{% extends "base.html" %}{% from "components/custom_dropdown.html" import render_dropdown %}+{% from "components/help_macros.html" import tooltip, help_panel, help_step, help_tip, label_with_tooltip %}{% set active_page = 'new-research' %}@@ -80,40 +81,40 @@<div class="ldr-form-row"><!-- Model Provider Selection --><div class="ldr-form-group ldr-half">- <label for="model_provider">Model Provider</label>+ <label for="model_provider">{{ tooltip("Model Provider", "Local (Ollama, LM Studio): Free, private, runs on your hardware but slower. Cloud (OpenAI, Anthropic): Faster, smarter, but costs per request and sends data externally.") }}</label><select id="model_provider" name="model_provider" class="ldr-form-control" data-initial-value="{{ settings.llm_provider }}"><!-- Will be populated dynamically --><option value="">Loading providers...</option></select>- <span class="ldr-input-help">Select the LLM provider to use</span>+ <span class="ldr-input-help">Local = runs on your computer | Cloud = external API</span></div><!-- Custom Endpoint (hidden by default) --><div class="ldr-form-group ldr-half" id="endpoint_container" style="display: none;">- <label for="custom_endpoint">Custom Endpoint</label>+ <label for="custom_endpoint">{{ tooltip("Custom Endpoint", "OpenAI-compatible API URL. Must include /v1 path (e.g., https://api.example.com/v1). Used for self-hosted or alternative API providers.") }}</label><input type="text" id="custom_endpoint" name="custom_endpoint" class="ldr-form-control" placeholder="https://your-endpoint-url/v1" value="{{ settings.llm_openai_endpoint_url }}"><span class="ldr-input-help">Enter the OpenAI-compatible API endpoint URL</span></div><!-- Ollama URL (hidden by default) --><div class="ldr-form-group ldr-half" id="ollama_url_container" style="display: none;">- <label for="ollama_url">Ollama Endpoint</label>+ <label for="ollama_url">{{ tooltip("Ollama Endpoint", "Where Ollama is running. Default localhost:11434. If connection fails, check that Ollama is installed and running (ollama serve).") }}</label><input type="text" id="ollama_url" name="ollama_url" class="ldr-form-control" placeholder="http://localhost:11434" value="{{ settings.llm_ollama_url }}"><span class="ldr-input-help">Enter the Ollama endpoint URL</span></div><!-- LM Studio URL (hidden by default) --><div class="ldr-form-group ldr-half" id="lmstudio_url_container" style="display: none;">- <label for="lmstudio_url">LM Studio Endpoint</label>+ <label for="lmstudio_url">{{ tooltip("LM Studio Endpoint", "Where LM Studio server is running. Default localhost:1234. Enable 'Local Server' in LM Studio settings first.") }}</label><input type="text" id="lmstudio_url" name="lmstudio_url" class="ldr-form-control" placeholder="http://localhost:1234" value="{{ settings.llm_lmstudio_url }}"><span class="ldr-input-help">Enter the LM Studio endpoint URL</span></div><!-- Context Window Size (for local providers, hidden by default) --><div class="ldr-form-group ldr-half" id="context_window_container" style="display: none;">- <label for="context_window">Context Window Size</label>+ <label for="context_window">{{ tooltip("Context Window Size", "How much text the model can 'see' at once. Too small: model forgets earlier info. Too large: uses more RAM/VRAM. Only adjust if you see 'context exceeded' errors.") }}</label><input type="number" id="context_window" name="context_window" class="ldr-form-control" min="512" max="131072" step="512" value="{{ settings.llm_local_context_window_size }}">- <span class="ldr-input-help">Context window size in tokens (num_ctx)</span>+ <span class="ldr-input-help">Context window size in tokens (512-131072)</span></div></div>@@ -150,31 +151,31 @@<div class="ldr-form-row"><!-- Search Iterations --><div class="ldr-form-group ldr-half">- <label for="iterations">Search Iterations</label>+ <label for="iterations">{{ tooltip("Search Iterations", "Each cycle: AI generates follow-up questions based on what it found, then searches again. Searches run in parallel. More iterations = deeper coverage but longer wait.") }}</label><input type="number" id="iterations" name="iterations" class="ldr-form-control" min="1" value="{{ settings.search_iterations }}">- <span class="ldr-input-help">Number of research cycles to perform</span>+ <span class="ldr-input-help">More iterations = deeper research, longer time</span></div><!-- Questions Per Iteration --><div class="ldr-form-group ldr-half">- <label for="questions_per_iteration">Questions Per Iteration</label>+ <label for="questions_per_iteration">{{ tooltip("Questions Per Iteration", "Follow-up questions per cycle. Multiplies with iterations: 3 questions × 4 iterations = 12 searches. More = broader but slower/costlier.") }}</label><input type="number" id="questions_per_iteration" name="questions_per_iteration" class="ldr-form-control" min="1" value="{{ settings.search_questions_per_iteration }}">- <span class="ldr-input-help">Follow-up questions in each cycle</span>+ <span class="ldr-input-help">More questions = broader coverage, more API calls</span></div></div><div class="ldr-form-row"><!-- Search Strategy --><div class="ldr-form-group ldr-half">- <label for="strategy">Search Strategy</label>+ <label for="strategy">{{ tooltip("Search Strategy", "Source-Based: Full report with inline citations. Focused Quick: Concise Q&A. Focused Comprehensive: Detailed answer with citations. Topic Organization: Groups results by theme.") }}</label><select id="strategy" name="strategy" class="ldr-form-control">- <option value="source-based" {% if settings.search_strategy == 'source-based' %}selected{% endif %}>Source-Based (~70% SimpleQA, Comprehensive Research & Text Creation)</option>- <option value="focused-iteration" {% if settings.search_strategy == 'focused-iteration' %}selected{% endif %}>Focused Iteration - Quick (~95% SimpleQA, Fast & Precise Q&A)</option>- <option value="focused-iteration-standard" {% if settings.search_strategy == 'focused-iteration-standard' %}selected{% endif %}>Focused Iteration - Comprehensive (Detailed long-form output with citations)</option>- <option value="iterative-refinement" {% if settings.search_strategy == 'iterative-refinement' %}selected{% endif %}>Experimental: Iterative Refinement (LLM-guided progressive refinement)</option>- <option value="topic-organization" {% if settings.search_strategy == 'topic-organization' %}selected{% endif %}>Experimental: Topic Organization (Clusters sources into topics with lead texts)</option>+ <option value="source-based" {% if settings.search_strategy == 'source-based' %}selected{% endif %}>Source-Based (Comprehensive research with citations)</option>+ <option value="focused-iteration" {% if settings.search_strategy == 'focused-iteration' %}selected{% endif %}>Focused Iteration - Quick (Fast & precise Q&A)</option>+ <option value="focused-iteration-standard" {% if settings.search_strategy == 'focused-iteration-standard' %}selected{% endif %}>Focused Iteration - Comprehensive (Detailed with citations)</option>+ <option value="iterative-refinement" {% if settings.search_strategy == 'iterative-refinement' %}selected{% endif %}>Iterative Refinement (Progressive refinement)</option>+ <option value="topic-organization" {% if settings.search_strategy == 'topic-organization' %}selected{% endif %}>Topic Organization (Clusters by topic)</option></select>- <span class="ldr-input-help">Source-Based: Proven for detailed research. Focused Iteration Quick: Fast precise Q&A. Focused Iteration Comprehensive: Detailed long-form with citations. Iterative Refinement: LLM-guided progressive refinement.</span>+ <span class="ldr-input-help">Choose how research is organized and presented</span></div></div>@@ -195,6 +196,17 @@</div></div></form>++ <!-- How Research Works Help Panel -->+ {% call help_panel('research-workflow', 'How Research Works', icon='lightbulb', collapsed=true, dismissible=true) %}+ <div class="ldr-help-steps">+ {{ help_step(1, "Query Analysis", "Your research question is analyzed to identify key concepts and generate initial search queries.") }}+ {{ help_step(2, "Source Discovery", "The search engine finds relevant sources. Each iteration generates follow-up questions to explore the topic deeper.") }}+ {{ help_step(3, "Content Analysis", "The AI reads and analyzes each source, extracting key information relevant to your query.") }}+ {{ help_step(4, "Report Generation", "Findings are synthesized into a comprehensive report with citations and references.") }}+ </div>+ {{ help_tip("<strong>Tip:</strong> For academic research, select ArXiv or PubMed as your search engine. For general topics, SearXNG provides the broadest coverage.") }}+ {% endcall %}</div></div></div>diff --git a/src/local_deep_research/web/templates/pages/results.html b/src/local_deep_research/web/templates/pages/results.htmlindex c948c804e2..bd68ec2911 100644--- a/src/local_deep_research/web/templates/pages/results.html+++ b/src/local_deep_research/web/templates/pages/results.html@@ -1,4 +1,5 @@{% extends "base.html" %}+{% from "components/help_macros.html" import tooltip %}{% block title %}Research Results - Deep Research System{% endblock %}@@ -9,14 +10,14 @@<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 ldr-btn-outline" id="view-metrics-btn"><i class="fas fa-chart-bar"></i> View Metrics</button>- <button class="btn ldr-btn-outline" id="download-pdf-btn"><i class="fas fa-file-pdf"></i> Download PDF</button>- <button class="btn ldr-btn-outline" id="export-markdown-btn"><i class="fas fa-file-alt"></i> Export Markdown</button>- <button class="btn ldr-btn-outline" id="export-latex-btn"><i class="fas fa-file-code"></i> Export LaTeX</button>- <button class="btn ldr-btn-outline" id="export-quarto-btn"><i class="fas fa-file-code"></i> Export Quarto</button>- <button class="btn ldr-btn-outline" id="export-ris-btn"><i class="fas fa-file-export"></i> Export RIS (Zotero)</button>- <button class="btn ldr-btn-outline" id="report-issue-btn"><i class="fas fa-hands-helping"></i> Help Improve</button>+ <button class="btn btn-primary" id="ask-followup-btn" onclick="window.followUpResearch ? followUpResearch.showFollowUpModal() : alert('Follow-up feature loading...')" title="Ask a follow-up question using this research's sources and context"><i class="fas fa-question-circle"></i> Ask Follow-up Question</button>+ <button class="btn ldr-btn-outline" id="view-metrics-btn" title="View token usage and cost metrics for this research session"><i class="fas fa-chart-bar"></i> View Metrics</button>+ <button class="btn ldr-btn-outline" id="download-pdf-btn" title="Download as PDF document for sharing or printing"><i class="fas fa-file-pdf"></i> Download PDF</button>+ <button class="btn ldr-btn-outline" id="export-markdown-btn" title="Download as .md file for use in documentation or note apps"><i class="fas fa-file-alt"></i> Export Markdown</button>+ <button class="btn ldr-btn-outline" id="export-latex-btn" title="Download as .tex file for academic paper formatting"><i class="fas fa-file-code"></i> Export LaTeX</button>+ <button class="btn ldr-btn-outline" id="export-quarto-btn" title="Download as .qmd file for Quarto publishing system"><i class="fas fa-file-code"></i> Export Quarto</button>+ <button class="btn ldr-btn-outline" id="export-ris-btn" title="Download citation file for Zotero, Mendeley, or other reference managers"><i class="fas fa-file-export"></i> Export RIS (Zotero)</button>+ <button class="btn ldr-btn-outline" id="report-issue-btn" title="Report bugs, suggest features, or get help from the community"><i class="fas fa-hands-helping"></i> Help Improve</button><button class="btn ldr-btn-outline" id="back-to-history"><i class="fas fa-arrow-left"></i> Back to History</button></div></div>diff --git a/src/local_deep_research/web/templates/pages/star_reviews.html b/src/local_deep_research/web/templates/pages/star_reviews.htmlindex ff2ddfe494..2d6ce7460d 100644--- a/src/local_deep_research/web/templates/pages/star_reviews.html+++ b/src/local_deep_research/web/templates/pages/star_reviews.html@@ -1,4 +1,5 @@{% extends "base.html" %}+{% from "components/help_macros.html" import tooltip, help_panel, help_step, help_tip, privacy_note %}{% block title %}Star Reviews Analytics{% endblock %}@@ -364,6 +365,16 @@</select></div>+ <!-- Understanding Star Reviews Help Panel -->+ {% call help_panel('reviews-how', 'Understanding Star Reviews', icon='star', collapsed=true, dismissible=true) %}+ <div class="ldr-help-steps">+ {{ help_step(1, "Rate Your Research", "After viewing results, rate them 1-5 stars. This helps you track which settings produce best results.") }}+ {{ help_step(2, "Model Comparison", "See which AI models and search engines give you the highest satisfaction.") }}+ {{ help_step(3, "Improve Over Time", "Use insights to adjust settings - switch to models or engines that consistently rate higher.") }}+ </div>+ {{ privacy_note("All rating data is stored locally on your device only - never shared or sent anywhere.") }}+ {% endcall %}+<div id="loading" class="ldr-loading"><div>Loading star reviews data...</div></div>diff --git a/src/local_deep_research/web/templates/pages/subscriptions.html b/src/local_deep_research/web/templates/pages/subscriptions.htmlindex e9e1e83386..1ca610afae 100644--- a/src/local_deep_research/web/templates/pages/subscriptions.html+++ b/src/local_deep_research/web/templates/pages/subscriptions.html@@ -1,4 +1,5 @@{% extends "base.html" %}+{% from "components/help_macros.html" import tooltip, help_panel, help_step, help_tip %}{% set active_page = 'subscriptions' %}{% block title %}Manage News Subscriptions - LDR{% endblock %}@@ -63,6 +64,17 @@</div></div>+ <!-- Understanding Subscriptions Help Panel -->+ {% call help_panel('subs-how', 'Understanding News Subscriptions', icon='bell', collapsed=true, dismissible=true) %}+ <div class="ldr-help-steps">+ {{ help_step(1, "Create Topics", "Define research topics you want to track. The system searches for new content automatically.") }}+ {{ help_step(2, "Set Schedule", "Choose update frequency: hourly, daily, or weekly. Adjust based on topic volatility.") }}+ {{ help_step(3, "Get Updates", "New results appear in your news feed with priority indicators and impact scores.") }}+ {{ help_step(4, "Pause/Resume", "Temporarily pause subscriptions without losing settings. Resume anytime.") }}+ </div>+ {{ help_tip("<strong>Tip:</strong> Start with daily updates. Switch to hourly only for fast-moving topics to avoid API overuse.") }}+ {% endcall %}+<!-- Stats Overview --><div class="ldr-stats-overview"><div class="ldr-stat-card">