fix:feature-parity
This commit is contained in:
1 parent
6c0a6eb498
commit
c33d87b06e
8 files changed
+196
-33
No files matched your search
@@ -3,7 +3,8 @@ import SwiftUI
|
||||
struct SettingsView: View {
|
||||
@ObservedObject var model: AppModel
|
||||
@ObservedObject private var settings: AppSettings
|
||||
@State private var apiKey = ""
|
||||
@State private var hostedKey = ""
|
||||
@State private var localKey = ""
|
||||
|
||||
init(model: AppModel) {
|
||||
self.model = model
|
||||
@@ -12,11 +13,23 @@ struct SettingsView: View {
|
||||
|
||||
var body: some View {
|
||||
Form {
|
||||
Section("Transcription") {
|
||||
TextField("Endpoint", text: $settings.endpoint, prompt: Text("https://api.example.com"))
|
||||
TextField("Model", text: $settings.model)
|
||||
SecureField("API key", text: $apiKey)
|
||||
.onChange(of: apiKey) { _, value in settings.apiKey = value }
|
||||
Section("Hosted") {
|
||||
TextField(
|
||||
"Endpoint", text: $settings.hostedEndpoint, prompt: Text("https://api.example.com"))
|
||||
TextField("Model", text: $settings.hostedModel)
|
||||
SecureField("API key", text: $hostedKey)
|
||||
.onChange(of: hostedKey) { _, value in settings.hostedKey = value }
|
||||
}
|
||||
|
||||
Section("Local fallback") {
|
||||
Toggle("Hosted first, local fallback", isOn: $settings.hostedFirst)
|
||||
TextField("Endpoint", text: $settings.localEndpoint)
|
||||
TextField("Model", text: $settings.localModel)
|
||||
SecureField("API key", text: $localKey)
|
||||
.onChange(of: localKey) { _, value in settings.localKey = value }
|
||||
}
|
||||
|
||||
Section("Transcript") {
|
||||
TextField("Prompt", text: $settings.prompt, axis: .vertical)
|
||||
.lineLimit(2...4)
|
||||
Picker("Output", selection: $settings.destination) {
|
||||
@@ -55,7 +68,10 @@ struct SettingsView: View {
|
||||
}
|
||||
}
|
||||
.formStyle(.grouped)
|
||||
.frame(width: 500, height: 470)
|
||||
.onAppear { apiKey = settings.apiKey }
|
||||
.frame(width: 500, height: 620)
|
||||
.onAppear {
|
||||
hostedKey = settings.hostedKey
|
||||
localKey = settings.localKey
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user