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(linux): an AI service problem in the notes window or a notification no longer says the same sentence twice, and names the service when no listening model is set

wquguruad65c0bbf8cc
diff --git a/linux/cicada/app/aicheck_view.py b/linux/cicada/app/aicheck_view.py
index a5f9db7..ea36b18 100644
--- a/linux/cicada/app/aicheck_view.py
+++ b/linux/cicada/app/aicheck_view.py
@@ -163,6 +163,13 @@ def blocking(app) -> str | None:
return problem.title(ling.check_result.reason, ling.service_name, c.text_model, c.hear_model)
+def blocking_detail(app) -> str:
+ """The line under blocking(): why, unless that only says the title again (余额不足, 听不了声音,
+ 找不到模型), then where it's fixed."""
+ why = app.ling.message() or ""
+ return why if why and why != blocking(app) else L("在 设置 › AI 服务 里换一个")
+
+
def key_hint(app, key: str):
"""A pasted key that belongs elsewhere: (what it is, the service it fits or None), else None.
A management key can't call models; another service's key goes there with one click."""
diff --git a/linux/cicada/app/main.py b/linux/cicada/app/main.py
index ba4a9f1..62ba131 100644
--- a/linux/cicada/app/main.py
+++ b/linux/cicada/app/main.py
@@ -143,11 +143,11 @@ class Controller:
shown = w is not None and w.get_visible() and w.shows_problem(reason)
kind = self.notices.tick(time.time(), self.listen.listening, reason, shown)
if kind is not None:
- from .aicheck_view import blocking
+ from .aicheck_view import blocking, blocking_detail
name = self.ling.service_name
title = blocking(self) if kind == "blocking" else LF("连不上 %@", name)
n = Gio.Notification.new(title or L("AI 服务的设置要改一下"))
- n.set_body(self.ling.message() or "")
+ n.set_body(blocking_detail(self) if kind == "blocking" else self.ling.message() or "")
n.set_default_action("app.ai-settings")
n.add_button(L("打开设置"), "app.ai-settings")
self.application.send_notification("problem", n)
diff --git a/linux/cicada/app/notes_window.py b/linux/cicada/app/notes_window.py
index 7217fe7..ee9ebaa 100644
--- a/linux/cicada/app/notes_window.py
+++ b/linux/cicada/app/notes_window.py
@@ -777,8 +777,8 @@ class NotesWindow(Gtk.Window):
elif problem.stops_hearing(self._reason()) and kind not in ("network", "busy"):
# Nothing is heard until it's fixed (no credit, a bad address…): said where the subtitles
# would be, with the way to fix it, not "等有人说话".
- from .aicheck_view import blocking
- self._state_card(box, "dialog-warning-symbolic", "warn", blocking(self.app), self.app.ling.message() or "",
+ from .aicheck_view import blocking, blocking_detail
+ self._state_card(box, "dialog-warning-symbolic", "warn", blocking(self.app), blocking_detail(self.app),
L("设置"), lambda: self.app.show_settings(ai=True))
elif line is None:
if listen.listening:
@@ -872,10 +872,10 @@ class NotesWindow(Gtk.Window):
tone = "error"
elif problem.blocking(reason) and (reason in problem.NOTES_ONLY or not self.live_box.get_visible()):
# Only the user can fix it (the live card says it too, when it shows): what, and 打开设置.
- from .aicheck_view import blocking
+ from .aicheck_view import blocking, blocking_detail
row = ui.hbox(10)
row.pack_start(ui.vbox(2, ui.text(blocking(self.app), 12, "ink", bold=True, width_chars=24),
- ui.text(self.app.ling.message() or "", 12, "secondary", width_chars=24)), True, True, 0)
+ ui.text(blocking_detail(self.app), 12, "secondary", width_chars=24)), True, True, 0)
b = ui.button(L("打开设置"), lambda: self.app.show_settings(ai=True), "darkbtn")
b.set_can_focus(False)
b.set_valign(Gtk.Align.CENTER)
diff --git a/linux/cicada/core/aicheck.py b/linux/cicada/core/aicheck.py
index 1255b4f..2994e75 100644
--- a/linux/cicada/core/aicheck.py
+++ b/linux/cicada/core/aicheck.py
@@ -175,7 +175,7 @@ class AICheck:
NO_CREDIT: lambda: LF("%@ 账户余额不足。", service),
NO_MODEL: lambda: LF("%@ 上找不到 %@ 这个模型。", service, text_model),
NO_JSON: lambda: L("这个服务不支持 JSON,纪要写不了;翻译照常。"),
- DEAF: lambda: LF("%@ 听不了声音。", hear_model),
+ DEAF: lambda: LF("%@ 听不了声音。", hear_model or service), # no hear model yet: the service
BUSY: lambda: LF("%@ 现在很忙,key 没问题。开会时会自动重试。", service),
SERVER_ERROR: lambda: LF("%@ 暂时出错(HTTP %lld),稍后再试。", service, code or 0),
}[reason]()
diff --git a/linux/cicada/core/problem.py b/linux/cicada/core/problem.py
index 5897242..984bc73 100644
--- a/linux/cicada/core/problem.py
+++ b/linux/cicada/core/problem.py
@@ -34,7 +34,7 @@ def title(reason: str | None, service: str, text_model: str, hear_model: str) ->
aicheck.MGMT_KEY: lambda: LF("%@ 的 key 用不了", service),
aicheck.NO_CREDIT: lambda: LF("%@ 账户余额不足。", service),
aicheck.NO_MODEL: lambda: LF("%@ 上找不到 %@ 这个模型。", service, text_model),
- aicheck.DEAF: lambda: LF("%@ 听不了声音。", hear_model)}.get(reason, lambda: L("AI 服务的设置要改一下"))()
+ aicheck.DEAF: lambda: LF("%@ 听不了声音。", hear_model or service)}.get(reason, lambda: L("AI 服务的设置要改一下"))()
class Notices:
diff --git a/linux/tests/test_custom.py b/linux/tests/test_custom.py
index 1719dd3..6ca551a 100644
--- a/linux/tests/test_custom.py
+++ b/linux/tests/test_custom.py
@@ -116,6 +116,14 @@ class Shape(unittest.TestCase):
r.fail("text", aicheck.NO_JSON)
self.assertFalse(r.slow)
+ def test_no_hear_model_yet_names_the_service(self):
+ from cicada.core import problem
+ r = aicheck.AICheck()
+ r.fail("hear", aicheck.DEAF)
+ self.assertEqual("这个服务 听不了声音。", r.message("这个服务", "10.0.2.2", "qwen3-8b", ""))
+ self.assertEqual("这个服务 听不了声音。", problem.title(aicheck.DEAF, "这个服务", "qwen3-8b", ""))
+ self.assertEqual("qwen3-omni 听不了声音。", r.message("这个服务", "10.0.2.2", "qwen3-8b", "qwen3-omni"))
+
class TemplateKwargs(Base):
def test_a_server_that_refuses_it_is_asked_again_without(self):
diff --git a/site/changelog.json b/site/changelog.json
index dcee19c..b462e8d 100644
--- a/site/changelog.json
+++ b/site/changelog.json
@@ -512,6 +512,14 @@
],
"title": "Linux 上设置已经开着时再点“设置”或“打开设置”,用自建服务时不再多出一块 key 输入框。",
"text": ""
+ },
+ {
+ "kind": "fixed",
+ "platforms": [
+ "linux"
+ ],
+ "title": "Linux 的纪要窗和通知说 AI 服务的问题时,第二行不再把标题原样重复一遍;自建服务还没填听的模型时,写“这个服务 听不了声音”,不再开头空一格。",
+ "text": ""
}
]
},