Skip to content

知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.

fix: a long meeting's live notes no longer give a topic a start time minutes after what was said in it

wqugurue6ccaacc2664
diff --git a/Sources/Cicada/Notes.swift b/Sources/Cicada/Notes.swift
index 8ce1408..44921b8 100644
--- a/Sources/Cicada/Notes.swift
+++ b/Sources/Cicada/Notes.swift
@@ -454,6 +454,9 @@ final class NotesEngine: ObservableObject {
// A point keeps the time it was first heard: a later mention never moves it later.
let times = t.points.enumerated().map { i, p in [t.pointTime(i), known[p]].compactMap { $0 }.min() }
new.topics[ti].pointTimes = times.contains { $0 != nil } ? times : nil
+ // The reply dates a topic from the lines it cites now, often only the latest: it starts no
+ // later than its first point, or its range runs minutes past what was said in it.
+ if let first = times.compactMap({ $0 }).min(), first < t.start { new.topics[ti].start = first }
}
let items = Dictionary((old.conclusions + old.todos).compactMap { i in i.t.map { (i.text, $0) } }, uniquingKeysWith: { a, _ in a })
func earliest(_ a: Double?, _ b: Double?) -> Double? { [a, b].compactMap { $0 }.min() }
diff --git a/Tests/CicadaTests/NotesTests.swift b/Tests/CicadaTests/NotesTests.swift
index 6037f54..7b3d8a8 100644
--- a/Tests/CicadaTests/NotesTests.swift
+++ b/Tests/CicadaTests/NotesTests.swift
@@ -12,6 +12,18 @@ import Testing
(0..<n).map { TranscriptLine(id: "l\($0)", t: Double($0 * 10), speaker: "them", src: "line \($0)", dst: nil, srcLang: "zh-CN", dstLang: "en") }
}
+ /// A rewritten topic cites only its newest lines; its points keep when they were first said,
+ /// and the topic starts no later than they do (a 35-minute replay showed 17:20 for points at 12:50).
+ @Test func topicStartsNoLaterThanItsFirstPoint() {
+ var old = MeetingNotes()
+ old.topics = [topic(770, "油价", ["A", "B"], [678, 700])]
+ var next = MeetingNotes()
+ next.topics = [topic(1040, "油价", ["A", "B", "C"], [nil, nil, 1040])]
+ NotesEngine.carryTimes(from: old, into: &next)
+ #expect(next.topics[0].pointTimes == [678, 700, 1040])
+ #expect(next.topics[0].start == 678)
+ }
+
@Test func keepsFrozenTopicsAndTakesTheReplysTail() {
let old = (0..<5).map { topic(Double($0 * 100), "t\($0)") }
// The model echoed everything, renamed the current topic and added one.