Browse Source

Buncha Stuff

- Added "Skip to First/Last Page" buttons to the Model Browser
- Added VAE as a checkpoint category in the Model Browser
- Model Browser navigation buttons are no longer disabled while changing pages
- Fixed issue where Open Web UI button would try to load 0.0.0.0 addresses
- Added missing CivitModelFpTypes
- Made a property for "OfferInOneClickInstaller" so we can selectively show things (for stuff like kohya eventually)
- Fix Show Web UI button not appearing for Fooocus
pull/109/head
JT 1 year ago
parent
commit
48bc532b0b
  1. 4
      CHANGELOG.md
  2. 58
      StabilityMatrix.Avalonia/ViewModels/CheckpointBrowserViewModel.cs
  3. 4
      StabilityMatrix.Avalonia/ViewModels/Dialogs/OneClickInstallViewModel.cs
  4. 2
      StabilityMatrix.Avalonia/ViewModels/LaunchPageViewModel.cs
  5. 28
      StabilityMatrix.Avalonia/Views/CheckpointBrowserPage.axaml
  6. 4
      StabilityMatrix.Core/Models/Api/CivitModelFpType.cs
  7. 16
      StabilityMatrix.Core/Models/Api/CivitModelType.cs
  8. 1
      StabilityMatrix.Core/Models/Packages/BasePackage.cs
  9. 2
      StabilityMatrix.Core/Models/Packages/Fooocus.cs

4
CHANGELOG.md

