nandi/gleanpublic Fork 0
9755234
Commits
Clone
git clone https://git.rickub.com/nandi/glean.git
git clone ssh://git@rickub.com/nandi/glean.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Add HasLLM flag to control LLM-specific UI sectionsUnverified

Julien Robert committed 2026-05-18T01:17:53+02:00 Browse files
9755234 parent: 01468b3
modified internal/server/server.go +5 -0
@@ -587,6 +587,8 @@ func (s *Server) render(w http.ResponseWriter, r *http.Request, name string, dat
587587 data = map[string]any{}
588588 }
589589
590+ data["HasLLM"] = s.llm != nil
591+
590592 if cookie, err := r.Cookie("glean_csrf"); err == nil {
591593 data["CSRFToken"] = cookie.Value
592594 }
@@ -621,6 +623,9 @@ func (s *Server) render(w http.ResponseWriter, r *http.Request, name string, dat
621623 if csrf, ok := data["CSRFToken"]; ok {
622624 baseData["CSRFToken"] = csrf
623625 }
626+ if hasLLM, ok := data["HasLLM"]; ok {
627+ baseData["HasLLM"] = hasLLM
628+ }
624629 }
625630
626631 if err := s.templates.ExecuteTemplate(w, "base.html", baseData); err != nil {
@@ -587,6 +587,8 @@ func (s *Server) render(w http.ResponseWriter, r *http.Request, name string, dat
587 data = map[string]any{}587 data = map[string]any{}
588 }588 }
589 589
590+ data["HasLLM"] = s.llm != nil
591+
590 if cookie, err := r.Cookie("glean_csrf"); err == nil {592 if cookie, err := r.Cookie("glean_csrf"); err == nil {
591 data["CSRFToken"] = cookie.Value593 data["CSRFToken"] = cookie.Value
592 }594 }
@@ -621,6 +623,9 @@ func (s *Server) render(w http.ResponseWriter, r *http.Request, name string, dat
621 if csrf, ok := data["CSRFToken"]; ok {623 if csrf, ok := data["CSRFToken"]; ok {
622 baseData["CSRFToken"] = csrf624 baseData["CSRFToken"] = csrf
623 }625 }
626+ if hasLLM, ok := data["HasLLM"]; ok {
627+ baseData["HasLLM"] = hasLLM
628+ }
624 }629 }
625 630
626 if err := s.templates.ExecuteTemplate(w, "base.html", baseData); err != nil {631 if err := s.templates.ExecuteTemplate(w, "base.html", baseData); err != nil {
modified internal/tmpl/dashboard.html +1 -19
@@ -38,7 +38,7 @@
3838 </div>
3939 {{end}}
4040
41-{{if .DigestEnabled}}
41+{{if and .DigestEnabled .HasLLM}}
4242 <div id="digest" hx-get="/digest" hx-trigger="load" hx-swap="innerHTML" hx-indicator="#digest">
4343 <div class="mb-6">
4444 <h2 class="text-lg font-semibold text-spot-text mb-4">Daily digest</h2>
@@ -82,24 +82,6 @@
8282 </div>
8383 {{end}}
8484
85-{{if and .DigestEnabled (gt .UnreadCount 0)}}
86-<div id="digest" hx-get="/digest" hx-trigger="load" hx-swap="innerHTML" hx-indicator="#digest">
87- <div class="mb-6">
88- <h2 class="text-lg font-semibold text-spot-text mb-4">Daily digest</h2>
89- <div class="animate-pulse bg-spot-surface rounded-xl px-5 py-4">
90- <div class="flex items-start gap-2.5">
91- <div class="w-4 h-4 bg-spot-hover rounded shrink-0 mt-0.5"></div>
92- <div class="flex-1 space-y-2">
93- <div class="h-4 bg-spot-hover rounded w-2/3"></div>
94- <div class="h-3 bg-spot-hover rounded w-full"></div>
95- <div class="h-3 bg-spot-hover rounded w-4/5"></div>
96- </div>
97- </div>
98- </div>
99- </div>
100-</div>
101-{{end}}
102-
10385 <div class="mb-8">
10486 <h2 class="text-lg font-semibold text-spot-text mb-4">Unread articles</h2>
10587 <div class="bg-spot-surface rounded-2xl py-14 px-6 text-center">
@@ -38,7 +38,7 @@
38 </div>38 </div>
39 {{end}}39 {{end}}
40 40
41-{{if .DigestEnabled}}41+{{if and .DigestEnabled .HasLLM}}
42 <div id="digest" hx-get="/digest" hx-trigger="load" hx-swap="innerHTML" hx-indicator="#digest">42 <div id="digest" hx-get="/digest" hx-trigger="load" hx-swap="innerHTML" hx-indicator="#digest">
43 <div class="mb-6">43 <div class="mb-6">
44 <h2 class="text-lg font-semibold text-spot-text mb-4">Daily digest</h2>44 <h2 class="text-lg font-semibold text-spot-text mb-4">Daily digest</h2>
@@ -82,24 +82,6 @@
82 </div>82 </div>
83 {{end}}83 {{end}}
84 84
85-{{if and .DigestEnabled (gt .UnreadCount 0)}}
86-<div id="digest" hx-get="/digest" hx-trigger="load" hx-swap="innerHTML" hx-indicator="#digest">
87- <div class="mb-6">
88- <h2 class="text-lg font-semibold text-spot-text mb-4">Daily digest</h2>
89- <div class="animate-pulse bg-spot-surface rounded-xl px-5 py-4">
90- <div class="flex items-start gap-2.5">
91- <div class="w-4 h-4 bg-spot-hover rounded shrink-0 mt-0.5"></div>
92- <div class="flex-1 space-y-2">
93- <div class="h-4 bg-spot-hover rounded w-2/3"></div>
94- <div class="h-3 bg-spot-hover rounded w-full"></div>
95- <div class="h-3 bg-spot-hover rounded w-4/5"></div>
96- </div>
97- </div>
98- </div>
99- </div>
100-</div>
101-{{end}}
102-
103 <div class="mb-8">85 <div class="mb-8">
104 <h2 class="text-lg font-semibold text-spot-text mb-4">Unread articles</h2>86 <h2 class="text-lg font-semibold text-spot-text mb-4">Unread articles</h2>
105 <div class="bg-spot-surface rounded-2xl py-14 px-6 text-center">87 <div class="bg-spot-surface rounded-2xl py-14 px-6 text-center">
modified internal/tmpl/profile.html +2 -0
@@ -23,6 +23,7 @@
2323 </div>
2424
2525 {{if eq .ProfileUser.DID .CurrentUserDID}}
26+ {{if .HasLLM}}
2627 <h2 class="text-sm font-bold text-spot-text uppercase tracking-wide mb-3">Settings</h2>
2728 <div class="bg-spot-surface rounded-xl p-5 mb-6 space-y-5">
2829 <form hx-post="/settings/digest-enabled" hx-swap="none" hx-on::after-request="location.reload()">
@@ -64,6 +65,7 @@
6465 </div>
6566 </div>
6667 {{end}}
68+ {{end}}
6769
6870 <h2 class="text-sm font-bold text-spot-text uppercase tracking-wide mb-3">Feeds</h2>
6971 <div class="bg-spot-surface rounded-xl divide-y divide-spot-divider mb-6 overflow-hidden">
@@ -23,6 +23,7 @@
23 </div>23 </div>
24 24
25 {{if eq .ProfileUser.DID .CurrentUserDID}}25 {{if eq .ProfileUser.DID .CurrentUserDID}}
26+ {{if .HasLLM}}
26 <h2 class="text-sm font-bold text-spot-text uppercase tracking-wide mb-3">Settings</h2>27 <h2 class="text-sm font-bold text-spot-text uppercase tracking-wide mb-3">Settings</h2>
27 <div class="bg-spot-surface rounded-xl p-5 mb-6 space-y-5">28 <div class="bg-spot-surface rounded-xl p-5 mb-6 space-y-5">
28 <form hx-post="/settings/digest-enabled" hx-swap="none" hx-on::after-request="location.reload()">29 <form hx-post="/settings/digest-enabled" hx-swap="none" hx-on::after-request="location.reload()">
@@ -64,6 +65,7 @@
64 </div>65 </div>
65 </div>66 </div>
66 {{end}}67 {{end}}
68+ {{end}}
67 69
68 <h2 class="text-sm font-bold text-spot-text uppercase tracking-wide mb-3">Feeds</h2>70 <h2 class="text-sm font-bold text-spot-text uppercase tracking-wide mb-3">Feeds</h2>
69 <div class="bg-spot-surface rounded-xl divide-y divide-spot-divider mb-6 overflow-hidden">71 <div class="bg-spot-surface rounded-xl divide-y divide-spot-divider mb-6 overflow-hidden">