From 43f12354824118272dcc3ea5828c1d349d1a2c19 Mon Sep 17 00:00:00 2001 From: Thomas Cravey Date: Sun, 17 Aug 2025 20:17:29 -0500 Subject: [PATCH] =?UTF-8?q?tweak:=20swap=20=F0=9F=8C=9A/=F0=9F=8C=9D=20UI?= =?UTF-8?q?=20states=20for=20link=20summary;=20adjust=20link=20summarizer?= =?UTF-8?q?=20prompt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/httpapi/static/app.js | 4 ++-- internal/summarizer/openai.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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}})