@ -9,14 +9,18 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2
### Added
- New installable Package - [Fooocus](https://github.com/lllyasviel/Fooocus)
- Added "Select New Data Directory" button to Settings
- Added "Skip to First/Last Page" buttons to the Model Browser
- Added VAE as a checkpoint category in the Model Browser
- Pause/Resume/Cancel buttons on downloads popup. Paused downloads persists and may be resumed after restarting the app
### Fixed
- Fixed issue where model version wouldn't be selected in the "All Versions" section of the Model Browser
- Improved Checkpoints page indexing performance
- Fixed issue where Checkpoints page may not show all checkpoints after clearing search filter
- Fixed issue where Checkpoints page may show incorrect checkpoints for the given filter after changing pages
- Fixed issue where Open Web UI button would try to load 0.0.0.0 addresses
### Changed
- Changed update method for SD.Next to use the built-in upgrade functionality
- Model Browser navigation buttons are no longer disabled while changing pages
## v2.2.1
### Fixed

58
StabilityMatrix.Avalonia/ViewModels/CheckpointBrowserViewModel.cs

@ -1,14 +1,19 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Net.Http;
using System.Reactive;
using System.Reactive.Linq;
using System.Reactive.Threading.Tasks;
using System.Threading;
using System.Threading.Tasks;
using AsyncAwaitBestPractices;
using Avalonia.Collections;
using Avalonia.Controls;
using Avalonia.Controls.Notifications;
using AvaloniaEdit.Utils;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using FluentAvalonia.UI.Controls;
@ -29,6 +34,7 @@ using StabilityMatrix.Core.Models;
using StabilityMatrix.Core.Models.Api;
using StabilityMatrix.Core.Models.Settings;
using StabilityMatrix.Core.Services;
using Notification = Avalonia.Controls.Notifications.Notification;
using Symbol = FluentIcons.Common.Symbol;
using SymbolIconSource = FluentIcons.FluentAvalonia.SymbolIconSource;
@ -61,6 +67,8 @@ public partial class CheckpointBrowserViewModel : PageViewModelBase
[ObservableProperty] private bool hasSearched;
[ObservableProperty] private bool canGoToNextPage;
[ObservableProperty] private bool canGoToPreviousPage;
[ObservableProperty] private bool canGoToFirstPage;
[ObservableProperty] private bool canGoToLastPage;
[ObservableProperty] private bool isIndeterminate;
[ObservableProperty] private bool noResultsFound;
[ObservableProperty] private string noResultsText = string.Empty;
@ -95,6 +103,16 @@ public partial class CheckpointBrowserViewModel : PageViewModelBase
CurrentPageNumber = 1;
CanGoToNextPage = true;
CanGoToLastPage = true;
Observable
.FromEventPattern<PropertyChangedEventArgs>(this, nameof(PropertyChanged))
.Where(x => x.EventArgs.PropertyName == nameof(CurrentPageNumber))
.Throttle(TimeSpan.FromMilliseconds(250))
.Select(_ => CurrentPageNumber)
.Where(page => page <= TotalPages && page > 0)
.ObserveOn(SynchronizationContext.Current)
.Subscribe(_ => TrySearchAgain(false).SafeFireAndForget(), err => Logger.Error(err));
}
public override void OnLoaded()
@ -103,6 +121,14 @@ public partial class CheckpointBrowserViewModel : PageViewModelBase
var searchOptions = settingsManager.Settings.ModelSearchOptions;
// Fix SelectedModelType if someone had selected the obsolete "Model" option
if (searchOptions is {SelectedModelType: CivitModelType.Model})
{
settingsManager.Transaction(s => s.ModelSearchOptions = new ModelSearchOptions(
SelectedPeriod, SortMode, CivitModelType.Checkpoint, SelectedBaseModelType));
searchOptions = settingsManager.Settings.ModelSearchOptions;
}
SelectedPeriod = searchOptions?.SelectedPeriod ?? CivitPeriod.Month;
SortMode = searchOptions?.SortMode ?? CivitSortMode.HighestRated;
SelectedModelType = searchOptions?.SelectedModelType ?? CivitModelType.Checkpoint;
@ -262,8 +288,10 @@ public partial class CheckpointBrowserViewModel : PageViewModelBase
ModelCards =new ObservableCollection<CheckpointBrowserCardViewModel>(filteredCards);
}
TotalPages = metadata?.TotalPages ?? 1;
CanGoToFirstPage = CurrentPageNumber != 1;
CanGoToPreviousPage = CurrentPageNumber > 1;
CanGoToNextPage = CurrentPageNumber < TotalPages;
CanGoToLastPage = CurrentPageNumber != TotalPages;
// Status update
ShowMainLoadingSpinner = false;
IsIndeterminate = false;
@ -371,22 +399,32 @@ public partial class CheckpointBrowserViewModel : PageViewModelBase
UpdateResultsText();
}
[RelayCommand]
private async Task PreviousPage()
public void FirstPage()
{
if (CurrentPageNumber == 1) return;
CurrentPageNumber = 1;
}
public void PreviousPage()
{
if (CurrentPageNumber == 1)
return;
CurrentPageNumber--;
await TrySearchAgain(false);
}
[RelayCommand]
private async Task NextPage()
public void NextPage()
{
if (CurrentPageNumber == TotalPages)
return;
CurrentPageNumber++;
await TrySearchAgain(false);
}
public void LastPage()
{
CurrentPageNumber = TotalPages;
}
partial void OnShowNsfwChanged(bool value)
{
settingsManager.Transaction(s => s.ModelBrowserNsfwEnabled, value);

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

@ -1,6 +1,7 @@
using System;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
@ -55,7 +56,8 @@ public partial class OneClickInstallViewModel : ViewModelBase
SubHeaderText = "Choose your preferred interface and click Install to get started!";
ShowInstallButton = true;
AllPackages =
new ObservableCollection<BasePackage>(this.packageFactory.GetAllAvailablePackages());
new ObservableCollection<BasePackage>(this.packageFactory.GetAllAvailablePackages()
.Where(p => p.OfferInOneClickInstaller));
SelectedPackage = AllPackages[0];
}

2
StabilityMatrix.Avalonia/ViewModels/LaunchPageViewModel.cs

@ -448,7 +448,7 @@ public partial class LaunchPageViewModel : PageViewModelBase, IDisposable, IAsyn
private void RunningPackageOnStartupComplete(object? sender, string e)
{
webUiUrl = e;
webUiUrl = e.Replace("0.0.0.0", "127.0.0.1");
ShowWebUiButton = !string.IsNullOrWhiteSpace(webUiUrl);
}

28
StabilityMatrix.Avalonia/Views/CheckpointBrowserPage.axaml

