Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.10.1 #587

Merged
merged 39 commits into from
Apr 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
49aa554
Fix settings env var conflict
ionite34 Apr 11, 2024
e41b419
Update CHANGELOG.md
ionite34 Apr 11, 2024
ef25d5b
Fix Inference teaching tip showing more often & fix `--launch-package…
mohnjiles Apr 13, 2024
fa1c0a4
Merge branch 'main' into fix-teaching-tip-spam
mohnjiles Apr 13, 2024
90e815a
Fix auth header added to all lykosauthapi routes
ionite34 Apr 13, 2024
d3b3722
Fix token refresh when access token is empty
ionite34 Apr 13, 2024
a75908e
Improve login error message
ionite34 Apr 13, 2024
01cc2f8
Add LykosLoginDialog max width
ionite34 Apr 13, 2024
68647f3
Merge pull request #598 from ionite34/fix-settings-env
ionite34 Apr 13, 2024
0273d8d
Merge branch 'dev' into fix-lykos-auth
ionite34 Apr 13, 2024
128ef13
Update CHANGELOG.md
ionite34 Apr 13, 2024
64c55ec
Update CHANGELOG.md
ionite34 Apr 13, 2024
a652287
Merge pull request #600 from ionite34/fix-lykos-auth
ionite34 Apr 13, 2024
68a9968
twoway?
mohnjiles Apr 13, 2024
d46b65f
Merge branch 'fix-teaching-tip-spam' of https://github.com/ionite34/S…
mohnjiles Apr 13, 2024
662022e
Merge pull request #599 from ionite34/fix-teaching-tip-spam
mohnjiles Apr 13, 2024
848468d
fix missing images on macos & linux
mohnjiles Apr 13, 2024
708743d
Merge pull request #601 from ionite34/fix-images
mohnjiles Apr 13, 2024
f2dde2a
Actually use the environment variables during install & add pip cache…
mohnjiles Apr 13, 2024
e28a398
undo settings change
mohnjiles Apr 13, 2024
42545f0
Merge pull request #602 from ionite34/actually-use-env-vars
mohnjiles Apr 13, 2024
921a540
Merge branch 'dev' into downmerge
mohnjiles Apr 13, 2024
a66063b
Merge pull request #603 from ionite34/downmerge
mohnjiles Apr 13, 2024
f97cabc
Fix crash when trying to add `file://` to an `avares://` uri
mohnjiles Apr 13, 2024
d441ea9
moar startswith
mohnjiles Apr 13, 2024
9843b6f
Merge pull request #604 from ionite34/fix-crash-when-no-image
ionite34 Apr 13, 2024
805dde5
fixed a few more github issues
mohnjiles Apr 14, 2024
dbd9efb
Merge branch 'dev' into moar-bug-fixes
mohnjiles Apr 14, 2024
aa032e0
actually do the thing
mohnjiles Apr 14, 2024
f86576c
Merge branch 'moar-bug-fixes' of https://github.com/ionite34/Stabilit…
mohnjiles Apr 14, 2024
a8b4d68
Remove update confirmation dialog
mohnjiles Apr 14, 2024
c285a0c
Merge pull request #605 from ionite34/moar-bug-fixes
mohnjiles Apr 14, 2024
041ec59
if the user never closes the package install dialog / is still on the…
mohnjiles Apr 14, 2024
fa458e2
Merge branch 'dev' into go-back-after-install
mohnjiles Apr 14, 2024
d73ca68
Merge pull request #606 from ionite34/go-back-after-install
mohnjiles Apr 14, 2024
e626c47
Merge pull request #607 from ionite34/dev
mohnjiles Apr 14, 2024
3b8b8cc
Merge branch 'main' of https://github.com/ionite34/StabilityMatrix
mohnjiles Apr 14, 2024
805d3f6
Merge branch 'main' of https://github.com/LykosAI/StabilityMatrix-Dev
mohnjiles Apr 14, 2024
72394aa
Merge branch 'LykosAI:main' into main
mohnjiles Apr 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@ All notable changes to Stability Matrix will be documented in this file.
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).

