Skip to content

Commit d0465aa

Browse files
committedFeb 7, 2023
Display model downloaded indicator.
1 parent 1fc9328 commit d0465aa

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed
 

‎Diffusion-macOS/ControlsView.swift

+8-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ struct ControlsView: View {
4949
@EnvironmentObject var generation: GenerationContext
5050

5151
static let models = ModelInfo.MODELS
52-
static let modelNames = models.map { $0.modelVersion }
5352

5453
@State private var model = Settings.shared.currentModel.modelVersion
5554
@State private var disclosedModel = true
@@ -106,6 +105,12 @@ struct ControlsView: View {
106105
}
107106
}
108107

108+
func modelLabel(_ model: ModelInfo) -> Text {
109+
let downloaded = PipelineLoader(model: model).ready
110+
let prefix = downloaded ? "" : "" //"○ "
111+
return Text(prefix).foregroundColor(downloaded ? .accentColor : .secondary) + Text(model.modelVersion)
112+
}
113+
109114
var body: some View {
110115
VStack(alignment: .leading) {
111116

@@ -118,8 +123,8 @@ struct ControlsView: View {
118123
Group {
119124
DisclosureGroup(isExpanded: $disclosedModel) {
120125
Picker("", selection: $model) {
121-
ForEach(Self.modelNames, id: \.self) {
122-
Text($0)
126+
ForEach(Self.models, id: \.modelVersion) {
127+
modelLabel($0)
123128
}
124129
}
125130
.onChange(of: model) { theModel in

0 commit comments

Comments
 (0)
Please sign in to comment.