@ -8,7 +8,8 @@
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"
xmlns:avalonia="clr-namespace:Projektanker.Icons.Avalonia;assembly=Projektanker.Icons.Avalonia"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="700"
x:DataType="viewModels:CheckpointBrowserViewModel"
d:DataContext="{x:Static designData:DesignData.CheckpointBrowserViewModel}"
x:CompileBindings="True"
@ -274,13 +275,30 @@
</TextBlock>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<Button
Command="{Binding PreviousPageCommand}"
Command="{Binding FirstPage}"
IsEnabled="{Binding CanGoToFirstPage}"
ToolTip.Tip="First Page"
Margin="0,0,8,0">
<avalonia:Icon Value="fa-solid fa-backward-fast"/>
</Button>
<Button
Command="{Binding PreviousPage}"
ToolTip.Tip="Previous Page"
IsEnabled="{Binding CanGoToPreviousPage}"
Margin="0,0,8,0">
<ui:SymbolIcon Symbol="PreviousFilled" />
<avalonia:Icon Value="fa-solid fa-caret-left"/>
</Button>
<Button Command="{Binding NextPageCommand}" IsEnabled="{Binding CanGoToNextPage}">
<ui:SymbolIcon Symbol="NextFilled" />
<Button Command="{Binding NextPage}"
IsEnabled="{Binding CanGoToNextPage}"
ToolTip.Tip="Next Page"
Margin="0,0,8,0">
<avalonia:Icon Value="fa-solid fa-caret-right"/>
</Button>
<Button
Command="{Binding LastPage}"
ToolTip.Tip="Last Page"
IsEnabled="{Binding CanGoToLastPage}">
<avalonia:Icon Value="fa-solid fa-forward-fast"/>
</Button>
</StackPanel>
</StackPanel>

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

@ -8,6 +8,8 @@ namespace StabilityMatrix.Core.Models.Api;
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum CivitModelFpType
{
bf16,
fp16,
fp32
fp32,
tf32
}

16
StabilityMatrix.Core/Models/Api/CivitModelType.cs

@ -9,23 +9,29 @@ namespace StabilityMatrix.Core.Models.Api;
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum CivitModelType
{
Unknown,
[ConvertTo<SharedFolderType>(SharedFolderType.StableDiffusion)]
Checkpoint,
[ConvertTo<SharedFolderType>(SharedFolderType.TextualInversion)]
TextualInversion,
[ConvertTo<SharedFolderType>(SharedFolderType.Hypernetwork)]
Hypernetwork,
AestheticGradient,
[ConvertTo<SharedFolderType>(SharedFolderType.Lora)]
LORA,
[ConvertTo<SharedFolderType>(SharedFolderType.ControlNet)]
Controlnet,
Poses,
[ConvertTo<SharedFolderType>(SharedFolderType.StableDiffusion)]
Model,
[ConvertTo<SharedFolderType>(SharedFolderType.LyCORIS)]
LoCon,
[ConvertTo<SharedFolderType>(SharedFolderType.VAE)]
VAE,
// Unused/obsolete/unknown/meta options
AestheticGradient,
Model,
Poses,
Upscaler,
Wildcards,
Workflows,
Other,
All,
Unknown
}

1
StabilityMatrix.Core/Models/Packages/BasePackage.cs

@ -18,6 +18,7 @@ public abstract class BasePackage
public abstract string LicenseType { get; }
public abstract string LicenseUrl { get; }
public virtual string Disclaimer => string.Empty;
public virtual bool OfferInOneClickInstaller => true;
/// <summary>
/// Primary command to launch the package. 'Launch' buttons uses this.

2
StabilityMatrix.Core/Models/Packages/Fooocus.cs

@ -94,7 +94,7 @@ public class Fooocus : BaseGitPackage
{
OnConsoleOutput(s);
if (s.Text.Contains("To see the GUI go to", StringComparison.OrdinalIgnoreCase))
if (s.Text.Contains("Use the app with", StringComparison.OrdinalIgnoreCase))
{
var regex = new Regex(@"(https?:\/\/)([^:\s]+):(\d+)");
var match = regex.Match(s.Text);

Loading…
Cancel
Save