## v2.10.1
### Added
- Added SVD Shared Model & Output Folders for Forge (fixes [#580](https://github.com/LykosAI/StabilityMatrix/issues/580))
### Changed
- Improved error message when logging in with a Lykos account fails due to incorrect email or password
- Model Browser & Workflow Browser now auto-load when first navigating to those pages
- Removed update confirmation dialog, instead showing the new version in the update button tooltip
### Fixed
- Fixed package launch not working when environment variable `SETUPTOOLS_USE_DISTUTILS` is set due to conflict with a default environment variable. User environment variables will now correctly override any default environment variables.
- Fixed "No refresh token found" error when failing to login with Lykos account in some cases
- Fixed blank entries appearing in the Categories dropdown on the Checkpoints page
- Fixed crash when loading invalid connected model info files
- Fixed [#585](https://github.com/LykosAI/StabilityMatrix/issues/585) - Crash when drag & drop source and destination are the same
- Fixed [#584](https://github.com/LykosAI/StabilityMatrix/issues/584) - `--launch-package` argument not working
- Fixed [#581](https://github.com/LykosAI/StabilityMatrix/issues/581) - Inference teaching tip showing more often than it should
- Fixed [#578](https://github.com/LykosAI/StabilityMatrix/issues/578) - "python setup.py egg_info did not run successfully" failure when installing Auto1111 or SDWebUI Forge
- Fixed [#574](https://github.com/LykosAI/StabilityMatrix/issues/574) - local images not showing on macOS or Linux

## v2.10.0
### Added
- Added Reference-Only mode for Inference ControlNet, used for guiding the sampler with an image without a pretrained model. Part of the latent and attention layers will be connected to the reference image, similar to Image to Image or Inpainting.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
xmlns:scroll="clr-namespace:StabilityMatrix.Avalonia.Controls.Scroll"
xmlns:labs="clr-namespace:Avalonia.Labs.Controls;assembly=Avalonia.Labs.Controls"
xmlns:vendorLabs="clr-namespace:StabilityMatrix.Avalonia.Controls.VendorLabs"
xmlns:converters="clr-namespace:StabilityMatrix.Avalonia.Converters"
x:DataType="vmInference:ImageFolderCardViewModel">

<Design.PreviewWith>
Expand All @@ -20,6 +21,8 @@
</Grid>
</Panel>
</Design.PreviewWith>

<converters:FileUriConverter x:Key="FileUriConverter" />

<ControlTheme x:Key="{x:Type controls:ImageFolderCard}" TargetType="controls:ImageFolderCard">
<Setter Property="Background" Value="Transparent" />
Expand Down Expand Up @@ -200,7 +203,7 @@
<vendorLabs:BetterAsyncImage
Width="{Binding $parent[ItemsRepeater].((vmInference:ImageFolderCardViewModel)DataContext).ImageSize.Width}"
Height="{Binding $parent[ItemsRepeater].((vmInference:ImageFolderCardViewModel)DataContext).ImageSize.Height}"
Source="{Binding AbsolutePath}"
Source="{Binding AbsolutePath, Converter={StaticResource FileUriConverter}}"
Stretch="UniformToFill" />

<Border
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<ui:TeachingTip
Target="{Binding #PART_HelpButton}"
Title="{x:Static lang:Resources.TeachingTip_InferencePromptHelpButton}"
IsOpen="{Binding IsHelpButtonTeachingTipOpen}"/>
IsOpen="{Binding IsHelpButtonTeachingTipOpen, Mode=TwoWay}"/>
</Panel>

<Button
Expand Down
1 change: 1 addition & 0 deletions StabilityMatrix.Avalonia/Converters/FileUriConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class FileUriConverter : IValueConverter

return value switch
{
string str when str.StartsWith("avares://") => new Uri(str),
string str => new Uri("file://" + str),
IFormattable formattable => new Uri("file://" + formattable.ToString(null, culture)),
_ => null
Expand Down
1 change: 1 addition & 0 deletions StabilityMatrix.Avalonia/Services/INavigationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ void NavigateTo<TViewModel>(NavigationTransitionInfo? transitionInfo = null, obj
bool GoBack();

bool CanGoBack { get; }
object? CurrentPageDataContext { get; }
}
3 changes: 3 additions & 0 deletions StabilityMatrix.Avalonia/Services/NavigationService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Linq;
using Avalonia.Controls;
using FluentAvalonia.UI.Controls;
using FluentAvalonia.UI.Media.Animation;
using FluentAvalonia.UI.Navigation;
Expand Down Expand Up @@ -190,4 +191,6 @@ public bool GoBack()
}

public bool CanGoBack => _frame?.CanGoBack ?? false;

public object? CurrentPageDataContext => (_frame?.Content as Control)?.DataContext;
}
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ public override void OnLoaded()
model => model.ShowNsfw,
settings => settings.ModelBrowserNsfwEnabled
);

SearchModelsCommand.ExecuteAsync(false);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text.Json;
using System.Threading.Tasks;
using Avalonia.Data;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using FluentAvalonia.UI.Controls;
using Microsoft.Extensions.DependencyInjection;
using NLog;
using StabilityMatrix.Avalonia.Languages;
using StabilityMatrix.Avalonia.ViewModels.Base;
using StabilityMatrix.Core.Attributes;
using StabilityMatrix.Core.Extensions;
Expand Down Expand Up @@ -333,8 +333,15 @@ private async Task FindConnectedMetadata(bool forceReimport = false)
if (File.Exists(jsonPath))
{
var json = File.ReadAllText(jsonPath);
var connectedModelInfo = ConnectedModelInfo.FromJson(json);
checkpointFile.ConnectedModel = connectedModelInfo;
try
{
var connectedModelInfo = ConnectedModelInfo.FromJson(json);
checkpointFile.ConnectedModel = connectedModelInfo;
}
catch (JsonException)
{
checkpointFile.ConnectedModel = null;
}
}

checkpointFile.PreviewImagePath = SupportedImageExtensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ public partial class CheckpointFolder : ViewModelBase

public string TitleWithFilesCount =>
CheckpointFiles.Any() || SubFolders.Any(f => f.CheckpointFiles.Any())
? $"{FolderType.GetDescription() ?? FolderType.GetStringValue()} ({CheckpointFiles.Count + SubFolders.Sum(folder => folder.CheckpointFiles.Count)})"
? $"{FolderType.GetDescription() ?? (string.IsNullOrWhiteSpace(FolderType.GetStringValue()) ? Path.GetFileName(DirectoryPath) : FolderType.GetStringValue())} "
+ $"({CheckpointFiles.Count + SubFolders.Sum(folder => folder.CheckpointFiles.Count)})"
: FolderType.GetDescription() ?? FolderType.GetStringValue();

public ProgressViewModel Progress { get; } = new();
Expand Down Expand Up @@ -447,6 +448,22 @@ public async Task ImportFilesAsync(IEnumerable<string> files, bool convertToConn
Progress.Value = 0;
var copyPaths = files.ToDictionary(k => k, v => Path.Combine(DirectoryPath, Path.GetFileName(v)));

// remove files that are already in the folder
foreach (var (source, destination) in copyPaths)
{
if (source == destination)
{
copyPaths.Remove(source);
}
}

if (copyPaths.Count == 0)
{
Progress.Text = "Import complete";
Progress.Value = 100;
return;
}

var progress = new Progress<ProgressReport>(report =>
{
Progress.IsIndeterminate = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Net;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
Expand Down Expand Up @@ -90,7 +91,15 @@ private async Task LoginAsync()
}
catch (ApiException e)
{
LoginError = new AppException("Failed to login", $"{e.StatusCode} - {e.Message}");
LoginError = e.StatusCode switch
{
HttpStatusCode.Unauthorized
=> new AppException(
"Incorrect email or password",
"Please try again or reset your password"
),
_ => new AppException("Failed to login", $"{e.StatusCode} - {e.Message}")
};
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using FluentAvalonia.UI.Controls;
using Refit;
using StabilityMatrix.Avalonia.Controls;
using StabilityMatrix.Avalonia.Languages;
using StabilityMatrix.Avalonia.Models;
using StabilityMatrix.Avalonia.Services;
using StabilityMatrix.Avalonia.ViewModels.Base;
Expand All @@ -36,8 +35,7 @@ public partial class OpenArtBrowserViewModel(
IOpenArtApi openArtApi,
INotificationService notificationService,
ISettingsManager settingsManager,
IPackageFactory packageFactory,
ServiceManager<ViewModelBase> vmFactory
IPackageFactory packageFactory
) : TabViewModelBase, IInfinitelyScroll
{
private const int PageSize = 20;
Expand Down Expand Up @@ -90,6 +88,7 @@ protected override void OnInitialLoaded()
{
searchResultsCache.Connect().DeferUntilLoaded().Bind(SearchResults).Subscribe();
SelectedSortMode = AllSortModes.First();
DoSearch().SafeFireAndForget();
}

[RelayCommand]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ RunningPackageService runningPackageService
[ObservableProperty]
private bool showWebUiButton;

[ObservableProperty]
private DownloadPackageVersionOptions? updateVersion;

private void RunningPackagesOnCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
{
if (runningPackageService.RunningPackages.Select(x => x.Value) is not { } runningPackages)
Expand Down Expand Up @@ -196,6 +199,10 @@ public override async Task OnLoadedAsync()
}

IsUpdateAvailable = await HasUpdate();
if (IsUpdateAvailable)
{
UpdateVersion = await basePackage.GetUpdate(currentPackage);
}

if (
Package != null
Expand Down Expand Up @@ -426,21 +433,6 @@ public async Task Update()
versionOptions.CommitHash = latest.Sha;
}

var confirmationDialog = new BetterContentDialog
{
Title = Resources.Label_AreYouSure,
Content =
$"{Package.DisplayName} will be updated to the latest version ({versionOptions.GetReadableVersionString()})",
PrimaryButtonText = Resources.Action_Continue,
SecondaryButtonText = Resources.Action_Cancel,
DefaultButton = ContentDialogButton.Primary,
IsSecondaryButtonEnabled = true,
};

var dialogResult = await confirmationDialog.ShowAsync();
if (dialogResult != ContentDialogResult.Primary)
return;

var updatePackageStep = new UpdatePackageStep(
settingsManager,
Package,
Expand Down Expand Up @@ -672,6 +664,7 @@ private async Task<bool> HasUpdate()
try
{
var hasUpdate = await basePackage.CheckForUpdates(Package);
UpdateVersion = await basePackage.GetUpdate(Package);

await using (settingsManager.BeginTransaction())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,13 @@ private async Task Install()

if (!runner.Failed)
{
if (ReferenceEquals(this, packageNavigationService.CurrentPageDataContext))
{
packageNavigationService.GoBack();
packageNavigationService.GoBack();
await Task.Delay(100);
}

EventManager.Instance.OnInstalledPackagesChanged();
}
}
Expand Down
45 changes: 40 additions & 5 deletions StabilityMatrix.Avalonia/ViewModels/PackageManagerViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public partial class PackageManagerViewModel : PageViewModelBase
private readonly INotificationService notificationService;
private readonly INavigationService<NewPackageManagerViewModel> packageNavigationService;
private readonly ILogger<PackageManagerViewModel> logger;
private readonly RunningPackageService runningPackageService;

public override string Title => Resources.Label_Packages;
public override IconSource IconSource => new SymbolIconSource { Symbol = Symbol.Box, IsFilled = true };
Expand Down Expand Up @@ -69,14 +70,16 @@ public partial class PackageManagerViewModel : PageViewModelBase
ServiceManager<ViewModelBase> dialogFactory,
INotificationService notificationService,
INavigationService<NewPackageManagerViewModel> packageNavigationService,
ILogger<PackageManagerViewModel> logger
ILogger<PackageManagerViewModel> logger,
RunningPackageService runningPackageService
)
{
this.settingsManager = settingsManager;
this.dialogFactory = dialogFactory;
this.notificationService = notificationService;
this.packageNavigationService = packageNavigationService;
this.logger = logger;
this.runningPackageService = runningPackageService;

EventManager.Instance.InstalledPackagesChanged += OnInstalledPackagesChanged;
EventManager.Instance.OneClickInstallFinished += OnOneClickInstallFinished;
Expand Down Expand Up @@ -118,15 +121,39 @@ public void SetUnknownPackages(IEnumerable<InstalledPackage> packages)
unknownInstalledPackages.Edit(s => s.Load(packages));
}

protected override async Task OnInitialLoadedAsync()
{
if (string.IsNullOrWhiteSpace(Program.Args.LaunchPackageName))
{
await base.OnInitialLoadedAsync();
return;
}

await LoadPackages();

var package = Packages.FirstOrDefault(x => x.DisplayName == Program.Args.LaunchPackageName);
if (package is not null)
{
await runningPackageService.StartPackage(package);
return;
}

package = Packages.FirstOrDefault(x => x.Id.ToString() == Program.Args.LaunchPackageName);
if (package is null)
{
await base.OnInitialLoadedAsync();
return;
}

await runningPackageService.StartPackage(package);
}

public override async Task OnLoadedAsync()
{
if (Design.IsDesignMode || !settingsManager.IsLibraryDirSet)
return;

installedPackages.EditDiff(settingsManager.Settings.InstalledPackages, InstalledPackage.Comparer);

var currentUnknown = await Task.Run(IndexUnknownPackages);
unknownInstalledPackages.Edit(s => s.Load(currentUnknown));
await LoadPackages();

timer.Start();
}
Expand All @@ -142,6 +169,14 @@ public void ShowInstallDialog(BasePackage? selectedPackage = null)
NavigateToSubPage(typeof(PackageInstallBrowserViewModel));
}

private async Task LoadPackages()
{
installedPackages.EditDiff(settingsManager.Settings.InstalledPackages, InstalledPackage.Comparer);

var currentUnknown = await Task.Run(IndexUnknownPackages);
unknownInstalledPackages.Edit(s => s.Load(currentUnknown));
}

private async Task CheckPackagesForUpdates()
{
foreach (var package in PackageCards)
Expand Down
5 changes: 3 additions & 2 deletions StabilityMatrix.Avalonia/Views/CheckpointsPage.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
x:Key="TextDropShadowEffect" />

<converters:EnumStringConverter x:Key="EnumStringConverter" />
<converters:FileUriConverter x:Key="FileUriConverter"/>

<!-- Template for a single badge -->
<DataTemplate DataType="{x:Type system:String}" x:Key="BadgeTemplate">
Expand Down Expand Up @@ -143,7 +144,7 @@
<vendorLabs:BetterAsyncImage
Margin="0,0,0,4"
CornerRadius="4"
Source="{Binding PreviewImagePath}"
Source="{Binding PreviewImagePath, Converter={StaticResource FileUriConverter}}"
Stretch="Uniform"
IsVisible="{Binding IsConnectedModel}" />
<TextBlock
Expand Down Expand Up @@ -182,7 +183,7 @@
Grid.ColumnSpan="2"
Margin="0, 4,0,4"
CornerRadius="8"
Source="{Binding PreviewImagePath}"
Source="{Binding PreviewImagePath, Converter={StaticResource FileUriConverter}}"
ClipToBounds="True"
Stretch="UniformToFill"
Height="300"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
xmlns:mdxaml="https://github.com/whistyun/Markdown.Avalonia.Tight"
xmlns:ctxt="clr-namespace:ColorTextBlock.Avalonia;assembly=ColorTextBlock.Avalonia"
Focusable="True"
MaxWidth="400"
d:DataContext="{x:Static mocks:DesignData.LykosLoginViewModel}"
d:DesignHeight="350"
d:DesignWidth="400"
Expand Down