Browse Source

Added Base Model to checkpoint browser search options & also did some housekeeping

pull/109/head
JT 1 year ago
parent
commit
8e8bcbe305
  1. 3
      CHANGELOG.md
  2. 4
      StabilityMatrix.Avalonia/App.axaml.cs
  3. 2
      StabilityMatrix.Avalonia/Controls/AppWindowBase.cs
  4. 2
      StabilityMatrix.Avalonia/Controls/BetterContentDialog.cs
  5. 2
      StabilityMatrix.Avalonia/Controls/UserControlBase.cs
  6. 5
      StabilityMatrix.Avalonia/DesignData/DesignData.cs
  7. 1
      StabilityMatrix.Avalonia/DesignData/MockLaunchPageViewModel.cs
  8. 1
      StabilityMatrix.Avalonia/Services/ServiceManager.cs
  9. 2
      StabilityMatrix.Avalonia/ViewLocator.cs
  10. 2
      StabilityMatrix.Avalonia/ViewModels/Base/PageViewModelBase.cs
  11. 2
      StabilityMatrix.Avalonia/ViewModels/Base/ProgressViewModel.cs
  12. 2
      StabilityMatrix.Avalonia/ViewModels/Base/ViewModelBase.cs
  13. 5
      StabilityMatrix.Avalonia/ViewModels/CheckpointBrowser/CheckpointBrowserCardViewModel.cs
  14. 24
      StabilityMatrix.Avalonia/ViewModels/CheckpointBrowserViewModel.cs
  15. 13
      StabilityMatrix.Avalonia/ViewModels/CheckpointManager/CheckpointFile.cs
  16. 5
      StabilityMatrix.Avalonia/ViewModels/CheckpointManager/CheckpointFolder.cs
  17. 15
      StabilityMatrix.Avalonia/ViewModels/CheckpointsPageViewModel.cs
  18. 1
      StabilityMatrix.Avalonia/ViewModels/Dialogs/CivitFileViewModel.cs
  19. 1
      StabilityMatrix.Avalonia/ViewModels/Dialogs/ContentDialogViewModelBase.cs
  20. 2
      StabilityMatrix.Avalonia/ViewModels/Dialogs/ExceptionViewModel.cs
  21. 2
      StabilityMatrix.Avalonia/ViewModels/Dialogs/InstallerViewModel.cs
  22. 1
      StabilityMatrix.Avalonia/ViewModels/Dialogs/ModelVersionViewModel.cs
  23. 1
      StabilityMatrix.Avalonia/ViewModels/Dialogs/OneClickInstallViewModel.cs
  24. 1
      StabilityMatrix.Avalonia/ViewModels/Dialogs/SelectModelVersionViewModel.cs
  25. 1
      StabilityMatrix.Avalonia/ViewModels/FirstLaunchSetupViewModel.cs
  26. 1
      StabilityMatrix.Avalonia/ViewModels/LaunchPageViewModel.cs
  27. 1
      StabilityMatrix.Avalonia/ViewModels/MainWindowViewModel.cs
  28. 3
      StabilityMatrix.Avalonia/ViewModels/PackageManager/PackageCardViewModel.cs
  29. 1
      StabilityMatrix.Avalonia/ViewModels/PackageManagerViewModel.cs
  30. 1
      StabilityMatrix.Avalonia/ViewModels/ProgressItemViewModel.cs
  31. 1
      StabilityMatrix.Avalonia/ViewModels/ProgressManagerViewModel.cs
  32. 1
      StabilityMatrix.Avalonia/ViewModels/RefreshBadgeViewModel.cs
  33. 1
      StabilityMatrix.Avalonia/ViewModels/SettingsViewModel.cs
  34. 39
      StabilityMatrix.Avalonia/Views/CheckpointBrowserPage.axaml
  35. 7
      StabilityMatrix.Avalonia/Views/CheckpointsPage.axaml
  36. 2
      StabilityMatrix.Avalonia/Views/CheckpointsPage.axaml.cs
  37. 19
      StabilityMatrix.Avalonia/Views/Dialogs/SelectModelVersionDialog.axaml
  38. 3
      StabilityMatrix.Avalonia/Views/MainWindow.axaml
  39. 4
      StabilityMatrix.Core/Extensions/StringExtensions.cs
  40. 1
      StabilityMatrix.Core/Helper/Compat.cs
  41. 1
      StabilityMatrix.Core/Helper/IPrerequisiteHelper.cs
  42. 3
      StabilityMatrix.Core/Helper/SharedFolders.cs
  43. 4
      StabilityMatrix.Core/Models/Api/CivitModel.cs
  44. 15
      StabilityMatrix.Core/Models/Api/CivitModelsRequest.cs
  45. 3
      StabilityMatrix.Core/Models/Packages/A3WebUI.cs
  46. 3
      StabilityMatrix.Core/Models/Packages/InvokeAI.cs
  47. 2
      StabilityMatrix.Core/Models/Settings/ModelSearchOptions.cs
  48. 3
      StabilityMatrix.Core/Processes/ApcMessage.cs
  49. 1
      StabilityMatrix.Core/Processes/ApcParser.cs

3
CHANGELOG.md

@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html).
## v2.2.0 ## v2.2.0
### Added
- Added option to search by Base Model in the Model Browser
### Changed ### Changed
- Revamped Package Manager UI - Revamped Package Manager UI
- InvokeAI installations can now use checkpoints from the Shared Models folder - InvokeAI installations can now use checkpoints from the Shared Models folder

4
StabilityMatrix.Avalonia/App.axaml.cs

@ -37,6 +37,8 @@ using StabilityMatrix.Avalonia.Helpers;
using StabilityMatrix.Avalonia.Models; using StabilityMatrix.Avalonia.Models;
using StabilityMatrix.Avalonia.Services; using StabilityMatrix.Avalonia.Services;
using StabilityMatrix.Avalonia.ViewModels; using StabilityMatrix.Avalonia.ViewModels;
using StabilityMatrix.Avalonia.ViewModels.Base;
using StabilityMatrix.Avalonia.ViewModels.CheckpointBrowser;
using StabilityMatrix.Avalonia.ViewModels.Dialogs; using StabilityMatrix.Avalonia.ViewModels.Dialogs;
using StabilityMatrix.Avalonia.ViewModels.PackageManager; using StabilityMatrix.Avalonia.ViewModels.PackageManager;
using StabilityMatrix.Avalonia.Views; using StabilityMatrix.Avalonia.Views;
@ -55,6 +57,8 @@ using StabilityMatrix.Core.Python;
using StabilityMatrix.Core.Services; using StabilityMatrix.Core.Services;
using StabilityMatrix.Core.Updater; using StabilityMatrix.Core.Updater;
using Application = Avalonia.Application; using Application = Avalonia.Application;
using CheckpointFile = StabilityMatrix.Avalonia.ViewModels.CheckpointManager.CheckpointFile;
using CheckpointFolder = StabilityMatrix.Avalonia.ViewModels.CheckpointManager.CheckpointFolder;
using LogLevel = Microsoft.Extensions.Logging.LogLevel; using LogLevel = Microsoft.Extensions.Logging.LogLevel;
namespace StabilityMatrix.Avalonia; namespace StabilityMatrix.Avalonia;

