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.

test(linux): heard can carry Ming's translation, so the usual fixing path runs without audio

wquguru199815dcd612
diff --git a/linux/cicada/app/debug.py b/linux/cicada/app/debug.py
index faa7e53..1a8cd90 100644
--- a/linux/cicada/app/debug.py
+++ b/linux/cicada/app/debug.py
@@ -434,7 +434,7 @@ def _fix_state(app, sid: str) -> dict:
def _fixes(app, cmd: str, arg: str) -> dict:
"""改正听错的词 (the Mac's fixes / heard / fixState / fixAnswer / fixLater / fixUndo / fixEdit /
fixRevert / vocabAdd / vocabState / resettle):
- fixes on|off | ask-names on|off | heard <text> (a finished sentence as if Ming heard it, in the
+ fixes on|off | ask-names on|off | heard <text>[|<translation>] (a finished sentence as if Ming heard it, in the
meeting being listened to: the record, the fixing request, the notes window all follow) |
fix-state [<id>] | fix-answer yes|no [<id>] | fix-later [<id>] | fix-undo | fix-revert <line> [<id>] |
fix-edit <line>=<text>[|one][|keep0][|@<id>] | vocab-add Morpho=莫拉、莫法[|…] | vocab-remove <word> |
@@ -465,7 +465,10 @@ def _fixes(app, cmd: str, arg: str) -> dict:
lang = listen._main.hint or "zh-CN"
seg = SimpleNamespace(start=listen.heard_seconds, seconds=2.0, index=0, voiceprint=None,
asked=app.settings.resolved_target(lang))
- heard = Heard(lang, arg, None)
+ # `heard <text>|<translation>`: a line Ming translated, the usual path (the fixing request
+ # replaces its translation); without one, the path of a line Ming left untranslated.
+ text, _, dst = arg.partition("|")
+ heard = Heard(lang, text, dst or None)
def run():
listen._record(listen._main, seg, heard)
diff --git a/linux/cicada/app/notes_window.py b/linux/cicada/app/notes_window.py
index d9b416d..3bcf7e9 100644
--- a/linux/cicada/app/notes_window.py
+++ b/linux/cicada/app/notes_window.py
@@ -602,7 +602,7 @@ class NotesWindow(Gtk.Window):
a = fx.asking(session.id) if session is not None else None
toast = fx.toast_text()
key = (session.id if session else None, a[1].from_ if a else None, a[1].to if a else None, a[3] if a else 0,
- a[0].id if a else None, toast, fx.can_undo)
+ a[0].id if a else None, fx.toast if toast else None, fx.can_undo) # the toast with its time
if key == getattr(self, "_fix_key", None):
return
self._fix_key = key