Skip to content

Commit e359545

Browse files
authored
Merge pull request #1180 from LykosAI/main
v2.13.4
2 parents bedc702 + 0d7f50d commit e359545

File tree

71 files changed

+1998
-247
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1998
-247
lines changed

.config/dotnet-tools.json

+7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323
],
2424
"rollForward": false
2525
},
26+
"refitter": {
27+
"version": "1.4.1",
28+
"commands": [
29+
"refitter"
30+
],
31+
"rollForward": false
32+
},
2633
"dotnet-script": {
2734
"version": "1.6.0",
2835
"commands": [

.husky/task-runner.json

+6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
"command": "dotnet",
1414
"args": [ "xstyler", "-f", "${staged}" ],
1515
"include": [ "**/*.axaml" ]
16+
},
17+
{
18+
"name": "Run refitter for LykosAuthApi",
19+
"group": "generate-openapi",
20+
"command": "dotnet",
21+
"args": ["refitter", "--settings-file", "./StabilityMatrix.Core/Api/LykosAuthApi/.refitter"]
1622
}
1723
]
1824
}

CHANGELOG.md

+24-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,32 @@ All notable changes to Stability Matrix will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html).
7+
8+
## v2.13.4
9+
### Added
10+
- Added support for RTX 5000-series GPUs in ComfyUI, Forge, and reForge
11+
- Added "Rebuild .NET Project" command to SwarmUI installs - available via the 3-dots menu -> Package Commands -> Rebuild .NET Project
12+
### Changed
13+
- Upgraded ComfyUI CUDA torch to 12.6
14+
- Upgraded Lykos account connection to use OAuth 2.0 device flow
15+
- (Internal) Updated Avalonia to 11.2.5
16+
### Fixed
17+
- Fixed [#1128](https://github.com/LykosAI/StabilityMatrix/issues/1128) - overwriting models when downloading multiple with the same name
18+
- Fixed ROCm torch indexes for ComfyUI & Forge
19+
- Fixed model browser sometimes downloading to `ModelsLora` or `ModelsStableDiffusion` folders instead of the correct folder
20+
- Fixed incorrect Unet folder path for ComfyUI users on Linux/macOS
21+
- Fixed [#1157](https://github.com/LykosAI/StabilityMatrix/issues/1157) - crash when broken symlinks exist in model directories
22+
- Fixed [#1154](https://github.com/LykosAI/StabilityMatrix/issues/1154) - increased width for package name on the package cards
23+
- Fixed ComfyUI-Zluda not being recognized as an option for Inference or SwarmUI
24+
- Fixed SwarmUI showing Python options in the 3-dots menu
25+
- Fixed SD.Next install failures in certain cases when using Zluda
26+
### Supporters
27+
#### Visionaries
28+
- Huge thanks to our amazing Visionary-tier Patrons, **Waterclouds** and **Corey T**! We're truly grateful for your continued generosity and support!
29+
#### Pioneers
30+
- Special appreciation to our fantastic Pioneer-tier Patrons: **tankfox**, **Mr. Unknown**, **Szir777**, **Tigon**, **NowFallenAngel**, and our newest addition, **Al Gorithm**! Thank you all for your incredible commitment and ongoing encouragement!
731

832
## v2.13.3
9-
### Added
10-
- Added Safetensor Metadata viewer to the Checkpoint Manager context menu - thanks to @genteure!
1133
### Changed
1234
- "Remove symbolic links on shutdown" option now also removes links from Output Sharing
1335
### Fixed

CONTRIBUTING.md

+46-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,48 @@
1-
# Stability Matrix Code Style Guidelines
1+
# Building
2+
## Running & Debug
3+
- If building using managed IDEs like Rider or Visual Studio, ensure that a valid `--runtime ...` argument is being passed to `dotnet`, or `RuntimeIdentifier=...` is set for calling `msbuild`. This is required for runtime-specific resources to be included in the build. Stability Matrix currently supports building for the `win-x64`, `linux-x64` and `osx-arm64` runtimes.
4+
- You can also build the `StabilityMatrix.Avalonia` project using `dotnet`:
5+
```bash
6+
dotnet build ./StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj -r win-x64 -c Debug
7+
```
8+
- Note that on Windows, the `net8.0-windows10.0.17763.0` framework is used, build outputs will be in `StabilityMatrix.Avalonia/bin/Debug/net8.0-windows10.0.17763.0/win-x64`. On other platforms the `net8.0` framework is used.
9+
10+
## Building to single file for release
11+
(Replace `$RELEASE_VERSION` with a non v-prefixed semver version number, e.g. `2.10.0`, `2.11.0-dev.1`, etc.)
12+
### Windows
13+
```bash
14+
dotnet publish ./StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj -r win-x64 -c Release -p:Version=$env:RELEASE_VERSION -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:PublishReadyToRun=true
15+
```
16+
### macOS
17+
The `output_dir` environment variable can be specified or defaults to `./out/osx-arm64/`
18+
```bash
19+
./Build/build_macos_app.sh -v $RELEASE_VERSION
20+
```
21+
### Linux
22+
```bash
23+
sudo apt-get -y install libfuse2
24+
dotnet tool install -g KuiperZone.PupNet
25+
pupnet -r linux-x64 -c Release --kind appimage --app-version $RELEASE_VERSION --clean
26+
```
27+
28+
# Scripts
29+
## Install Husky.Net & Pre-commit hooks
30+
- Building the `StabilityMatrix.Avalonia` project once should also install Husky.Net, or run the following command:
31+
```bash
32+
dotnet tool restore && dotnet husky install
33+
```
34+
## Adding Husky pre-commit hooks
35+
```bash
36+
dotnet husky install
37+
```
38+
## Generated OpenApi clients
39+
- Refitter is used to generate some OpenApi clients. New clients should be added to `./.husky/task-runner.json`.
40+
- To regenerate clients, run the following command:
41+
```bash
42+
dotnet husky run -g generate-openapi
43+
```
44+
45+
# Style Guidelines
246
These are just guidelines, mostly following the official C# style guidelines, except in a few cases. We might not adhere to these 100% ourselves, but lets try our best :)
347

448
## Naming conventions
@@ -47,4 +91,4 @@ if (alreadyAteLunch)
4791
- Mock data for XAML Designer should go in `DesignData\`
4892
- The `Helper\` and `Services\` folder don't really have guidelines, use your best judgment
4993
- XAML & JSON converters should go in the `Converters\` and `Converters\Json\` directories respectively
50-
- Refit interfaces should go in the `Api\` folder
94+
- Refit interfaces should go in the `Api\` folder

Directory.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<PropertyGroup>
11-
<AvaloniaVersion>11.2.2</AvaloniaVersion>
11+
<AvaloniaVersion>11.2.5</AvaloniaVersion>
1212
</PropertyGroup>
1313

1414
<PropertyGroup>

Directory.Packages.props

+3-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
<PackageVersion Include="Octokit" Version="13.0.1" />
5454
<PackageVersion Include="OneOf" Version="3.0.271" />
5555
<PackageVersion Include="OneOf.SourceGenerator" Version="3.0.271" />
56+
<PackageVersion Include="OpenIddict.Client" Version="5.8.0" />
57+
<PackageVersion Include="OpenIddict.Client.SystemNetHttp" Version="5.8.0" />
5658
<PackageVersion Include="Polly" Version="8.5.0" />
5759
<PackageVersion Include="Polly.Contrib.WaitAndRetry" Version="1.1.1" />
5860
<PackageVersion Include="Polly.Extensions.Http" Version="3.0.0" />
@@ -125,4 +127,4 @@
125127
<PackageVersion Include="xunit" Version="2.9.0" />
126128
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
127129
</ItemGroup>
128-
</Project>
130+
</Project>

StabilityMatrix.Avalonia/App.axaml.cs

+64-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Linq;
88
using System.Net;
99
using System.Net.Http;
10+
using System.Net.Http.Headers;
1011
using System.Reflection;
1112
using System.Text.Json;
1213
using System.Text.Json.Serialization;
@@ -37,6 +38,8 @@
3738
using NLog.Extensions.Logging;
3839
using NLog.Targets;
3940
using Octokit;
41+
using OpenIddict.Abstractions;
42+
using OpenIddict.Client;
4043
using Polly;
4144
using Polly.Contrib.WaitAndRetry;
4245
using Polly.Extensions.Http;
@@ -52,6 +55,7 @@
5255
using StabilityMatrix.Avalonia.ViewModels.Progress;
5356
using StabilityMatrix.Avalonia.Views;
5457
using StabilityMatrix.Core.Api;
58+
using StabilityMatrix.Core.Api.LykosAuthApi;
5559
using StabilityMatrix.Core.Attributes;
5660
using StabilityMatrix.Core.Converters.Json;
5761
using StabilityMatrix.Core.Database;
@@ -67,6 +71,7 @@
6771
using Application = Avalonia.Application;
6872
using Logger = NLog.Logger;
6973
using LogLevel = Microsoft.Extensions.Logging.LogLevel;
74+
using ProductHeaderValue = Octokit.ProductHeaderValue;
7075
#if DEBUG
7176
using StabilityMatrix.Avalonia.Diagnostics.LogViewer;
7277
using StabilityMatrix.Avalonia.Diagnostics.LogViewer.Extensions;
@@ -123,6 +128,14 @@ public sealed class App : Application
123128
#else
124129
public const string LykosAnalyticsApiBaseUrl = "https://analytics.lykos.ai";
125130
#endif
131+
#if DEBUG
132+
// ReSharper disable twice LocalizableElement
133+
// ReSharper disable once ConditionalAccessQualifierIsNonNullableAccordingToAPIContract
134+
public static string LykosAccountApiBaseUrl =>
135+
Config?["LykosAccountApiBaseUrl"] ?? "https://account.lykos.ai/";
136+
#else
137+
public const string LykosAccountApiBaseUrl = "https://account.lykos.ai/";
138+
#endif
126139

127140
// ReSharper disable once MemberCanBePrivate.Global
128141
public IClassicDesktopStyleApplicationLifetime? DesktopLifetime =>
@@ -365,7 +378,10 @@ internal static void ConfigurePageViewModels(IServiceCollection services)
365378
provider.GetRequiredService<Lazy<IModelDownloadLinkHandler>>(),
366379
provider.GetRequiredService<INotificationService>(),
367380
provider.GetRequiredService<IAnalyticsHelper>(),
368-
provider.GetRequiredService<IUpdateHelper>()
381+
provider.GetRequiredService<IUpdateHelper>(),
382+
provider.GetRequiredService<ISecretsManager>(),
383+
provider.GetRequiredService<INavigationService<MainWindowViewModel>>(),
384+
provider.GetRequiredService<INavigationService<SettingsViewModel>>()
369385
)
370386
{
371387
Pages =
@@ -594,7 +610,7 @@ internal static IServiceCollection ConfigureServices()
594610
.AddPolicyHandler(retryPolicyLonger);
595611

596612
services
597-
.AddRefitClient<ILykosAuthApi>(defaultRefitSettings)
613+
.AddRefitClient<ILykosAuthApiV1>(defaultRefitSettings)
598614
.ConfigureHttpClient(c =>
599615
{
600616
c.BaseAddress = new Uri(LykosAuthApiBaseUrl);
@@ -607,6 +623,21 @@ internal static IServiceCollection ConfigureServices()
607623
new TokenAuthHeaderHandler(serviceProvider.GetRequiredService<LykosAuthTokenProvider>())
608624
);
609625

626+
services
627+
.AddRefitClient<ILykosAuthApiV2>(defaultRefitSettings)
628+
.ConfigureHttpClient(c =>
629+
{
630+
c.BaseAddress = new Uri(LykosAuthApiBaseUrl);
631+
c.Timeout = TimeSpan.FromHours(1);
632+
c.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "");
633+
})
634+
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler { AllowAutoRedirect = false })
635+
.AddPolicyHandler(retryPolicy)
636+
.AddHttpMessageHandler(
637+
serviceProvider =>
638+
new TokenAuthHeaderHandler(serviceProvider.GetRequiredService<LykosAuthTokenProvider>())
639+
);
640+
610641
services
611642
.AddRefitClient<ILykosAnalyticsApi>(defaultRefitSettings)
612643
.ConfigureHttpClient(c =>
@@ -643,6 +674,37 @@ internal static IServiceCollection ConfigureServices()
643674
}
644675
);
645676

677+
// Add OpenId
678+
services
679+
.AddOpenIddict()
680+
.AddClient(options =>
681+
{
682+
options.AllowDeviceCodeFlow().AllowRefreshTokenFlow();
683+
684+
options.DisableTokenStorage();
685+
options.AddEphemeralEncryptionKey().AddEphemeralSigningKey();
686+
687+
options.UseSystemNetHttp().SetProductInformation("StabilityMatrix", "2.0");
688+
689+
options.AddRegistration(
690+
new OpenIddictClientRegistration
691+
{
692+
ProviderName = OpenIdClientConstants.LykosAccount.ProviderName,
693+
Issuer = new Uri(LykosAccountApiBaseUrl),
694+
ClientId = "ai.lykos.stabilitymatrix",
695+
Scopes =
696+
{
697+
OpenIddictConstants.Scopes.Profile,
698+
OpenIddictConstants.Scopes.Email,
699+
OpenIddictConstants.Scopes.OpenId,
700+
"api",
701+
OpenIddictConstants.Scopes.OfflineAccess
702+
},
703+
RedirectUri = Program.MessagePipeUri.Append("/callback/login/lykos")
704+
}
705+
);
706+
});
707+
646708
ConditionalAddLogViewer(services);
647709

648710
var logConfig = ConfigureLogging();
Loading

StabilityMatrix.Avalonia/DesignData/DesignData.cs

+7
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,13 @@ public static UpdateSettingsViewModel UpdateSettingsViewModel
788788
+ "redirect_uri=http://localhost:5022/api/oauth/patreon/callback";
789789
});
790790

791+
public static OAuthDeviceAuthViewModel OAuthDeviceAuthViewModel =>
792+
DialogFactory.Get<OAuthDeviceAuthViewModel>(vm =>
793+
{
794+
vm.VerificationUri = new Uri("https://example.org/connect/verify");
795+
vm.UserCode = "AB23-CD56";
796+
});
797+
791798
public static PythonPackageSpecifiersViewModel PythonPackageSpecifiersViewModel =>
792799
DialogFactory.Get<PythonPackageSpecifiersViewModel>();
793800

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
using CommunityToolkit.Mvvm.Input;
3+
4+
namespace StabilityMatrix.Avalonia.Helpers;
5+
6+
public static class ClipboardCommands
7+
{
8+
private static readonly Lazy<RelayCommand<string?>> CopyTextCommandLazy =
9+
new(() => new RelayCommand<string?>(text => App.Clipboard.SetTextAsync(text)));
10+
11+
public static RelayCommand<string?> CopyTextCommand => CopyTextCommandLazy.Value;
12+
}

0 commit comments

Comments
 (0)