Skip to content

Commit a2b420a

Browse files
cpcloudclaude
andcommitted
fix(llm): align plan doc with implementation, fix duplicate insights header
- Update plan doc to describe the actual JSON object format ({"insights": [...]}) instead of a bare JSON array - Only show insights error state when there are no cached items, preventing a duplicate "Insights" header after a failed refresh Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a5caeef commit a2b420a

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

internal/app/dashboard.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,8 @@ func (m *Model) dashboardView(budget, maxWidth int) string {
519519

520520
// Show loading/error state for insights even when there are no items yet.
521521
showInsightsLoading := m.insightsEnabled && m.dash.insights.loading
522-
showInsightsError := m.insightsEnabled && m.dash.insights.err != nil && !m.dash.insights.loading
522+
showInsightsError := m.insightsEnabled && m.dash.insights.err != nil &&
523+
!m.dash.insights.loading && len(m.dash.insights.items) == 0
523524

524525
if len(sections) == 0 && !showInsightsLoading && !showInsightsError {
525526
return ""

plans/proactive-insights.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ Urgent/actionable items stay on top; insights are supplementary analysis.
5050
- **Config**: `llm.insights` bool field on `LLM` config struct. Env var
5151
`MICASA_LLM_INSIGHTS`. Stored as `*bool` for tri-state (nil = default off).
5252
- **Prompt**: new `BuildInsightsPrompt()` in `internal/llm/prompt.go`. Receives
53-
full data dump + schema + date + house profile, instructs LLM to output JSON
54-
array of `{text, tab, entity_id}` objects. Emphasizes cross-entity
55-
observations, max 5-7 items, no duplication of existing dashboard sections.
53+
full data dump + schema + date + house profile, instructs LLM to output a
54+
JSON object `{"insights": [{text, tab, entity_id}, ...]}` via
55+
`WithJSONSchema`. Emphasizes cross-entity observations, max 5-7 items, no
56+
duplication of existing dashboard sections.
5657
- **Non-streaming**: uses `ChatComplete()` since output is a small JSON array.
5758
Runs via `tea.Cmd` returning an `insightsResultMsg`.
5859
- **State**: `insightsState` struct on `dashState`. Tracks results, loading

0 commit comments

Comments
 (0)