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(android): the listening notification names a custom AI service by its address when it can't be reached, as the listening screen does

wquguru9971309beef2
diff --git a/android/cli/src/main/kotlin/cicada/cli/ProviderTests.kt b/android/cli/src/main/kotlin/cicada/cli/ProviderTests.kt
index b7da38e..179def3 100644
--- a/android/cli/src/main/kotlin/cicada/cli/ProviderTests.kt
+++ b/android/cli/src/main/kotlin/cicada/cli/ProviderTests.kt
@@ -220,6 +220,7 @@ object ProviderTests {
equal("http://192.168.1.21:8001/v1/chat/completions", fake.sent[0].first, "audio to the hear model's address")
ling.chat("c", "i", Priority.Translate)
equal("http://192.168.1.20:8000/v1/chat/completions", fake.sent[1].first, "text to the text model's")
+ equal("192.168.1.21", ling.hearName, "a hearing problem names the hear model's address")
try {
s.aiCustomHearBase = "http://192.168.1.21:8001/v1"
s.save()
diff --git a/android/core/src/main/kotlin/cicada/Ling.kt b/android/core/src/main/kotlin/cicada/Ling.kt
index eea5bdc..241409e 100644
--- a/android/core/src/main/kotlin/cicada/Ling.kt
+++ b/android/core/src/main/kotlin/cicada/Ling.kt
@@ -272,6 +272,9 @@ class LingClient(
val serviceHost: String get() = host(config().base ?: provider.base)
/// Where the hear model is asked: the service's host unless a custom service names its own.
val hearHost: String get() = config().let { c -> if (c.hearsElsewhere) host(c.hearBase) else serviceHost }
+ /// Who a line about hearing names (连不上 …, … 的 key 无效): a custom service by the address it
+ /// hears at, as the live screen's banner does, not 其他(兼容 OpenAI).
+ val hearName: String get() = if (provider.id == "custom") hearHost.ifEmpty { provider.name } else provider.name
private fun host(base: String?) = base?.let { try { java.net.URI(it).host } catch (_: Exception) { null } } ?: ""
diff --git a/android/core/src/main/kotlin/cicada/ListenEngine.kt b/android/core/src/main/kotlin/cicada/ListenEngine.kt
index 5b3eeea..7d39542 100644
--- a/android/core/src/main/kotlin/cicada/ListenEngine.kt
+++ b/android/core/src/main/kotlin/cicada/ListenEngine.kt
@@ -242,7 +242,7 @@ class ListenEngine(
onWords?.invoke()
if (text != null) onSaid?.invoke(text, their) else sayProblem = Strings.L("这句已经是对方的语言")
} catch (e: LingException) {
- val name = ling.provider.name
+ val name = ling.hearName
sayProblem = when {
e.kind == LingException.Kind.Http && e.status in listOf(400, 404) && name != "Ling" -> Strings.L("这个模型听不了声音,换一个支持音频输入的")
e.kind == LingException.Kind.NoKey || e.kind == LingException.Kind.InvalidKey ->
@@ -286,7 +286,7 @@ class ListenEngine(
}
problem = null; problemKind = null
} catch (e: LingException) {
- val (kind, text) = problem(e, ling.provider.name)
+ val (kind, text) = problem(e, ling.hearName)
problemKind = kind; problem = text
Log.d("listen: segment ${seg.index} failed ${e.message}")
} catch (e: Exception) {
diff --git a/site/changelog.json b/site/changelog.json
index b462e8d..2298f1b 100644
--- a/site/changelog.json
+++ b/site/changelog.json
@@ -520,6 +520,14 @@
],
"title": "Linux 的纪要窗和通知说 AI 服务的问题时,第二行不再把标题原样重复一遍;自建服务还没填听的模型时,写“这个服务 听不了声音”,不再开头空一格。",
"text": ""
+ },
+ {
+ "kind": "fixed",
+ "platforms": [
+ "android"
+ ],
+ "title": "Android 连不上自建服务时,常驻通知也写出服务的地址,和正在听页面一致,不再写“连不上 其他(兼容 OpenAI)”。",
+ "text": ""
}
]
},