Skip to content

Commit ab11220

Browse files
authored
Merge pull request LykosAI#1117 from ionite34/improve-model-combobox
Model combobox with base model types
2 parents af3b3e4 + e2e75b6 commit ab11220

4 files changed

Lines changed: 95 additions & 14 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2
1313
- Added "Install Nunchaku" option to the ComfyUI Package Commands menu
1414
- Added "Select All" button to the Installed Extensions page
1515
- Added experimental ROCm pytorch install for ComfyUI (non-Zluda) on Windows - requires a compatible AMD GPU
16+
- Added base model type labels (SD1.5, SDXL, Flux, etc.) to Inference model selection boxes
1617
- Added Ukrainian translation thanks to @r0ddty!
1718
### Changed
1819
- Redesigned Civitai model details page

StabilityMatrix.Avalonia/DesignData/DesignData.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,6 +1268,12 @@ public static CompletionList SampleCompletionList
12681268
{
12691269
ModelName = "Art Shaper (very long name example)",
12701270
VersionName = "Style v8 (very long name)",
1271+
ModelId = 0,
1272+
VersionId = 0,
1273+
ModelDescription =
1274+
"This is a very long description for the Art Shaper model, which is used to demonstrate how long descriptions can be handled in the UI. It should be able to display multiple lines and still look good.",
1275+
ModelType = CivitModelType.Checkpoint,
1276+
BaseModel = "SD 1.5",
12711277
},
12721278
}
12731279
),
@@ -1282,6 +1288,12 @@ public static CompletionList SampleCompletionList
12821288
{
12831289
ModelName = "Background Arts",
12841290
VersionName = "Anime Style v10",
1291+
ModelId = 0,
1292+
VersionId = 0,
1293+
ModelDescription =
1294+
"This is a very long description for the Art Shaper model, which is used to demonstrate how long descriptions can be handled in the UI. It should be able to display multiple lines and still look good.",
1295+
ModelType = CivitModelType.Checkpoint,
1296+
BaseModel = "SDXL 1.0",
12851297
},
12861298
}
12871299
),

StabilityMatrix.Avalonia/DesignData/MockModelIndexService.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Nito.Disposables.Internals;
22
using StabilityMatrix.Core.Models;
3+
using StabilityMatrix.Core.Models.Api;
34
using StabilityMatrix.Core.Models.Database;
45
using StabilityMatrix.Core.Services;
56

@@ -23,6 +24,12 @@ public class MockModelIndexService : IModelIndexService
2324
{
2425
ModelName = "Art Shaper (very long name example)",
2526
VersionName = "Style v8 (very long name)",
27+
ModelId = 0,
28+
VersionId = 0,
29+
ModelDescription =
30+
"This is a very long description for the Art Shaper model, which is used to demonstrate how long descriptions can be handled in the UI. It should be able to display multiple lines and still look good.",
31+
ModelType = CivitModelType.Checkpoint,
32+
BaseModel = "SD 1.5",
2633
},
2734
},
2835
new LocalModelFile
@@ -35,6 +42,12 @@ public class MockModelIndexService : IModelIndexService
3542
{
3643
ModelName = "Background Arts",
3744
VersionName = "Anime Style v10",
45+
ModelId = 0,
46+
VersionId = 0,
47+
ModelDescription =
48+
"This is a very long description for the Art Shaper model, which is used to demonstrate how long descriptions can be handled in the UI. It should be able to display multiple lines and still look good.",
49+
ModelType = CivitModelType.Checkpoint,
50+
BaseModel = "SDXL 1.0",
3851
},
3952
},
4053
],

StabilityMatrix.Avalonia/Styles/ControlThemes/BetterComboBoxStyles.axaml

Lines changed: 69 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22
xmlns="https://github.com/avaloniaui"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:controls="clr-namespace:StabilityMatrix.Avalonia.Controls"
5+
xmlns:converters="clr-namespace:StabilityMatrix.Avalonia.Converters"
56
xmlns:fluentIcons="clr-namespace:FluentIcons.Avalonia.Fluent;assembly=FluentIcons.Avalonia.Fluent"
7+
xmlns:labs="clr-namespace:Avalonia.Labs.Controls;assembly=Avalonia.Labs.Controls"
68
xmlns:mocks="using:StabilityMatrix.Avalonia.DesignData"
79
xmlns:models="clr-namespace:StabilityMatrix.Core.Models;assembly=StabilityMatrix.Core"
810
xmlns:sg="clr-namespace:SpacedGridControl.Avalonia;assembly=SpacedGridControl.Avalonia"
911
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
10-
xmlns:labs="clr-namespace:Avalonia.Labs.Controls;assembly=Avalonia.Labs.Controls"
11-
xmlns:vendorLabs="clr-namespace:StabilityMatrix.Avalonia.Controls.VendorLabs"
12-
xmlns:converters="clr-namespace:StabilityMatrix.Avalonia.Converters">
12+
xmlns:vendorLabs="clr-namespace:StabilityMatrix.Avalonia.Controls.VendorLabs">
1313

