Skip to content

Commit 70d4dc4

Browse files
committed
Remove insight feature from digest
1 parent 1cd9c6b commit 70d4dc4

5 files changed

Lines changed: 3 additions & 25 deletions

File tree

src/main/java/com/codebrief/model/Digest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,5 @@ public class Digest {
1919
private List<NewsItem> topUpdates;
2020
private List<NewsItem> quickMentions;
2121
private List<NewsItem> communityBuzz;
22-
private String insight;
2322
private String summary;
2423
}

src/main/java/com/codebrief/service/GeminiService.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,13 @@ private String buildPrompt(List<NewsItem> items) {
9090
prompt.append("\nTASK:\n");
9191
prompt.append("1. Identify the TOP 3 most important updates (framework releases, major news)\n");
9292
prompt.append("2. List 3-5 quick mentions (interesting but less critical)\n");
93-
prompt.append("3. Highlight 2-3 community discussions (Reddit/HN posts with high engagement)\n");
94-
prompt.append("4. Provide a 1-sentence insight about trends you notice\n\n");
93+
prompt.append("3. Highlight 2-3 community discussions (Reddit/HN posts with high engagement)\n\n");
9594

9695
prompt.append("OUTPUT FORMAT (respond with ONLY this JSON, no markdown formatting):\n");
9796
prompt.append("{\n");
9897
prompt.append(" \"topUpdates\": [1, 3, 7], // indices of top 3 items\n");
9998
prompt.append(" \"quickMentions\": [2, 5, 9, 12], // indices of 3-5 items\n");
100-
prompt.append(" \"communityBuzz\": [4, 8], // indices of 2-3 discussion items\n");
101-
prompt.append(" \"insight\": \"One sentence about what's trending\"\n");
99+
prompt.append(" \"communityBuzz\": [4, 8] // indices of 2-3 discussion items\n");
102100
prompt.append("}\n");
103101

104102
return prompt.toString();
@@ -172,14 +170,12 @@ private Digest parseDigestResponse(String response, List<NewsItem> items) {
172170
List<NewsItem> topUpdates = extractItems(json, "topUpdates", items);
173171
List<NewsItem> quickMentions = extractItems(json, "quickMentions", items);
174172
List<NewsItem> communityBuzz = extractItems(json, "communityBuzz", items);
175-
String insight = json.has("insight") ? json.get("insight").getAsString() : "";
176173

177174
return Digest.builder()
178175
.date(LocalDate.now().format(DateTimeFormatter.ofPattern("EEEE, MMMM d, yyyy")))
179176
.topUpdates(topUpdates)
180177
.quickMentions(quickMentions)
181178
.communityBuzz(communityBuzz)
182-
.insight(insight)
183179
.build();
184180

185181
} catch (Exception e) {
@@ -212,7 +208,6 @@ private Digest createEmptyDigest() {
212208
.topUpdates(new ArrayList<>())
213209
.quickMentions(new ArrayList<>())
214210
.communityBuzz(new ArrayList<>())
215-
.insight("No news items collected today.")
216211
.build();
217212
}
218213

@@ -236,7 +231,6 @@ private Digest createFallbackDigest(List<NewsItem> items) {
236231
.topUpdates(topUpdates)
237232
.quickMentions(quickMentions)
238233
.communityBuzz(communityBuzz)
239-
.insight("Frontend development continues to evolve rapidly.")
240234
.build();
241235
}
242236
}

src/main/java/com/codebrief/service/SlackService.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,6 @@ private String formatDigest(Digest digest) {
7979
sb.append("\n");
8080
}
8181

82-
// Insight
83-
if (digest.getInsight() != null && !digest.getInsight().isEmpty()) {
84-
sb.append("💡 *Insight*\n");
85-
sb.append("_").append(digest.getInsight()).append("_\n\n");
86-
}
87-
8882
sb.append("────────────────────────────────\n");
8983
sb.append("_Curated by Gemini AI • Running on GitHub Actions_");
9084

src/test/java/com/codebrief/service/GeminiServiceTest.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ void testProcessNewsItems_EmptyList() {
5858
assertTrue(result.getTopUpdates().isEmpty());
5959
assertTrue(result.getQuickMentions().isEmpty());
6060
assertTrue(result.getCommunityBuzz().isEmpty());
61-
assertEquals("No news items collected today.", result.getInsight());
6261
}
6362

6463
@Test
@@ -67,7 +66,7 @@ void testProcessNewsItems_WithValidResponse() throws Exception {
6766
List<NewsItem> newsItems = createTestNewsItems();
6867

6968
// This is what callGeminiAPI returns (the extracted text from the API response)
70-
String extractedJsonText = "{\"topUpdates\": [1, 2], \"quickMentions\": [3], \"communityBuzz\": [4], \"insight\": \"Test insight\"}";
69+
String extractedJsonText = "{\"topUpdates\": [1, 2], \"quickMentions\": [3], \"communityBuzz\": [4]}";
7170

7271
when(retryTemplate.execute(any())).thenAnswer(invocation -> {
7372
return extractedJsonText;
@@ -82,7 +81,6 @@ void testProcessNewsItems_WithValidResponse() throws Exception {
8281
assertEquals(2, result.getTopUpdates().size());
8382
assertEquals(1, result.getQuickMentions().size());
8483
assertEquals(1, result.getCommunityBuzz().size());
85-
assertEquals("Test insight", result.getInsight());
8684
}
8785

8886
@Test
@@ -101,7 +99,6 @@ void testProcessNewsItems_APIFailure_UsesFallback() throws Exception {
10199
assertNotNull(result.getTopUpdates());
102100
assertNotNull(result.getQuickMentions());
103101
assertNotNull(result.getCommunityBuzz());
104-
assertEquals("Frontend development continues to evolve rapidly.", result.getInsight());
105102
}
106103

107104
@Test
@@ -120,7 +117,6 @@ void testProcessNewsItems_InvalidJSONResponse_UsesFallback() throws Exception {
120117
// Assert - Should use fallback logic
121118
assertNotNull(result);
122119
assertNotNull(result.getDate());
123-
assertEquals("Frontend development continues to evolve rapidly.", result.getInsight());
124120
}
125121

126122
@Test

src/test/java/com/codebrief/service/SlackServiceTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ void testPostDigest_EmptyDigest() throws Exception {
9494
.topUpdates(List.of())
9595
.quickMentions(List.of())
9696
.communityBuzz(List.of())
97-
.insight("")
9897
.build();
9998

10099
when(retryTemplate.execute(any())).thenAnswer(invocation -> {
@@ -140,7 +139,6 @@ void testPostDigest_FormatsMessageCorrectly() throws Exception {
140139
.topUpdates(Arrays.asList(githubItem))
141140
.quickMentions(List.of())
142141
.communityBuzz(Arrays.asList(redditItem))
143-
.insight("Server-side rendering is trending")
144142
.build();
145143

146144
ArgumentCaptor<String> messageCaptor = ArgumentCaptor.forClass(String.class);
@@ -171,7 +169,6 @@ void testPostDigest_HandlesItemsWithoutScores() throws Exception {
171169
.topUpdates(Arrays.asList(itemWithoutScore))
172170
.quickMentions(List.of())
173171
.communityBuzz(List.of())
174-
.insight("Test insight")
175172
.build();
176173

177174
when(retryTemplate.execute(any())).thenAnswer(invocation -> {
@@ -200,7 +197,6 @@ void testPostDigest_MultipleItemsInEachSection() throws Exception {
200197
createNewsItem("Discussion 1", "Reddit", 450),
201198
createNewsItem("Discussion 2", "HackerNews", 350)
202199
))
203-
.insight("Multiple items test")
204200
.build();
205201

206202
when(retryTemplate.execute(any())).thenAnswer(invocation -> {
@@ -245,7 +241,6 @@ private Digest createTestDigest() {
245241
.communityBuzz(Arrays.asList(
246242
createNewsItem("Discussion", "Reddit", 450)
247243
))
248-
.insight("Test insight about trends")
249244
.build();
250245
}
251246

0 commit comments

Comments
 (0)