tweak: swap 🌚/🌝 UI states for link summary; adjust link summarizer prompt

This commit is contained in:
Thomas Cravey 2025-08-17 20:17:29 -05:00
parent 01ff3a0579
commit 43f1235482
2 changed files with 4 additions and 4 deletions

View file

@ -74,11 +74,11 @@ function processLinks(scope){ const links = scope.querySelectorAll('a[href]:not(
const toggle = ()=>{ const hidden = c.style.display==='none'; c.style.display = hidden? '' : 'none'; chevron.textContent = hidden? '▾':'▸'; pinBottomMulti(); };
chevron.onclick = (ev)=>{ ev.stopPropagation(); toggle(); };
sumBtn.onclick = async ()=>{
if(sum.style.display!== 'none' && sum.textContent){ sum.style.display='none'; sumBtn.textContent='🌝'; pinBottomMulti(); return; }
if(sum.style.display!== 'none' && sum.textContent){ sum.style.display='none'; sumBtn.textContent='🌚'; pinBottomMulti(); return; }
// Ensure card is visible when showing summary
if(c.style.display==='none'){ toggle(); }
sumBtn.disabled=true; spinner.textContent='…'; sum.textContent=''; sum.style.display='';
try{ const data = await api('/api/linksummary',{query:{url:a.href}}); sum.textContent = (data && data.summary) ? data.summary : '(no summary)'; sumBtn.textContent='🌚'; }
try{ const data = await api('/api/linksummary',{query:{url:a.href}}); sum.textContent = (data && data.summary) ? data.summary : '(no summary)'; sumBtn.textContent='🌝'; }
catch(e){ sum.textContent = 'error: '+e; }
spinner.textContent=''; sumBtn.disabled=false; pinBottomMulti();
};