知了 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: when your own AI service can't be reached, subtitles no longer wait a few seconds on every line before Google translates them
wquguru89485cb90332
diff --git a/Sources/Cicada/Translator.swift b/Sources/Cicada/Translator.swiftindex f8a026b..338d02c 100644--- a/Sources/Cicada/Translator.swift+++ b/Sources/Cicada/Translator.swift@@ -100,6 +100,17 @@ final class TranslationService {var onHealth: ((TranslationHealth) -> Void)?/// Set by the app: reads the proxy settings once Google goes down, to word the hint.var proxyHint: (() async -> AICheck.ProxyHint)?+ private var lastUnreachableTry = Date.distantPast++ /// A service that answers nothing (a home server switched off) costs every line its timeout+ /// before Google gets it, so subtitles run seconds late. While the check says unreachable, one+ /// line in 15 s still goes to it, so a server that is back is noticed without waiting for a check.+ private func lingWorthTrying() -> Bool {+ guard ling.aiCheck.failure?.reason == .unreachable else { return true }+ guard Date().timeIntervalSince(lastUnreachableTry) >= 15 else { return false }+ lastUnreachableTry = Date()+ return true+ }init(ling: LingClient) { self.ling = ling }@@ -153,7 +164,7 @@ final class TranslationService {trace?.attempts.append(.init(provider: ling.provider.id.rawValue, seconds: 0, failure: "simulated"))return nil}- if kind != .draft, ling.usable {+ if kind != .draft, ling.usable, lingWorthTrying() {let started = Date()let (out, failure) = await viaLing(text, source: source, target: target, kind: kind, trace: trace)trace?.attempts.append(.init(provider: ling.provider.id.rawValue, seconds: Date().timeIntervalSince(started),diff --git a/site/changelog.json b/site/changelog.jsonindex e3aeea7..51aebbf 100644--- a/site/changelog.json+++ b/site/changelog.json@@ -119,6 +119,14 @@],"title": "会议结束后的“改用 English 重新整理”按钮,英文名两边有空格了。","text": "原来挤成“改用English重新整理”;中文名照旧不加空格。"+ },+ {+ "kind": "fixed",+ "platforms": [+ "mac"+ ],+ "title": "自己的 AI 服务连不上时,字幕不再每句先等几秒才出来。",+ "text": "连不上期间翻译直接用 Google,每 15 秒才再试一次那台服务器,连上后自动换回。"}]},