|
|
@ -25,8 +25,11 @@ struct ControlsView: View {
|
|
|
|
static let modelNames = models.map { $0.modelVersion }
|
|
|
|
static let modelNames = models.map { $0.modelVersion }
|
|
|
|
|
|
|
|
|
|
|
|
@State private var model = Settings.shared.currentModel.modelVersion
|
|
|
|
@State private var model = Settings.shared.currentModel.modelVersion
|
|
|
|
|
|
|
|
@State private var disclosedModel = true
|
|
|
|
@State private var disclosedPrompt = true
|
|
|
|
@State private var disclosedPrompt = true
|
|
|
|
|
|
|
|
@State private var disclosedSteps = false
|
|
|
|
|
|
|
|
@State private var disclosedSeed = false
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: refactor download with similar code in Loading.swift (iOS)
|
|
|
|
// TODO: refactor download with similar code in Loading.swift (iOS)
|
|
|
|
@State private var stateSubscriber: Cancellable?
|
|
|
|
@State private var stateSubscriber: Cancellable?
|
|
|
|
@State private var pipelineState: PipelineState = .downloading(0)
|
|
|
|
@State private var pipelineState: PipelineState = .downloading(0)
|
|
|
@ -72,7 +75,7 @@ struct ControlsView: View {
|
|
|
|
|
|
|
|
|
|
|
|
ScrollView {
|
|
|
|
ScrollView {
|
|
|
|
Group {
|
|
|
|
Group {
|
|
|
|
DisclosureGroup {
|
|
|
|
DisclosureGroup(isExpanded: $disclosedModel) {
|
|
|
|
Picker("", selection: $model) {
|
|
|
|
Picker("", selection: $model) {
|
|
|
|
ForEach(Self.modelNames, id: \.self) {
|
|
|
|
ForEach(Self.modelNames, id: \.self) {
|
|
|
|
Text($0)
|
|
|
|
Text($0)
|
|
|
@ -83,7 +86,11 @@ struct ControlsView: View {
|
|
|
|
modelDidChange(model: model)
|
|
|
|
modelDidChange(model: model)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} label: {
|
|
|
|
} label: {
|
|
|
|
Label("Model", systemImage: "cpu").foregroundColor(.secondary)
|
|
|
|
Label("Model from Hub", systemImage: "cpu").foregroundColor(.secondary).onTapGesture {
|
|
|
|
|
|
|
|
withAnimation {
|
|
|
|
|
|
|
|
disclosedModel.toggle()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Divider()
|
|
|
|
Divider()
|
|
|
@ -99,19 +106,27 @@ struct ControlsView: View {
|
|
|
|
.textFieldStyle(.squareBorder)
|
|
|
|
.textFieldStyle(.squareBorder)
|
|
|
|
}.padding(.leading, 10)
|
|
|
|
}.padding(.leading, 10)
|
|
|
|
} label: {
|
|
|
|
} label: {
|
|
|
|
Label("Prompts", systemImage: "text.quote").foregroundColor(.secondary)
|
|
|
|
Label("Prompts", systemImage: "text.quote").foregroundColor(.secondary).onTapGesture {
|
|
|
|
|
|
|
|
withAnimation {
|
|
|
|
|
|
|
|
disclosedPrompt.toggle()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Divider()
|
|
|
|
Divider()
|
|
|
|
|
|
|
|
|
|
|
|
DisclosureGroup {
|
|
|
|
DisclosureGroup(isExpanded: $disclosedSteps) {
|
|
|
|
CompactSlider(value: $generation.steps, in: 0...150, step: 5) {
|
|
|
|
CompactSlider(value: $generation.steps, in: 0...150, step: 5) {
|
|
|
|
Text("Steps")
|
|
|
|
Text("Steps")
|
|
|
|
Spacer()
|
|
|
|
Spacer()
|
|
|
|
Text("\(Int(generation.steps))")
|
|
|
|
Text("\(Int(generation.steps))")
|
|
|
|
}.padding(.leading, 10)
|
|
|
|
}.padding(.leading, 10)
|
|
|
|
} label: {
|
|
|
|
} label: {
|
|
|
|
Label("Step count", systemImage: "square.3.layers.3d.down.left").foregroundColor(.secondary)
|
|
|
|
Label("Step count", systemImage: "square.3.layers.3d.down.left").foregroundColor(.secondary).onTapGesture {
|
|
|
|
|
|
|
|
withAnimation {
|
|
|
|
|
|
|
|
disclosedSteps.toggle()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Divider()
|
|
|
|
Divider()
|
|
|
|
|
|
|
|
|
|
|
@ -126,7 +141,7 @@ struct ControlsView: View {
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// Divider()
|
|
|
|
// Divider()
|
|
|
|
|
|
|
|
|
|
|
|
DisclosureGroup() {
|
|
|
|
DisclosureGroup(isExpanded: $disclosedSeed) {
|
|
|
|
let sliderLabel = generation.seed < 0 ? "Random Seed" : "Seed"
|
|
|
|
let sliderLabel = generation.seed < 0 ? "Random Seed" : "Seed"
|
|
|
|
CompactSlider(value: $generation.seed, in: -1...1000, step: 1) {
|
|
|
|
CompactSlider(value: $generation.seed, in: -1...1000, step: 1) {
|
|
|
|
Text(sliderLabel)
|
|
|
|
Text(sliderLabel)
|
|
|
@ -134,7 +149,11 @@ struct ControlsView: View {
|
|
|
|
Text("\(Int(generation.seed))")
|
|
|
|
Text("\(Int(generation.seed))")
|
|
|
|
}.padding(.leading, 10)
|
|
|
|
}.padding(.leading, 10)
|
|
|
|
} label: {
|
|
|
|
} label: {
|
|
|
|
Label("Seed", systemImage: "leaf").foregroundColor(.secondary)
|
|
|
|
Label("Seed", systemImage: "leaf").foregroundColor(.secondary).onTapGesture {
|
|
|
|
|
|
|
|
withAnimation {
|
|
|
|
|
|
|
|
disclosedSeed.toggle()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|