Skip to content

Commit e3aa876

Browse files
authored
Merge pull request #1041 from ionite34/proxy
2 parents 33705e0 + 0d9867b commit e3aa876

Some content is hidden

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

42 files changed

+2879
-87
lines changed

.aiexclude

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Docs
2+
LICENSE
3+
CHANGELOG.md
4+
5+
# Legacy
6+
StabilityMatrix/
7+
8+
# Tests
9+
*.verified.*
10+
11+
# Misc projects
12+
StabilityMatrix.Native/
13+
StabilityMatrix.Native.*/
14+
StabilityMatrix.Avalonia.Diagnostics/
15+
StabilityMatrix.Avalonia.Diagnostics/
16+
StabilityMatrix.UITests/
17+
18+
# Vendored
19+
Avalonia.Gif/
20+
21+
# Configs
22+
*.editorconfig
23+
*.DotSettings
24+
25+
# Assets
26+
*.svg
27+
StabilityMatrix.Avalonia/Assets/Fonts/
28+
StabilityMatrix.Avalonia/Assets/linux-x64/
29+
StabilityMatrix.Avalonia/Assets/macos-arm64/
30+
StabilityMatrix.Avalonia/Assets/win-x64/

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2
88
## v2.14.0-pre.2
99
### Added
1010
- Added new package - [Stable Diffusion WebUI Forge - Classic](https://github.com/Haoming02/sd-webui-forge-classic)
11+
- Added Accelerated Model Discovery (Beta) (⚡ icon in Civitai Browser) for Insider+ supporters. Utilizes an optimized connection for dramatically faster, more responsive browsing of online model repositories.
1112
- Added Undo/Redo commands to text editor context menus
1213
### Changed
1314
- Updated install for kohya_ss to support RTX 5000-series GPUs

StabilityMatrix.Avalonia/App.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
<ResourceInclude Source="Styles/FAComboBoxStyles.axaml" />
3131
<ResourceInclude Source="Controls/Inference/ImageFolderCard.axaml" />
3232
<ResourceInclude Source="Controls/VendorLabs/Themes/BetterAsyncImage.axaml" />
33+
<ResourceInclude Source="Styles/ControlThemes/ButtonStyles.Accelerator.axaml" />
3334
</ResourceDictionary.MergedDictionaries>
3435

3536
<ControlRecycling x:Key="ControlRecyclingKey" />

StabilityMatrix.Avalonia/App.axaml.cs

Lines changed: 67 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,11 @@
33
using System.Collections.Immutable;
44
using System.Diagnostics;
55
using System.Diagnostics.CodeAnalysis;
6-
using System.IO;
7-
using System.Linq;
86
using System.Net;
9-
using System.Net.Http;
107
using System.Net.Http.Headers;
118
using System.Reflection;
129
using System.Text.Json;
1310
using System.Text.Json.Serialization;
14-
using System.Threading;
15-
using System.Threading.Tasks;
1611
using Apizr;
1712
using Apizr.Logging;
1813
using AsyncAwaitBestPractices;
@@ -47,7 +42,6 @@
4742
using Polly.Extensions.Http;
4843
using Polly.Timeout;
4944
using Refit;
50-
using Sentry;
5145
using StabilityMatrix.Avalonia.Behaviors;
5246
using StabilityMatrix.Avalonia.Helpers;
5347
using StabilityMatrix.Avalonia.Languages;
@@ -450,7 +444,7 @@ internal static IServiceCollection ConfigureServices()
450444

451445
Config = new ConfigurationBuilder()
452446
.SetBasePath(Directory.GetCurrentDirectory())
453-
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
447+
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
454448
.AddEnvironmentVariables()
455449
.Build();
456450

@@ -536,11 +530,12 @@ internal static IServiceCollection ConfigureServices()
536530
if (retryCount > 3)
537531
{
538532
Logger.Info(
539-
"Retry attempt {Count}/{Max} after {Seconds:N2}s due to {Exception}",
533+
"Retry attempt {Count}/{Max} after {Seconds:N2}s due to ({Status}) {Msg}",
540534
retryCount,
541535
6,
542536
timeSpan.TotalSeconds,
543-
result.Exception?.ToString()
537+
result?.Result?.StatusCode,
538+
result?.Result?.ToString()
544539
);
545540
}
546541
}
@@ -563,11 +558,12 @@ internal static IServiceCollection ConfigureServices()
563558
if (retryCount > 4)
564559
{
565560
Logger.Info(
566-
"Retry attempt {Count}/{Max} after {Seconds:N2}s due to {Exception}",
561+
"Retry attempt {Count}/{Max} after {Seconds:N2}s due to ({Status}) {Msg}",
567562
retryCount,
568563
7,
569564
timeSpan.TotalSeconds,
570-
result.Exception?.ToString()
565+
result?.Result?.StatusCode,
566+
result?.Result?.ToString()
571567
);
572568
}
573569
}
@@ -612,6 +608,20 @@ internal static IServiceCollection ConfigureServices()
612608
})
613609
.AddPolicyHandler(retryPolicyLonger);
614610

