diff --git a/internal/httpapi/static/app.js b/internal/httpapi/static/app.js index bfeb7e1..bfd412c 100644 --- a/internal/httpapi/static/app.js +++ b/internal/httpapi/static/app.js @@ -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(); }; diff --git a/internal/summarizer/openai.go b/internal/summarizer/openai.go index f380036..5cce09a 100644 --- a/internal/summarizer/openai.go +++ b/internal/summarizer/openai.go @@ -249,7 +249,7 @@ func (o *OpenAI) SummarizeLink(ctx context.Context, rawURL string) (string, erro } // Build link-specific prompt - sys := "You summarize the content at a single URL. Ignore surrounding chat context. Be concise and natural." + sys := "You summarize web content." var userParts []openai.ChatMessagePart b := strings.Builder{} b.WriteString("URL: ") @@ -266,7 +266,7 @@ func (o *OpenAI) SummarizeLink(ctx context.Context, rawURL string) (string, erro b.WriteString(content) b.WriteString("\n\n") } - b.WriteString("Write a short, skimmable summary of the page/video/image above. If relevant, include key takeaways and any notable cautions. Keep it under a few short paragraphs.") + b.WriteString("Write a summary of the page/video/image above.") userParts = append(userParts, openai.ChatMessagePart{Type: openai.ChatMessagePartTypeText, Text: b.String()}) if img != "" { userParts = append(userParts, openai.ChatMessagePart{Type: openai.ChatMessagePartTypeImageURL, ImageURL: &openai.ChatMessageImageURL{URL: img}})