Skip to content

Commit 81a2d49

Browse files
committed
Make reveal work even if model is not downloaded.
Related: huggingface#36.
1 parent d3a504d commit 81a2d49

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diffusion-macOS/ControlsView.swift

+8-2
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,13 @@ struct ControlsView: View {
141141
return Text(prefix).foregroundColor(downloaded ? .accentColor : .secondary) + Text(model.modelVersion)
142142
}
143143

144+
var modelFilename: String? {
145+
guard let pipelineLoader = pipelineLoader else { return nil }
146+
let selectedPath = pipelineLoader.compiledPath
147+
guard selectedPath.exists else { return nil }
148+
return selectedPath.string
149+
}
150+
144151
var body: some View {
145152
VStack(alignment: .leading) {
146153

@@ -161,8 +168,7 @@ struct ControlsView: View {
161168
}
162169
.onChange(of: model) { selection in
163170
guard selection != revealOption else {
164-
let selected = pipelineLoader?.compiledPath
165-
NSWorkspace.shared.selectFile(selected?.string, inFileViewerRootedAtPath: PipelineLoader.models.string)
171+
NSWorkspace.shared.selectFile(modelFilename, inFileViewerRootedAtPath: PipelineLoader.models.string)
166172
model = Settings.shared.currentModel.modelVersion
167173
return
168174
}

0 commit comments

Comments
 (0)