Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to Notebook LM will be documented in this file.

## [0.3.0.0] - 2026-04-15

### Added
- One-click Zotero library import. Hit Cmd+K, type "Zotero", select which collections to import, and your entire paper library becomes searchable notebooks. Each Zotero collection maps to one notebook.
- Auto-detects Zotero data directory on macOS, Windows, and Linux. Opens the database read-only so your Zotero library is never modified.
- Resolves PDF attachment paths from Zotero's storage directory and imports them through the existing ingestion pipeline (chunking, embedding, summarization).

## [0.2.0.0] - 2026-04-15

### Added
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.0.0
0.3.0.0
5 changes: 4 additions & 1 deletion apps/desktop/src/components/layout/AppShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { ConnectionBanner } from '../ui/ConnectionBanner';
import { SetupWizard } from '../ui/SetupWizard';
import { CommandPalette } from '../ui/CommandPalette';
import { KeyboardShortcutsOverlay } from '../ui/KeyboardShortcuts';
import { ZoteroImportDialog } from '../ui/ZoteroImport';
import './layout.css';

function isWizardComplete(): boolean {
Expand All @@ -32,6 +33,7 @@ export function AppShell() {
const [pendingSuggest, setPendingSuggest] = useState<string | null>(null);
const [paletteOpen, setPaletteOpen] = useState(false);
const [shortcutsOpen, setShortcutsOpen] = useState(false);
const [zoteroOpen, setZoteroOpen] = useState(false);

// Global keyboard shortcuts
useEffect(() => {
Expand Down Expand Up @@ -230,8 +232,9 @@ export function AppShell() {
/>
<ConnectionBanner />
<ToastContainer />
<CommandPalette open={paletteOpen} onClose={() => setPaletteOpen(false)} />
<CommandPalette open={paletteOpen} onClose={() => setPaletteOpen(false)} onZoteroImport={() => setZoteroOpen(true)} />
<KeyboardShortcutsOverlay open={shortcutsOpen} onClose={() => setShortcutsOpen(false)} />
<ZoteroImportDialog open={zoteroOpen} onClose={() => setZoteroOpen(false)} />
</>
);
}
8 changes: 7 additions & 1 deletion apps/desktop/src/components/ui/CommandPalette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function matchScore(query: string, label: string): number {
return 0;
}

export function CommandPalette({ open, onClose }: { open: boolean; onClose: () => void }) {
export function CommandPalette({ open, onClose, onZoteroImport }: { open: boolean; onClose: () => void; onZoteroImport?: () => void }) {
const [query, setQuery] = useState('');
const inputRef = useRef<HTMLInputElement>(null);
const notebooks = useAppStore((s) => s.notebooks);
Expand Down Expand Up @@ -87,6 +87,12 @@ export function CommandPalette({ open, onClose }: { open: boolean; onClose: () =
onClose();
},
},
...(onZoteroImport ? [{
id: 'action-zotero',
label: 'Import from Zotero',
section: 'Actions' as const,
onSelect: () => { onZoteroImport(); onClose(); },
}] : []),
];

const filtered = query
Expand Down
199 changes: 199 additions & 0 deletions apps/desktop/src/components/ui/ZoteroImport.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
import { useEffect, useState } from 'react';
import { useAppStore } from '../../store/app-store';
import { useNotebooks } from '../../hooks/useNotebooks';
import { showToast } from './Toast';
import './zotero-import.css';

interface ZoteroCollection {
id: number;
name: string;
parent_id: number | null;
paper_count: number;
}

interface ZoteroLibrary {
detected: boolean;
data_dir: string | null;
total_items: number;
total_pdfs: number;
collections: ZoteroCollection[];
error: string | null;
}

async function getApiBase(): Promise<string> {
if (window.notebookBridge?.backendUrl) {
try {
const url = await window.notebookBridge.backendUrl();
if (url) return `${url}/api`;
} catch {}
}
return (import.meta.env.VITE_API_BASE_URL as string | undefined) ?? 'http://127.0.0.1:8000/api';
}

export function ZoteroImportDialog({ open, onClose }: { open: boolean; onClose: () => void }) {
const [library, setLibrary] = useState<ZoteroLibrary | null>(null);
const [loading, setLoading] = useState(false);
const [importing, setImporting] = useState(false);
const [selected, setSelected] = useState<Set<number>>(new Set());
const [importResult, setImportResult] = useState<string | null>(null);
const { refresh: refreshNotebooks } = useNotebooks();

useEffect(() => {
if (!open) return;
setLibrary(null);
setSelected(new Set());
setImportResult(null);
detectZotero();
}, [open]);

async function detectZotero() {
setLoading(true);
try {
const base = await getApiBase();
const res = await fetch(`${base}/zotero/detect`);
const data: ZoteroLibrary = await res.json();
setLibrary(data);
if (data.detected && data.collections.length > 0) {
setSelected(new Set(data.collections.map((c) => c.id)));
}
} catch (err) {
setLibrary({ detected: false, data_dir: null, total_items: 0, total_pdfs: 0, collections: [], error: 'Failed to connect to backend' });
}
setLoading(false);
}

async function handleImport() {
if (selected.size === 0) return;
setImporting(true);
try {
const base = await getApiBase();
const res = await fetch(`${base}/zotero/import`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
collection_ids: Array.from(selected),
data_dir: library?.data_dir,
}),
});
const data = await res.json();
if (!res.ok) {
showToast(data.detail || 'Import failed', 'error');
setImporting(false);
return;
}
setImportResult(
`Imported ${data.total_pdfs} PDFs into ${data.collections_imported} notebooks (${data.total_chunks} chunks indexed)`
);
showToast(`Zotero import complete: ${data.total_pdfs} PDFs`, 'success');
await refreshNotebooks();
} catch (err) {
showToast('Import failed', 'error');
}
setImporting(false);
}

function toggleCollection(id: number) {
setSelected((prev) => {
const next = new Set(prev);
if (next.has(id)) next.delete(id);
else next.add(id);
return next;
});
}

function toggleAll() {
if (!library) return;
if (selected.size === library.collections.length) {
setSelected(new Set());
} else {
setSelected(new Set(library.collections.map((c) => c.id)));
}
}

if (!open) return null;

return (
<div className="zotero-backdrop" onClick={onClose}>
<div className="zotero-dialog" onClick={(e) => e.stopPropagation()}>
<h2 className="zotero-title">Import from Zotero</h2>

{loading && (
<div className="zotero-status">
<span className="zotero-spinner" />
Detecting Zotero library...
</div>
)}

{library && !library.detected && (
<div className="zotero-status zotero-status-error">
<p>Zotero library not found.</p>
<p className="zotero-hint">{library.error || 'Make sure Zotero is installed and has been opened at least once.'}</p>
</div>
)}

{library && library.detected && !importResult && (
<>
<p className="zotero-summary">
{library.total_items} items, {library.total_pdfs} PDFs in {library.collections.length} collections
</p>

<div className="zotero-collections">
<label className="zotero-select-all">
<input
type="checkbox"
checked={selected.size === library.collections.length}
onChange={toggleAll}
/>
Select all
</label>
{library.collections.map((c) => (
<label key={c.id} className="zotero-collection-row">
<input
type="checkbox"
checked={selected.has(c.id)}
onChange={() => toggleCollection(c.id)}
/>
<span className="zotero-collection-name">{c.name}</span>
<span className="zotero-collection-count">{c.paper_count} papers</span>
</label>
))}
{library.collections.length === 0 && (
<p className="zotero-hint">No collections found. Create collections in Zotero first.</p>
)}
</div>

<div className="zotero-actions">
<button
type="button"
className="zotero-btn zotero-btn-primary"
onClick={handleImport}
disabled={importing || selected.size === 0}
>
{importing ? (
<>
<span className="zotero-spinner" />
Importing...
</>
) : (
`Import ${selected.size} collection${selected.size !== 1 ? 's' : ''}`
)}
</button>
<button type="button" className="zotero-btn zotero-btn-text" onClick={onClose}>
Cancel
</button>
</div>
</>
)}

{importResult && (
<div className="zotero-result">
<p>{importResult}</p>
<button type="button" className="zotero-btn zotero-btn-primary" onClick={onClose}>
Done
</button>
</div>
)}
</div>
</div>
);
}
Loading
Loading