From d0465aa408cb30f0721403d51f967e94450aa176 Mon Sep 17 00:00:00 2001 From: Pedro Cuenca Date: Tue, 7 Feb 2023 18:07:12 +0100 Subject: [PATCH] Display model downloaded indicator. --- Diffusion-macOS/ControlsView.swift | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Diffusion-macOS/ControlsView.swift b/Diffusion-macOS/ControlsView.swift index 9481fda..f36ef25 100644 --- a/Diffusion-macOS/ControlsView.swift +++ b/Diffusion-macOS/ControlsView.swift @@ -49,7 +49,6 @@ struct ControlsView: View { @EnvironmentObject var generation: GenerationContext static let models = ModelInfo.MODELS - static let modelNames = models.map { $0.modelVersion } @State private var model = Settings.shared.currentModel.modelVersion @State private var disclosedModel = true @@ -106,6 +105,12 @@ struct ControlsView: View { } } + func modelLabel(_ model: ModelInfo) -> Text { + let downloaded = PipelineLoader(model: model).ready + let prefix = downloaded ? "● " : "◌ " //"○ " + return Text(prefix).foregroundColor(downloaded ? .accentColor : .secondary) + Text(model.modelVersion) + } + var body: some View { VStack(alignment: .leading) { @@ -118,8 +123,8 @@ struct ControlsView: View { Group { DisclosureGroup(isExpanded: $disclosedModel) { Picker("", selection: $model) { - ForEach(Self.modelNames, id: \.self) { - Text($0) + ForEach(Self.models, id: \.modelVersion) { + modelLabel($0) } } .onChange(of: model) { theModel in