Skip to content

Commit 6bb3ed4

Browse files
author
ComputelessComputer
committed
Restore pre-KakaoTalk summary wording
Roll back the direct-message recap rewrite in JournalGenerator. Update journal tests to expect plain conversation titles again.
1 parent 281252b commit 6bb3ed4

2 files changed

Lines changed: 8 additions & 77 deletions

File tree

Sources/OpenbirdKit/Services/JournalGenerator.swift

Lines changed: 2 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,6 @@ public actor JournalGenerator {
196196
]
197197

198198
if dominantCategory(for: section) == .communication {
199-
guidance.append(
200-
"For chat or messaging evidence, participant or thread titles identify the conversation context, not automatically the speaker of each nearby message snippet."
201-
)
202-
guidance.append(
203-
"If the excerpt does not explicitly identify who said a message, describe it as something discussed or coordinated rather than attributing it to a named person."
204-
)
205199
guidance.append(
206200
"If message cues are prefixed with `Me:` or `Them:`, preserve that attribution."
207201
)
@@ -291,30 +285,21 @@ public actor JournalGenerator {
291285
}
292286

293287
private func eventPrompt(_ event: GroupedActivityEvent) -> String {
294-
let isCommunicationEvent = communicationAppLabels.contains(event.appName.normalizedComparisonKey)
295288
var pieces = [
296289
"\(OpenbirdDateFormatting.timeString(for: event.startedAt))-\(OpenbirdDateFormatting.timeString(for: event.endedAt))",
297290
event.appName,
298291
]
299292

300293
if let detailTitle = event.detailTitle {
301-
if isCommunicationEvent {
302-
pieces.append("context: \(detailTitle)")
303-
} else {
304-
pieces.append(detailTitle)
305-
}
294+
pieces.append(detailTitle)
306295
}
307296

308297
if let urlSummary = ActivityEvidencePreprocessor.summarizedURL(from: event.url) {
309298
pieces.append(urlSummary)
310299
}
311300

312301
if event.excerpt.isEmpty == false {
313-
if isCommunicationEvent {
314-
pieces.append("message cues (speaker may be unclear): \(event.excerpt)")
315-
} else {
316-
pieces.append(event.excerpt)
317-
}
302+
pieces.append(event.excerpt)
318303
}
319304

320305
if event.sourceEventCount > 1 {
@@ -435,10 +420,6 @@ public actor JournalGenerator {
435420
}
436421

437422
private func storyHeadingLabel(for section: PreparedSection) -> String {
438-
if let directMessageHeading = directMessageHeading(for: section) {
439-
return directMessageHeading
440-
}
441-
442423
let topic = displayTopic(for: section)
443424
guard shouldRewriteHeading(topic, section: section),
444425
let context = bestStoryContext(for: section) else {
@@ -458,10 +439,6 @@ public actor JournalGenerator {
458439
}
459440

460441
private func storyNarrativeLead(for section: PreparedSection, apps: [String]) -> String? {
461-
if let directMessageLead = directMessageNarrativeLead(for: section, apps: apps) {
462-
return directMessageLead
463-
}
464-
465442
guard shouldRewriteHeading(displayTopic(for: section), section: section),
466443
let context = bestStoryContext(for: section) else {
467444
return nil
@@ -493,48 +470,6 @@ public actor JournalGenerator {
493470
return genericToolLabels.contains(normalizedTopic)
494471
}
495472

496-
private func directMessageHeading(for section: PreparedSection) -> String? {
497-
guard isDirectMessagingSection(section),
498-
let conversationTitle = primaryConversationTitle(for: section) else {
499-
return nil
500-
}
501-
502-
return "Chatting with \(conversationTitle)"
503-
}
504-
505-
private func directMessageNarrativeLead(for section: PreparedSection, apps: [String]) -> String? {
506-
guard isDirectMessagingSection(section),
507-
let conversationTitle = primaryConversationTitle(for: section),
508-
let appName = apps.first else {
509-
return nil
510-
}
511-
512-
return "You were chatting with \(conversationTitle) on \(appName)."
513-
}
514-
515-
private func isDirectMessagingSection(_ section: PreparedSection) -> Bool {
516-
let appNames = Set(section.groupedEvents.map { $0.appName.normalizedComparisonKey })
517-
return appNames.count == 1 && appNames.isDisjoint(with: directMessagingAppLabels) == false
518-
}
519-
520-
private func primaryConversationTitle(for section: PreparedSection) -> String? {
521-
section.groupedEvents
522-
.compactMap(\.detailTitle)
523-
.map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }
524-
.first(where: isUsableConversationTitle)
525-
}
526-
527-
private func isUsableConversationTitle(_ title: String) -> Bool {
528-
let normalizedTitle = title.normalizedComparisonKey
529-
guard normalizedTitle.isEmpty == false,
530-
genericToolLabels.contains(normalizedTitle) == false
531-
else {
532-
return false
533-
}
534-
535-
return normalizedTitle.replacingOccurrences(of: " ", with: "").allSatisfy(\.isNumber) == false
536-
}
537-
538473
private func bestStoryContext(for section: PreparedSection) -> String? {
539474
let topicKey = displayTopic(for: section).normalizedComparisonKey
540475

@@ -676,10 +611,6 @@ public actor JournalGenerator {
676611
["slack", "messages", "imessage", "discord", "kakaotalk", "telegram", "whatsapp", "mail", "gmail"]
677612
}
678613

679-
private var directMessagingAppLabels: Set<String> {
680-
["messages", "imessage", "kakaotalk", "telegram", "whatsapp"]
681-
}
682-
683614
private var developmentAppLabels: Set<String> {
684615
["xcode", "visual studio code", "vs code", "cursor", "zed", "terminal", "iterm2", "warp", "nova"]
685616
}

Tests/OpenbirdKitTests/JournalGeneratorTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -366,12 +366,12 @@ struct JournalGeneratorTests {
366366
#expect(journal.sections.first?.bullets.first?.contains("Enter a message") == false)
367367
#expect(journal.sections.first?.bullets.first?.contains("Voice Call") == false)
368368
#expect(journal.markdown.contains("Looked through your context."))
369-
#expect(journal.markdown.contains("## Chatting with Alice"))
370-
#expect(journal.markdown.contains("You were chatting with Alice on KakaoTalk."))
369+
#expect(journal.markdown.contains("## Alice"))
370+
#expect(journal.markdown.contains("This part of the day centered on Alice in KakaoTalk."))
371371
#expect(journal.markdown.contains("- See you there"))
372372
}
373373

374-
@Test func fallbackMarkdownTreatsDirectMessagesAsConversationContext() async throws {
374+
@Test func fallbackMarkdownKeepsDirectMessageTitlesPlain() async throws {
375375
let databaseURL = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString).appendingPathExtension("sqlite")
376376
let store = try OpenbirdStore(databaseURL: databaseURL)
377377
let generator = JournalGenerator(store: store)
@@ -403,9 +403,9 @@ struct JournalGeneratorTests {
403403
)
404404
)
405405

406-
#expect(journal.markdown.contains("## Chatting with 윤진솔"))
407-
#expect(journal.markdown.contains("You were chatting with 윤진솔 on KakaoTalk."))
408-
#expect(journal.markdown.contains("## 윤진솔") == false)
406+
#expect(journal.markdown.contains("## 윤진솔"))
407+
#expect(journal.markdown.contains("This part of the day centered on 윤진솔 in KakaoTalk."))
408+
#expect(journal.markdown.contains("## Chatting with 윤진솔") == false)
409409
}
410410

411411
@Test func compactsAcrossWholeDayWhenSourceEventsAreCapped() async throws {

0 commit comments

Comments
 (0)