~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
<!DOCTYPE html>
{# Hashed is the registered dark palette, preferred while light themes need refinement. #}
<html lang="en" data-theme="{{ default_theme }}">
<head>
<script nonce="{{ csp_nonce }}" data-template-token="{{ template_event_token }}" src="/static/js/security/template-events.js"></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="csrf-token" content="{{ csrf_token() }}">
<meta name="auth-context" content="{{ auth_context|default('', true) }}">
<meta name="user-id" content="{{ session.username|default('anonymous', true) }}">
<title>{% block title %}Deep Research System{% endblock %}</title>
<link rel="icon" type="image/png" href="/static/favicon.png">
<!-- FOUC Prevention: Apply theme before any rendering -->
<!-- Theme list is auto-detected from themes.css by ThemeHelper -->
<script nonce="{{ csp_nonce }}">
(function() {
// Auto-detected from CSS - no need to manually update this list
var validThemes = {{ get_themes_json() }};
// Store theme metadata for JavaScript (used by theme.js)
window.LDR_THEME_METADATA = {{ get_theme_metadata() }};
// Share the chosen Hashed dark default with theme.js for first renders
// without a saved preference while light themes need refinement.
window.LDR_DEFAULT_THEME = {{ default_theme|tojson }};
var userId = {{ session.username|default("anonymous", true)|tojson }};
var storageKey = 'ldr-theme-' + userId;
var theme = localStorage.getItem(storageKey) || window.LDR_DEFAULT_THEME;
// Validate theme
if (validThemes.indexOf(theme) === -1) {
theme = window.LDR_DEFAULT_THEME;
}
var effectiveTheme = theme;
if (theme === 'system') {
// Hashed's registered ID is "hashed"; System still resolves
// an explicit OS-dark preference to that dark palette.
effectiveTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'hashed' : 'light';
}
document.documentElement.setAttribute('data-theme', effectiveTheme);
})();
</script>
<!-- Vite HMR for development -->
{{ vite_hmr() }}
<!-- SafeLogger must load before app.js which uses it at init -->
<script src="/static/js/security/safe-logger.js"></script>
<!-- Load all vendor dependencies and styles through Vite -->
{{ vite_asset('js/app.js') }}
<!-- Keep local styles that aren't bundled by Vite -->
<!-- Note: styles.css is already bundled via app.js import; do not add a duplicate link -->
<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">
<!-- Theme overrides must load AFTER base styles to take precedence -->
<link rel="stylesheet" href="/static/css/themes.css">
<!--
Egress-scope visual cues
========================
Inline (not in styles.css) because styles.css is bundled by Vite —
editing the source doesn't take effect without a rebuild, and these
cues need to ship with the next reload. body[data-scope=…] is
server-rendered by base.html below from the user's saved
policy.egress_scope; JS on the research form updates it live when
the dropdown changes (see static/js/components/research.js).
Palette:
ADAPTIVE → no left-border accent (default; posture follows the
primary engine, so there is no fixed cue)
PUBLIC_ONLY → blue #3b82f6 (informational "public sources only")
PRIVATE_ONLY → teal #14a37f (privacy mode)
STRICT → violet #8b5cf6 (locked to a single engine)
UNPROTECTED → no accent on this card; its caution cue is the
light-red Privacy & Egress panel on the research
form (research.html) plus a non-dismissible banner.
A residual/legacy `both` is coerced to `adaptive` before render, so it
also falls through to the no-accent default below.
Risk ordering (data exfil): UNPROTECTED > PUBLIC_ONLY > STRICT/PRIVATE_ONLY.
UNPROTECTED is the riskiest — it disables egress-scope enforcement and
lifts the forced-local inference coupling. ADAPTIVE (default) carries no
fixed accent because its real posture depends on the primary engine.
PUBLIC_ONLY blocks local engines so local data never enters the
pipeline; that active choice is informational (blue), not a deeper
warning. The egress banners do the actual nag. Red intentionally
avoided on the card itself.
-->
<style nonce="{{ csp_nonce }}">
.ldr-card.ldr-research-card,
#chat-page,
.ldr-chat-container {
transition: border-left-color 0.2s ease, background-color 0.2s ease;
border-left: 5px solid transparent;
}
#query,
#chat-input {
transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
/* ADAPTIVE (default) and UNPROTECTED have NO body[data-scope] rule —
the transparent left border above stays, the textarea uses its
default border, and the egress banners do the nagging. (A legacy
`both` is coerced to `adaptive`, so it lands here too.) */
body[data-scope="public_only"] .ldr-card.ldr-research-card,
body[data-scope="public_only"] #chat-page,
body[data-scope="public_only"] .ldr-chat-container {
border-left-color: #3b82f6;
background-color: rgba(59, 130, 246, 0.03);
}
body[data-scope="public_only"] #query,
body[data-scope="public_only"] #chat-input {
border-color: #3b82f6;
box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.22);
}
body[data-scope="private_only"] .ldr-card.ldr-research-card,
body[data-scope="private_only"] #chat-page,
body[data-scope="private_only"] .ldr-chat-container {
border-left-color: #14a37f;
background-color: rgba(20, 163, 127, 0.03);
}
body[data-scope="private_only"] #query,
body[data-scope="private_only"] #chat-input {
border-color: #14a37f;
box-shadow: 0 0 0 1px rgba(20, 163, 127, 0.25);
}
body[data-scope="strict"] .ldr-card.ldr-research-card,
body[data-scope="strict"] #chat-page,
body[data-scope="strict"] .ldr-chat-container {
border-left-color: #8b5cf6;
background-color: rgba(139, 92, 246, 0.035);
}
body[data-scope="strict"] #query,
body[data-scope="strict"] #chat-input {
border-color: #8b5cf6;
box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.25);
}
</style>
<!-- Force hide sidebar on mobile with inline CSS for highest priority -->
<style nonce="{{ csp_nonce }}">
@media (max-width: 767px) {
/* Absolutely hide the desktop sidebar on mobile */
.ldr-sidebar:not(.active),
aside.ldr-sidebar:not(.active),
.ldr-app-container > aside {
display: none !important;
visibility: hidden !important;
width: 0 !important;
height: 0 !important;
position: absolute !important;
left: -9999px !important;
}
/* Ensure app container doesn't use flex on mobile */
.ldr-app-container {
display: block !important;
}
/* Main content takes full width */
.ldr-main-content {
margin-left: 0 !important;
width: 100% !important;
max-width: 100vw !important;
box-sizing: border-box !important;
overflow-x: hidden !important;
}
/* Top bar must not overflow viewport */
.ldr-top-bar {
max-width: 100vw !important;
box-sizing: border-box !important;
}
}
</style>
{% block extra_head %}{% endblock %}
</head>
<body data-scope="{{ egress_scope or 'adaptive' }}">
{{ vite_missing_assets_banner() }}
<!-- Skip to content link for keyboard/screen reader users -->
<a href="#main-content" class="ldr-skip-link">Skip to main content</a>
<div class="ldr-app-container">
<!-- Sidebar -->
{% include 'components/sidebar.html' %}
<!-- Main Content -->
<main id="main-content" class="ldr-main-content">
{% if session.username %}
<div class="ldr-top-bar">
<div class="ldr-top-bar-left">
<!-- Theme dropdown selector -->
<div class="ldr-theme-selector">
<i aria-hidden="true" class="fas fa-palette ldr-theme-icon"></i>
<select id="theme-dropdown" class="ldr-theme-dropdown"
title="Select theme" aria-label="Select color theme">
<!-- Options populated by theme.js -->
</select>
</div>
</div>
<div class="ldr-top-bar-right">
<div class="ldr-user-menu">
<span class="ldr-user-info">
<i aria-hidden="true" class="fas fa-user"></i> {{ session.username }}
</span>
<form action="{{ url_for('auth.logout') }}" method="POST" class="ldr-logout-form" id="logout-form" style="display: inline;">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
{# A link, not a submit button: this sits before every page's own form, so page-wide button[type="submit"] selectors would otherwise find Logout first. services/api.js handles the click. #}
<a href="#" class="ldr-logout-btn">
<i aria-hidden="true" class="fas fa-sign-out-alt"></i> Logout
</a>
</form>
</div>
</div>
</div>
{% endif %}
{% block content %}{% endblock %}
<!-- Collapsible Log Panel is included in specific pages -->
</main>
</div>
<!-- Mobile Tab Bar -->
{# Mobile navigation now handled dynamically by mobile-navigation.js #}
{# {% include 'components/mobile_nav.html' %} #}
<!-- Common Templates -->
{% block templates %}{% endblock %}
<!-- Scripts -->
<!-- Backend constants injected from Python (single source of truth) -->
<!-- Source: src/local_deep_research/constants.py::ResearchStatus -->
<!-- Injected by: src/local_deep_research/web/template_config.py (_LDRTemplates.TemplateResponse) -->
<!-- Consumed by: src/local_deep_research/web/static/js/config/constants.js (ResearchStates helpers) -->
<!-- Must remain a bare <script> (no defer) so window.* is set before defer-ed scripts run. -->
<script nonce="{{ csp_nonce }}">
window.RESEARCH_STATUS = Object.freeze({{ research_status_enum | tojson }}); // nosemgrep: generic.html-templates.security.var-in-script-tag.var-in-script-tag, reason: Jinja tojson escapes HTML delimiters
window.RESEARCH_TERMINAL_STATES = Object.freeze(new Set({{ research_terminal_states | tojson }})); // nosemgrep: generic.html-templates.security.var-in-script-tag.var-in-script-tag, reason: Jinja tojson escapes HTML delimiters
window.LDR_LOG_LIMITS = Object.freeze({{ log_limits | tojson }}); // nosemgrep: generic.html-templates.security.var-in-script-tag.var-in-script-tag, reason: Jinja tojson escapes HTML delimiters
window.LDR_LOCAL_SEARCH_DEFAULTS = Object.freeze({{ local_search_defaults | tojson }}); // nosemgrep: generic.html-templates.security.var-in-script-tag.var-in-script-tag, reason: Jinja tojson escapes HTML delimiters
</script>
<!-- Constants and URL Configuration -->
<script defer src="/static/js/config/constants.js"></script>
<script defer src="/static/js/config/urls.js"></script>
<!-- Logo click handler -->
<script nonce="{{ csp_nonce }}">
document.addEventListener('DOMContentLoaded', function() {
const logoLink = document.getElementById('logo-link');
if (logoLink) {
logoLink.addEventListener('click', function() {
window.location.href = '/';
});
}
});
</script>
<!-- All vendor libraries are now loaded through Vite in the <head> section -->
<!-- Core JS
IMPORTANT: ui.js defines the global `escapeHtmlFallback` constant.
All subsequent scripts can reference it directly. Do NOT redeclare
escapeHtmlFallback at top-level in any other script — it will cause
a SyntaxError and crash the page. See the comment in ui.js.
deletion/delete_manager.js (loaded by collection_details.html and
library.html) similarly declares a top-level `const formatBytes`
wrapping the shared utils/format-bytes.js global. On those pages,
do NOT redeclare formatBytes at top-level in any other script
either — same SyntaxError, same crash. See the comment in
delete_manager.js. -->
<script defer src="/static/js/services/theme.js"></script>
<script defer src="/static/js/services/formatting.js"></script>
<script defer src="/static/js/services/ui.js"></script>
<script defer src="/static/js/services/api.js"></script>
<script defer src="/static/js/services/socket.js"></script>
<script defer src="/static/js/services/keyboard.js"></script>
<script defer src="/static/js/services/help.js"></script>
<!-- Security Utilities -->
<script defer src="/static/js/security/xss-protection.js"></script>
<!-- url-validator + safe-fetch are core shared deps used BY page/component
scripts (e.g. safeFetchWithAuth in the annotation components), so they
must load before the component_scripts/page_scripts blocks. Deferred
scripts run in document order at readyState 'interactive' (never
'loading'), and the annotation components call init() synchronously —
if safe-fetch.js loaded after them, safeFetchWithAuth would be
undefined and annotations/notes would fail to load on first render. -->
<script defer src="/static/js/security/url-validator.js"></script>
<script defer src="/static/js/security/safe-fetch.js"></script>
<!-- Form Utilities -->
<script defer src="/static/js/utils/form-validation.js"></script>
<script defer src="/static/js/utils/sse-completion.js"></script>
<script defer src="/static/js/utils/value-helpers.js"></script>
<script defer src="/static/js/utils/provider-options.js"></script>
<script defer src="/static/js/utils/alert-helpers.js"></script>
<script defer src="/static/js/utils/format-bytes.js"></script>
<!-- Shared Components -->
<script defer src="/static/js/utils/log-helpers.js"></script>
<script defer src="/static/js/components/logpanel.js"></script>
<!-- Page-specific Components -->
{% block component_scripts %}{% endblock %}
<!-- Page-specific JS -->
{% block page_scripts %}{% endblock %}
<script nonce="{{ csp_nonce }}">
// Configure marked to not use eval
if (typeof marked !== 'undefined') {
marked.setOptions({
headerIds: false,
mangle: false,
smartypants: false
});
}
// Configure html2canvas to avoid using eval if possible
if (typeof html2canvas !== 'undefined') {
window.html2canvas_noSandbox = true;
}
</script>
<script defer src="/static/js/components/settings_sync.js"></script>
<!-- Mobile Navigation (url-validator + safe-fetch moved up to load before
the page/component script blocks) -->
<script defer src="/static/js/mobile-navigation.js"></script>
</body>
</html>