2
StabilityMatrix.Avalonia/Controls/AppWindowBase.cs

@ -6,7 +6,7 @@ using AsyncAwaitBestPractices;
using Avalonia.Interactivity; using Avalonia.Interactivity;
using Avalonia.Threading; using Avalonia.Threading;
using FluentAvalonia.UI.Windowing; using FluentAvalonia.UI.Windowing;
using StabilityMatrix.Avalonia.ViewModels; using StabilityMatrix.Avalonia.ViewModels.Base;
namespace StabilityMatrix.Avalonia.Controls; namespace StabilityMatrix.Avalonia.Controls;

2
StabilityMatrix.Avalonia/Controls/BetterContentDialog.cs

@ -8,7 +8,7 @@ using Avalonia.Controls.Primitives;
using Avalonia.Interactivity; using Avalonia.Interactivity;
using Avalonia.Threading; using Avalonia.Threading;
using FluentAvalonia.UI.Controls; using FluentAvalonia.UI.Controls;
using StabilityMatrix.Avalonia.ViewModels; using StabilityMatrix.Avalonia.ViewModels.Base;
using StabilityMatrix.Avalonia.ViewModels.Dialogs; using StabilityMatrix.Avalonia.ViewModels.Dialogs;
namespace StabilityMatrix.Avalonia.Controls; namespace StabilityMatrix.Avalonia.Controls;

2
StabilityMatrix.Avalonia/Controls/UserControlBase.cs

@ -3,7 +3,7 @@ using AsyncAwaitBestPractices;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Interactivity; using Avalonia.Interactivity;
using Avalonia.Threading; using Avalonia.Threading;
using StabilityMatrix.Avalonia.ViewModels; using StabilityMatrix.Avalonia.ViewModels.Base;
namespace StabilityMatrix.Avalonia.Controls; namespace StabilityMatrix.Avalonia.Controls;

5
StabilityMatrix.Avalonia/DesignData/DesignData.cs

