Skip to content

Commit 265c331

Browse files
authored
Merge pull request #1267 from ionite34/dev
Dev to main
2 parents 2724ca2 + 33cdbab commit 265c331

275 files changed

Lines changed: 45327 additions & 2294 deletions

File tree

Some content is hidden

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

CHANGELOG.md

Lines changed: 279 additions & 1 deletion
Large diffs are not rendered by default.

StabilityMatrix.Avalonia/App.axaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
<StyleInclude Source="avares://Avalonia.Xaml.Interactions.Draggable/Styles.axaml" />
5757
<StyleInclude Source="avares://FluentAvalonia.BreadcrumbBar/Styling/Styles.axaml" />
5858
<StyleInclude Source="Styles/ProgressRing.axaml" />
59+
<StyleInclude Source="Styles/ScrollBarStyles.axaml" />
5960
<StyleInclude Source="Styles/ButtonStyles.axaml" />
6061
<StyleInclude Source="Styles/SplitButtonStyles.axaml" />
6162
<StyleInclude Source="Styles/ToggleButtonStyles.axaml" />
@@ -89,6 +90,7 @@
8990
<StyleInclude Source="Controls/Inference/SharpenCard.axaml" />
9091
<StyleInclude Source="Controls/Inference/FreeUCard.axaml" />
9192
<StyleInclude Source="Controls/Inference/ControlNetCard.axaml" />
93+
<StyleInclude Source="Controls/Inference/RegionalPromptCard.axaml" />
9294
<StyleInclude Source="Controls/Inference/PromptExpansionCard.axaml" />
9395
<StyleInclude Source="Controls/Inference/ExtraNetworkCard.axaml" />
9496
<StyleInclude Source="Controls/Inference/LayerDiffuseCard.axaml" />

