Browse Source

fixed a few bugs from sentry, see chagenlog for details

pull/438/head
JT 10 months ago
parent
commit
d3f3c858a0
  1. 3
      CHANGELOG.md
  2. 2
      StabilityMatrix.Avalonia/DialogHelper.cs
  3. 7
      StabilityMatrix.Avalonia/ViewModels/Inference/InferenceTextToImageViewModel.cs
  4. 15
      StabilityMatrix.Avalonia/ViewModels/Inference/ModelCardViewModel.cs
  5. 6
      StabilityMatrix.Core/Helper/ModelFinder.cs
  6. 18
      StabilityMatrix.Core/Models/Database/LocalImageFile.cs
  7. 6
      StabilityMatrix.Core/Models/Packages/Extensions/GitPackageExtensionManager.cs

3
CHANGELOG.md

@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2
## v2.8.0-pre.5 ## v2.8.0-pre.5
### Fixed ### Fixed
- Fixed error when ControlNet module image paths are not found, even if the module is disabled - Fixed error when ControlNet module image paths are not found, even if the module is disabled
- Fixed error when finding metadata for archived models
- Fixed error when extensions folder is missing
- Fixed error when webp files have incorrect metadata
## v2.8.0-pre.4 ## v2.8.0-pre.4
### Added ### Added

2
StabilityMatrix.Avalonia/DialogHelper.cs

@ -509,7 +509,7 @@ public static class DialogHelper
models.Select(m => m.FileNameWithoutExtension) models.Select(m => m.FileNameWithoutExtension)
); );
if (result.Score > 40) if (result is { Score: > 40 })
{ {
mainGrid.Children.Add( mainGrid.Children.Add(
new InfoBar new InfoBar

7
StabilityMatrix.Avalonia/ViewModels/Inference/InferenceTextToImageViewModel.cs

@ -188,14 +188,13 @@ public class InferenceTextToImageViewModel : InferenceGenerationViewModelBase, I
{ {
// Validate the prompts // Validate the prompts
if (!await PromptCardViewModel.ValidatePrompts()) if (!await PromptCardViewModel.ValidatePrompts())
{
return; return;
}
if (!await ModelCardViewModel.ValidateModel())
return;
if (!await CheckClientConnectedWithPrompt() || !ClientManager.IsConnected) if (!await CheckClientConnectedWithPrompt() || !ClientManager.IsConnected)
{
return; return;
}
// If enabled, randomize the seed // If enabled, randomize the seed
var seedCard = StackCardViewModel.GetCard<SeedCardViewModel>(); var seedCard = StackCardViewModel.GetCard<SeedCardViewModel>();

15
StabilityMatrix.Avalonia/ViewModels/Inference/ModelCardViewModel.cs

@ -2,8 +2,10 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text.Json.Nodes; using System.Text.Json.Nodes;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using StabilityMatrix.Avalonia.Controls; using StabilityMatrix.Avalonia.Controls;
using StabilityMatrix.Avalonia.Languages;
using StabilityMatrix.Avalonia.Models; using StabilityMatrix.Avalonia.Models;
using StabilityMatrix.Avalonia.Models.Inference; using StabilityMatrix.Avalonia.Models.Inference;
using StabilityMatrix.Avalonia.Services; using StabilityMatrix.Avalonia.Services;
@ -51,6 +53,19 @@ public partial class ModelCardViewModel(IInferenceClientManager clientManager)
public IInferenceClientManager ClientManager { get; } = clientManager; public IInferenceClientManager ClientManager { get; } = clientManager;
public async Task<bool> ValidateModel()
{
if (SelectedModel != null)
return true;
var dialog = DialogHelper.CreateMarkdownDialog(
"Please select a model to continue.",
"No Model Selected"
);
await dialog.ShowAsync();
return false;
}
/// <inheritdoc /> /// <inheritdoc />
public virtual void ApplyStep(ModuleApplyStepEventArgs e) public virtual void ApplyStep(ModuleApplyStepEventArgs e)
{ {

6
StabilityMatrix.Core/Helper/ModelFinder.cs

@ -56,10 +56,14 @@ public class ModelFinder
// VersionResponse is not actually the full data of ModelVersion, so find it again // VersionResponse is not actually the full data of ModelVersion, so find it again
var version = model.ModelVersions!.First(version => version.Id == versionResponse.Id); var version = model.ModelVersions!.First(version => version.Id == versionResponse.Id);
var file = versionResponse.Files.First( var file = versionResponse.Files.FirstOrDefault(
file => hashBlake3.Equals(file.Hashes.BLAKE3, StringComparison.OrdinalIgnoreCase) file => hashBlake3.Equals(file.Hashes.BLAKE3, StringComparison.OrdinalIgnoreCase)
); );
// Archived models do not have files
if (file == null)
return null;
return new ModelSearchResult(model, version, file); return new ModelSearchResult(model, version, file);
} }
catch (TaskCanceledException e) catch (TaskCanceledException e)

18
StabilityMatrix.Core/Models/Database/LocalImageFile.cs

@ -1,4 +1,5 @@
using DynamicData.Tests; using System.Text.Json;
using DynamicData.Tests;
using MetadataExtractor.Formats.Exif; using MetadataExtractor.Formats.Exif;
using StabilityMatrix.Core.Helper; using StabilityMatrix.Core.Helper;
using StabilityMatrix.Core.Models.FileInterfaces; using StabilityMatrix.Core.Models.FileInterfaces;
@ -89,9 +90,18 @@ public record LocalImageFile
filePath, filePath,
ExifDirectoryBase.TagImageDescription ExifDirectoryBase.TagImageDescription
); );
var parameters = string.IsNullOrWhiteSpace(paramsJson)
? null GenerationParameters? parameters = null;
: JsonSerializer.Deserialize<GenerationParameters>(paramsJson); try
{
parameters = string.IsNullOrWhiteSpace(paramsJson)
? null
: JsonSerializer.Deserialize<GenerationParameters>(paramsJson);
}
catch (JsonException)
{
// just don't load params I guess, no logger here <_<
}
filePath.Info.Refresh(); filePath.Info.Refresh();

6
StabilityMatrix.Core/Models/Packages/Extensions/GitPackageExtensionManager.cs

@ -82,6 +82,12 @@ public abstract class GitPackageExtensionManager(IPrerequisiteHelper prerequisit
{ {
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
// Skip directory if not exists
if (!indexDirectory.Exists)
{
continue;
}
// Check subdirectories of the index directory // Check subdirectories of the index directory
foreach (var subDirectory in indexDirectory.EnumerateDirectories()) foreach (var subDirectory in indexDirectory.EnumerateDirectories())
{ {

Loading…
Cancel
Save