From 19f4663763a852f39d1d17fcea11416042b3c7a9 Mon Sep 17 00:00:00 2001 From: Ionite Date: Sat, 10 Feb 2024 15:47:41 -0500 Subject: [PATCH 01/12] Add indexing of LocalModelFile.ConfigFullPath --- StabilityMatrix.Core/Models/Database/LocalModelFile.cs | 8 ++++++++ StabilityMatrix.Core/Services/ModelIndexService.cs | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/StabilityMatrix.Core/Models/Database/LocalModelFile.cs b/StabilityMatrix.Core/Models/Database/LocalModelFile.cs index 96c3092c..f43bd65e 100644 --- a/StabilityMatrix.Core/Models/Database/LocalModelFile.cs +++ b/StabilityMatrix.Core/Models/Database/LocalModelFile.cs @@ -34,6 +34,11 @@ public record LocalModelFile /// public string? PreviewImageFullPath { get; set; } + /// + /// Optional full path to the model's configuration (.yaml) file. + /// + public string? ConfigFullPath { get; set; } + /// /// Whether or not an update is available for this model /// @@ -88,6 +93,9 @@ public record LocalModelFile [BsonIgnore] public string DisplayModelFileName => FileName; + [BsonIgnore] + public string DisplayConfigFileName => Path.GetFileName(ConfigFullPath) ?? string.Empty; + public string GetFullPath(string rootModelDirectory) { return Path.Combine(rootModelDirectory, RelativePath); diff --git a/StabilityMatrix.Core/Services/ModelIndexService.cs b/StabilityMatrix.Core/Services/ModelIndexService.cs index 16443354..9d03bf60 100644 --- a/StabilityMatrix.Core/Services/ModelIndexService.cs +++ b/StabilityMatrix.Core/Services/ModelIndexService.cs @@ -158,6 +158,12 @@ public partial class ModelIndexService : IModelIndexService localModel.PreviewImageRelativePath = Path.GetRelativePath(modelsDir, previewImagePath); } + // Try to find a config file (same name as model file but with .yaml extension) + if (file.WithName($"{file.NameWithoutExtension}.yaml") is { Exists: true } configFile) + { + localModel.ConfigFullPath = configFile; + } + // Insert into database await localModelFiles.InsertAsync(localModel).ConfigureAwait(false); From a18014db76935930f39ca4eb1a639fed86f6af34 Mon Sep 17 00:00:00 2001 From: Ionite Date: Sat, 10 Feb 2024 15:48:32 -0500 Subject: [PATCH 02/12] Add icon for models with config --- .../ControlThemes/BetterComboBoxStyles.axaml | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/StabilityMatrix.Avalonia/Styles/ControlThemes/BetterComboBoxStyles.axaml b/StabilityMatrix.Avalonia/Styles/ControlThemes/BetterComboBoxStyles.axaml index 7565401b..61d77d82 100644 --- a/StabilityMatrix.Avalonia/Styles/ControlThemes/BetterComboBoxStyles.axaml +++ b/StabilityMatrix.Avalonia/Styles/ControlThemes/BetterComboBoxStyles.axaml @@ -10,7 +10,10 @@ - + - + - + + + + + + @@ -236,7 +261,7 @@ - +