@@ -65,6 +65,12 @@ struct ControlsView: View {
65
65
// TODO: make this computed, and observable, and easy to read
66
66
@State private var mustShowSafetyCheckerDisclaimer = false
67
67
68
+ @State private var showModelsHelp = false
69
+ @State private var showPromptsHelp = false
70
+ @State private var showGuidanceHelp = false
71
+ @State private var showStepsHelp = false
72
+ @State private var showSeedHelp = false
73
+
68
74
func updateSafetyCheckerState( ) {
69
75
mustShowSafetyCheckerDisclaimer = generation. disableSafety && !Settings. shared. safetyCheckerDisclaimerShown
70
76
}
@@ -110,7 +116,7 @@ struct ControlsView: View {
110
116
let prefix = downloaded ? " ● " : " ◌ " //"○ "
111
117
return Text ( prefix) . foregroundColor ( downloaded ? . accentColor : . secondary) + Text( model. modelVersion)
112
118
}
113
-
119
+
114
120
var body : some View {
115
121
VStack ( alignment: . leading) {
116
122
@@ -132,9 +138,23 @@ struct ControlsView: View {
132
138
modelDidChange ( model: model)
133
139
}
134
140
} label: {
135
- Label ( " Model from Hub " , systemImage: " cpu " ) . foregroundColor ( . secondary)
141
+ HStack {
142
+ Label ( " Model from Hub " , systemImage: " cpu " ) . foregroundColor ( . secondary)
143
+ Spacer ( )
144
+ if disclosedModel {
145
+ Button {
146
+ showModelsHelp. toggle ( )
147
+ } label: {
148
+ Image ( systemName: " info.circle " )
149
+ }
150
+ . buttonStyle ( . plain)
151
+ // Or maybe use .sheet instead
152
+ . sheet ( isPresented: $showModelsHelp) {
153
+ modelsHelp ( $showModelsHelp)
154
+ }
155
+ }
156
+ } . foregroundColor ( . secondary)
136
157
}
137
-
138
158
Divider ( )
139
159
140
160
DisclosureGroup ( isExpanded: $disclosedPrompt) {
@@ -148,19 +168,51 @@ struct ControlsView: View {
148
168
. textFieldStyle ( . squareBorder)
149
169
} . padding ( . leading, 10 )
150
170
} label: {
151
- Label ( " Prompts " , systemImage: " text.quote " ) . foregroundColor ( . secondary)
171
+ HStack {
172
+ Label ( " Prompts " , systemImage: " text.quote " ) . foregroundColor ( . secondary)
173
+ Spacer ( )
174
+ if disclosedPrompt {
175
+ Button {
176
+ showPromptsHelp. toggle ( )
177
+ } label: {
178
+ Image ( systemName: " info.circle " )
179
+ }
180
+ . buttonStyle ( . plain)
181
+ // Or maybe use .sheet instead
182
+ . popover ( isPresented: $showPromptsHelp, arrowEdge: . trailing) {
183
+ promptsHelp ( $showPromptsHelp)
184
+ }
185
+ }
186
+ } . foregroundColor ( . secondary)
152
187
}
153
-
154
188
Divider ( )
155
189
190
+ let guidanceScaleValue = generation. guidanceScale. formatted ( " %.1f " )
156
191
DisclosureGroup ( isExpanded: $disclosedGuidance) {
157
192
CompactSlider ( value: $generation. guidanceScale, in: 0 ... 20 , step: 0.5 ) {
158
193
Text ( " Guidance Scale " )
159
194
Spacer ( )
160
- Text ( generation . guidanceScale . formatted ( " %.1f " ) )
195
+ Text ( guidanceScaleValue )
161
196
} . padding ( . leading, 10 )
162
197
} label: {
163
- Label ( " Guidance Scale " , systemImage: " scalemass " ) . foregroundColor ( . secondary)
198
+ HStack {
199
+ Label ( " Guidance Scale " , systemImage: " scalemass " ) . foregroundColor ( . secondary)
200
+ Spacer ( )
201
+ if disclosedGuidance {
202
+ Button {
203
+ showGuidanceHelp. toggle ( )
204
+ } label: {
205
+ Image ( systemName: " info.circle " )
206
+ }
207
+ . buttonStyle ( . plain)
208
+ // Or maybe use .sheet instead
209
+ . popover ( isPresented: $showGuidanceHelp, arrowEdge: . trailing) {
210
+ guidanceHelp ( $showGuidanceHelp)
211
+ }
212
+ } else {
213
+ Text ( guidanceScaleValue)
214
+ }
215
+ } . foregroundColor ( . secondary)
164
216
}
165
217
Divider ( )
166
218
@@ -171,7 +223,23 @@ struct ControlsView: View {
171
223
Text ( " \( Int ( generation. steps) ) " )
172
224
} . padding ( . leading, 10 )
173
225
} label: {
174
- Label ( " Step count " , systemImage: " square.3.layers.3d.down.left " ) . foregroundColor ( . secondary)
226
+ HStack {
227
+ Label ( " Step count " , systemImage: " square.3.layers.3d.down.left " ) . foregroundColor ( . secondary)
228
+ Spacer ( )
229
+ if disclosedSteps {
230
+ Button {
231
+ showStepsHelp. toggle ( )
232
+ } label: {
233
+ Image ( systemName: " info.circle " )
234
+ }
235
+ . buttonStyle ( . plain)
236
+ . popover ( isPresented: $showStepsHelp, arrowEdge: . trailing) {
237
+ stepsHelp ( $showStepsHelp)
238
+ }
239
+ } else {
240
+ Text ( " \( Int ( generation. steps) ) " )
241
+ }
242
+ } . foregroundColor ( . secondary)
175
243
}
176
244
Divider ( )
177
245
@@ -183,7 +251,23 @@ struct ControlsView: View {
183
251
Text ( " \( Int ( generation. seed) ) " )
184
252
} . padding ( . leading, 10 )
185
253
} label: {
186
- Label ( " Seed " , systemImage: " leaf " ) . foregroundColor ( . secondary)
254
+ HStack {
255
+ Label ( " Seed " , systemImage: " leaf " ) . foregroundColor ( . secondary)
256
+ Spacer ( )
257
+ if disclosedSeed {
258
+ Button {
259
+ showSeedHelp. toggle ( )
260
+ } label: {
261
+ Image ( systemName: " info.circle " )
262
+ }
263
+ . buttonStyle ( . plain)
264
+ . popover ( isPresented: $showSeedHelp, arrowEdge: . trailing) {
265
+ seedHelp ( $showSeedHelp)
266
+ }
267
+ } else {
268
+ Text ( " \( Int ( generation. seed) ) " )
269
+ }
270
+ } . foregroundColor ( . secondary)
187
271
}
188
272
}
189
273
}
@@ -224,4 +308,3 @@ struct ControlsView: View {
224
308
}
225
309
}
226
310
}
227
-
0 commit comments