@ -10,6 +10,8 @@ using Microsoft.Extensions.DependencyInjection;
using StabilityMatrix.Avalonia.Models; using StabilityMatrix.Avalonia.Models;
using StabilityMatrix.Avalonia.Services; using StabilityMatrix.Avalonia.Services;
using StabilityMatrix.Avalonia.ViewModels; using StabilityMatrix.Avalonia.ViewModels;
using StabilityMatrix.Avalonia.ViewModels.Base;
using StabilityMatrix.Avalonia.ViewModels.CheckpointBrowser;
using StabilityMatrix.Avalonia.ViewModels.Dialogs; using StabilityMatrix.Avalonia.ViewModels.Dialogs;
using StabilityMatrix.Avalonia.ViewModels.PackageManager; using StabilityMatrix.Avalonia.ViewModels.PackageManager;
using StabilityMatrix.Core.Api; using StabilityMatrix.Core.Api;
@ -23,6 +25,8 @@ using StabilityMatrix.Core.Models.Progress;
using StabilityMatrix.Core.Python; using StabilityMatrix.Core.Python;
using StabilityMatrix.Core.Services; using StabilityMatrix.Core.Services;
using StabilityMatrix.Core.Updater; using StabilityMatrix.Core.Updater;
using CheckpointFile = StabilityMatrix.Avalonia.ViewModels.CheckpointManager.CheckpointFile;
using CheckpointFolder = StabilityMatrix.Avalonia.ViewModels.CheckpointManager.CheckpointFolder;
namespace StabilityMatrix.Avalonia.DesignData; namespace StabilityMatrix.Avalonia.DesignData;
@ -284,6 +288,7 @@ public static class DesignData
{ {
Name = "BB95 Furry Mix", Name = "BB95 Furry Mix",
Description = "v1.0.0", Description = "v1.0.0",
BaseModel = "SD 1.5",
Files = new List<CivitFile> Files = new List<CivitFile>
{ {
new() new()

1
StabilityMatrix.Avalonia/DesignData/MockLaunchPageViewModel.cs

@ -2,6 +2,7 @@
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using StabilityMatrix.Avalonia.Services; using StabilityMatrix.Avalonia.Services;
using StabilityMatrix.Avalonia.ViewModels; using StabilityMatrix.Avalonia.ViewModels;
using StabilityMatrix.Avalonia.ViewModels.Base;
using StabilityMatrix.Core.Helper; using StabilityMatrix.Core.Helper;
using StabilityMatrix.Core.Helper.Factory; using StabilityMatrix.Core.Helper.Factory;
using StabilityMatrix.Core.Models.Packages; using StabilityMatrix.Core.Models.Packages;

1
StabilityMatrix.Avalonia/Services/ServiceManager.cs

@ -1,7 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
namespace StabilityMatrix.Avalonia.Services; namespace StabilityMatrix.Avalonia.Services;

2
StabilityMatrix.Avalonia/ViewLocator.cs

@ -1,7 +1,7 @@
using System; using System;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Controls.Templates; using Avalonia.Controls.Templates;
using StabilityMatrix.Avalonia.ViewModels; using StabilityMatrix.Avalonia.ViewModels.Base;
using StabilityMatrix.Core.Attributes; using StabilityMatrix.Core.Attributes;
namespace StabilityMatrix.Avalonia; namespace StabilityMatrix.Avalonia;

2
StabilityMatrix.Avalonia/ViewModels/PageViewModelBase.cs → StabilityMatrix.Avalonia/ViewModels/Base/PageViewModelBase.cs

@ -1,6 +1,6 @@
using FluentAvalonia.UI.Controls; using FluentAvalonia.UI.Controls;
namespace StabilityMatrix.Avalonia.ViewModels; namespace StabilityMatrix.Avalonia.ViewModels.Base;
/// <summary> /// <summary>
/// An abstract class for enabling page navigation. /// An abstract class for enabling page navigation.

2
StabilityMatrix.Avalonia/ViewModels/ProgressViewModel.cs → StabilityMatrix.Avalonia/ViewModels/Base/ProgressViewModel.cs

@ -1,6 +1,6 @@
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
namespace StabilityMatrix.Avalonia.ViewModels; namespace StabilityMatrix.Avalonia.ViewModels.Base;
/// <summary> /// <summary>
/// Generic view model for progress reporting. /// Generic view model for progress reporting.

2
StabilityMatrix.Avalonia/ViewModels/ViewModelBase.cs → StabilityMatrix.Avalonia/ViewModels/Base/ViewModelBase.cs

@ -4,7 +4,7 @@ using AsyncAwaitBestPractices;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using StabilityMatrix.Avalonia.Models; using StabilityMatrix.Avalonia.Models;
namespace StabilityMatrix.Avalonia.ViewModels; namespace StabilityMatrix.Avalonia.ViewModels.Base;
public class ViewModelBase : ObservableValidator, IRemovableListItem public class ViewModelBase : ObservableValidator, IRemovableListItem
{ {

5
StabilityMatrix.Avalonia/ViewModels/CheckpointBrowserCardViewModel.cs → StabilityMatrix.Avalonia/ViewModels/CheckpointBrowser/CheckpointBrowserCardViewModel.cs

@ -16,6 +16,7 @@ using NLog;
using Octokit; using Octokit;
using StabilityMatrix.Avalonia.Controls; using StabilityMatrix.Avalonia.Controls;
using StabilityMatrix.Avalonia.Services; using StabilityMatrix.Avalonia.Services;
using StabilityMatrix.Avalonia.ViewModels.Base;
using StabilityMatrix.Avalonia.ViewModels.Dialogs; using StabilityMatrix.Avalonia.ViewModels.Dialogs;
using StabilityMatrix.Avalonia.Views.Dialogs; using StabilityMatrix.Avalonia.Views.Dialogs;
using StabilityMatrix.Core.Extensions; using StabilityMatrix.Core.Extensions;
@ -28,9 +29,9 @@ using StabilityMatrix.Core.Processes;
using StabilityMatrix.Core.Services; using StabilityMatrix.Core.Services;
using Notification = Avalonia.Controls.Notifications.Notification; using Notification = Avalonia.Controls.Notifications.Notification;
namespace StabilityMatrix.Avalonia.ViewModels; namespace StabilityMatrix.Avalonia.ViewModels.CheckpointBrowser;
public partial class CheckpointBrowserCardViewModel : ProgressViewModel public partial class CheckpointBrowserCardViewModel : Base.ProgressViewModel
{ {
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();

24
StabilityMatrix.Avalonia/ViewModels/CheckpointBrowserViewModel.cs

@ -15,6 +15,8 @@ using FluentAvalonia.UI.Controls;
using NLog; using NLog;
using Refit; using Refit;
using StabilityMatrix.Avalonia.Services; using StabilityMatrix.Avalonia.Services;
using StabilityMatrix.Avalonia.ViewModels.Base;
using StabilityMatrix.Avalonia.ViewModels.CheckpointBrowser;
using StabilityMatrix.Avalonia.Views; using StabilityMatrix.Avalonia.Views;
using StabilityMatrix.Core.Api; using StabilityMatrix.Core.Api;
using StabilityMatrix.Core.Attributes; using StabilityMatrix.Core.Attributes;
@ -61,6 +63,7 @@ public partial class CheckpointBrowserViewModel : PageViewModelBase
[ObservableProperty] private bool isIndeterminate; [ObservableProperty] private bool isIndeterminate;
[ObservableProperty] private bool noResultsFound; [ObservableProperty] private bool noResultsFound;
[ObservableProperty] private string noResultsText = string.Empty; [ObservableProperty] private string noResultsText = string.Empty;
[ObservableProperty] private string selectedBaseModelType = "All";
private List<CheckpointBrowserCardViewModel> allModelCards = new(); private List<CheckpointBrowserCardViewModel> allModelCards = new();
@ -72,6 +75,8 @@ public partial class CheckpointBrowserViewModel : PageViewModelBase
.Where(t => t == CivitModelType.All || t.ConvertTo<SharedFolderType>() > 0) .Where(t => t == CivitModelType.All || t.ConvertTo<SharedFolderType>() > 0)
.OrderBy(t => t.ToString()); .OrderBy(t => t.ToString());
public List<string> BaseModelOptions => new() {"All", "SD 1.5", "SD 2.1", "SDXL 0.9", "SDXL 1.0"};
public CheckpointBrowserViewModel( public CheckpointBrowserViewModel(
ICivitApi civitApi, ICivitApi civitApi,
IDownloadService downloadService, IDownloadService downloadService,
@ -100,6 +105,7 @@ public partial class CheckpointBrowserViewModel : PageViewModelBase
SelectedPeriod = searchOptions?.SelectedPeriod ?? CivitPeriod.Month; SelectedPeriod = searchOptions?.SelectedPeriod ?? CivitPeriod.Month;
SortMode = searchOptions?.SortMode ?? CivitSortMode.HighestRated; SortMode = searchOptions?.SortMode ?? CivitSortMode.HighestRated;
SelectedModelType = searchOptions?.SelectedModelType ?? CivitModelType.Checkpoint; SelectedModelType = searchOptions?.SelectedModelType ?? CivitModelType.Checkpoint;
SelectedBaseModelType = searchOptions?.SelectedBaseModelType ?? "All";
ShowNsfw = settingsManager.Settings.ModelBrowserNsfwEnabled; ShowNsfw = settingsManager.Settings.ModelBrowserNsfwEnabled;
@ -299,6 +305,11 @@ public partial class CheckpointBrowserViewModel : PageViewModelBase
modelRequest.Types = new[] {SelectedModelType}; modelRequest.Types = new[] {SelectedModelType};
} }
if (SelectedBaseModelType != "All")
{
modelRequest.BaseModel = SelectedBaseModelType;
}
// See if query is cached // See if query is cached
var cachedQuery = await liteDbContext.CivitModelQueryCache var cachedQuery = await liteDbContext.CivitModelQueryCache
.IncludeAll() .IncludeAll()
@ -366,21 +377,28 @@ public partial class CheckpointBrowserViewModel : PageViewModelBase
{ {
TrySearchAgain().SafeFireAndForget(); TrySearchAgain().SafeFireAndForget();
settingsManager.Transaction(s => s.ModelSearchOptions = new ModelSearchOptions( settingsManager.Transaction(s => s.ModelSearchOptions = new ModelSearchOptions(
value, SortMode, SelectedModelType)); value, SortMode, SelectedModelType, SelectedBaseModelType));
} }
partial void OnSortModeChanged(CivitSortMode value) partial void OnSortModeChanged(CivitSortMode value)
{ {
TrySearchAgain().SafeFireAndForget(); TrySearchAgain().SafeFireAndForget();
settingsManager.Transaction(s => s.ModelSearchOptions = new ModelSearchOptions( settingsManager.Transaction(s => s.ModelSearchOptions = new ModelSearchOptions(
SelectedPeriod, value, SelectedModelType)); SelectedPeriod, value, SelectedModelType, SelectedBaseModelType));
} }
partial void OnSelectedModelTypeChanged(CivitModelType value) partial void OnSelectedModelTypeChanged(CivitModelType value)
{ {
TrySearchAgain().SafeFireAndForget(); TrySearchAgain().SafeFireAndForget();
settingsManager.Transaction(s => s.ModelSearchOptions = new ModelSearchOptions( settingsManager.Transaction(s => s.ModelSearchOptions = new ModelSearchOptions(
SelectedPeriod, SortMode, value)); SelectedPeriod, SortMode, value, SelectedBaseModelType));
}
partial void OnSelectedBaseModelTypeChanged(string value)
{
TrySearchAgain().SafeFireAndForget();
settingsManager.Transaction(s => s.ModelSearchOptions = new ModelSearchOptions(
SelectedPeriod, SortMode, SelectedModelType, value));
} }
private async Task TrySearchAgain(bool shouldUpdatePageNumber = true) private async Task TrySearchAgain(bool shouldUpdatePageNumber = true)

13
StabilityMatrix.Avalonia/ViewModels/CheckpointFile.cs → StabilityMatrix.Avalonia/ViewModels/CheckpointManager/CheckpointFile.cs

@ -10,13 +10,14 @@ using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using FluentAvalonia.UI.Controls; using FluentAvalonia.UI.Controls;
using NLog; using NLog;
using StabilityMatrix.Avalonia.ViewModels.Base;
using StabilityMatrix.Core.Extensions; using StabilityMatrix.Core.Extensions;
using StabilityMatrix.Core.Helper; using StabilityMatrix.Core.Helper;
using StabilityMatrix.Core.Models; using StabilityMatrix.Core.Models;
using StabilityMatrix.Core.Models.Progress; using StabilityMatrix.Core.Models.Progress;
using StabilityMatrix.Core.Processes; using StabilityMatrix.Core.Processes;
namespace StabilityMatrix.Avalonia.ViewModels; namespace StabilityMatrix.Avalonia.ViewModels.CheckpointManager;
public partial class CheckpointFile : ViewModelBase public partial class CheckpointFile : ViewModelBase
{ {
@ -46,7 +47,7 @@ public partial class CheckpointFile : ViewModelBase
[ObservableProperty] private bool isLoading; [ObservableProperty] private bool isLoading;
public string FileName => Path.GetFileName(FilePath); public string FileName => Path.GetFileName((string?) FilePath);
public ObservableCollection<string> Badges { get; set; } = new(); public ObservableCollection<string> Badges { get; set; } = new();
@ -78,8 +79,8 @@ public partial class CheckpointFile : ViewModelBase
throw new InvalidOperationException( throw new InvalidOperationException(
"Cannot get connected model info file path when FilePath is empty"); "Cannot get connected model info file path when FilePath is empty");
} }
var modelNameNoExt = Path.GetFileNameWithoutExtension(FilePath); var modelNameNoExt = Path.GetFileNameWithoutExtension((string?) FilePath);
var modelDir = Path.GetDirectoryName(FilePath) ?? ""; var modelDir = Path.GetDirectoryName((string?) FilePath) ?? "";
return Path.Combine(modelDir, $"{modelNameNoExt}.cm-info.json"); return Path.Combine(modelDir, $"{modelNameNoExt}.cm-info.json");
} }
@ -123,7 +124,7 @@ public partial class CheckpointFile : ViewModelBase
private async Task RenameAsync() private async Task RenameAsync()
{ {
// Parent folder path // Parent folder path
var parentPath = Path.GetDirectoryName(FilePath) ?? ""; var parentPath = Path.GetDirectoryName((string?) FilePath) ?? "";
var textFields = new TextBoxField[] var textFields = new TextBoxField[]
{ {
@ -158,7 +159,7 @@ public partial class CheckpointFile : ViewModelBase
// If preview image exists, rename it too // If preview image exists, rename it too
if (PreviewImagePath != null && File.Exists(PreviewImagePath)) if (PreviewImagePath != null && File.Exists(PreviewImagePath))
{ {
var newPreviewImagePath = Path.Combine(parentPath, $"{nameNoExt}.preview{Path.GetExtension(PreviewImagePath)}"); var newPreviewImagePath = Path.Combine(parentPath, $"{nameNoExt}.preview{Path.GetExtension((string?) PreviewImagePath)}");
File.Move(PreviewImagePath, newPreviewImagePath); File.Move(PreviewImagePath, newPreviewImagePath);
PreviewImagePath = newPreviewImagePath; PreviewImagePath = newPreviewImagePath;
} }

5
StabilityMatrix.Avalonia/ViewModels/CheckpointFolder.cs → StabilityMatrix.Avalonia/ViewModels/CheckpointManager/CheckpointFolder.cs

@ -12,6 +12,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using FluentAvalonia.UI.Controls; using FluentAvalonia.UI.Controls;
using StabilityMatrix.Avalonia.Models; using StabilityMatrix.Avalonia.Models;
using StabilityMatrix.Avalonia.ViewModels.Base;
using StabilityMatrix.Core.Extensions; using StabilityMatrix.Core.Extensions;
using StabilityMatrix.Core.Helper; using StabilityMatrix.Core.Helper;
using StabilityMatrix.Core.Models; using StabilityMatrix.Core.Models;
@ -20,7 +21,7 @@ using StabilityMatrix.Core.Models.Progress;
using StabilityMatrix.Core.Processes; using StabilityMatrix.Core.Processes;
using StabilityMatrix.Core.Services; using StabilityMatrix.Core.Services;
namespace StabilityMatrix.Avalonia.ViewModels; namespace StabilityMatrix.Avalonia.ViewModels.CheckpointManager;
public partial class CheckpointFolder : ViewModelBase public partial class CheckpointFolder : ViewModelBase
{ {
@ -73,7 +74,7 @@ public partial class CheckpointFolder : ViewModelBase
? $"{Title} ({CheckpointFiles.Count + SubFolders.Sum(folder => folder.CheckpointFiles.Count)})" ? $"{Title} ({CheckpointFiles.Count + SubFolders.Sum(folder => folder.CheckpointFiles.Count)})"
: Title; : Title;
public ProgressViewModel Progress { get; } = new(); public Base.ProgressViewModel Progress { get; } = new();
public CheckpointFolder? ParentFolder { get; init; } public CheckpointFolder? ParentFolder { get; init; }
public AdvancedObservableList<CheckpointFolder> SubFolders { get; init; } = new(); public AdvancedObservableList<CheckpointFolder> SubFolders { get; init; } = new();

15
StabilityMatrix.Avalonia/ViewModels/CheckpointsPageViewModel.cs

@ -9,6 +9,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using FluentAvalonia.UI.Controls; using FluentAvalonia.UI.Controls;
using NLog; using NLog;
using StabilityMatrix.Avalonia.ViewModels.Base;
using StabilityMatrix.Avalonia.Views; using StabilityMatrix.Avalonia.Views;
using StabilityMatrix.Core.Attributes; using StabilityMatrix.Core.Attributes;
using StabilityMatrix.Core.Helper; using StabilityMatrix.Core.Helper;
@ -51,10 +52,10 @@ public partial class CheckpointsPageViewModel : PageViewModelBase
} }
[ObservableProperty] [ObservableProperty]
private ObservableCollection<CheckpointFolder> checkpointFolders = new(); private ObservableCollection<CheckpointManager.CheckpointFolder> checkpointFolders = new();
[ObservableProperty] [ObservableProperty]
private ObservableCollection<CheckpointFolder> displayedCheckpointFolders = new(); private ObservableCollection<CheckpointManager.CheckpointFolder> displayedCheckpointFolders = new();
public CheckpointsPageViewModel( public CheckpointsPageViewModel(
ISharedFolders sharedFolders, ISharedFolders sharedFolders,
@ -105,10 +106,10 @@ public partial class CheckpointsPageViewModel : PageViewModelBase
folder.SearchFilter = SearchFilter; folder.SearchFilter = SearchFilter;
} }
DisplayedCheckpointFolders = new ObservableCollection<CheckpointFolder>(filteredFolders); DisplayedCheckpointFolders = new ObservableCollection<CheckpointManager.CheckpointFolder>(filteredFolders);
} }
private bool ContainsSearchFilter(CheckpointFolder folder) private bool ContainsSearchFilter(CheckpointManager.CheckpointFolder folder)
{ {
if (folder == null) if (folder == null)
throw new ArgumentNullException(nameof(folder)); throw new ArgumentNullException(nameof(folder));
@ -139,7 +140,7 @@ public partial class CheckpointsPageViewModel : PageViewModelBase
var indexTasks = folders.Select(f => Task.Run(async () => var indexTasks = folders.Select(f => Task.Run(async () =>
{ {
var checkpointFolder = var checkpointFolder =
new CheckpointFolder(settingsManager, downloadService, modelFinder) new CheckpointManager.CheckpointFolder(settingsManager, downloadService, modelFinder)
{ {
Title = Path.GetFileName(f), Title = Path.GetFileName(f),
DirectoryPath = f, DirectoryPath = f,
@ -153,13 +154,13 @@ public partial class CheckpointsPageViewModel : PageViewModelBase
// Set new observable collection, ordered by alphabetical order // Set new observable collection, ordered by alphabetical order
CheckpointFolders = CheckpointFolders =
new ObservableCollection<CheckpointFolder>(indexTasks new ObservableCollection<CheckpointManager.CheckpointFolder>(indexTasks
.Select(t => t.Result) .Select(t => t.Result)
.OrderBy(f => f.Title)); .OrderBy(f => f.Title));
if (!string.IsNullOrWhiteSpace(SearchFilter)) if (!string.IsNullOrWhiteSpace(SearchFilter))
{ {
DisplayedCheckpointFolders = new ObservableCollection<CheckpointFolder>( DisplayedCheckpointFolders = new ObservableCollection<CheckpointManager.CheckpointFolder>(
CheckpointFolders CheckpointFolders
.Where(x => x.CheckpointFiles.Any(y => y.FileName.Contains(SearchFilter)))); .Where(x => x.CheckpointFiles.Any(y => y.FileName.Contains(SearchFilter))));
} }

1
StabilityMatrix.Avalonia/ViewModels/Dialogs/CivitFileViewModel.cs

@ -1,5 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using StabilityMatrix.Core.Models.Api; using StabilityMatrix.Core.Models.Api;

1
StabilityMatrix.Avalonia/ViewModels/Dialogs/ContentDialogViewModelBase.cs

@ -1,5 +1,6 @@
using System; using System;
using FluentAvalonia.UI.Controls; using FluentAvalonia.UI.Controls;
using StabilityMatrix.Avalonia.ViewModels.Base;
namespace StabilityMatrix.Avalonia.ViewModels.Dialogs; namespace StabilityMatrix.Avalonia.ViewModels.Dialogs;

2
StabilityMatrix.Avalonia/ViewModels/Dialogs/ExceptionViewModel.cs

@ -1,5 +1,5 @@
using System; using System;
using CommunityToolkit.Mvvm.ComponentModel; using StabilityMatrix.Avalonia.ViewModels.Base;
using StabilityMatrix.Avalonia.Views.Dialogs; using StabilityMatrix.Avalonia.Views.Dialogs;
using StabilityMatrix.Core.Attributes; using StabilityMatrix.Core.Attributes;

2
StabilityMatrix.Avalonia/ViewModels/Dialogs/InstallerViewModel.cs

@ -75,7 +75,7 @@ public partial class InstallerViewModel : ContentDialogViewModelBase
[ObservableProperty] private string? installName; [ObservableProperty] private string? installName;
public ProgressViewModel InstallProgress { get; } = new(); public Base.ProgressViewModel InstallProgress { get; } = new();
public InstallerViewModel( public InstallerViewModel(
ISettingsManager settingsManager, ISettingsManager settingsManager,

1
StabilityMatrix.Avalonia/ViewModels/Dialogs/ModelVersionViewModel.cs

@ -3,7 +3,6 @@ using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using StabilityMatrix.Core.Models.Api; using StabilityMatrix.Core.Models.Api;
using StabilityMatrix.Core.Services;
namespace StabilityMatrix.Avalonia.ViewModels.Dialogs; namespace StabilityMatrix.Avalonia.ViewModels.Dialogs;

1
StabilityMatrix.Avalonia/ViewModels/Dialogs/OneClickInstallViewModel.cs

@ -5,6 +5,7 @@ using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using StabilityMatrix.Avalonia.ViewModels.Base;
using StabilityMatrix.Core.Helper; using StabilityMatrix.Core.Helper;
using StabilityMatrix.Core.Helper.Factory; using StabilityMatrix.Core.Helper.Factory;
using StabilityMatrix.Core.Models; using StabilityMatrix.Core.Models;

1
StabilityMatrix.Avalonia/ViewModels/Dialogs/SelectModelVersionViewModel.cs

@ -7,7 +7,6 @@ using Avalonia.Platform;
using Avalonia.Threading; using Avalonia.Threading;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using FluentAvalonia.UI.Controls; using FluentAvalonia.UI.Controls;
using StabilityMatrix.Core.Models.Api;
using StabilityMatrix.Core.Services; using StabilityMatrix.Core.Services;
namespace StabilityMatrix.Avalonia.ViewModels.Dialogs; namespace StabilityMatrix.Avalonia.ViewModels.Dialogs;

1
StabilityMatrix.Avalonia/ViewModels/FirstLaunchSetupViewModel.cs

@ -3,6 +3,7 @@ using System.Threading.Tasks;
using AsyncAwaitBestPractices; using AsyncAwaitBestPractices;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using StabilityMatrix.Avalonia.Styles; using StabilityMatrix.Avalonia.Styles;
using StabilityMatrix.Avalonia.ViewModels.Base;
using StabilityMatrix.Avalonia.Views; using StabilityMatrix.Avalonia.Views;
using StabilityMatrix.Core.Attributes; using StabilityMatrix.Core.Attributes;
using StabilityMatrix.Core.Helper; using StabilityMatrix.Core.Helper;

1
StabilityMatrix.Avalonia/ViewModels/LaunchPageViewModel.cs

@ -19,6 +19,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using StabilityMatrix.Avalonia.Controls; using StabilityMatrix.Avalonia.Controls;
using StabilityMatrix.Avalonia.Services; using StabilityMatrix.Avalonia.Services;
using StabilityMatrix.Avalonia.ViewModels.Base;
using StabilityMatrix.Avalonia.ViewModels.Dialogs; using StabilityMatrix.Avalonia.ViewModels.Dialogs;
using StabilityMatrix.Avalonia.Views; using StabilityMatrix.Avalonia.Views;
using StabilityMatrix.Avalonia.Views.Dialogs; using StabilityMatrix.Avalonia.Views.Dialogs;

1
StabilityMatrix.Avalonia/ViewModels/MainWindowViewModel.cs

@ -9,6 +9,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
using FluentAvalonia.UI.Controls; using FluentAvalonia.UI.Controls;
using StabilityMatrix.Avalonia.Controls; using StabilityMatrix.Avalonia.Controls;
using StabilityMatrix.Avalonia.Services; using StabilityMatrix.Avalonia.Services;
using StabilityMatrix.Avalonia.ViewModels.Base;
using StabilityMatrix.Avalonia.ViewModels.Dialogs; using StabilityMatrix.Avalonia.ViewModels.Dialogs;
using StabilityMatrix.Avalonia.Views; using StabilityMatrix.Avalonia.Views;
using StabilityMatrix.Avalonia.Views.Dialogs; using StabilityMatrix.Avalonia.Views.Dialogs;

3
StabilityMatrix.Avalonia/ViewModels/PackageManager/PackageCardViewModel.cs

@ -2,7 +2,6 @@
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using AsyncAwaitBestPractices;
using Avalonia.Controls.Notifications; using Avalonia.Controls.Notifications;
using Avalonia.Threading; using Avalonia.Threading;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
@ -19,7 +18,7 @@ using StabilityMatrix.Core.Services;
namespace StabilityMatrix.Avalonia.ViewModels.PackageManager; namespace StabilityMatrix.Avalonia.ViewModels.PackageManager;
public partial class PackageCardViewModel : ProgressViewModel public partial class PackageCardViewModel : Base.ProgressViewModel
{ {
private readonly IPackageFactory packageFactory; private readonly IPackageFactory packageFactory;
private readonly INotificationService notificationService; private readonly INotificationService notificationService;

1
StabilityMatrix.Avalonia/ViewModels/PackageManagerViewModel.cs

@ -9,6 +9,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
using FluentAvalonia.UI.Controls; using FluentAvalonia.UI.Controls;
using StabilityMatrix.Avalonia.Controls; using StabilityMatrix.Avalonia.Controls;
using StabilityMatrix.Avalonia.Services; using StabilityMatrix.Avalonia.Services;
using StabilityMatrix.Avalonia.ViewModels.Base;
using StabilityMatrix.Avalonia.ViewModels.Dialogs; using StabilityMatrix.Avalonia.ViewModels.Dialogs;
using StabilityMatrix.Avalonia.ViewModels.PackageManager; using StabilityMatrix.Avalonia.ViewModels.PackageManager;
using StabilityMatrix.Avalonia.Views; using StabilityMatrix.Avalonia.Views;

1
StabilityMatrix.Avalonia/ViewModels/ProgressItemViewModel.cs

@ -1,5 +1,6 @@
using System; using System;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using StabilityMatrix.Avalonia.ViewModels.Base;
using StabilityMatrix.Core.Helper; using StabilityMatrix.Core.Helper;
using StabilityMatrix.Core.Models.Progress; using StabilityMatrix.Core.Models.Progress;

1
StabilityMatrix.Avalonia/ViewModels/ProgressManagerViewModel.cs

@ -3,6 +3,7 @@ using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using FluentAvalonia.UI.Controls; using FluentAvalonia.UI.Controls;
using StabilityMatrix.Avalonia.ViewModels.Base;
using StabilityMatrix.Avalonia.Views; using StabilityMatrix.Avalonia.Views;
using StabilityMatrix.Core.Attributes; using StabilityMatrix.Core.Attributes;
using StabilityMatrix.Core.Helper; using StabilityMatrix.Core.Helper;

1
StabilityMatrix.Avalonia/ViewModels/RefreshBadgeViewModel.cs

@ -8,6 +8,7 @@ using FluentAvalonia.UI.Controls;
using NLog; using NLog;
using StabilityMatrix.Avalonia.Controls; using StabilityMatrix.Avalonia.Controls;
using StabilityMatrix.Avalonia.Styles; using StabilityMatrix.Avalonia.Styles;
using StabilityMatrix.Avalonia.ViewModels.Base;
using StabilityMatrix.Core.Attributes; using StabilityMatrix.Core.Attributes;
using StabilityMatrix.Core.Models.Progress; using StabilityMatrix.Core.Models.Progress;

1
StabilityMatrix.Avalonia/ViewModels/SettingsViewModel.cs

@ -19,6 +19,7 @@ using StabilityMatrix.Avalonia.Controls;
using StabilityMatrix.Avalonia.Helpers; using StabilityMatrix.Avalonia.Helpers;
using StabilityMatrix.Avalonia.Models; using StabilityMatrix.Avalonia.Models;
using StabilityMatrix.Avalonia.Services; using StabilityMatrix.Avalonia.Services;
using StabilityMatrix.Avalonia.ViewModels.Base;
using StabilityMatrix.Avalonia.ViewModels.Dialogs; using StabilityMatrix.Avalonia.ViewModels.Dialogs;
using StabilityMatrix.Avalonia.Views; using StabilityMatrix.Avalonia.Views;
using StabilityMatrix.Avalonia.Views.Dialogs; using StabilityMatrix.Avalonia.Views.Dialogs;

39
StabilityMatrix.Avalonia/Views/CheckpointBrowserPage.axaml

@ -6,6 +6,8 @@
xmlns:viewModels="clr-namespace:StabilityMatrix.Avalonia.ViewModels" xmlns:viewModels="clr-namespace:StabilityMatrix.Avalonia.ViewModels"
xmlns:designData="clr-namespace:StabilityMatrix.Avalonia.DesignData" xmlns:designData="clr-namespace:StabilityMatrix.Avalonia.DesignData"
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
xmlns:vm="clr-namespace:StabilityMatrix.Avalonia.ViewModels.CheckpointManager"
xmlns:checkpointBrowser="clr-namespace:StabilityMatrix.Avalonia.ViewModels.CheckpointBrowser"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="600" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="600"
x:DataType="viewModels:CheckpointBrowserViewModel" x:DataType="viewModels:CheckpointBrowserViewModel"
d:DataContext="{x:Static designData:DesignData.CheckpointBrowserViewModel}" d:DataContext="{x:Static designData:DesignData.CheckpointBrowserViewModel}"
@ -13,7 +15,7 @@
x:Class="StabilityMatrix.Avalonia.Views.CheckpointBrowserPage"> x:Class="StabilityMatrix.Avalonia.Views.CheckpointBrowserPage">
<UserControl.Resources> <UserControl.Resources>
<DataTemplate DataType="{x:Type viewModels:CheckpointBrowserCardViewModel}" x:Key="CivitModelTemplate"> <DataTemplate DataType="{x:Type checkpointBrowser:CheckpointBrowserCardViewModel}" x:Key="CivitModelTemplate">
<controls:Card <controls:Card
Margin="8" Margin="8"
MaxHeight="450" MaxHeight="450"
@ -65,13 +67,29 @@
VerticalAlignment="Top"> VerticalAlignment="Top">
<TextBlock <TextBlock
FontSize="10" FontSize="11"
FontWeight="Medium" FontWeight="Medium"
HorizontalAlignment="Center" HorizontalAlignment="Center"
Text="{Binding CivitModel.Type}" Text="{Binding CivitModel.Type}"
VerticalAlignment="Center" /> VerticalAlignment="Center" />
</controls:Card> </controls:Card>
<controls:Card
Classes="info"
Height="24"
HorizontalAlignment="Left"
Padding="4"
Margin="4,16,0,0"
VerticalAlignment="Top">
<TextBlock
FontSize="11"
FontWeight="Medium"
HorizontalAlignment="Center"
Text="{Binding CivitModel.BaseModelType}"
VerticalAlignment="Center" />
</controls:Card>
<controls:Card <controls:Card
Classes="success" Classes="success"
Height="24" Height="24"
@ -82,7 +100,7 @@
VerticalAlignment="Top"> VerticalAlignment="Top">
<TextBlock <TextBlock
FontSize="10" FontSize="11"
FontWeight="Medium" FontWeight="Medium"
HorizontalAlignment="Center" HorizontalAlignment="Center"
Text="{Binding UpdateCardText}" Text="{Binding UpdateCardText}"
@ -185,7 +203,7 @@
</Button> </Button>
</Grid> </Grid>
<DockPanel> <DockPanel>
<StackPanel Margin="8" Orientation="Vertical"> <StackPanel Margin="4, 8" Orientation="Vertical">
<Label Content="Sort" /> <Label Content="Sort" />
<ComboBox <ComboBox
ItemsSource="{Binding AllSortModes}" ItemsSource="{Binding AllSortModes}"
@ -193,7 +211,7 @@
SelectedItem="{Binding SortMode}" /> SelectedItem="{Binding SortMode}" />
</StackPanel> </StackPanel>
<StackPanel Margin="0,8" Orientation="Vertical"> <StackPanel Margin="4, 8" Orientation="Vertical">
<Label Content="Period" /> <Label Content="Period" />
<ComboBox <ComboBox
ItemsSource="{Binding AllCivitPeriods}" ItemsSource="{Binding AllCivitPeriods}"
@ -201,7 +219,7 @@
SelectedItem="{Binding SelectedPeriod}" /> SelectedItem="{Binding SelectedPeriod}" />
</StackPanel> </StackPanel>
<StackPanel Margin="8" Orientation="Vertical"> <StackPanel Margin="4, 8" Orientation="Vertical">
<Label Content="Model Type" /> <Label Content="Model Type" />
<ComboBox <ComboBox
ItemsSource="{Binding AllModelTypes}" ItemsSource="{Binding AllModelTypes}"
@ -209,6 +227,15 @@
SelectedItem="{Binding SelectedModelType}" /> SelectedItem="{Binding SelectedModelType}" />
</StackPanel> </StackPanel>
<StackPanel Margin="4, 8" Orientation="Vertical">
<Label Content="Base Model" />
<ComboBox
ItemsSource="{Binding BaseModelOptions}"
MinWidth="100"
SelectedItem="{Binding SelectedBaseModelType}" />
</StackPanel>
<CheckBox <CheckBox
Content="Show NSFW Content" Content="Show NSFW Content"
HorizontalAlignment="Right" HorizontalAlignment="Right"

7
StabilityMatrix.Avalonia/Views/CheckpointsPage.axaml

@ -7,6 +7,7 @@
xmlns:mocks="clr-namespace:StabilityMatrix.Avalonia.DesignData" xmlns:mocks="clr-namespace:StabilityMatrix.Avalonia.DesignData"
xmlns:controls="clr-namespace:StabilityMatrix.Avalonia.Controls" xmlns:controls="clr-namespace:StabilityMatrix.Avalonia.Controls"
xmlns:system="clr-namespace:System;assembly=System.Runtime" xmlns:system="clr-namespace:System;assembly=System.Runtime"
xmlns:checkpointManager="clr-namespace:StabilityMatrix.Avalonia.ViewModels.CheckpointManager"
d:DataContext="{x:Static mocks:DesignData.CheckpointsPageViewModel}" d:DataContext="{x:Static mocks:DesignData.CheckpointsPageViewModel}"
x:CompileBindings="True" x:CompileBindings="True"
x:DataType="vm:CheckpointsPageViewModel" x:DataType="vm:CheckpointsPageViewModel"
@ -40,7 +41,7 @@
</DataTemplate> </DataTemplate>
<!-- Checkpoint File Card --> <!-- Checkpoint File Card -->
<DataTemplate DataType="{x:Type vm:CheckpointFile}" x:Key="CheckpointFileDataTemplate"> <DataTemplate DataType="{x:Type checkpointManager:CheckpointFile}" x:Key="CheckpointFileDataTemplate">
<Border <Border
DragDrop.AllowDrop="False" DragDrop.AllowDrop="False"
Background="Transparent" Background="Transparent"
@ -203,7 +204,7 @@
</DataTemplate> </DataTemplate>
<!-- Checkpoint Folder Expander --> <!-- Checkpoint Folder Expander -->
<DataTemplate DataType="{x:Type vm:CheckpointFolder}" x:Key="CheckpointFolderGridDataTemplate"> <DataTemplate DataType="{x:Type checkpointManager:CheckpointFolder}" x:Key="CheckpointFolderGridDataTemplate">
<Expander <Expander
IsExpanded="{Binding IsExpanded}" IsExpanded="{Binding IsExpanded}"
Margin="8" Margin="8"
@ -399,7 +400,7 @@
<ui:FAMenuFlyout <ui:FAMenuFlyout
ItemsSource="{Binding CheckpointFolders}"> ItemsSource="{Binding CheckpointFolders}">
<ui:FAMenuFlyout.ItemTemplate> <ui:FAMenuFlyout.ItemTemplate>
<DataTemplate DataType="{x:Type vm:CheckpointFolder}"> <DataTemplate DataType="{x:Type checkpointManager:CheckpointFolder}">
<ui:ToggleMenuFlyoutItem <ui:ToggleMenuFlyoutItem
Text="{Binding TitleWithFilesCount}" Text="{Binding TitleWithFilesCount}"
IsChecked="{Binding IsCategoryEnabled, Mode=TwoWay}"/> IsChecked="{Binding IsCategoryEnabled, Mode=TwoWay}"/>

2
StabilityMatrix.Avalonia/Views/CheckpointsPage.axaml.cs

@ -2,7 +2,7 @@
using Avalonia.Input; using Avalonia.Input;
using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml;
using StabilityMatrix.Avalonia.Controls; using StabilityMatrix.Avalonia.Controls;
using StabilityMatrix.Avalonia.ViewModels; using CheckpointFolder = StabilityMatrix.Avalonia.ViewModels.CheckpointManager.CheckpointFolder;
namespace StabilityMatrix.Avalonia.Views; namespace StabilityMatrix.Avalonia.Views;

19
StabilityMatrix.Avalonia/Views/Dialogs/SelectModelVersionDialog.axaml

@ -33,18 +33,27 @@
SelectedItem="{Binding SelectedVersionViewModel}"> SelectedItem="{Binding SelectedVersionViewModel}">
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type dialogs:ModelVersionViewModel}"> <DataTemplate DataType="{x:Type dialogs:ModelVersionViewModel}">
<StackPanel Orientation="Horizontal" <Grid ColumnDefinitions="Auto, Auto"
RowDefinitions="Auto, Auto"
MinWidth="128" MinWidth="128"
Margin="0,4,0,4"> Margin="0,4,0,4">
<fluentAvalonia:SymbolIcon Symbol="Checkmark" <fluentAvalonia:SymbolIcon Grid.Row="0"
Grid.Column="0"
Grid.RowSpan="2"
Symbol="Checkmark"
Foreground="Lime" Foreground="Lime"
IsVisible="{Binding IsInstalled}" IsVisible="{Binding IsInstalled}"
VerticalAlignment="Center" /> VerticalAlignment="Center" />
<TextBlock Margin="4, 0" <TextBlock Grid.Row="0" Grid.Column="1"
Margin="4, 0"
Padding="4" Padding="4"
Text="{Binding ModelVersion.Name}" /> Text="{Binding ModelVersion.Name}" />
<TextBlock Grid.Row="1" Grid.Column="1"
</StackPanel> Margin="6, 0, 0, 0"
FontSize="11"
Padding="4, 0, 4, 4"
Text="{Binding ModelVersion.BaseModel}" />
</Grid>
</DataTemplate> </DataTemplate>
</ListBox.ItemTemplate> </ListBox.ItemTemplate>
<ListBox.Template> <ListBox.Template>

3
StabilityMatrix.Avalonia/Views/MainWindow.axaml

@ -6,6 +6,7 @@
xmlns:mocks="clr-namespace:StabilityMatrix.Avalonia.DesignData" xmlns:mocks="clr-namespace:StabilityMatrix.Avalonia.DesignData"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:StabilityMatrix.Avalonia.Controls" xmlns:controls="clr-namespace:StabilityMatrix.Avalonia.Controls"
xmlns:base="clr-namespace:StabilityMatrix.Avalonia.ViewModels.Base"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="550" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="550"
d:DataContext="{x:Static mocks:DesignData.MainWindowViewModel}" d:DataContext="{x:Static mocks:DesignData.MainWindowViewModel}"
x:DataType="vm:MainWindowViewModel" x:DataType="vm:MainWindowViewModel"
@ -63,7 +64,7 @@
SelectedItem="{Binding SelectedCategory}"> SelectedItem="{Binding SelectedCategory}">
<ui:NavigationView.MenuItemTemplate> <ui:NavigationView.MenuItemTemplate>
<DataTemplate DataType="{x:Type vm:PageViewModelBase}"> <DataTemplate DataType="{x:Type base:PageViewModelBase}">
<ui:NavigationViewItem <ui:NavigationViewItem
Margin="0,0,0,0" Margin="0,0,0,0"
IconSource="{Binding IconSource}" IconSource="{Binding IconSource}"

4
StabilityMatrix.Core/Extensions/StringExtensions.cs

@ -1,6 +1,4 @@
using System.CodeDom; using System.Text;
using System.CodeDom.Compiler;
using System.Text;
namespace StabilityMatrix.Core.Extensions; namespace StabilityMatrix.Core.Extensions;

1
StabilityMatrix.Core/Helper/Compat.cs

@ -4,7 +4,6 @@ using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Runtime.Versioning; using System.Runtime.Versioning;
using Semver; using Semver;
using Sentry.Protocol;
using StabilityMatrix.Core.Models.FileInterfaces; using StabilityMatrix.Core.Models.FileInterfaces;
namespace StabilityMatrix.Core.Helper; namespace StabilityMatrix.Core.Helper;

1
StabilityMatrix.Core/Helper/IPrerequisiteHelper.cs

@ -1,6 +1,5 @@
using System.Runtime.Versioning; using System.Runtime.Versioning;
using StabilityMatrix.Core.Models.Progress; using StabilityMatrix.Core.Models.Progress;
using StabilityMatrix.Core.Processes;
namespace StabilityMatrix.Core.Helper; namespace StabilityMatrix.Core.Helper;

3
StabilityMatrix.Core/Helper/SharedFolders.cs

@ -1,5 +1,4 @@
using AsyncAwaitBestPractices; using NLog;
using NLog;
using StabilityMatrix.Core.Extensions; using StabilityMatrix.Core.Extensions;
using StabilityMatrix.Core.Helper.Factory; using StabilityMatrix.Core.Helper.Factory;
using StabilityMatrix.Core.Models; using StabilityMatrix.Core.Models;

4
StabilityMatrix.Core/Models/Api/CivitModel.cs

@ -59,4 +59,8 @@ public class CivitModel
public string LatestModelVersionName => ModelVersions != null && ModelVersions.Any() public string LatestModelVersionName => ModelVersions != null && ModelVersions.Any()
? ModelVersions[0].Name ? ModelVersions[0].Name
: string.Empty; : string.Empty;
public string? BaseModelType => ModelVersions != null && ModelVersions.Any()
? ModelVersions[0].BaseModel?.Replace("SD", "").Trim()
: string.Empty;
} }

15
StabilityMatrix.Core/Models/Api/CivitModelsRequest.cs

@ -102,4 +102,19 @@ public class CivitModelsRequest
/// </summary> /// </summary>
[AliasAs("nsfw")] [AliasAs("nsfw")]
public string? Nsfw { get; set; } public string? Nsfw { get; set; }
/// <summary>
/// options: <br/>
/// SD 1.4 <br/>
/// SD 1.5 <br/>
/// SD 2.0 <br/>
/// SD 2.0 768 <br/>
/// SD 2.1 <br/>
/// SD 2.1 768 <br/>
/// SD 2.1 Unclip <br/>
/// SDXL 0.9 <br/>
/// SDXL 1.0
/// </summary>
[AliasAs("baseModels")]
public string? BaseModel { get; set; }
} }

3
StabilityMatrix.Core/Models/Packages/A3WebUI.cs

@ -1,5 +1,4 @@
using System.Diagnostics; using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json.Nodes; using System.Text.Json.Nodes;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using NLog; using NLog;

3
StabilityMatrix.Core/Models/Packages/InvokeAI.cs

@ -1,5 +1,4 @@
using System.Data; using System.Text.Json;
using System.Text.Json;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using NLog; using NLog;
using StabilityMatrix.Core.Extensions; using StabilityMatrix.Core.Extensions;

2
StabilityMatrix.Core/Models/Settings/ModelSearchOptions.cs

@ -2,4 +2,4 @@
namespace StabilityMatrix.Core.Models.Settings; namespace StabilityMatrix.Core.Models.Settings;
public record ModelSearchOptions(CivitPeriod SelectedPeriod, CivitSortMode SortMode, CivitModelType SelectedModelType); public record ModelSearchOptions(CivitPeriod SelectedPeriod, CivitSortMode SortMode, CivitModelType SelectedModelType, string SelectedBaseModelType);

3
StabilityMatrix.Core/Processes/ApcMessage.cs

@ -1,5 +1,4 @@
using System.Diagnostics; using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using NLog; using NLog;

1
StabilityMatrix.Core/Processes/ApcParser.cs

@ -1,6 +1,5 @@
using System.Diagnostics; using System.Diagnostics;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Text;
using System.Text.Json; using System.Text.Json;
namespace StabilityMatrix.Core.Processes; namespace StabilityMatrix.Core.Processes;

Loading…
Cancel
Save