StabilityMatrix.Avalonia/App.axaml.cs

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
using StabilityMatrix.Avalonia.ViewModels.Progress;
5252
using StabilityMatrix.Avalonia.Views;
5353
using StabilityMatrix.Core.Api;
54+
using StabilityMatrix.Core.Api.Handlers;
5455
using StabilityMatrix.Core.Api.LykosAuthApi;
5556
using StabilityMatrix.Core.Api.PromptGenApi;
5657
using StabilityMatrix.Core.Attributes;
@@ -65,6 +66,7 @@
6566
using StabilityMatrix.Core.Models.Settings;
6667
using StabilityMatrix.Core.Python;
6768
using StabilityMatrix.Core.Services;
69+
using StabilityMatrix.Core.Services.ImageGeneration;
6870
using StabilityMatrix.Core.Updater;
6971
using ApiOptions = StabilityMatrix.Core.Models.Configs.ApiOptions;
7072
using Application = Avalonia.Application;
@@ -149,6 +151,11 @@ public override void OnFrameworkInitializationCompleted()
149151
{
150152
base.OnFrameworkInitializationCompleted();
151153

154+
if (!Debugger.IsAttached || Program.Args.DebugExceptionDialog)
155+
{
156+
Dispatcher.UIThread.UnhandledException += Dispatcher_UnhandledException;
157+
}
158+
152159
if (Design.IsDesignMode)
153160
{
154161
DesignData.DesignData.Initialize();
@@ -389,6 +396,7 @@ internal static void ConfigurePageViewModels(IServiceCollection services)
389396
{
390397
provider.GetRequiredService<PackageManagerViewModel>(),
391398
provider.GetRequiredService<InferenceViewModel>(),
399+
provider.GetRequiredService<BananaVisionPageViewModel>(),
392400
provider.GetRequiredService<CheckpointsPageViewModel>(),
393401
provider.GetRequiredService<CheckpointBrowserViewModel>(),
394402
provider.GetRequiredService<OutputsPageViewModel>(),
@@ -503,8 +511,21 @@ internal static IServiceCollection ConfigureServices(bool disableMessagePipeInte
503511
{
504512
services.AddSingleton<ILiteDbContext, LiteDbContext>();
505513
services.AddSingleton<IDisposable>(p => p.GetRequiredService<ILiteDbContext>());
514+
515+
// BananaVision has its own database to preserve conversations when main DB is cleared
516+
services.AddSingleton<IBananaVisionDbContext, BananaVisionDbContext>();
517+
services.AddSingleton<IDisposable>(p => p.GetRequiredService<IBananaVisionDbContext>());
506518
}
507519

520+
// Image generation services
521+
services.AddSingleton<IImageGenerationProvider, GeminiImageGenerationProvider>();
522+
services.AddSingleton<IImageGenerationProvider, Gemini31FlashImageGenerationProvider>();
523+
services.AddSingleton<IImageGenerationProvider, Gemini3ProImageGenerationProvider>();
524+
services.AddSingleton<IImageGenerationProvider, FluxKontextProvider>();
525+
services.AddSingleton<IImageGenerationProvider, QwenImageEditProvider>();
526+
services.AddSingleton<IImageGenerationProvider, Flux2KleinProvider>();
527+
services.AddSingleton<IImageGenerationChatService, ImageGenerationChatService>();
528+
508529
services.AddTransient<IGitHubClient, GitHubClient>(_ =>
509530
{
510531
var client = new GitHubClient(new ProductHeaderValue("StabilityMatrix"));
@@ -728,7 +749,7 @@ internal static IServiceCollection ConfigureServices(bool disableMessagePipeInte
728749
}
729750
)
730751
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler { AllowAutoRedirect = false })
731-
.AddPolicyHandler(retryPolicy)
752+
.AddPolicyHandler(retryPolicyLonger)
732753
.AddHttpMessageHandler(serviceProvider => new TokenAuthHeaderHandler(
733754
serviceProvider.GetRequiredService<LykosAuthTokenProvider>()
734755
));
@@ -764,6 +785,19 @@ internal static IServiceCollection ConfigureServices(bool disableMessagePipeInte
764785
})
765786
.AddPolicyHandler(retryPolicy); // Assuming retryPolicy is suitable
766787

788+
services
789+
.AddRefitClient<IGeminiApi>(defaultRefitSettings)
790+
.ConfigureHttpClient(c =>
791+
{
792+
c.BaseAddress = new Uri("https://generativelanguage.googleapis.com");
793+
c.Timeout = TimeSpan.FromMinutes(5); // Higher timeout for image generation
794+
})
795+
.AddHttpMessageHandler<GeminiApiKeyHandler>()
796+
.AddPolicyHandler(retryPolicyLonger);
797+
798+
// Register GeminiApiKeyHandler
799+
services.AddTransient<GeminiApiKeyHandler>();
800+
767801
// Apizr clients
768802
services.AddApizrManagerFor<IOpenModelDbApi, OpenModelDbManager>(options =>
769803
{
@@ -1039,6 +1073,14 @@ private static void OnServiceProviderDisposing(ServiceProvider serviceProvider)
10391073
Logger.Trace("Disposing {Count} Disposables", disposables.Count);
10401074
}
10411075

1076+
private static void Dispatcher_UnhandledException(object? sender, DispatcherUnhandledExceptionEventArgs e)
1077+
{
1078+
if (Program.ShowExceptionDialog(e.Exception, true))
1079+
{
1080+
e.Handled = true;
1081+
}
1082+
}
1083+
10421084
private static void TaskScheduler_UnobservedTaskException(
10431085
object? sender,
10441086
UnobservedTaskExceptionEventArgs e

StabilityMatrix.Avalonia/Assets.cs

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ internal static class Assets
105105
new RemoteResource
106106
{
107107
Url = new Uri("https://www.python.org/ftp/python/3.10.11/python-3.10.11-embed-amd64.zip"),
108-
HashSha256 = "608619f8619075629c9c69f361352a0da6ed7e62f83a0e19c63e0ea32eb7629d"
108+
HashSha256 = "608619f8619075629c9c69f361352a0da6ed7e62f83a0e19c63e0ea32eb7629d",
109109
}
110110
),
111111
(
@@ -115,7 +115,7 @@ internal static class Assets
115115
Url = new Uri(
116116
"https://github.com/indygreg/python-build-standalone/releases/download/20230507/cpython-3.10.11+20230507-x86_64-unknown-linux-gnu-install_only.tar.gz"
117117
),
118-
HashSha256 = "c5bcaac91bc80bfc29cf510669ecad12d506035ecb3ad85ef213416d54aecd79"
118+
HashSha256 = "c5bcaac91bc80bfc29cf510669ecad12d506035ecb3ad85ef213416d54aecd79",
119119
}
120120
),
121121
(
@@ -124,7 +124,48 @@ internal static class Assets
124124
{
125125
// Requires our distribution with signed dylib for gatekeeper
126126
Url = new Uri("https://cdn.lykos.ai/cpython-3.10.11-macos-arm64.zip"),
127-
HashSha256 = "83c00486e0af9c460604a425e519d58e4b9604fbe7a4448efda0f648f86fb6e3"
127+
HashSha256 = "83c00486e0af9c460604a425e519d58e4b9604fbe7a4448efda0f648f86fb6e3",
128+
}
129+
)
130+
);
131+
132+
/// <summary>
133+
/// FFmpeg LGPL builds for video thumbnail generation.
134+
/// </summary>
135+
[SupportedOSPlatform("windows")]
136+
[SupportedOSPlatform("linux")]
137+
[SupportedOSPlatform("macos")]
138+
public static RemoteResource FfmpegDownloadUrl =>
139+
Compat.Switch(
140+
(
141+
PlatformKind.Windows | PlatformKind.X64,
142+
new RemoteResource
143+
{
144+
// BtbN LGPL build - ffmpeg-n7.1-latest-win64-lgpl-7.1
145+
Url = new Uri(
146+
"https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n7.1-latest-win64-lgpl-7.1.zip"
147+
),
148+
HashSha256 = "a77ecdc794d67401f3e4976f8856065f7762d74afd16f9c7b777ff0291a7bcaa",
149+
}
150+
),
151+
(
152+
PlatformKind.Linux | PlatformKind.X64,
153+
new RemoteResource
154+
{
155+
// BtbN LGPL build - linux
156+
Url = new Uri(
157+
"https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n7.1-latest-linux64-lgpl-7.1.tar.xz"
158+
),
159+
HashSha256 = "d7d691dfa3a6d0a75362c02274a80a1f9635bd67908561aae31ee538853ab8ce",
160+
}
161+
),
162+
(
163+
PlatformKind.MacOS | PlatformKind.Arm,
164+
new RemoteResource
165+
{
166+
// evermeet.cx build for macOS arm64
167+
Url = new Uri("https://evermeet.cx/ffmpeg/ffmpeg-7.1.1.zip"),
168+
HashSha256 = "8d7917c1cebd7a29e68c0a0a6cc4ecc3fe05c7fffed958636c7018b319afdda4",
128169
}
129170
)
130171
);
@@ -135,18 +176,18 @@ internal static class Assets
135176
new RemoteResource
136177
{
137178
Url = new Uri("https://cdn.lykos.ai/tags/danbooru.csv"),
138-
HashSha256 = "b84a879f1d9c47bf4758d66542598faa565b1571122ae12e7b145da8e7a4c1c6"
179+
HashSha256 = "b84a879f1d9c47bf4758d66542598faa565b1571122ae12e7b145da8e7a4c1c6",
139180
},
140181
new RemoteResource
141182
{
142183
Url = new Uri("https://cdn.lykos.ai/tags/e621.csv"),
143-
HashSha256 = "ef7ea148ad865ad936d0c1ee57f0f83de723b43056c70b07fd67dbdbb89cae35"
184+
HashSha256 = "ef7ea148ad865ad936d0c1ee57f0f83de723b43056c70b07fd67dbdbb89cae35",
144185
},
145186
new RemoteResource
146187
{
147188
Url = new Uri("https://cdn.lykos.ai/tags/danbooru_e621_merged.csv"),
148-
HashSha256 = "ac405ebce8b0caae363a7ef91f89beb4b8f60a7e218deb5078833686da6d497d"
149-
}
189+
HashSha256 = "ac405ebce8b0caae363a7ef91f89beb4b8f60a7e218deb5078833686da6d497d",
190+
},
150191
};
151192

152193
public static Uri DiscordServerUrl { get; } = new("https://discord.com/invite/TUrgfECxHz");

StabilityMatrix.Avalonia/Assets/ImagePrompt.tmLanguage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,4 +320,4 @@
320320
]
321321
}
322322
}
323-
}
323+
}

StabilityMatrix.Avalonia/Assets/hf-packages.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,12 +1223,11 @@
12231223
{
12241224
"ModelCategory": "Vae",
12251225
"ModelName": "Flux.1 VAE",
1226-
"RepositoryPath": "black-forest-labs/FLUX.1-schnell",
1226+
"RepositoryPath": "Comfy-Org/Lumina_Image_2.0_Repackaged",
12271227
"Files": [
1228-
"ae.safetensors"
1228+
"split_files/vae/ae.safetensors"
12291229
],
1230-
"LicenseType": "Apache 2.0",
1231-
"LoginRequired": true
1230+
"LicenseType": "Flux.1 Dev NonCommercial"
12321231
},
12331232
{
12341233
"ModelCategory": "Vae",
108 KB
Binary file not shown.

0 commit comments

Comments
 (0)