知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.
Swift androidlinuxlive-captionsmacosmeeting-notesmenubar-appsimultaneous-interpretationspeech-recognitionsubtitlesswiftswiftuitranslationwindows
fix(linux): a key the check refused shows as invalid in the notes window instead of an idle wait
wqugurue7eacfbd31b7
diff --git a/linux/cicada/core/notes.py b/linux/cicada/core/notes.pyindex 6d1d0e8..8205b03 100644--- a/linux/cicada/core/notes.py+++ b/linux/cicada/core/notes.py@@ -12,7 +12,7 @@ from concurrent.futures import ThreadPoolExecutorfrom . import jsonfmt, speakersfrom .jsonfmt import arr, num, obj-from .ling import NOTES, LingError+from .ling import CHECKING, INVALID, NOTES, LingErrorfrom .models import Fishbone, FishboneBranch, MeetingNotes, NoteItem, NoteTerm, NoteTopic, nowfrom .support import Log, clock, written_in@@ -61,6 +61,7 @@ class NotesEngine:s = self.store.get(sid)self.notes = (s.notes if s else None) or MeetingNotes()self.status = IDLE if self.ling.has_key else NO_KEY+ self._sync_key()self._last_attempt = time.time()self._stop_ticker()stop = threading.Event()@@ -104,10 +105,21 @@ class NotesEngine:"""Notes for a finished meeting that has none (runs in the background)."""self._work.submit(self._update, sid, True)+ def _sync_key(self) -> None:+ """The status follows the key, as on the Mac (`NotesEngine.tick`)."""+ ling = self.ling+ # A key was added or replaced since the last failure.+ if self.status in (NO_KEY, INVALID_KEY) and ling.usable and ling.key_state != CHECKING:+ self.status = IDLE+ if self.status == IDLE and not ling.has_key:+ self.status = NO_KEY+ # A key that was just checked and refused says so, rather than asking for a key again.+ if self.status in (NO_KEY, IDLE) and ling.has_key and ling.key_state == INVALID:+ self.status = INVALID_KEY+def _tick(self) -> None:with self._gate:- if self.status == NO_KEY and self.ling.usable:- self.status = IDLE+ self._sync_key()sid = self._session_idif sid is None or self._in_flight:returndiff --git a/linux/tests/test_core.py b/linux/tests/test_core.pyindex 1fc9b7d..3852e6c 100644--- a/linux/tests/test_core.py+++ b/linux/tests/test_core.py@@ -482,6 +482,23 @@ class Segmenting(Base):class Notes(Base):+ def test_status_follows_the_key_as_on_the_mac(self):+ # A key the check refused is "invalid", not "no key"; a fixed key goes back to idle.+ from cicada.core import ling as lingmod+ store = SessionStore()+ ling = client(Fake(lambda body: reply("{}")))+ notes = NotesEngine(ling, store)+ ling.key_state = lingmod.INVALID+ notes.status = notesmod.IDLE+ notes._sync_key()+ self.assertEqual(notesmod.INVALID_KEY, notes.status)+ ling.key_state = lingmod.CHECKING+ notes._sync_key()+ self.assertEqual(notesmod.INVALID_KEY, notes.status, "still checking")+ ling.key_state = lingmod.OK+ notes._sync_key()+ self.assertEqual(notesmod.IDLE, notes.status)+def test_notes_language_as_on_the_mac(self):# "mine" or "source"; one meeting's choice over the setting; a change while live rewrites.store = SessionStore()