feat: LLM auto-titles — daemon names unnamed sessions from their first user message via one cheap ZAI completion (no agent-turn pollution); flows into sidebar + tab title
This commit is contained in:
@@ -614,6 +614,16 @@ func (h *Hub) handleEvent(f frame) {
|
||||
log.Printf("hub: touch session %s: %v", f.sessionID, err)
|
||||
}
|
||||
}
|
||||
// Auto-title: first persisted user message on an unnamed session asks
|
||||
// the configured LLM for a short title (separate cheap completion; never
|
||||
// touches the agent conversation).
|
||||
if f.typ == evMessageEnd && h.needsAutoTitle(f) {
|
||||
sid := f.sessionID
|
||||
text := firstUserText(f.raw)
|
||||
if text != "" {
|
||||
go h.autoTitle(sid, text)
|
||||
}
|
||||
}
|
||||
// Track mid-turn state for the session-list activity pulse.
|
||||
if f.typ == evAgentStart || f.typ == evAgentSettled {
|
||||
busy := f.typ == evAgentStart
|
||||
|
||||
Reference in New Issue
Block a user