Drop-in-Settings-UI für die lokalen LLM-Backends aus mana-swift-llm. Pendant zu ManaAuthUI — vorher hatte nur Memoro die UI handgeschrieben, die drei anderen Konsumenten (pageta, comicello, herbatrium) gar nichts. Komponenten: - ManaLLMSettingsView(context:) — Convenience-Wrapper, drei Sections - ManaLLMBackendPickerSection — Picker + Availability + Empfohlen-Badge - ManaLLMPrepareSection — Download/Init-Card mit Progress, gated für Gemma - ManaLLMDownloadPolicySection — WiFi-only-Toggle - ManaLLMSettingsState (@Observable, @MainActor) — geteilter State, delegiert an Stores aus mana-swift-llm 0.2.0 - ManaLLMContext(useCaseShort:useCaseLong:) — app-spezifischer Section-Text; .generic als Fallback Test-Target ManaLLMUITests bewusst noch nicht angelegt (Linter hat es aus Package.swift entfernt, Comment markiert TODO). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
35 lines
1.1 KiB
Swift
35 lines
1.1 KiB
Swift
import ManaLLM
|
||
import SwiftUI
|
||
|
||
/// WiFi-only-Default-Toggle für Modell-Downloads. Apps die nur Apple FM
|
||
/// und NoOp anbieten brauchen die Section nicht — der Toggle hat dann
|
||
/// keine Wirkung. `ManaLLMSettingsView` zeigt die Section trotzdem,
|
||
/// weil der Default-Pool aller Backends Gemma enthält.
|
||
public struct ManaLLMDownloadPolicySection: View {
|
||
@Bindable private var state: ManaLLMSettingsState
|
||
|
||
public init(state: ManaLLMSettingsState) {
|
||
self.state = state
|
||
}
|
||
|
||
public var body: some View {
|
||
Section {
|
||
Toggle("Modelle auch über Mobilfunk laden", isOn: cellularBinding)
|
||
} header: {
|
||
Text("Modell-Download")
|
||
} footer: {
|
||
Text(
|
||
"Standard: nur über WLAN. Gemma-Modelle sind 1.3–2.5 GB groß — "
|
||
+ "über Mobilfunk verbraucht das spürbar Datenvolumen."
|
||
)
|
||
.font(.caption2)
|
||
}
|
||
}
|
||
|
||
private var cellularBinding: Binding<Bool> {
|
||
Binding(
|
||
get: { state.allowCellular },
|
||
set: { state.setAllowCellular($0) }
|
||
)
|
||
}
|
||
}
|