refactor(digest): consolidate AI-generated groups #58

Merged
eleith merged 2 commits from gemini/refactor/consolidate-ai-groups into main 2025-09-12 22:23:59 +00:00
2 Commits
Author SHA1 Message Date
eleith e4bc859029 refactor(digest): co-locate prompt response types
Moves the Go structs for LLM responses into the `ai_prompts.go` file, alongside the prompts that generate them.

The structs have been renamed to better associate them with their corresponding prompt variables:
- `GroupingResponse` is now `InitialGroupingResponse`
- `AIGroupSummaryResponse` is now `SummaryResponse`
- `AISubGroupingResponse` is now `SubGroupingResponse`

This change improves maintainability by keeping the prompt, its expected response type, and its schema in the same file.
2025-09-12 22:19:49 +00:00
eleith 8b52be6992 refactor(digest): consolidate AI-generated groups
This change addresses the creation of too many similar primary groups by adding an LLM-powered consolidation step.

The GroupAIEntries function now processes entry chunks in parallel. A new consolidatePrimaryGroups function is introduced, which calls an LLM to merge the initial, numerous group titles into a smaller set. The logic preserves any group titles that the LLM fails to map, and this behavior is verified in a new unit test.

Additionally, all prompt constants have been moved from ai.go into a new internal/digest/view/ai_prompts.go file.
2025-09-12 22:05:13 +00:00