1414
<Design.PreviewWith>
15-
<Panel Width="450" Height="600">
15+
<Panel Width="550" Height="600">
1616
<StackPanel
1717
Width="250"
18-
Margin="8"
18+
Margin="64,24"
19+
HorizontalAlignment="Left"
1920
Spacing="4">
2021
<controls:BetterComboBox
2122
HorizontalAlignment="Stretch"
@@ -30,9 +31,9 @@
3031
</StackPanel>
3132
</Panel>
3233
</Design.PreviewWith>
33-
34+
3435
<converters:FileUriConverter x:Key="FileUriConverter" />
35-
36+
3637
<!-- ReSharper disable once Xaml.StaticResourceNotResolved -->
3738
<ControlTheme
3839
x:Key="BetterComboBoxItemHybridModelTheme"
@@ -53,8 +54,9 @@
5354
CornerRadius="6"
5455
IsVisible="{Binding Local.PreviewImageFullPathGlobal, Converter={x:Static StringConverters.IsNotNullOrEmpty}, FallbackValue=''}"
5556
RenderOptions.BitmapInterpolationMode="HighQuality"
57+
RenderOptions.EdgeMode="Antialias"
5658
Source="{Binding Local.PreviewImageFullPathGlobal, FallbackValue='', Converter={StaticResource FileUriConverter}}"
57-
Stretch="UniformToFill"/>
59+
Stretch="UniformToFill" />
5860
<StackPanel
5961
Grid.Column="1"
6062
MaxWidth="300"
@@ -133,10 +135,11 @@
133135
Grid.RowSpan="2"
134136
Width="42"
135137
Height="42"
138+
CornerRadius="20"
136139
RenderOptions.BitmapInterpolationMode="HighQuality"
137-
CornerRadius="40"
140+
RenderOptions.EdgeMode="Antialias"
138141
Source="{Binding Local.PreviewImageFullPathGlobal, Converter={StaticResource FileUriConverter}}"
139-
Stretch="UniformToFill"/>
142+
Stretch="UniformToFill" />
140143

141144
<!-- Text -->
142145
<sg:SpacedGrid
@@ -179,6 +182,15 @@
179182
IsVisible="{Binding Local.ConfigFullPath, Converter={x:Static StringConverters.IsNotNullOrEmpty}, FallbackValue=False}"
180183
Symbol="BeakerSettings"
181184
ToolTip.Tip="{Binding Local.DisplayConfigFileName}" />
185+
<Label
186+
MinHeight="0"
187+
Margin="0,0,0,0"
188+
Padding="6,0,6,0"
189+
Classes="Circle LightBlue"
190+
Content="{Binding Local.ConnectedModelInfo.BaseModel}"
191+
FontSize="10"
192+
FontWeight="SemiBold"
193+
Theme="{StaticResource TagLabel}" />
182194
</StackPanel>
183195
</sg:SpacedGrid>
184196
</sg:SpacedGrid>
@@ -221,27 +233,70 @@
221233
Grid.RowSpan="2"
222234
Width="36"
223235
Height="36"
224-
CornerRadius="60"
236+
CornerRadius="36"
225237
RenderOptions.BitmapInterpolationMode="HighQuality"
226238
Source="{Binding Local.PreviewImageFullPathGlobal, Converter={StaticResource FileUriConverter}}"
227-
Stretch="UniformToFill">
228-
</vendorLabs:BetterAsyncImage>
239+
Stretch="UniformToFill" />
240+
241+
<!--<Label
242+
Grid.RowSpan="2"
243+
Theme="{StaticResource TagLabel}"
244+
Classes="Circle Solid White"
245+
VerticalAlignment="Bottom"
246+
FontSize="10"
247+
FontWeight="SemiBold"
248+
Padding="4,1"
249+
Content="{Binding Local.ConnectedModelInfo.BaseModel}"/>-->
229250

230251
<!-- Text -->
231252
<sg:SpacedGrid
232253
Grid.Row="1"
233254
Grid.Column="1"
255+
ColumnDefinitions="*,Auto"
234256
RowDefinitions="Auto,Auto"
235257
RowSpacing="1">
236258

237-
<TextBlock Text="{Binding Local.DisplayModelName}" TextTrimming="CharacterEllipsis" />
259+
<TextBlock
260+
Grid.Row="0"
261+
Grid.Column="0"
262+
Grid.ColumnSpan="2"
263+
Text="{Binding Local.DisplayModelName}"
264+
TextTrimming="CharacterEllipsis" />
238265
<TextBlock
239266
Grid.Row="1"
267+
Grid.Column="0"
268+
Grid.ColumnSpan="1"
269+
Margin="0,2,0,0"
240270
FontSize="12"
241271
FontWeight="Regular"
242272
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
243273
Text="{Binding Local.DisplayModelVersion}"
244274
TextTrimming="CharacterEllipsis" />
275+
276+
<!-- Badges -->
277+
<StackPanel
278+
Grid.Row="1"
279+
Grid.Column="1"
280+
HorizontalAlignment="Right"
281+
VerticalAlignment="Bottom"
282+
Orientation="Horizontal">
283+
<fluentIcons:SymbolIcon
284+
Margin="4"
285+
FontSize="12"
286+
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
287+
IsVisible="{Binding Local.ConfigFullPath, Converter={x:Static StringConverters.IsNotNullOrEmpty}, FallbackValue=False}"
288+
Symbol="BeakerSettings"
289+
ToolTip.Tip="{Binding Local.DisplayConfigFileName}" />
290+
<Label
291+
MinHeight="0"
292+
Margin="0,0,0,0"
293+
Padding="6,0,6,0"
294+
Classes="Circle LightBlue"
295+
Content="{Binding Local.ConnectedModelInfo.BaseModel}"
296+
FontSize="10"
297+
FontWeight="SemiBold"
298+
Theme="{StaticResource TagLabel}" />
299+
</StackPanel>
245300
</sg:SpacedGrid>
246301
</sg:SpacedGrid>
247302
</DataTemplate>

0 commit comments

Comments
 (0)