|
|
@ -88,9 +88,11 @@ struct ControlsView: View {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func modelDidChange(model: ModelInfo) {
|
|
|
|
func modelDidChange(model: ModelInfo) {
|
|
|
|
|
|
|
|
guard pipelineLoader?.model != model else { return }
|
|
|
|
|
|
|
|
|
|
|
|
print("Loading model \(model)")
|
|
|
|
print("Loading model \(model)")
|
|
|
|
Settings.shared.currentModel = model
|
|
|
|
Settings.shared.currentModel = model
|
|
|
|
|
|
|
|
|
|
|
|
pipelineLoader?.cancel()
|
|
|
|
pipelineLoader?.cancel()
|
|
|
|
pipelineState = .downloading(0)
|
|
|
|
pipelineState = .downloading(0)
|
|
|
|
Task.init {
|
|
|
|
Task.init {
|
|
|
@ -144,13 +146,21 @@ struct ControlsView: View {
|
|
|
|
ScrollView {
|
|
|
|
ScrollView {
|
|
|
|
Group {
|
|
|
|
Group {
|
|
|
|
DisclosureGroup(isExpanded: $disclosedModel) {
|
|
|
|
DisclosureGroup(isExpanded: $disclosedModel) {
|
|
|
|
|
|
|
|
let revealOption = "-- reveal --"
|
|
|
|
Picker("", selection: $model) {
|
|
|
|
Picker("", selection: $model) {
|
|
|
|
ForEach(Self.models, id: \.modelVersion) {
|
|
|
|
ForEach(Self.models, id: \.modelVersion) {
|
|
|
|
modelLabel($0)
|
|
|
|
modelLabel($0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Text("Reveal in Finder…").tag(revealOption)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.onChange(of: model) { theModel in
|
|
|
|
.onChange(of: model) { selection in
|
|
|
|
guard let model = ModelInfo.from(modelVersion: theModel) else { return }
|
|
|
|
guard selection != revealOption else {
|
|
|
|
|
|
|
|
let selected = pipelineLoader?.compiledPath
|
|
|
|
|
|
|
|
NSWorkspace.shared.selectFile(selected?.string, inFileViewerRootedAtPath: PipelineLoader.models.string)
|
|
|
|
|
|
|
|
model = Settings.shared.currentModel.modelVersion
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
guard let model = ModelInfo.from(modelVersion: selection) else { return }
|
|
|
|
modelDidChange(model: model)
|
|
|
|
modelDidChange(model: model)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} label: {
|
|
|
|
} label: {
|
|
|
|