formatMemoryNotice renders an ExtractionSummary as a compact one-liner, e.g. "memory: +2 facts, profile updated, +1 project". Returns "" when nothing user-visible was persisted (a lone daily-note write is noise).
(s memory.ExtractionSummary)
| 49 | // e.g. "memory: +2 facts, profile updated, +1 project". Returns "" when |
| 50 | // nothing user-visible was persisted (a lone daily-note write is noise). |
| 51 | func formatMemoryNotice(s memory.ExtractionSummary) string { |
| 52 | var parts []string |
| 53 | if s.FactsAdded > 0 { |
| 54 | parts = append(parts, i18n.T("mem.notice.facts", s.FactsAdded)) |
| 55 | } |
| 56 | if s.ProfileUpdated { |
| 57 | parts = append(parts, i18n.T("mem.notice.profile")) |
| 58 | } |
| 59 | if s.ProjectsUpserted > 0 { |
| 60 | parts = append(parts, i18n.T("mem.notice.projects", s.ProjectsUpserted)) |
| 61 | } |
| 62 | if s.TopicsRecorded > 0 { |
| 63 | parts = append(parts, i18n.T("mem.notice.topics", s.TopicsRecorded)) |
| 64 | } |
| 65 | if len(parts) == 0 { |
| 66 | return "" |
| 67 | } |
| 68 | return i18n.T("mem.notice.prefix") + " " + strings.Join(parts, ", ") |
| 69 | } |