Online Smart Note-Taking App
Your Smart Notebook
Select a note to edit or create a new one to get started.
AI-Generated Summary
Please write more content (at least 50 characters) to generate a summary.
'; summaryModal.classList.remove('hidden'); return; } summaryModal.classList.remove('hidden'); summaryContent.innerHTML = '';
try {
const summary = await callGeminiAPI(content);
summaryContent.innerHTML = `
${summary}
`; } catch (error) { console.error("Summarization failed:", error); summaryContent.innerHTML = 'Failed to generate summary. Please try again later.
'; } }); closeModalBtn.addEventListener('click', () => summaryModal.classList.add('hidden')); async function callGeminiAPI(text) { const apiKey = ""; // API key handled by environment const apiUrl = `https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-preview-05-20:generateContent?key=${apiKey}`; const prompt = `Summarize the following note into a few key bullet points:\n\n---\n${text}\n---`; const payload = { contents: [{ parts: [{ text: prompt }] }] }; const response = await fetch(apiUrl, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }); if (!response.ok) throw new Error(`API request failed with status ${response.status}`); const result = await response.json(); return result.candidates[0].content.parts[0].text; } // --- PDF DOWNLOAD LOGIC --- downloadPdfBtn.addEventListener('click', () => { if (!currentNoteId) return; const note = notes.find(n => n.id === currentNoteId); const { jsPDF } = window.jspdf; const tempDiv = document.createElement('div'); tempDiv.innerHTML = `${note.title}
${note.content}
