Display model downloaded indicator.

pull/28/head
Pedro Cuenca 2 years ago
parent 1fc9328e78
commit d0465aa408

@ -49,7 +49,6 @@ struct ControlsView: View {
@EnvironmentObject var generation: GenerationContext @EnvironmentObject var generation: GenerationContext
static let models = ModelInfo.MODELS static let models = ModelInfo.MODELS
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 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 { var body: some View {
VStack(alignment: .leading) { VStack(alignment: .leading) {
@ -118,8 +123,8 @@ struct ControlsView: View {
Group { Group {
DisclosureGroup(isExpanded: $disclosedModel) { DisclosureGroup(isExpanded: $disclosedModel) {
Picker("", selection: $model) { Picker("", selection: $model) {
ForEach(Self.modelNames, id: \.self) { ForEach(Self.models, id: \.modelVersion) {
Text($0) modelLabel($0)
} }
} }
.onChange(of: model) { theModel in .onChange(of: model) { theModel in

Loading…
Cancel
Save