知了 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
feat(windows): when the AI service needs you to fix something, like a key that stopped working, the tray icon shows an orange dot naming it, and one notification per meeting if the notes window is put away
wqugurufd1550dffe45
diff --git a/windows/scripts/cicadactl.ps1 b/windows/scripts/cicadactl.ps1index bc153ec..e2caf43 100644--- a/windows/scripts/cicadactl.ps1+++ b/windows/scripts/cicadactl.ps1@@ -1,5 +1,5 @@# Sends one debug command to a running dev build (Cicada.exe --dev) and prints its JSON state.-# .\cicadactl.ps1 state | start | stop | end | notesproblem failed | sample | feed C:\clip.wav | view subtitles | capture on | show records | quit+# .\cicadactl.ps1 state | start | stop | end | notesproblem failed | sample | feed C:\clip.wav | view subtitles | capture on | show records | hide notes | quit# AI 服务: provider ling|openrouter|zenmux|custom | ai-model hear|text|voice <id> | show settings ai models# AI 服务检查: ai-check | ai-check-sim <unreachable|invalidKey|noCredit|mgmtKey|noModel|noJSON|deaf|busy|serverError|lowBalance|off> (state › ai.check: every step)# 结束会议: calls zoom.exe=Zoom|none|real | realcalls | endtimes <silence> <countdown> <grace>|off | endkeepdiff --git a/windows/src/Cicada.Core/AICheck.cs b/windows/src/Cicada.Core/AICheck.csindex dd0c371..ad536a4 100644--- a/windows/src/Cicada.Core/AICheck.cs+++ b/windows/src/Cicada.Core/AICheck.cs@@ -95,6 +95,15 @@ public sealed class AICheck/// Something only the user can fix (a busy service or a server error fixes itself).public bool NeedsUser => Failure is { } f ? f.Why is not (Reason.Busy or Reason.ServerError) : IsLowBalance;+ /// What stops listening or the notes until the user changes something (the Mac's+ /// AIServiceStrip.blocking): the tray's dot and the one notification a meeting, beyond the panel.+ /// Not the network, a busy service or a server error (they pass by themselves), nor a low balance+ /// (it still works). Deaf is the ports' own: the hear model is the user's choice to change.+ public static bool Blocks(Reason why) => why is Reason.InvalidKey or Reason.MgmtKey or Reason.NoCredit+ or Reason.NoModel or Reason.BadAddress or Reason.NoJSON or Reason.Deaf;++ public bool Blocking => Failure is { } f && Blocks(f.Why);+/// Whether a request to `later` must have got past `step`: the hear model's request proves the/// address and the key, not the text model, and the text model's says nothing about hearing.static bool Needs(StepId later, StepId step) => later == StepId.Hear ? step is StepId.Reach or StepId.Key : step < later;diff --git a/windows/src/Cicada/App.cs b/windows/src/Cicada/App.csindex 195c76a..d5ab26b 100644--- a/windows/src/Cicada/App.cs+++ b/windows/src/Cicada/App.cs@@ -76,7 +76,11 @@ sealed class Controller/// Dev builds: a WAV that stands in for the microphone (the VM has none).string? fakeMic;readonly Forms.NotifyIcon tray = new();- System.Drawing.Icon? idleIcon, liveIcon;+ System.Drawing.Icon? idleIcon, liveIcon, updateIcon;+ /// Something only the user can fix (AICheck.Blocking), said beyond the panel: the tray's orange+ /// dot and tooltip, and once a meeting a notification while the notes panel is put away.+ public string? Problem { get; private set; }+ bool problemNotified;/// The installer's download progress (0…1) while an update is being fetched, and why the last one failed.public double? UpdateProgress { get; private set; }public string? UpdateFailure { get; private set; }@@ -207,7 +211,8 @@ sealed class Controllervoid SetUpTray(){idleIcon = LoadIcon();- liveIcon = WithDot(idleIcon);+ liveIcon = WithDot(idleIcon, System.Drawing.Color.FromArgb(0xE8, 0x55, 0x2B));+ updateIcon = WithDot(idleIcon, System.Drawing.Color.FromArgb(0x6B, 0x70, 0x80));tray.Icon = idleIcon;tray.Text = L("知了");tray.Visible = true;@@ -232,8 +237,9 @@ sealed class Controllercatch { return System.Drawing.SystemIcons.Application; }}- /// The tray icon while listening: the logo with the live dot on its corner.- static System.Drawing.Icon WithDot(System.Drawing.Icon icon)+ /// The logo with a dot on its corner: orange while listening or something needs fixing, grey+ /// for a new version (it can wait).+ static System.Drawing.Icon WithDot(System.Drawing.Icon icon, System.Drawing.Color colour){using var bmp = new System.Drawing.Bitmap(32, 32);using (var g = System.Drawing.Graphics.FromImage(bmp))@@ -241,7 +247,7 @@ sealed class Controllerg.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;g.DrawIcon(icon, new System.Drawing.Rectangle(0, 0, 32, 32));using var ring = new System.Drawing.SolidBrush(System.Drawing.Color.White);- using var dot = new System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(0xE8, 0x55, 0x2B));+ using var dot = new System.Drawing.SolidBrush(colour);g.FillEllipse(ring, 16, 16, 16, 16);g.FillEllipse(dot, 19, 19, 10, 10);}@@ -250,10 +256,32 @@ sealed class Controllervoid UpdateTray(){- // The same orange dot says 正在听 or 有新版本 (the Mac's badge); listening wins.- tray.Icon = Listen.Listening || Updates.Available is not null ? liveIcon : idleIcon;- tray.Text = Listen.Listening ? L("知了") + " · " + L("正在听")+ CheckProblem();+ // Orange says 正在听 or something to fix (the Mac's problem badge), grey a new version;+ // the tooltip names the problem first.+ tray.Icon = Listen.Listening || Problem is not null ? liveIcon : Updates.Available is not null ? updateIcon : idleIcon;+ var text = Problem is { } p ? L("知了") + " · " + p+ : Listen.Listening ? L("知了") + " · " + L("正在听"): Updates.Available is { } u ? L("知了") + " · " + LF("有新版本 %@", u.Version) : L("知了");+ // NotifyIcon.Text throws past 127 characters (a long model id in the title).+ tray.Text = text.Length > 127 ? text[..126] + "…" : text;+ }++ /// On every change: the tray's problem, and its one notification a meeting. Only while+ /// listening, and only when the notes panel isn't up (its banner says so; the subtitle bar has+ /// none). Never a dialog: it would take the focus from the meeting app.+ void CheckProblem()+ {+ var p = Ling.HasKey && Ling.Health.Blocking ? AIProblem()?.Title : null;+ if (p != Problem)+ {+ Problem = p;+ Log.Debug($"tray: problem {(p is null ? "-" : Ling.Health.Failure?.Why.ToString())}");+ }+ if (p is null || problemNotified || !Listen.Listening || (NotesVisible && Settings.View == "notes")) return;+ problemNotified = true;+ Toast(p, LF("%@。点按去设置", AIProblem()?.Detail ?? ""), ShowAISettings);+ Log.Debug($"tray: notified problem {Ling.Health.Failure?.Why}");}public void ShowFlyout()@@ -546,6 +574,7 @@ sealed class ControllerWatch(source);AutoEnded = false;Ending = null;+ problemNotified = false;endWatch = new MeetingEndWatch(EndConfig(), DateTimeOffset.Now);Listen.Start(source, room: source is GatedSource);onlinePromptAnswered = false;@@ -753,6 +782,11 @@ sealed class Controller// MARK: Windows/// The tray icon while listening: the notes window comes and goes.+ public void HideNotes()+ {+ if (NotesVisible) ToggleNotes();+ }+public void ToggleNotes(){if (NotesVisible) notesWindow!.Hide(); else ShowNotes();@@ -965,6 +999,9 @@ sealed class Controller["problem"] = Ling.Health.Message(Ling.ServiceName, Ling.ServiceHost, Ling.Config.TextModel, Ling.HearName),["proxy"] = Ling.Health.ProxyLine(Ling.ServiceName, Ling.ServiceHost),["tray"] = AIProblem()?.Title,+ ["dot"] = Problem is not null ? "problem" : Listen.Listening ? "live" : Updates.Available is not null ? "update" : null,+ ["blocking"] = Problem,+ ["notified"] = problemNotified,["simulated"] = Ling.SimulateCheck?.ToString() ?? (Ling.SimulateBalance is null ? null : "lowBalance"),["catalog"] = new JsonArray(Ling.TextCatalog.Count, Ling.HearCatalog.Count), ["keyFile"] = Path.GetFileName(Key.File_),};@@ -1188,6 +1225,7 @@ static class DebugServerelse if (arg.StartsWith("onboarding")) app.ShowOnboarding(int.TryParse(arg[10..].Trim(), out var n) ? n : null);else app.ShowNotes();break;+ case "hide": if (arg == "notes") app.HideNotes(); break;case "toast": app.Toast(L("纪要整理好了"), LF("%@ · 点这里打开", "Test"), () => app.ShowRecords()); break;case "problem": app.Listen.SimulateProblem(arg); break;case "speak":diff --git a/windows/src/Cicada/Strings/en.lproj/Windows.strings b/windows/src/Cicada/Strings/en.lproj/Windows.stringsindex d77c230..8fb6596 100644--- a/windows/src/Cicada/Strings/en.lproj/Windows.strings+++ b/windows/src/Cicada/Strings/en.lproj/Windows.strings@@ -311,3 +311,4 @@"电脑和会议室(线上和桌边的人都听)" = "PC + Room (people online and at the table)";"也听电脑" = "Hear the PC too";"电脑里放出来的" = "Played on the PC";+"%@。点按去设置" = "%@. Click to open Settings";diff --git a/windows/src/Cicada/Strings/ja.lproj/Windows.strings b/windows/src/Cicada/Strings/ja.lproj/Windows.stringsindex 130f630..62ac152 100644--- a/windows/src/Cicada/Strings/ja.lproj/Windows.strings+++ b/windows/src/Cicada/Strings/ja.lproj/Windows.strings@@ -311,3 +311,4 @@"电脑和会议室(线上和桌边的人都听)" = "PC と会議室(オンラインとテーブルの両方)";"也听电脑" = "PC も聞く";"电脑里放出来的" = "PC で再生された音声";+"%@。点按去设置" = "%@。クリックして設定を開く";diff --git a/windows/src/Cicada/Strings/ko.lproj/Windows.strings b/windows/src/Cicada/Strings/ko.lproj/Windows.stringsindex 5e6948b..35c4920 100644--- a/windows/src/Cicada/Strings/ko.lproj/Windows.strings+++ b/windows/src/Cicada/Strings/ko.lproj/Windows.strings@@ -311,3 +311,4 @@"电脑和会议室(线上和桌边的人都听)" = "PC와 회의실 (온라인과 테이블 모두)";"也听电脑" = "PC도 듣기";"电脑里放出来的" = "PC에서 재생된 소리";+"%@。点按去设置" = "%@. 클릭하여 설정 열기";diff --git a/windows/tests/Cicada.Tests/Program.cs b/windows/tests/Cicada.Tests/Program.csindex 78ba454..c8cfda0 100644--- a/windows/tests/Cicada.Tests/Program.cs+++ b/windows/tests/Cicada.Tests/Program.cs@@ -1736,6 +1736,22 @@ static class TestsEqual("ZenMux 现在很忙,key 没问题。开会时会自动重试。", c.Message("ZenMux", "zenmux.ai", "m", "h"), "busy words");}+ public static void OnlyWhatTheUserMustFixShowsBeyondThePanel()+ {+ var blocking = new[] { AICheck.Reason.InvalidKey, AICheck.Reason.MgmtKey, AICheck.Reason.NoCredit, AICheck.Reason.NoModel, AICheck.Reason.BadAddress, AICheck.Reason.NoJSON, AICheck.Reason.Deaf };+ foreach (var why in Enum.GetValues<AICheck.Reason>())+ Equal(blocking.Contains(why), AICheck.Blocks(why), $"{why}");+ var key = new AICheck();+ key.Fail(AICheck.StepId.Key, AICheck.Reason.InvalidKey);+ Check(key.Blocking, "a bad key");+ var away = new AICheck();+ away.Fail(AICheck.StepId.Reach, AICheck.Reason.Unreachable);+ Check(!away.Blocking && away.NeedsUser, "unreachable: the panel says so, no dot");+ var low = new AICheck { Balance = 0.3 };+ Check(!low.Blocking && low.NeedsUser, "a low balance still works: no dot");+ Check(!new AICheck().Blocking, "nothing known");+ }+public static void KeyPrefixesTellWhoseKeyItIs(){Equal(("openrouter", false), AICheck.Owner("sk-or-v1-abc"), "OpenRouter");