知了 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(ios): with your own AI service, meeting audio and text can stay off Google Translate, as on the Mac
wquguru3ab2d4d79f56
diff --git a/ios/Sources/Cicada/AIServicePage.swift b/ios/Sources/Cicada/AIServicePage.swiftindex 1730d3a..7cb7d94 100644--- a/ios/Sources/Cicada/AIServicePage.swift+++ b/ios/Sources/Cicada/AIServicePage.swift@@ -10,6 +10,11 @@ enum AIPrefs {static let models = "aiModels"static let voiceModels = "aiVoiceModels"static let customBase = "aiCustomBase"+ /// 语音和文字只发给你的服务, the Mac's key: with the user's own service, Google is never asked.+ static let customOnly = "aiCustomOnly"++ /// Whether the translator leaves Google out: only with the user's own service and the switch on.+ static var googleOff: Bool { current.id == .custom && d.bool(forKey: customOnly) }private static var d: UserDefaults { .standard }static var current: AIProvider { AIProvider.named(d.string(forKey: provider) ?? "ling") }@@ -65,6 +70,7 @@ struct AIServicePage: View {@EnvironmentObject var ling: LingClient@AppStorage(AIPrefs.provider) private var provider = "ling"@AppStorage(AIPrefs.customBase) private var base = ""+ @AppStorage(AIPrefs.customOnly) private var customOnly = false@State private var customModel = AIPrefs.modelMap["custom"] ?? ""@State private var customVoice = AIPrefs.voiceMap["custom"] ?? ""@State private var tick = 0@@ -131,6 +137,10 @@ struct AIServicePage: View {}Text(p.clones ? L("填入 Ling key:声音更自然,还能用你自己的声音") : L("只有 Ling 能用你自己的声音")).font(.footnote).foregroundStyle(Ink.secondary).padding(.horizontal, 4).padding(.top, 10)+ if p.id == .custom {+ Card { onlyRow }.padding(.top, 24)+ Text(onlyDetail).font(.footnote).foregroundStyle(Ink.secondary).padding(.horizontal, 4).padding(.top, 8)+ }}.padding(.horizontal, 16).padding(.bottom, 120).frame(maxWidth: 640).frame(maxWidth: .infinity)@@ -143,6 +153,27 @@ struct AIServicePage: View {.navigationBarTitleDisplayMode(.inline)}+ /// 语音和文字只发给你的服务, as on the Mac: Google is never asked.+ private var onlyRow: some View {+ Toggle(isOn: Binding(get: { customOnly }, set: { customOnly = $0; model.aiChanged() })) {+ Text("语音和文字只发给你的服务").foregroundStyle(Ink.ink)+ }+ .tint(Ink.ink)+ .padding(.horizontal, 16).frame(minHeight: 50)+ }++ /// What the switch costs, and while the service can't be reached, what stands in.+ private var onlyDetail: String {+ let down: Bool+ switch ling.keyState {+ case .invalid, .unreachable: down = customOnly+ default: down = false+ }+ return !down ? L("不用 Google 翻译;说话时要等整句说完才出译文")+ : Recognition.hasOnDeviceTranslation ? L("现在连不上:整句先用本机翻译,半句只显示原文")+ : L("现在连不上:新字幕暂时只有原文")+ }+private func serviceRow(_ s: AIProvider) -> some View {HStack(spacing: 8) {Text(verbatim: s.name).foregroundStyle(Ink.ink)@@ -212,8 +243,9 @@ extension AppModel {/// service's voices.func aiChanged() {AIPrefs.applyVoices()+ translator.googleOff = AIPrefs.googleOffling.reconfigure()- debugLog("ai: service \(AIPrefs.config.provider.id.rawValue) model \(AIPrefs.config.textModel) voice \(AIPrefs.config.voiceModel ?? "-")")+ debugLog("ai: service \(AIPrefs.config.provider.id.rawValue) model \(AIPrefs.config.textModel) voice \(AIPrefs.config.voiceModel ?? "-") googleOff=\(translator.googleOff)")objectWillChange.send()}}diff --git a/ios/Sources/Cicada/CicadaApp.swift b/ios/Sources/Cicada/CicadaApp.swiftindex 3000a95..c9ac6f8 100644--- a/ios/Sources/Cicada/CicadaApp.swift+++ b/ios/Sources/Cicada/CicadaApp.swift@@ -231,6 +231,7 @@ final class AppModel: ObservableObject {// 设置 › AI 服务 (AIServicePage.swift): the Mac's services and settings.ling.config = { AIPrefs.config }AIPrefs.applyVoices()+ translator.googleOff = AIPrefs.googleOffwireNotes()// 存到文件夹, as the Mac's AppModel: a meeting is written once settled and rewritten when it changes.folderExport.settling = { [weak self] id in self?.notes.settling(id) ?? false }diff --git a/ios/Sources/Cicada/Debug.swift b/ios/Sources/Cicada/Debug.swiftindex efd4714..08e158c 100644--- a/ios/Sources/Cicada/Debug.swift+++ b/ios/Sources/Cicada/Debug.swift@@ -182,6 +182,10 @@ extension AppModel {// A meeting without the microphone or the recognizer, fed lines by `heard:`.RoomListen.silent = arg != "off"case "heard": room.debugHeard(arg)+ case "aiCustomOnly":+ // aiCustomOnly:on|off, 语音和文字只发给你的服务, as on the Mac.+ UserDefaults.standard.set(arg == "on", forKey: AIPrefs.customOnly)+ aiChanged()case "aiService":// aiService:<ling|openrouter|zenmux|openai|custom>[,<text model>]; aiService opens the pagelet p = arg.split(separator: ",", maxSplits: 1).map(String.init)diff --git a/ios/Sources/Cicada/LiveViews.swift b/ios/Sources/Cicada/LiveViews.swiftindex 328ad5e..f440b78 100644--- a/ios/Sources/Cicada/LiveViews.swift+++ b/ios/Sources/Cicada/LiveViews.swift@@ -245,7 +245,19 @@ struct TranslateDownCard: View {@EnvironmentObject var model: AppModelvar body: some View {- if model.translationDown {+ // 语音和文字只发给你的服务, and the service doesn't translate: it picks up by itself, and no+ // other service is offered, which would send the meeting elsewhere (as the Mac's notes window).+ if model.translationHealth.googleOff, model.translationHealth.sentencesUntranslated {+ HStack(alignment: .top, spacing: 10) {+ Image(systemName: "hourglass").foregroundStyle(Ink.secondary).padding(.top, 2)+ Text(L("译文等 \(model.ling.serviceLabel) 恢复 · 字幕先显示原文"))+ .font(.subheadline.weight(.semibold)).foregroundStyle(Ink.ink).fixedSize(horizontal: false, vertical: true)+ Spacer(minLength: 0)+ }+ .padding(14)+ .frame(maxWidth: .infinity, alignment: .leading)+ .background(Color.white, in: RoundedRectangle(cornerRadius: 18, style: .continuous))+ } else if model.translationDown {Button { if !model.ling.hasKey { model.tab = .settings; model.showSettings = true } } label: {HStack(alignment: .top, spacing: 10) {Image(systemName: "exclamationmark.triangle.fill").foregroundStyle(Ink.accent).padding(.top, 2)