611+
services
612+
.AddRefitClient<ILykosModelDiscoveryApi>(defaultRefitSettings)
613+
.ConfigureHttpClient(c =>
614+
{
615+
c.BaseAddress = new Uri("https://discovery.lykos.ai/api/v1");
616+
c.Timeout = TimeSpan.FromHours(1);
617+
c.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "");
618+
})
619+
.AddPolicyHandler(retryPolicy)
620+
.AddHttpMessageHandler(
621+
serviceProvider =>
622+
new TokenAuthHeaderHandler(serviceProvider.GetRequiredService<LykosAuthTokenProvider>())
623+
);
624+
615625
services
616626
.AddRefitClient<IPyPiApi>(defaultRefitSettings)
617627
.ConfigureHttpClient(c =>
@@ -1061,10 +1071,53 @@ private static LoggingConfiguration ConfigureLogging()
10611071
.ForLogger()
10621072
.FilterMinLevel(NLog.LogLevel.Trace)
10631073
.WriteTo(
1064-
new ConsoleTarget("console")
1074+
new ColoredConsoleTarget("console")
10651075
{
1066-
Layout = "[${level:uppercase=true}]\t${logger:shortName=true}\t${message}",
1067-
DetectConsoleAvailable = true
1076+
Layout =
1077+
"[${level:uppercase=true}]\t${logger:shortName=true}\t${message}${onexception:\n${exception:format=tostring}}",
1078+
DetectConsoleAvailable = true,
1079+
EnableAnsiOutput = true,
1080+
WordHighlightingRules =
1081+
{
1082+
new ConsoleWordHighlightingRule(
1083+
"[TRACE]",
1084+
ConsoleOutputColor.DarkGray,
1085+
ConsoleOutputColor.NoChange
1086+
),
1087+
new ConsoleWordHighlightingRule(
1088+
"[DEBUG]",
1089+
ConsoleOutputColor.Gray,
1090+
ConsoleOutputColor.NoChange
1091+
),
1092+
new ConsoleWordHighlightingRule(
1093+
"[INFO]",
1094+
ConsoleOutputColor.DarkGreen,
1095+
ConsoleOutputColor.NoChange
1096+
),
1097+
new ConsoleWordHighlightingRule(
1098+
"[WARN]",
1099+
ConsoleOutputColor.Yellow,
1100+
ConsoleOutputColor.NoChange
1101+
),
1102+
new ConsoleWordHighlightingRule(
1103+
"[ERROR]",
1104+
ConsoleOutputColor.White,
1105+
ConsoleOutputColor.Red
1106+
),
1107+
new ConsoleWordHighlightingRule(
1108+
"[FATAL]",
1109+
ConsoleOutputColor.Black,
1110+
ConsoleOutputColor.DarkRed
1111+
)
1112+
},
1113+
RowHighlightingRules =
1114+
{
1115+
new ConsoleRowHighlightingRule(
1116+
"level == LogLevel.Trace",
1117+
ConsoleOutputColor.Gray,
1118+
ConsoleOutputColor.NoChange
1119+
),
1120+
}
10681121
}
10691122
)
10701123
.WithAsync();

StabilityMatrix.Avalonia/Controls/VendorLabs/Cache/CacheBase.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System;
99
using System.Collections.Concurrent;
1010
using System.Collections.Generic;
11+
using System.Diagnostics;
1112
using System.IO;
1213
using System.Linq;
1314
using System.Net.Http;
@@ -337,6 +338,7 @@ private static ulong CreateHash64(string str)
337338
return value;
338339
}
339340

341+
[DebuggerDisableUserUnhandledExceptions]
340342
private async Task<T?> GetItemAsync(
341343
Uri uri,
342344
bool throwOnError,
@@ -375,7 +377,8 @@ CancellationToken cancellationToken
375377
}
376378
catch (Exception ex)
377379
{
378-
System.Diagnostics.Debug.WriteLine(ex.Message);
380+
Debug.WriteLine($"Image loading failed for (url={uri}, file={fileName}): {ex.Message}");
381+
379382
if (throwOnError)
380383
{
381384
throw;
@@ -506,6 +509,7 @@ CancellationToken cancellationToken
506509
return instance;
507510
}
508511

512+
[DebuggerDisableUserUnhandledExceptions]
509513
private async Task<T?> DownloadFileAsync(
510514
Uri uri,
511515
string baseFile,

StabilityMatrix.Avalonia/DesignData/DesignData.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,9 @@ public static CompletionList SampleCompletionList
12011201
.ToArray();
12021202
});
12031203

1204+
public static SponsorshipPromptViewModel SponsorshipPromptViewModel =>
1205+
DialogFactory.Get<SponsorshipPromptViewModel>(vm => { });
1206+
12041207
public static OpenArtWorkflowViewModel OpenArtWorkflowViewModel =>
12051208
new(Services.GetRequiredService<ISettingsManager>(), Services.GetRequiredService<IPackageFactory>())
12061209
{

StabilityMatrix.Avalonia/Extensions/SkiaExtensions.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,15 @@ public static Bitmap ToAvaloniaBitmap(this SKImage image, Vector dpi)
172172
pixmap.RowBytes
173173
);
174174
}
175+
176+
public static PixelFormat ToAvaloniaPixelFormat(this SKColorType colorType)
177+
{
178+
// ReSharper disable once SwitchExpressionHandlesSomeKnownEnumValuesWithExceptionInDefault
179+
return colorType switch
180+
{
181+
SKColorType.Rgba8888 => PixelFormat.Rgba8888,
182+
SKColorType.Bgra8888 => PixelFormat.Bgra8888,
183+
_ => throw new NotSupportedException($"Unsupported SKColorType: {colorType}")
184+
};
185+
}
175186
}

0 commit comments

Comments
 (0)