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: saying yes to a fixed name fixes the rest of the meeting heard the same way at once, not only with the next line

wquguru46dae9fa7cfc
diff --git a/Sources/Cicada/LiveFixes.swift b/Sources/Cicada/LiveFixes.swift
index 3ce8c55..b8c9d91 100644
--- a/Sources/Cicada/LiveFixes.swift
+++ b/Sources/Cicada/LiveFixes.swift
@@ -164,7 +164,8 @@ final class LiveFixes: ObservableObject {
let c = Correction.core(fix.from, fix.to)
guard let s = store.session(id) else { return }
let touched = s.lines.filter { ($0.fixes ?? []).contains { $0.ask == true && Correction.core($0.from, $0.to) == c } }
- remember(id, lines: touched.map(\.id))
+ let others = yes ? s.lines.filter { $0.src.contains(c.from) && !touched.contains($0) } : []
+ remember(id, lines: (touched + others).map(\.id))
for l in touched {
var fixes = l.fixes ?? []
for k in fixes.indices where fixes[k].ask == true && Correction.core(fixes[k].from, fixes[k].to) == c {
@@ -173,7 +174,13 @@ final class LiveFixes: ObservableObject {
}
set(fixes, line: l.id, in: id)
}
- if yes { vocabulary.confirm(heard: c.from, word: c.to) } else { refused.insert(Self.pair(c.from, c.to)) }
+ if yes {
+ vocabulary.confirm(heard: c.from, word: c.to)
+ // The rest of the meeting heard the same way follows now, not with the next line.
+ for l in others { applyKnown(lineID: l.id, in: id) }
+ } else {
+ refused.insert(Self.pair(c.from, c.to))
+ }
debugLog("fix answered \(yes ? "yes" : "no")")
say(yes ? L("已改 \(c.from) → \(c.to),记进词表") : L("这场不再问 \(c.from)"))
}
diff --git a/Tests/CicadaTests/LiveFixesTests.swift b/Tests/CicadaTests/LiveFixesTests.swift
index 5f87937..068d3f4 100644
--- a/Tests/CicadaTests/LiveFixesTests.swift
+++ b/Tests/CicadaTests/LiveFixesTests.swift
@@ -83,4 +83,13 @@ import Testing
fx.received("但质压这种", [.init(from: "质压", to: "质押", confidence: 0.9)])
#expect(line(store, id, "l0").shown == "但质压这种")
}
+
+ @Test func yesFixesTheRestOfTheMeetingAtOnce() {
+ let (fx, store, id) = setup(["最近那个开布特提了", "开布特那边也说了"])
+ fx.received("最近那个开布特提了", [.init(from: "开布特", to: "Curve", confidence: 0.9)])
+ fx.answer(fx.pending(in: id)[0].fix, yes: true, in: id)
+ #expect(line(store, id, "l1").shown == "Curve那边也说了")
+ fx.undo()
+ #expect(line(store, id, "l1").shown == "开布特那边也说了")
+ }
}