Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

Enhance UI styling and fix critical bugs

LearningCircuitf9f291eed714
diff --git a/src/local_deep_research/research_library/routes/rag_routes.py b/src/local_deep_research/research_library/routes/rag_routes.py
index a6ed1b8ec7..a05fc2414b 100644
--- a/src/local_deep_research/research_library/routes/rag_routes.py
+++ b/src/local_deep_research/research_library/routes/rag_routes.py
@@ -131,19 +131,29 @@ def get_available_models():
OpenAIEmbeddingsProvider,
)
+ # Get current settings for providers
+ settings = get_settings_manager()
+ settings_snapshot = (
+ settings.get_all_settings()
+ if hasattr(settings, "get_all_settings")
+ else {}
+ )
+
# Get provider options
provider_options = []
providers = {}
# Sentence Transformers
- if SentenceTransformersProvider.is_available():
+ if SentenceTransformersProvider.is_available(settings_snapshot):
provider_options.append(
{
"value": "sentence_transformers",
"label": "Sentence Transformers (Local)",
}
)
- models = SentenceTransformersProvider.get_available_models()
+ models = SentenceTransformersProvider.get_available_models(
+ settings_snapshot
+ )
providers["sentence_transformers"] = [
{
"value": m["value"],
@@ -154,20 +164,24 @@ def get_available_models():
]
# Ollama
- if OllamaEmbeddingsProvider.is_available():
+ if OllamaEmbeddingsProvider.is_available(settings_snapshot):
provider_options.append(
{"value": "ollama", "label": "Ollama (Local)"}
)
- models = OllamaEmbeddingsProvider.get_available_models()
+ models = OllamaEmbeddingsProvider.get_available_models(
+ settings_snapshot
+ )
providers["ollama"] = [
{"value": m["value"], "label": m["label"], "provider": "ollama"}
for m in models
]
# OpenAI
- if OpenAIEmbeddingsProvider.is_available():
+ if OpenAIEmbeddingsProvider.is_available(settings_snapshot):
provider_options.append({"value": "openai", "label": "OpenAI API"})
- models = OpenAIEmbeddingsProvider.get_available_models()
+ models = OpenAIEmbeddingsProvider.get_available_models(
+ settings_snapshot
+ )
providers["openai"] = [
{"value": m["value"], "label": m["label"], "provider": "openai"}
for m in models
diff --git a/src/local_deep_research/research_library/services/library_service.py b/src/local_deep_research/research_library/services/library_service.py
index 54559d9b10..be45b104b2 100644
--- a/src/local_deep_research/research_library/services/library_service.py
+++ b/src/local_deep_research/research_library/services/library_service.py
@@ -866,7 +866,8 @@ class LibraryService:
def sync_library_with_filesystem(self) -> Dict:
"""
Sync library database with filesystem.
- Check which files exist and update database accordingly.
+ Check which PDF files exist and update database accordingly.
+ Text documents in database are not synced - only PDF files are checked.
Returns:
Statistics about the sync operation
@@ -876,26 +877,27 @@ class LibraryService:
documents = (
session.query(LibraryDocument)
.filter_by(download_status="completed")
+ .filter_by(file_type="pdf") # Only sync PDF files
.all()
)
- # Get all text documents marked as extracted
- text_documents = (
+ # Get count of text documents for reporting (but don't sync them)
+ text_documents_count = (
session.query(LibraryTextDocument)
.filter_by(extraction_status="completed")
- .all()
+ .count()
)
stats = {
"total_documents": len(documents),
- "total_text_documents": len(text_documents),
+ "total_text_documents": text_documents_count,
"files_found": 0,
"files_missing": 0,
- "text_files_found": 0,
- "text_files_missing": 0,
+ "text_files_found": text_documents_count, # All assumed present in DB
+ "text_files_missing": 0, # Not checking text files
"trackers_updated": 0,
"missing_files": [],
- "missing_text_files": [],
+ "missing_text_files": [], # Not tracking text file issues
}
# Sync PDF documents
@@ -939,37 +941,8 @@ class LibraryService:
stats["files_missing"] += 1
session.delete(doc)
- # Sync text documents
- library_root = Path(self._get_storage_path())
- for text_doc in text_documents:
- if text_doc.file_path:
- # Check if text file exists
- text_path = library_root / text_doc.file_path
- if text_path.exists():
- stats["text_files_found"] += 1
- else:
- # Text file missing - mark as failed so it can be re-extracted
- stats["text_files_missing"] += 1
- stats["missing_text_files"].append(
- {
- "id": text_doc.id,
- "title": text_doc.title,
- "path": str(text_path),
- "url": text_doc.original_url,
- "type": "txt",
- }
- )
-
- # Mark as failed so it can be re-extracted
- text_doc.extraction_status = "failed"
- text_doc.extraction_error = (
- "File missing on disk during sync"
- )
- else:
- # No file path - mark as failed
- stats["text_files_missing"] += 1
- text_doc.extraction_status = "failed"
- text_doc.extraction_error = "No file path recorded"
+ # Text documents are not synced - they exist in database as RAG content
+ # No action needed for text documents
session.commit()
logger.info(
diff --git a/src/local_deep_research/web/auth/cleanup_middleware.py b/src/local_deep_research/web/auth/cleanup_middleware.py
index e0cadbb5c9..14f1d3c4e0 100644
--- a/src/local_deep_research/web/auth/cleanup_middleware.py
+++ b/src/local_deep_research/web/auth/cleanup_middleware.py
@@ -26,10 +26,11 @@ def cleanup_completed_research():
# Find completed researches that haven't been cleaned up
from ..routes.globals import active_research
- # Get all active records for this user
+ # Get all active records for this user with limit and better error handling
active_records = (
g.db_session.query(UserActiveResearch)
.filter_by(username=username)
+ .limit(50) # Limit to prevent excessive memory usage
.all()
)
@@ -52,7 +53,20 @@ def cleanup_completed_research():
f"for user {username}"
)
- except Exception:
+ except Exception as e:
# Don't let cleanup errors break the request
- logger.exception("Error cleaning up completed research")
- g.db_session.rollback()
+ # Handle connection pool exhaustion gracefully
+ if "QueuePool limit" in str(e) or "connection timed out" in str(e):
+ logger.warning(
+ "Database connection pool exhausted during cleanup - skipping"
+ )
+ else:
+ logger.exception("Error cleaning up completed research")
+
+ try:
+ g.db_session.rollback()
+ except Exception:
+ # Even rollback might fail if connections are exhausted
+ logger.warning(
+ "Could not rollback database session during cleanup error"
+ )
diff --git a/src/local_deep_research/web/routes/research_routes.py b/src/local_deep_research/web/routes/research_routes.py
index 2427cbe265..cf4508f39a 100644
--- a/src/local_deep_research/web/routes/research_routes.py
+++ b/src/local_deep_research/web/routes/research_routes.py
@@ -322,6 +322,7 @@ def start_research():
"timestamp": created_at,
"user": username,
"version": "1.0", # Track metadata version for future migrations
+ "server_url": request.host_url, # Add server URL for link generation
},
}
diff --git a/src/local_deep_research/web/static/css/collection_details.css b/src/local_deep_research/web/static/css/collection_details.css
new file mode 100644
index 0000000000..5e5a1c83aa
--- /dev/null
+++ b/src/local_deep_research/web/static/css/collection_details.css
@@ -0,0 +1,679 @@
+/* Individual Collection Page Styling */
+.ldr-rag-manager-container {
+ max-width: 1200px;
+ margin: 0 auto;
+ padding: 20px;
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ min-height: 100vh;
+ border-radius: 20px;
+ box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
+}
+
+/* Header Section */
+.ldr-rag-header {
+ background: rgba(255, 255, 255, 0.95);
+ backdrop-filter: blur(10px);
+ border-radius: 16px;
+ padding: 30px;
+ margin-bottom: 25px;
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
+ border: 1px solid rgba(255, 255, 255, 0.2);
+ animation: slideDown 0.6s ease-out;
+}
+
+.ldr-rag-header h1 {
+ color: #2d3748;
+ font-size: 2.5rem;
+ font-weight: 700;
+ margin: 15px 0;
+ display: flex;
+ align-items: center;
+ gap: 15px;
+ background: linear-gradient(135deg, #667eea, #764ba2);
+ -webkit-background-clip: text;
+ -webkit-text-fill-color: transparent;
+ background-clip: text;
+}
+
+.ldr-rag-header h1 i {
+ background: linear-gradient(135deg, #667eea, #764ba2);
+ -webkit-background-clip: text;
+ -webkit-text-fill-color: transparent;
+ background-clip: text;
+}
+
+.ldr-subtitle {
+ color: #718096;
+ font-size: 1.1rem;
+ margin: 10px 0 0 0;
+ font-style: italic;
+}
+
+/* Section Styling */
+.ldr-rag-section {
+ background: rgba(255, 255, 255, 0.95);
+ backdrop-filter: blur(10px);
+ border-radius: 16px;
+ padding: 25px;
+ margin-bottom: 25px;
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
+ border: 1px solid rgba(255, 255, 255, 0.2);
+ animation: fadeInUp 0.8s ease-out;
+ transition: transform 0.3s ease, box-shadow 0.3s ease;
+}
+
+.ldr-rag-section:hover {
+ transform: translateY(-2px);
+ box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
+}
+
+.ldr-section-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 20px;
+ padding-bottom: 15px;
+ border-bottom: 2px solid #e2e8f0;
+}
+
+.ldr-section-header h2 {
+ color: #2d3748;
+ font-size: 1.5rem;
+ font-weight: 600;
+ display: flex;
+ align-items: center;
+ gap: 10px;
+}
+
+.ldr-section-header h2 i {
+ color: #667eea;
+}
+
+/* Collection Actions Grid */
+.ldr-collection-actions-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
+ gap: 15px;
+ margin-top: 20px;
+}
+
+.ldr-collection-actions-grid .btn {
+ padding: 15px 20px;
+ border-radius: 12px;
+ font-weight: 600;
+ font-size: 1rem;
+ border: none;
+ cursor: pointer;
+ transition: all 0.3s ease;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 8px;
+ text-transform: uppercase;
+ letter-spacing: 0.5px;
+ position: relative;
+ overflow: hidden;
+}
+
+.ldr-collection-actions-grid .btn::before {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: -100%;
+ width: 100%;
+ height: 100%;
+ background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
+ transition: left 0.5s ease;
+}
+
+.ldr-collection-actions-grid .btn:hover::before {
+ left: 100%;
+}
+
+.btn-primary {
+ background: linear-gradient(135deg, #48bb78, #38a169);
+ color: white;
+}
+
+.btn-primary:hover {
+ background: linear-gradient(135deg, #38a169, #2f855a);
+ transform: translateY(-2px);
+ box-shadow: 0 8px 25px rgba(72, 187, 120, 0.3);
+}
+
+.btn-success {
+ background: linear-gradient(135deg, #4299e1, #3182ce);
+ color: white;
+}
+
+.btn-success:hover {
+ background: linear-gradient(135deg, #3182ce, #2c5282);
+ transform: translateY(-2px);
+ box-shadow: 0 8px 25px rgba(66, 153, 225, 0.3);
+}
+
+.btn-warning {
+ background: linear-gradient(135deg, #ed8936, #dd6b20);
+ color: white;
+}
+
+.btn-warning:hover {
+ background: linear-gradient(135deg, #dd6b20, #c05621);
+ transform: translateY(-2px);
+ box-shadow: 0 8px 25px rgba(237, 137, 54, 0.3);
+}
+
+.btn-danger {
+ background: linear-gradient(135deg, #f56565, #e53e3e);
+ color: white;
+}
+
+.btn-danger:hover {
+ background: linear-gradient(135deg, #e53e3e, #c53030);
+ transform: translateY(-2px);
+ box-shadow: 0 8px 25px rgba(245, 101, 101, 0.3);
+}
+
+.btn-secondary {
+ background: linear-gradient(135deg, #a0aec0, #718096);
+ color: white;
+}
+
+.btn-secondary:hover {
+ background: linear-gradient(135deg, #718096, #4a5568);
+ transform: translateY(-2px);
+ box-shadow: 0 8px 25px rgba(160, 174, 192, 0.3);
+}
+
+/* Statistics Grid */
+.ldr-stats-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
+ gap: 20px;
+ margin-top: 20px;
+}
+
+.ldr-stat-card {
+ background: linear-gradient(135deg, #f7fafc, #edf2f7);
+ border-radius: 12px;
+ padding: 20px;
+ text-align: center;
+ transition: all 0.3s ease;
+ border: 2px solid transparent;
+ position: relative;
+ overflow: hidden;
+}
+
+.ldr-stat-card::before {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ height: 4px;
+ background: linear-gradient(90deg, #667eea, #764ba2);
+}
+
+.ldr-stat-card:hover {
+ transform: translateY(-5px);
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
+ border-color: #667eea;
+}
+
+.ldr-stat-success::before {
+ background: linear-gradient(90deg, #48bb78, #38a169);
+}
+
+.ldr-stat-warning::before {
+ background: linear-gradient(90deg, #ed8936, #dd6b20);
+}
+
+.ldr-stat-value {
+ font-size: 2.5rem;
+ font-weight: 700;
+ color: #2d3748;
+ margin-bottom: 5px;
+ background: linear-gradient(135deg, #2d3748, #4a5568);
+ -webkit-background-clip: text;
+ -webkit-text-fill-color: transparent;
+ background-clip: text;
+}
+
+.ldr-stat-label {
+ color: #718096;
+ font-size: 0.9rem;
+ font-weight: 500;
+ text-transform: uppercase;
+ letter-spacing: 0.5px;
+}
+
+/* Filter Controls */
+.ldr-filter-controls {
+ display: flex;
+ gap: 10px;
+}
+
+.ldr-filter-controls .btn {
+ padding: 8px 16px;
+ border-radius: 8px;
+ font-size: 0.9rem;
+ font-weight: 500;
+ border: 2px solid #e2e8f0;
+ background: white;
+ color: #4a5568;
+ transition: all 0.3s ease;
+}
+
+.ldr-filter-controls .btn.active {
+ background: linear-gradient(135deg, #667eea, #764ba2);
+ color: white;
+ border-color: #667eea;
+}
+
+.ldr-filter-controls .btn:hover {
+ border-color: #667eea;
+ color: #667eea;
+}
+
+.ldr-filter-controls .btn.active:hover {
+ color: white;
+}
+
+/* Documents List */
+.ldr-documents-list {
+ max-height: 600px;
+ overflow-y: auto;
+ padding: 10px;
+}
+
+.ldr-documents-list::-webkit-scrollbar {
+ width: 8px;
+}
+
+.ldr-documents-list::-webkit-scrollbar-track {
+ background: #f1f1f1;
+ border-radius: 10px;
+}
+
+.ldr-documents-list::-webkit-scrollbar-thumb {
+ background: linear-gradient(135deg, #667eea, #764ba2);
+ border-radius: 10px;
+}
+
+.ldr-documents-list::-webkit-scrollbar-thumb:hover {
+ background: linear-gradient(135deg, #5a67d8, #6b46c1);
+}
+
+/* Loading Spinner */
+.ldr-loading-spinner {
+ text-align: center;
+ padding: 40px;
+ color: #718096;
+ font-size: 1.1rem;
+}
+
+.ldr-loading-spinner i {
+ font-size: 2rem;
+ margin-bottom: 15px;
+ color: #667eea;
+}
+
+/* Empty State */
+.ldr-empty-state {
+ text-align: center;
+ padding: 60px 20px;
+ color: #718096;
+}
+
+.ldr-empty-state i {
+ font-size: 4rem;
+ margin-bottom: 20px;
+ color: #cbd5e0;
+}
+
+.ldr-empty-state p {
+ font-size: 1.2rem;
+ margin-bottom: 10px;
+}
+
+.ldr-empty-state .btn {
+ margin-top: 20px;
+ padding: 12px 24px;
+ border-radius: 10px;
+ font-weight: 600;
+}
+
+/* Progress Container */
+.ldr-progress-container {
+ margin: 20px 0;
+}
+
+.ldr-progress-bar {
+ width: 100%;
+ height: 12px;
+ background: #e2e8f0;
+ border-radius: 10px;
+ overflow: hidden;
+ margin-bottom: 10px;
+}
+
+.ldr-progress-fill {
+ height: 100%;
+ background: linear-gradient(90deg, #667eea, #764ba2);
+ border-radius: 10px;
+ transition: width 0.3s ease;
+ position: relative;
+ overflow: hidden;
+}
+
+.ldr-progress-fill::after {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: 0;
+ bottom: 0;
+ right: 0;
+ background: linear-gradient(
+ 90deg,
+ transparent,
+ rgba(255, 255, 255, 0.3),
+ transparent
+ );
+ animation: shimmer 2s infinite;
+}
+
+.ldr-progress-text {
+ text-align: center;
+ color: #4a5568;
+ font-weight: 500;
+}
+
+.ldr-progress-log {
+ background: #f7fafc;
+ border-radius: 8px;
+ padding: 15px;
+ max-height: 200px;
+ overflow-y: auto;
+ font-family: 'Courier New', monospace;
+ font-size: 0.9rem;
+ color: #4a5568;
+ border: 1px solid #e2e8f0;
+}
+
+/* Document Items */
+.ldr-document-item {
+ background: white;
+ border-radius: 12px;
+ padding: 20px;
+ margin-bottom: 15px;
+ border: 2px solid #e2e8f0;
+ transition: all 0.3s ease;
+ position: relative;
+ overflow: hidden;
+}
+
+.ldr-document-item .ldr-document-title {
+ font-size: 1.2rem;
+ font-weight: 600;
+ color: #2d3748;
+ margin-bottom: 8px;
+}
+
+.ldr-document-item .ldr-document-meta {
+ font-size: 0.9rem;
+ color: #718096;
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ flex-wrap: wrap;
+}
+
+/* Badge Styles */
+.badge {
+ display: inline-block;
+ padding: 4px 8px;
+ font-size: 0.75rem;
+ font-weight: 600;
+ border-radius: 6px;
+ text-transform: uppercase;
+ letter-spacing: 0.5px;
+}
+
+.badge-success {
+ background: linear-gradient(135deg, #48bb78, #38a169);
+ color: white;
+}
+
+.badge-warning {
+ background: linear-gradient(135deg, #ed8936, #dd6b20);
+ color: white;
+}
+
+/* Upload Results Messages */
+.ldr-upload-results {
+ margin-top: 15px;
+ padding: 15px;
+ border-radius: 8px;
+ border: 1px solid #e2e8f0;
+}
+
+.ldr-success-message {
+ color: #38a169;
+ font-weight: 500;
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ margin-bottom: 10px;
+}
+
+.ldr-error-message {
+ color: #e53e3e;
+ font-weight: 500;
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ margin-bottom: 10px;
+}
+
+.ldr-error-list {
+ margin: 10px 0;
+ padding-left: 20px;
+}
+
+.ldr-error-list li {
+ color: #e53e3e;
+ margin-bottom: 5px;
+}
+
+/* Log Entry Styles */
+.ldr-log-entry {
+ padding: 4px 8px;
+ margin: 2px 0;
+ border-radius: 4px;
+ font-family: 'Courier New', monospace;
+ font-size: 0.85rem;
+}
+
+.ldr-log-info {
+ background: rgba(66, 153, 225, 0.1);
+ color: #2c5282;
+ border-left: 3px solid #4299e1;
+}
+
+.ldr-log-success {
+ background: rgba(72, 187, 120, 0.1);
+ color: #276749;
+ border-left: 3px solid #48bb78;
+}
+
+.ldr-log-error {
+ background: rgba(245, 101, 101, 0.1);
+ color: #c53030;
+ border-left: 3px solid #f56565;
+}
+
+.ldr-document-item::before {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 4px;
+ height: 100%;
+ background: linear-gradient(135deg, #667eea, #764ba2);
+ transform: scaleY(0);
+ transition: transform 0.3s ease;
+}
+
+.ldr-document-item:hover::before {
+ transform: scaleY(1);
+}
+
+.ldr-document-item:hover {
+ border-color: #667eea;
+ box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
+ transform: translateX(5px);
+}
+
+.ldr-document-item.indexed {
+ border-left: 4px solid #48bb78;
+}
+
+.ldr-document-item.unindexed {
+ border-left: 4px solid #ed8936;
+}
+
+/* Animations */
+@keyframes slideDown {
+ from {
+ opacity: 0;
+ transform: translateY(-30px);
+ }
+ to {
+ opacity: 1;
+ transform: translateY(0);
+ }
+}
+
+@keyframes fadeInUp {
+ from {
+ opacity: 0;
+ transform: translateY(30px);
+ }
+ to {
+ opacity: 1;
+ transform: translateY(0);
+ }
+}
+
+@keyframes shimmer {
+ 0% {
+ transform: translateX(-100%);
+ }
+ 100% {
+ transform: translateX(100%);
+ }
+}
+
+/* Responsive Design */
+@media (max-width: 768px) {
+ .ldr-rag-manager-container {
+ padding: 15px;
+ border-radius: 0;
+ }
+
+ .ldr-rag-header h1 {
+ font-size: 2rem;
+ }
+
+ .ldr-collection-actions-grid {
+ grid-template-columns: 1fr;
+ }
+
+ .ldr-stats-grid {
+ grid-template-columns: repeat(2, 1fr);
+ gap: 15px;
+ }
+
+ .ldr-section-header {
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 15px;
+ }
+
+ .ldr-filter-controls {
+ width: 100%;
+ justify-content: center;
+ }
+}
+
+@media (max-width: 480px) {
+ .ldr-stats-grid {
+ grid-template-columns: 1fr;
+ }
+
+ .ldr-rag-header {
+ padding: 20px;
+ }
+
+ .ldr-rag-section {
+ padding: 20px;
+ }
+}
+
+/* Dark Theme Support */
+@media (prefers-color-scheme: dark) {
+ .ldr-rag-manager-container {
+ background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
+ }
+
+ .ldr-rag-header,
+ .ldr-rag-section {
+ background: rgba(45, 55, 72, 0.95);
+ color: #f7fafc;
+ }
+
+ .ldr-rag-header h1 {
+ background: linear-gradient(135deg, #9f7aea, #667eea);
+ -webkit-background-clip: text;
+ -webkit-text-fill-color: transparent;
+ background-clip: text;
+ }
+
+ .ldr-section-header h2 {
+ color: #f7fafc;
+ }
+
+ .ldr-stat-card {
+ background: linear-gradient(135deg, #2d3748, #1a202c);
+ color: #f7fafc;
+ }
+
+ .ldr-stat-value {
+ background: linear-gradient(135deg, #f7fafc, #e2e8f0);
+ -webkit-background-clip: text;
+ -webkit-text-fill-color: transparent;
+ background-clip: text;
+ }
+
+ .ldr-document-item {
+ background: #2d3748;
+ color: #f7fafc;
+ border-color: #4a5568;
+ }
+
+ .ldr-progress-bar {
+ background: #4a5568;
+ }
+
+ .ldr-progress-log {
+ background: #1a202c;
+ color: #f7fafc;
+ border-color: #4a5568;
+ }
+
+ .ldr-filter-controls .btn {
+ background: #2d3748;
+ color: #f7fafc;
+ border-color: #4a5568;
+ }
+}
diff --git a/src/local_deep_research/web/static/css/collections.css b/src/local_deep_research/web/static/css/collections.css
new file mode 100644
index 0000000000..0146531961
--- /dev/null
+++ b/src/local_deep_research/web/static/css/collections.css
@@ -0,0 +1,636 @@
+/* RAG Manager & Collections Page Styles */
+/* Beautiful styling for document collections management */
+
+/* Main Container */
+.ldr-rag-manager-container {
+ max-width: 1200px;
+ margin: 0 auto;
+ padding: 2rem;
+ animation: fadeInUp 0.6s ease;
+}
+
+@keyframes fadeInUp {
+ from {
+ opacity: 0;
+ transform: translateY(30px);
+ }
+ to {
+ opacity: 1;
+ transform: translateY(0);
+ }
+}
+
+/* Header Section */
+.ldr-rag-header {
+ text-align: center;
+ margin-bottom: 3rem;
+ padding: 2rem 0;
+ background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
+ border-radius: 16px;
+ border: 1px solid var(--border-color);
+ position: relative;
+ overflow: hidden;
+}
+
+.ldr-rag-header::before {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ height: 4px;
+ background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary), var(--accent-tertiary));
+ animation: shimmer 3s ease-in-out infinite;
+}
+
+@keyframes shimmer {
+ 0%, 100% { opacity: 1; }
+ 50% { opacity: 0.7; }
+}
+
+.ldr-rag-header h1 {
+ font-size: 2.5rem;
+ font-weight: 700;
+ color: var(--text-primary);
+ margin-bottom: 1rem;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 1rem;
+}
+
+.ldr-rag-header h1 i {
+ color: var(--accent-primary);
+ font-size: 2.2rem;
+ animation: float 3s ease-in-out infinite;
+}
+
+@keyframes float {
+ 0%, 100% { transform: translateY(0); }
+ 50% { transform: translateY(-10px); }
+}
+
+.ldr-subtitle {
+ font-size: 1.1rem;
+ color: var(--text-secondary);
+ margin: 0;
+ font-weight: 400;
+}
+
+/* Section Headers */
+.ldr-rag-section {
+ margin-bottom: 3rem;
+}
+
+.ldr-section-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 2rem;
+ padding: 1rem 0;
+ border-bottom: 2px solid var(--border-color);
+}
+
+.ldr-section-header h2 {
+ font-size: 1.8rem;
+ font-weight: 600;
+ color: var(--text-primary);
+ margin: 0;
+ display: flex;
+ align-items: center;
+ gap: 0.75rem;
+}
+
+.ldr-section-header h2 i {
+ color: var(--accent-secondary);
+ font-size: 1.6rem;
+}
+
+/* Collections Grid */
+.ldr-collections-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
+ gap: 2rem;
+ margin-bottom: 2rem;
+}
+
+/* Collection Cards */
+.ldr-collection-card {
+ background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
+ border-radius: 16px;
+ padding: 1.5rem;
+ border: 1px solid var(--border-color);
+ transition: all 0.3s ease;
+ position: relative;
+ overflow: hidden;
+ cursor: pointer;
+}
+
+.ldr-collection-card::before {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: -100%;
+ width: 100%;
+ height: 100%;
+ background: linear-gradient(90deg, transparent, rgba(110, 79, 246, 0.1), transparent);
+ transition: left 0.6s ease;
+}
+
+.ldr-collection-card:hover::before {
+ left: 100%;
+}
+
+.ldr-collection-card:hover {
+ transform: translateY(-8px);
+ box-shadow: 0 12px 40px rgba(110, 79, 246, 0.2);
+ border-color: var(--accent-primary);
+}
+
+.ldr-collection-header {
+ margin-bottom: 1.5rem;
+}
+
+.ldr-collection-header h3 {
+ font-size: 1.4rem;
+ font-weight: 600;
+ color: var(--text-primary);
+ margin: 0 0 0.75rem 0;
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+}
+
+.ldr-collection-header h3::before {
+ content: '📚';
+ font-size: 1.2rem;
+}
+
+.ldr-collection-description {
+ color: var(--text-secondary);
+ font-size: 0.95rem;
+ line-height: 1.5;
+ margin: 0;
+}
+
+/* Collection Stats */
+.ldr-collection-stats {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 1rem;
+ margin-bottom: 1.5rem;
+ padding: 1rem;
+ background: rgba(0, 0, 0, 0.2);
+ border-radius: 12px;
+ border: 1px solid rgba(255, 255, 255, 0.05);
+}
+
+.ldr-stat-item {
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+ font-size: 0.9rem;
+ color: var(--text-secondary);
+ padding: 0.5rem 0.75rem;
+ background: rgba(110, 79, 246, 0.1);
+ border-radius: 8px;
+ border: 1px solid rgba(110, 79, 246, 0.2);
+ transition: all 0.2s ease;
+}
+
+.ldr-stat-item:hover {
+ background: rgba(110, 79, 246, 0.2);
+ transform: translateY(-2px);
+}
+
+.ldr-stat-item i {
+ color: var(--accent-primary);
+ font-size: 1rem;
+}
+
+.ldr-stat-item.embedding-info i {
+ color: var(--success-color);
+}
+
+.ldr-stat-item.embedding-warning i {
+ color: var(--warning-color);
+ animation: pulse 2s infinite;
+}
+
+/* Collection Actions */
+.ldr-collection-actions {
+ display: flex;
+ gap: 0.75rem;
+ margin-top: 1.5rem;
+}
+
+.ldr-collection-actions .btn {
+ flex: 1;
+ padding: 0.75rem 1rem;
+ font-weight: 500;
+ border-radius: 10px;
+ transition: all 0.3s ease;
+ position: relative;
+ overflow: hidden;
+}
+
+.ldr-collection-actions .btn::before {
+ content: '';
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ width: 0;
+ height: 0;
+ background: rgba(255, 255, 255, 0.1);
+ border-radius: 50%;
+ transform: translate(-50%, -50%);
+ transition: width 0.6s ease, height 0.6s ease;
+}
+
+.ldr-collection-actions .btn:hover::before {
+ width: 300px;
+ height: 300px;
+}
+
+.ldr-collection-actions .btn i {
+ font-size: 1rem;
+}
+
+/* Empty State */
+.ldr-empty-state {
+ text-align: center;
+ padding: 4rem 2rem;
+ background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
+ border-radius: 16px;
+ border: 2px dashed var(--border-color);
+ margin: 2rem 0;
+ transition: all 0.3s ease;
+}
+
+.ldr-empty-state:hover {
+ border-color: var(--accent-primary);
+ background: linear-gradient(135deg, rgba(110, 79, 246, 0.05) 0%, rgba(145, 121, 240, 0.05) 100%);
+}
+
+.ldr-empty-state i {
+ font-size: 4rem;
+ color: var(--text-muted);
+ margin-bottom: 1.5rem;
+ opacity: 0.6;
+}
+
+.ldr-empty-state p {
+ margin: 0.5rem 0;
+ font-size: 1.1rem;
+}
+
+.ldr-empty-state p:first-of-type {
+ font-size: 1.4rem;
+ font-weight: 600;
+ color: var(--text-secondary);
+}
+
+.ldr-text-muted {
+ color: var(--text-muted);
+ font-size: 1rem;
+}
+
+/* Modal Styles */
+.ldr-modal {
+ display: none;
+ position: fixed;
+ z-index: 1000;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ background-color: rgba(0, 0, 0, 0.7);
+ backdrop-filter: blur(5px);
+ animation: fadeIn 0.3s ease;
+}
+
+.ldr-modal-content {
+ background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
+ margin: 5% auto;
+ border: 1px solid var(--border-color);
+ border-radius: 16px;
+ width: 90%;
+ max-width: 500px;
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
+ animation: slideInDown 0.3s ease;
+ overflow: hidden;
+}
+
+@keyframes slideInDown {
+ from {
+ opacity: 0;
+ transform: translateY(-50px);
+ }
+ to {
+ opacity: 1;
+ transform: translateY(0);
+ }
+}
+
+.ldr-modal-header {
+ background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
+ color: white;
+ padding: 1.5rem;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+}
+
+.ldr-modal-header h3 {
+ margin: 0;
+ font-size: 1.4rem;
+ font-weight: 600;
+}
+
+.ldr-close {
+ color: white;
+ font-size: 1.5rem;
+ font-weight: bold;
+ cursor: pointer;
+ line-height: 1;
+ opacity: 0.8;
+ transition: opacity 0.2s ease;
+ background: none;
+ border: none;
+ padding: 0.25rem;
+ border-radius: 4px;
+}
+
+.ldr-close:hover {
+ opacity: 1;
+ background: rgba(255, 255, 255, 0.1);
+}
+
+.ldr-modal-body {
+ padding: 2rem;
+}
+
+.ldr-form-group {
+ margin-bottom: 1.5rem;
+}
+
+.ldr-form-group label {
+ display: block;
+ margin-bottom: 0.5rem;
+ font-weight: 500;
+ color: var(--text-secondary);
+ font-size: 0.95rem;
+}
+
+.ldr-form-group input[type="text"],
+.ldr-form-group textarea {
+ width: 100%;
+ padding: 0.75rem 1rem;
+ border: 2px solid var(--border-color);
+ border-radius: 10px;
+ background-color: var(--bg-primary);
+ color: var(--text-primary);
+ font-family: inherit;
+ font-size: 1rem;
+ transition: all 0.3s ease;
+}
+
+.ldr-form-group input[type="text"]:focus,
+.ldr-form-group textarea:focus {
+ outline: none;
+ border-color: var(--accent-primary);
+ box-shadow: 0 0 0 4px rgba(110, 79, 246, 0.1);
+ transform: translateY(-2px);
+}
+
+.ldr-form-group textarea {
+ resize: vertical;
+ min-height: 100px;
+}
+
+.ldr-form-actions {
+ display: flex;
+ gap: 1rem;
+ justify-content: flex-end;
+ margin-top: 2rem;
+ padding-top: 1.5rem;
+ border-top: 1px solid var(--border-color);
+}
+
+/* Enhanced Button Styles */
+.btn {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ gap: 0.5rem;
+ padding: 0.75rem 1.5rem;
+ border-radius: 10px;
+ font-weight: 500;
+ font-size: 0.95rem;
+ cursor: pointer;
+ transition: all 0.3s ease;
+ border: none;
+ position: relative;
+ overflow: hidden;
+ text-decoration: none;
+}
+
+.btn-primary {
+ background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
+ color: white;
+ box-shadow: 0 4px 15px rgba(110, 79, 246, 0.3);
+}
+
+.btn-primary:hover {
+ transform: translateY(-2px);
+ box-shadow: 0 6px 20px rgba(110, 79, 246, 0.4);
+}
+
+.btn-secondary {
+ background-color: var(--bg-tertiary);
+ color: var(--text-secondary);
+ border: 2px solid var(--border-color);
+}
+
+.btn-secondary:hover {
+ background-color: var(--bg-primary);
+ border-color: var(--accent-primary);
+ color: var(--text-primary);
+ transform: translateY(-2px);
+}
+
+/* Loading States */
+.ldr-collection-card.loading {
+ opacity: 0.7;
+ pointer-events: none;
+}
+
+.ldr-collection-card.loading::after {
+ content: '';
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ width: 40px;
+ height: 40px;
+ margin: -20px 0 0 -20px;
+ border: 3px solid var(--border-color);
+ border-top: 3px solid var(--accent-primary);
+ border-radius: 50%;
+ animation: spin 1s linear infinite;
+}
+
+@keyframes spin {
+ 0% { transform: rotate(0deg); }
+ 100% { transform: rotate(360deg); }
+}
+
+/* Responsive Design */
+@media (max-width: 768px) {
+ .ldr-rag-manager-container {
+ padding: 1rem;
+ }
+
+ .ldr-rag-header {
+ padding: 1.5rem 1rem;
+ margin-bottom: 2rem;
+ }
+
+ .ldr-rag-header h1 {
+ font-size: 2rem;
+ }
+
+ .ldr-collections-grid {
+ grid-template-columns: 1fr;
+ gap: 1.5rem;
+ }
+
+ .ldr-section-header {
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 1rem;
+ }
+
+ .ldr-collection-stats {
+ flex-direction: column;
+ gap: 0.75rem;
+ }
+
+ .ldr-collection-actions {
+ flex-direction: column;
+ }
+
+ .ldr-modal-content {
+ margin: 10% auto;
+ width: 95%;
+ }
+
+ .ldr-modal-body {
+ padding: 1.5rem;
+ }
+
+ .ldr-form-actions {
+ flex-direction: column;
+ }
+}
+
+@media (max-width: 480px) {
+ .ldr-rag-header h1 {
+ font-size: 1.8rem;
+ }
+
+ .ldr-collection-card {
+ padding: 1.25rem;
+ }
+
+ .ldr-collection-header h3 {
+ font-size: 1.2rem;
+ }
+
+ .ldr-stat-item {
+ font-size: 0.85rem;
+ padding: 0.4rem 0.6rem;
+ }
+}
+
+/* Dark theme enhancements */
+@media (prefers-color-scheme: dark) {
+ .ldr-collection-card::before {
+ background: linear-gradient(90deg, transparent, rgba(110, 79, 246, 0.15), transparent);
+ }
+
+ .ldr-modal {
+ background-color: rgba(0, 0, 0, 0.8);
+ }
+}
+
+/* Animation for new collections */
+@keyframes slideInRight {
+ from {
+ opacity: 0;
+ transform: translateX(50px);
+ }
+ to {
+ opacity: 1;
+ transform: translateX(0);
+ }
+}
+
+.ldr-collection-card.new {
+ animation: slideInRight 0.5s ease;
+}
+
+/* Success animation */
+@keyframes successPulse {
+ 0% {
+ box-shadow: 0 0 0 0 rgba(10, 207, 151, 0.4);
+ }
+ 70% {
+ box-shadow: 0 0 0 10px rgba(10, 207, 151, 0);
+ }
+ 100% {
+ box-shadow: 0 0 0 0 rgba(10, 207, 151, 0);
+ }
+}
+
+.ldr-collection-card.success {
+ animation: successPulse 0.6s ease;
+}
+
+/* Hover effects for interactive elements */
+.ldr-collection-card,
+.btn,
+.ldr-empty-state {
+ transform-origin: center;
+}
+
+.ldr-collection-card:active,
+.btn:active {
+ transform: scale(0.98);
+}
+
+/* Focus states for accessibility */
+.btn:focus,
+.ldr-form-group input:focus,
+.ldr-form-group textarea:focus {
+ outline: 2px solid var(--accent-primary);
+ outline-offset: 2px;
+}
+
+/* Enhanced scrollbar styling */
+.ldr-collections-grid::-webkit-scrollbar {
+ width: 8px;
+}
+
+.ldr-collections-grid::-webkit-scrollbar-track {
+ background: var(--bg-primary);
+ border-radius: 4px;
+}
+
+.ldr-collections-grid::-webkit-scrollbar-thumb {
+ background: var(--accent-primary);
+ border-radius: 4px;
+}
+
+.ldr-collections-grid::-webkit-scrollbar-thumb:hover {
+ background: var(--accent-secondary);
+}
diff --git a/src/local_deep_research/web/static/css/document_details.css b/src/local_deep_research/web/static/css/document_details.css
new file mode 100644
index 0000000000..a3f01de370
--- /dev/null
+++ b/src/local_deep_research/web/static/css/document_details.css
@@ -0,0 +1,486 @@
+/* Individual Document Page Styling */
+.ldr-document-details-container {
+ max-width: 1200px;
+ margin: 0 auto;
+ padding: 20px;
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ min-height: 100vh;
+ border-radius: 20px;
+ box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
+}
+
+/* Document Header Section */
+.ldr-document-header {
+ background: rgba(255, 255, 255, 0.95);
+ backdrop-filter: blur(10px);
+ border-radius: 16px;
+ padding: 30px;
+ margin-bottom: 25px;
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
+ border: 1px solid rgba(255, 255, 255, 0.2);
+ animation: slideDown 0.6s ease-out;
+}
+
+.ldr-document-title {
+ font-size: 2.5rem;
+ font-weight: 700;
+ margin: 20px 0 15px 0;
+ color: #2d3748;
+ display: flex;
+ align-items: center;
+ gap: 15px;
+ background: linear-gradient(135deg, #667eea, #764ba2);
+ -webkit-background-clip: text;
+ -webkit-text-fill-color: transparent;
+ background-clip: text;
+}
+
+.ldr-document-title i {
+ background: linear-gradient(135deg, #667eea, #764ba2);
+ -webkit-background-clip: text;
+ -webkit-text-fill-color: transparent;
+ background-clip: text;
+}
+
+.ldr-document-subtitle {
+ font-size: 1.2rem;
+ color: #718096;
+ margin-bottom: 25px;
+ font-style: italic;
+}
+
+.ldr-authors-list {
+ list-style: none;
+ padding: 0;
+ margin: 0;
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px;
+}
+
+.ldr-authors-list li {
+ background: linear-gradient(135deg, #edf2f7, #e2e8f0);
+ padding: 6px 12px;
+ border-radius: 20px;
+ font-size: 0.9rem;
+ color: #4a5568;
+ font-weight: 500;
+}
+
+.ldr-authors-list li:not(:last-child):after {
+ content: "";
+ display: none;
+}
+
+/* Document Actions */
+.ldr-document-actions {
+ display: flex;
+ gap: 15px;
+ flex-wrap: wrap;
+ margin-top: 25px;
+}
+
+.ldr-btn {
+ padding: 12px 24px;
+ border: none;
+ border-radius: 12px;
+ font-size: 1rem;
+ font-weight: 600;
+ cursor: pointer;
+ text-decoration: none;
+ display: inline-flex;
+ align-items: center;
+ gap: 10px;
+ transition: all 0.3s ease;
+ text-transform: uppercase;
+ letter-spacing: 0.5px;
+ position: relative;
+ overflow: hidden;
+}
+
+.ldr-btn::before {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: -100%;
+ width: 100%;
+ height: 100%;
+ background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
+ transition: left 0.5s ease;
+}
+
+.ldr-btn:hover::before {
+ left: 100%;
+}
+
+.ldr-btn:hover {
+ transform: translateY(-2px);
+ box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
+}
+
+.ldr-btn-primary {
+ background: linear-gradient(135deg, #4299e1, #3182ce);
+ color: white;
+}
+
+.ldr-btn-primary:hover {
+ background: linear-gradient(135deg, #3182ce, #2c5282);
+ box-shadow: 0 8px 25px rgba(66, 153, 225, 0.3);
+}
+
+.ldr-btn-secondary {
+ background: linear-gradient(135deg, #a0aec0, #718096);
+ color: white;
+}
+
+.ldr-btn-secondary:hover {
+ background: linear-gradient(135deg, #718096, #4a5568);
+ box-shadow: 0 8px 25px rgba(160, 174, 192, 0.3);
+}
+
+.ldr-btn-success {
+ background: linear-gradient(135deg, #48bb78, #38a169);
+ color: white;
+}
+
+.ldr-btn-success:hover {
+ background: linear-gradient(135deg, #38a169, #2f855a);
+ box-shadow: 0 8px 25px rgba(72, 187, 120, 0.3);
+}
+
+/* Metadata Sections */
+.ldr-metadata-section {
+ background: rgba(255, 255, 255, 0.95);
+ backdrop-filter: blur(10px);
+ border-radius: 16px;
+ padding: 25px;
+ margin-bottom: 25px;
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
+ border: 1px solid rgba(255, 255, 255, 0.2);
+ animation: fadeInUp 0.8s ease-out;
+ transition: transform 0.3s ease, box-shadow 0.3s ease;
+}
+
+.ldr-metadata-section:hover {
+ transform: translateY(-2px);
+ box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
+}
+
+.ldr-metadata-section h2 {
+ font-size: 1.5rem;
+ font-weight: 600;
+ margin-bottom: 20px;
+ color: #2d3748;
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ padding-bottom: 15px;
+ border-bottom: 2px solid #e2e8f0;
+}
+
+.ldr-metadata-section h2 i {
+ color: #667eea;
+ font-size: 1.3rem;
+}
+
+.ldr-metadata-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
+ gap: 20px;
+}
+
+.ldr-metadata-item {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ padding: 15px;
+ background: linear-gradient(135deg, #f7fafc, #edf2f7);
+ border-radius: 12px;
+ border: 1px solid #e2e8f0;
+ transition: all 0.3s ease;
+}
+
+.ldr-metadata-item:hover {
+ background: linear-gradient(135deg, #edf2f7, #e2e8f0);
+ border-color: #cbd5e0;
+ transform: translateY(-1px);
+}
+
+.ldr-metadata-label {
+ font-weight: 600;
+ color: #718096;
+ font-size: 0.85rem;
+ text-transform: uppercase;
+ letter-spacing: 0.5px;
+ margin-bottom: 4px;
+}
+
+.ldr-metadata-value {
+ color: #2d3748;
+ font-size: 1rem;
+ word-break: break-word;
+ font-weight: 500;
+}
+
+.ldr-metadata-value code {
+ background: #2d3748;
+ color: #f7fafc;
+ padding: 4px 8px;
+ border-radius: 6px;
+ font-family: 'Courier New', monospace;
+ font-size: 0.9rem;
+}
+
+.ldr-metadata-value a {
+ color: #667eea;
+ text-decoration: none;
+ font-weight: 500;
+ transition: color 0.3s ease;
+}
+
+.ldr-metadata-value a:hover {
+ color: #5a67d8;
+ text-decoration: underline;
+}
+
+/* Badge Styles */
+.ldr-badge {
+ display: inline-block;
+ padding: 6px 12px;
+ border-radius: 20px;
+ font-size: 0.8rem;
+ font-weight: 600;
+ text-transform: uppercase;
+ letter-spacing: 0.5px;
+}
+
+.ldr-badge-success {
+ background: linear-gradient(135deg, #48bb78, #38a169);
+ color: white;
+ box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
+}
+
+.ldr-badge-info {
+ background: linear-gradient(135deg, #4299e1, #3182ce);
+ color: white;
+ box-shadow: 0 4px 15px rgba(66, 153, 225, 0.3);
+}
+
+.ldr-badge-warning {
+ background: linear-gradient(135deg, #ed8936, #dd6b20);
+ color: white;
+ box-shadow: 0 4px 15px rgba(237, 137, 54, 0.3);
+}
+
+/* RAG Status */
+.ldr-rag-status {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ padding: 8px 12px;
+ background: linear-gradient(135deg, #f7fafc, #edf2f7);
+ border-radius: 8px;
+ border: 1px solid #e2e8f0;
+}
+
+.ldr-rag-status i {
+ font-size: 1.2rem;
+}
+
+.ldr-rag-status span {
+ font-weight: 500;
+ color: #2d3748;
+}
+
+/* Empty Value Styling */
+.ldr-empty-value {
+ color: #a0aec0;
+ font-style: italic;
+ font-size: 0.9rem;
+}
+
+/* Content Preview */
+.ldr-content-preview {
+ background: linear-gradient(135deg, #2d3748, #1a202c);
+ color: #f7fafc;
+ padding: 20px;
+ border-radius: 12px;
+ border-left: 4px solid #667eea;
+ white-space: pre-wrap;
+ font-family: 'Courier New', monospace;
+ font-size: 0.9rem;
+ max-height: 400px;
+ overflow-y: auto;
+ margin-top: 15px;
+ box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
+}
+
+.ldr-content-preview::-webkit-scrollbar {
+ width: 8px;
+}
+
+.ldr-content-preview::-webkit-scrollbar-track {
+ background: #4a5568;
+ border-radius: 10px;
+}
+
+.ldr-content-preview::-webkit-scrollbar-thumb {
+ background: linear-gradient(135deg, #667eea, #764ba2);
+ border-radius: 10px;
+}
+
+/* Source URL Section */
+.ldr-metadata-section .ldr-metadata-value {
+ background: linear-gradient(135deg, #f7fafc, #edf2f7);
+ padding: 15px;
+ border-radius: 8px;
+ border: 1px solid #e2e8f0;
+ word-break: break-all;
+}
+
+/* Animations */
+@keyframes slideDown {
+ from {
+ opacity: 0;
+ transform: translateY(-30px);
+ }
+ to {
+ opacity: 1;
+ transform: translateY(0);
+ }
+}
+
+@keyframes fadeInUp {
+ from {
+ opacity: 0;
+ transform: translateY(30px);
+ }
+ to {
+ opacity: 1;
+ transform: translateY(0);
+ }
+}
+
+/* Responsive Design */
+@media (max-width: 768px) {
+ .ldr-document-details-container {
+ padding: 15px;
+ border-radius: 0;
+ }
+
+ .ldr-document-title {
+ font-size: 2rem;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 10px;
+ }
+
+ .ldr-document-actions {
+ flex-direction: column;
+ align-items: stretch;
+ }
+
+ .ldr-btn {
+ justify-content: center;
+ }
+
+ .ldr-metadata-grid {
+ grid-template-columns: 1fr;
+ gap: 15px;
+ }
+
+ .ldr-authors-list {
+ flex-direction: column;
+ gap: 5px;
+ }
+
+ .ldr-authors-list li {
+ align-self: flex-start;
+ }
+}
+
+@media (max-width: 480px) {
+ .ldr-document-header,
+ .ldr-metadata-section {
+ padding: 20px;
+ }
+
+ .ldr-document-title {
+ font-size: 1.8rem;
+ }
+
+ .ldr-metadata-section h2 {
+ font-size: 1.3rem;
+ }
+}
+
+/* Dark Theme Support */
+@media (prefers-color-scheme: dark) {
+ .ldr-document-details-container {
+ background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
+ }
+
+ .ldr-document-header,
+ .ldr-metadata-section {
+ background: rgba(45, 55, 72, 0.95);
+ color: #f7fafc;
+ }
+
+ .ldr-document-title {
+ background: linear-gradient(135deg, #9f7aea, #667eea);
+ -webkit-background-clip: text;
+ -webkit-text-fill-color: transparent;
+ background-clip: text;
+ }
+
+ .ldr-document-subtitle {
+ color: #cbd5e0;
+ }
+
+ .ldr-metadata-section h2 {
+ color: #f7fafc;
+ border-bottom-color: #4a5568;
+ }
+
+ .ldr-metadata-item {
+ background: linear-gradient(135deg, #2d3748, #1a202c);
+ border-color: #4a5568;
+ }
+
+ .ldr-metadata-label {
+ color: #cbd5e0;
+ }
+
+ .ldr-metadata-value {
+ color: #f7fafc;
+ }
+
+ .ldr-metadata-value code {
+ background: #1a202c;
+ color: #f7fafc;
+ border: 1px solid #4a5568;
+ }
+
+ .ldr-rag-status {
+ background: linear-gradient(135deg, #2d3748, #1a202c);
+ border-color: #4a5568;
+ }
+
+ .ldr-rag-status span {
+ color: #f7fafc;
+ }
+
+ .ldr-empty-value {
+ color: #718096;
+ }
+
+ .ldr-authors-list li {
+ background: linear-gradient(135deg, #4a5568, #2d3748);
+ color: #cbd5e0;
+ }
+
+ .ldr-metadata-section .ldr-metadata-value {
+ background: linear-gradient(135deg, #2d3748, #1a202c);
+ border-color: #4a5568;
+ }
+}
diff --git a/src/local_deep_research/web/static/js/collection_details.js b/src/local_deep_research/web/static/js/collection_details.js
index 49c26b5ea9..f3a8f5d76a 100644
--- a/src/local_deep_research/web/static/js/collection_details.js
+++ b/src/local_deep_research/web/static/js/collection_details.js
@@ -37,7 +37,7 @@ document.addEventListener('DOMContentLoaded', function() {
document.getElementById('cancel-upload-btn').addEventListener('click', hideUploadModal);
// Setup close buttons
- document.querySelectorAll('.modal .ldr-close').forEach(btn => {
+ document.querySelectorAll('.ldr-modal .ldr-close').forEach(btn => {
btn.addEventListener('click', () => {
hideUploadModal();
});
@@ -45,7 +45,7 @@ document.addEventListener('DOMContentLoaded', function() {
// Click outside modal to close
window.addEventListener('click', (event) => {
- if (event.target.classList.contains('modal')) {
+ if (event.target.classList.contains('ldr-modal')) {
event.target.style.display = 'none';
}
});
@@ -139,14 +139,14 @@ function renderDocuments() {
noDocsMessage.style.display = 'none';
container.innerHTML = filteredDocs.map(doc => `
- <div class="document-item">
+ <div class="ldr-document-item ${doc.indexed ? 'indexed' : 'unindexed'}">
<div class="document-info">
- <div class="document-title">${escapeHtml(doc.filename)}</div>
- <div class="document-meta">
+ <div class="ldr-document-title">${escapeHtml(doc.filename)}</div>
+ <div class="ldr-document-meta">
${doc.file_size ? `Size: ${formatBytes(doc.file_size)} • ` : ''}
${doc.indexed ?
- `<span class="badge-success">Indexed (${doc.chunk_count} chunks)</span>` :
- '<span class="badge-warning">Not indexed</span>'
+ `<span class="badge badge-success">Indexed (${doc.chunk_count} chunks)</span>` :
+ '<span class="badge badge-warning">Not indexed</span>'
}
${doc.last_indexed_at ? ` • Last indexed: ${new Date(doc.last_indexed_at).toLocaleString()}` : ''}
</div>
@@ -162,10 +162,10 @@ function filterDocuments(filter) {
currentFilter = filter;
// Update button states
- document.querySelectorAll('.ldr-filter-controls .ldr-btn').forEach(btn => {
- btn.classList.remove('ldr-active');
+ document.querySelectorAll('.ldr-filter-controls .btn').forEach(btn => {
+ btn.classList.remove('active');
});
- event.target.classList.add('ldr-active');
+ event.target.classList.add('active');
renderDocuments();
}
@@ -301,11 +301,11 @@ async function handleUploadFiles(event) {
const uploadedCount = data.uploaded ? data.uploaded.length : 0;
const failedCount = data.errors ? data.errors.length : 0;
- let resultsHTML = `<p class="success-message"><i class="fas fa-check-circle"></i> Successfully uploaded ${uploadedCount} files</p>`;
+ let resultsHTML = `<p class="ldr-success-message"><i class="fas fa-check-circle"></i> Successfully uploaded ${uploadedCount} files</p>`;
if (failedCount > 0) {
- resultsHTML += `<p class="error-message"><i class="fas fa-exclamation-circle"></i> Failed to upload ${failedCount} files:</p>`;
- resultsHTML += '<ul class="error-list">';
+ resultsHTML += `<p class="ldr-error-message"><i class="fas fa-exclamation-circle"></i> Failed to upload ${failedCount} files:</p>`;
+ resultsHTML += '<ul class="ldr-error-list">';
data.errors.forEach(err => {
resultsHTML += `<li>${escapeHtml(err.filename)}: ${escapeHtml(err.error)}</li>`;
});
@@ -319,13 +319,13 @@ async function handleUploadFiles(event) {
loadCollectionDetails();
}, 3000);
} else {
- resultsDiv.innerHTML = `<p class="error-message"><i class="fas fa-times-circle"></i> Upload failed: ${escapeHtml(data.error)}</p>`;
+ resultsDiv.innerHTML = `<p class="ldr-error-message"><i class="fas fa-times-circle"></i> Upload failed: ${escapeHtml(data.error)}</p>`;
}
} catch (error) {
console.error('Error uploading files:', error);
progressDiv.style.display = 'none';
resultsDiv.style.display = 'block';
- resultsDiv.innerHTML = `<p class="error-message"><i class="fas fa-times-circle"></i> Failed to upload files</p>`;
+ resultsDiv.innerHTML = `<p class="ldr-error-message"><i class="fas fa-times-circle"></i> Failed to upload files</p>`;
} finally {
submitBtn.disabled = false;
}
@@ -403,7 +403,7 @@ async function indexCollection(forceReindex) {
function addLogEntry(message, type = 'info') {
const progressLog = document.getElementById('progress-log');
const entry = document.createElement('div');
- entry.className = `log-entry log-${type}`;
+ entry.className = `ldr-log-entry ldr-log-${type}`;
entry.textContent = message;
progressLog.appendChild(entry);
progressLog.scrollTop = progressLog.scrollHeight;
diff --git a/src/local_deep_research/web/templates/pages/collection_details.html b/src/local_deep_research/web/templates/pages/collection_details.html
index e437238eb2..e8c51867d4 100644
--- a/src/local_deep_research/web/templates/pages/collection_details.html
+++ b/src/local_deep_research/web/templates/pages/collection_details.html
@@ -1,7 +1,7 @@
{% extends "base.html" %}
{% block extra_head %}
-<link rel="stylesheet" href="/static/css/rag_manager.css">
+<link rel="stylesheet" href="/static/css/collection_details.css">
<style>
.ldr-drop-zone {
border: 2px dashed var(--ldr-border-color, #ccc);
diff --git a/src/local_deep_research/web/templates/pages/collections.html b/src/local_deep_research/web/templates/pages/collections.html
index bb8ba06878..1f7dce0f54 100644
--- a/src/local_deep_research/web/templates/pages/collections.html
+++ b/src/local_deep_research/web/templates/pages/collections.html
@@ -1,7 +1,7 @@
{% extends "base.html" %}
{% block extra_head %}
-<link rel="stylesheet" href="/static/css/rag_manager.css">
+<link rel="stylesheet" href="/static/css/collections.css">
{% endblock %}
{% block content %}
diff --git a/src/local_deep_research/web/templates/pages/document_details.html b/src/local_deep_research/web/templates/pages/document_details.html
index 195c5331d5..d64c2463fa 100644
--- a/src/local_deep_research/web/templates/pages/document_details.html
+++ b/src/local_deep_research/web/templates/pages/document_details.html
@@ -1,194 +1,7 @@
{% extends "base.html" %}
{% block extra_head %}
-<style>
-.ldr-document-details-container {
- max-width: 1200px;
- margin: 0 auto;
- padding: 20px;
-}
-
-.ldr-document-header {
- margin-bottom: 30px;
-}
-
-.ldr-document-title {
- font-size: 28px;
- font-weight: 600;
- margin-bottom: 10px;
- color: var(--ldr-text-primary, #e4e4e4);
-}
-
-.ldr-document-subtitle {
- font-size: 16px;
- color: var(--ldr-text-secondary, #a0a0a0);
- margin-bottom: 15px;
-}
-
-.ldr-document-actions {
- display: flex;
- gap: 10px;
- flex-wrap: wrap;
- margin-top: 20px;
-}
-
-.ldr-metadata-section {
- background-color: var(--ldr-card-bg, #2a2a2a);
- border: 1px solid var(--ldr-border-color, #333);
- border-radius: 8px;
- padding: 20px;
- margin-bottom: 20px;
-}
-
-.ldr-metadata-section h2 {
- font-size: 20px;
- font-weight: 600;
- margin-bottom: 15px;
- color: var(--ldr-text-primary, #e4e4e4);
- border-bottom: 2px solid var(--ldr-primary-color, #007bff);
- padding-bottom: 10px;
-}
-
-.ldr-metadata-grid {
- display: grid;
- grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
- gap: 15px;
-}
-
-.ldr-metadata-item {
- display: flex;
- flex-direction: column;
- gap: 5px;
-}
-
-.ldr-metadata-label {
- font-weight: 600;
- color: var(--ldr-text-secondary, #a0a0a0);
- font-size: 13px;
- text-transform: uppercase;
- letter-spacing: 0.5px;
-}
-
-.ldr-metadata-value {
- color: var(--ldr-text-primary, #e4e4e4);
- font-size: 15px;
- word-break: break-word;
-}
-
-.ldr-metadata-value a {
- color: var(--ldr-primary-color, #007bff);
- text-decoration: none;
-}
-
-.ldr-metadata-value a:hover {
- text-decoration: underline;
-}
-
-.ldr-badge {
- display: inline-block;
- padding: 4px 12px;
- border-radius: 4px;
- font-size: 13px;
- font-weight: 500;
-}
-
-.ldr-badge-success {
- background-color: var(--ldr-success-bg, #1a3a1f);
- color: var(--ldr-success-color, #28a745);
-}
-
-.ldr-badge-info {
- background-color: var(--ldr-info-bg, #1a2a3a);
- color: var(--ldr-info-color, #17a2b8);
-}
-
-.ldr-badge-warning {
- background-color: var(--ldr-warning-bg, #3d3313);
- color: var(--ldr-warning-color, #ffc107);
-}
-
-.ldr-authors-list {
- list-style: none;
- padding: 0;
- margin: 0;
-}
-
-.ldr-authors-list li {
- display: inline;
-}
-
-.ldr-authors-list li:not(:last-child):after {
- content: ", ";
-}
-
-.ldr-content-preview {
- background-color: var(--ldr-bg, #1a1a1a);
- padding: 15px;
- border-radius: 4px;
- border-left: 3px solid var(--ldr-primary-color, #007bff);
- white-space: pre-wrap;
- font-family: monospace;
- font-size: 13px;
- max-height: 400px;
- overflow-y: auto;
-}
-
-.ldr-rag-status {
- display: flex;
- align-items: center;
- gap: 10px;
-}
-
-.ldr-rag-status i {
- font-size: 18px;
-}
-
-.ldr-btn {
- padding: 8px 16px;
- border: none;
- border-radius: 4px;
- font-size: 14px;
- font-weight: 500;
- cursor: pointer;
- text-decoration: none;
- display: inline-flex;
- align-items: center;
- gap: 8px;
- transition: all 0.2s;
-}
-
-.ldr-btn-primary {
- background-color: var(--ldr-primary-color, #007bff);
- color: white;
-}
-
-.ldr-btn-primary:hover {
- background-color: var(--ldr-primary-hover, #0056b3);
-}
-
-.ldr-btn-secondary {
- background-color: var(--ldr-secondary-bg, #6c757d);
- color: white;
-}
-
-.ldr-btn-secondary:hover {
- background-color: var(--ldr-secondary-hover, #545b62);
-}
-
-.ldr-btn-success {
- background-color: var(--ldr-success-color, #28a745);
- color: white;
-}
-
-.ldr-btn-success:hover {
- background-color: var(--ldr-success-hover, #218838);
-}
-
-.ldr-empty-value {
- color: var(--ldr-text-secondary, #a0a0a0);
- font-style: italic;
-}
-</style>
+<link rel="stylesheet" href="/static/css/document_details.css">
{% endblock %}
{% block content %}
diff --git a/src/local_deep_research/web/templates/pages/library.html b/src/local_deep_research/web/templates/pages/library.html
index c837f4bbd6..881caf5f13 100644
--- a/src/local_deep_research/web/templates/pages/library.html
+++ b/src/local_deep_research/web/templates/pages/library.html
@@ -18,21 +18,21 @@
data-toggle="tooltip"
{% else %}
onclick="downloadAllNew()"
- title="Download PDF files to disk and store metadata in encrypted database"
+ title="Download ALL available PDF files to disk and store metadata in encrypted database"
{% endif %}>
- <i class="fas fa-file-pdf"></i> Download PDFs
+ <i class="fas fa-file-pdf"></i> Download ALL PDFs
</button>
{% if enable_txt_storage %}
<button class="btn btn-warning"
onclick="downloadAllAsText(true)"
- title="Extract text to encrypted database AND save .txt files to disk for RAG/search integration">
- <i class="fas fa-file-alt"></i> Extract + RAG Files
+ title="Extract ALL text to encrypted database AND save .txt files to disk for RAG/search integration">
+ <i class="fas fa-file-alt"></i> Extract ALL + RAG Files
</button>
{% endif %}
<button class="btn btn-info"
onclick="downloadAllAsText(false)"
- title="Extract text to encrypted database only (no files saved to disk - maximum privacy)">
- <i class="fas fa-database"></i> Extract to DB Only
+ title="Extract ALL text to encrypted database only (no files saved to disk - maximum privacy)">
+ <i class="fas fa-database"></i> Extract ALL to DB Only
</button>
</div>
<button class="btn btn-primary" onclick="window.location.href='/library/download-manager'">
diff --git a/src/local_deep_research/web_search_engines/engines/search_engine_library.py b/src/local_deep_research/web_search_engines/engines/search_engine_library.py
index 08dcd120f9..d40ed17529 100644
--- a/src/local_deep_research/web_search_engines/engines/search_engine_library.py
+++ b/src/local_deep_research/web_search_engines/engines/search_engine_library.py
@@ -72,6 +72,41 @@ class LibraryRAGSearchEngine(BaseSearchEngine):
"local_search_chunk_overlap", settings_snapshot, 200
)
+ # Extract server URL from settings snapshot for link generation
+ self.server_url = None
+ if settings_snapshot:
+ # Try to get server URL from research metadata first (where we added it)
+ self.server_url = settings_snapshot.get("server_url")
+
+ # If not found, try system settings
+ if not self.server_url:
+ system_settings = settings_snapshot.get("system", {})
+ self.server_url = system_settings.get("server_url")
+
+ # If not found, try web.host and web.port settings
+ if not self.server_url:
+ host = get_setting_from_snapshot(
+ "web.host", settings_snapshot, "127.0.0.1"
+ )
+ port = get_setting_from_snapshot(
+ "web.port", settings_snapshot, 5000
+ )
+ use_https = get_setting_from_snapshot(
+ "web.use_https", settings_snapshot, True
+ )
+
+ # Use localhost for 0.0.0.0 bindings as that's what users will use
+ if host == "0.0.0.0":
+ host = "127.0.0.1"
+
+ scheme = "https" if use_https else "http"
+ self.server_url = f"{scheme}://{host}:{port}/"
+
+ # Fallback to default if still not found
+ if not self.server_url:
+ self.server_url = "http://127.0.0.1:5000/"
+ logger.warning("Could not determine server URL, using default")
+
def search(
self,
query: str,
@@ -137,13 +172,18 @@ class LibraryRAGSearchEngine(BaseSearchEngine):
else doc.page_content
)
+ # Generate full URL using server URL
+ document_url = (
+ f"{self.server_url}library/document/{doc_id}"
+ if doc_id
+ else "#"
+ )
+
result = {
"title": title,
"snippet": snippet,
- "url": f"/library/document/{doc_id}" if doc_id else "#",
- "link": f"/library/document/{doc_id}"
- if doc_id
- else "#", # Add "link" for source extraction
+ "url": document_url,
+ "link": document_url, # Add "link" for source extraction
"source": "library",
"relevance_score": float(
1 / (1 + score)