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: a custom AI service whose key fails is named by its address, not "The this service key doesn't work"

wquguruabe84d23d8b1
diff --git a/Sources/Cicada/AICheckView.swift b/Sources/Cicada/AICheckView.swift
index 01e20ae..31aaba2 100644
--- a/Sources/Cicada/AICheckView.swift
+++ b/Sources/Cicada/AICheckView.swift
@@ -19,7 +19,7 @@ struct AICheckSteps: View {
var changeKey: () -> Void
private var check: AICheck { ling.aiCheck }
- private var service: String { ling.serviceName }
+ private var service: String { ling.serviceLabel }
private var host: String { ling.serviceHost }
var body: some View {
@@ -151,7 +151,7 @@ struct AIServiceStrip: View {
private var words: (String, String)? {
let c = ling.aiCheck
guard ling.hasKey, c.needsUser else { return nil }
- let name = ling.serviceName
+ let name = ling.serviceLabel
let stopped = L("字幕照常;纪要和整句翻译先停下")
guard let f = c.failure else {
return c.balanceLine(service: name).map { ($0, L("用完后纪要会停下")) }
@@ -164,7 +164,7 @@ struct AIServiceStrip: View {
/// also the menu bar's dot, beyond the panel.
static func blocking(_ ling: LingClient, textModel: String) -> String? {
guard ling.hasKey, let f = ling.aiCheck.failure else { return nil }
- let name = ling.serviceName
+ let name = ling.serviceLabel
switch f.reason {
case .invalidKey, .mgmtKey: return L("\(name) 的 key 用不了")
case .noCredit: return L("\(name) 账户余额不足。")
diff --git a/Sources/Cicada/Ling.swift b/Sources/Cicada/Ling.swift
index 29313fe..4678e54 100644
--- a/Sources/Cicada/Ling.swift
+++ b/Sources/Cicada/Ling.swift
@@ -304,6 +304,9 @@ final class LingClient: ObservableObject {
/// The service's name for messages ("这个服务" for a custom address) and its host.
var serviceName: String { provider.id == .custom ? L("这个服务") : provider.name }
+ /// Who a status line names: a custom service by its address, which says more than 这个服务
+ /// and reads right in "The … key doesn't work".
+ var serviceLabel: String { provider.id == .custom && !serviceHost.isEmpty ? serviceHost : serviceName }
var serviceHost: String { config().base?.host ?? provider.base?.host ?? "" }
/// The cheapest requests that prove each step: Ling's tiny model; OpenRouter's key info (plus
@@ -493,7 +496,7 @@ final class LingClient: ObservableObject {
let c = aiCheck
if let f = c.failure, f.reason != .busy {
keyState = f.reason == .invalidKey || f.reason == .mgmtKey ? .invalid
- : .unreachable(c.message(service: serviceName, host: serviceHost, model: config().textModel) ?? "")
+ : .unreachable(c.message(service: serviceLabel, host: serviceHost, model: config().textModel) ?? "")
} else if c.passed {
var seconds = 0.0
for s in c.steps { if case .ok(let sec?) = s.state { seconds = sec } }
diff --git a/Sources/Cicada/NotesWindow.swift b/Sources/Cicada/NotesWindow.swift
index 0bd5ad7..549a840 100644
--- a/Sources/Cicada/NotesWindow.swift
+++ b/Sources/Cicada/NotesWindow.swift
@@ -749,11 +749,7 @@ struct NotesWindowView: View {
.background(RoundedRectangle(cornerRadius: 12).fill(Palette.accentPale))
}
- /// Who the banners name: a custom service by its address, which says more than 这个服务.
- private var serviceLabel: String {
- let ling = model.ling
- return ling.provider.id == .custom && !ling.serviceHost.isEmpty ? ling.serviceHost : ling.serviceName
- }
+ private var serviceLabel: String { model.ling.serviceLabel }
/// Lines the notes don't cover yet, once they are two minutes behind the meeting (between
/// ordinary 45 s updates there is always a little that isn't in yet).