Skip to content

Commit

Permalink
Merge pull request #298 from LykosAI/main
Browse files Browse the repository at this point in the history
  • Loading branch information
ionite34 authored Nov 28, 2023
2 parents 24cb710 + 4da9d24 commit e85f03a
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 19 deletions.
43 changes: 27 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,16 @@ jobs:
python-version: '3.11'

- name: Install Python Dependencies
run: pip install stability-matrix-tools>=0.2.15
run: pip install stability-matrix-tools>=0.2.18 --upgrade

- name: Publish Auto-Update Release
run: sm-tools updates publish-matrix-v3 -v ${{ github.event.inputs.version }} -y
env:
SM_B2_API_ID: ${{ secrets.SM_B2_API_ID }}
SM_B2_API_KEY: ${{ secrets.SM_B2_API_KEY }}
SM_CF_CACHE_PURGE_TOKEN: ${{ secrets.SM_CF_CACHE_PURGE_TOKEN }}
SM_CF_ZONE_ID: ${{ secrets.SM_CF_ZONE_ID }}
SM_SIGNING_PRIVATE_KEY: ${{ secrets.SM_SIGNING_PRIVATE_KEY }}
run: sm-tools updates publish-matrix-v3 -v $RELEASE_VERSION -y

publish-auto-update-b2:
name: Publish Auto-Update Release (B2)
Expand All @@ -251,24 +257,23 @@ jobs:
echo "Using version ${{ github.event.inputs.version }}"
echo "RELEASE_VERSION=${{ github.event.inputs.version }}" >> $env:GITHUB_ENV
# Downloads all previous artifacts to the current working directory
- name: Download Artifacts
uses: actions/download-artifact@v3

# Zip each build
- name: Zip Artifacts
run: |
cd StabilityMatrix-win-x64 && zip -r ../StabilityMatrix-win-x64.zip ./. && cd $OLDPWD
cd StabilityMatrix-linux-x64 && zip -r ../StabilityMatrix-linux-x64.zip ./. && cd $OLDPWD
- uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install Python Dependencies
run: pip install stability-matrix-tools~=0.2.7

- name: Download Changelog
run: >
sm-tools updates download-changelog -v $RELEASE_VERSION -y
--changelog
run: pip install stability-matrix-tools>=0.2.18 --upgrade

# Zip each build
- name: Zip Artifacts
run: |
zip -r StabilityMatrix-win-x64.zip StabilityMatrix-win-x64/*
zip -r StabilityMatrix-linux-x64.zip StabilityMatrix-linux-x64/*
# Check that the zips and CHANGELOG.md are in the current working directory
- name: Check files
run: |
Expand All @@ -286,10 +291,16 @@ jobs:
fi
- name: Publish Auto-Update Release
env:
SM_B2_API_ID: ${{ secrets.SM_B2_API_ID }}
SM_B2_API_KEY: ${{ secrets.SM_B2_API_KEY }}
SM_CF_CACHE_PURGE_TOKEN: ${{ secrets.SM_CF_CACHE_PURGE_TOKEN }}
SM_CF_ZONE_ID: ${{ secrets.SM_CF_ZONE_ID }}
SM_SIGNING_PRIVATE_KEY: ${{ secrets.SM_SIGNING_PRIVATE_KEY }}
run: >
sm-tools updates publish-files-v3 -v $RELEASE_VERSION -y
sm-tools updates publish-files-v3 -v ${{ github.event.inputs.version }}
--channel ${{ github.event.inputs.auto-update-release-channel }}
--changelog CHANGELOG.md
--win-x64 StabilityMatrix-win-x64.zip
--linux-x64 StabilityMatrix-linux-x64.zip
--b2-bucket-name ${{ secrets.B2_BUCKET_NAME }}
-y
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ 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.6.6
### Fixed
- Fixed [#297](https://github.com/LykosAI/StabilityMatrix/issues/297) - Model browser LiteAsyncException occuring when fetching entries with unrecognized values from enum name changes

## v2.6.5
### Fixed
- Fixed error when receiving unknown model format values from the Model Browser
Expand Down
30 changes: 27 additions & 3 deletions StabilityMatrix.Avalonia/ViewModels/CheckpointBrowserViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using FluentAvalonia.UI.Controls;
using LiteDB;
using LiteDB.Async;
using NLog;
using Refit;
using StabilityMatrix.Avalonia.Services;
Expand Down Expand Up @@ -470,9 +472,31 @@ private async Task SearchModels()
}

// See if query is cached
var cachedQuery = await liteDbContext.CivitModelQueryCache
.IncludeAll()
.FindByIdAsync(ObjectHash.GetMd5Guid(modelRequest));
CivitModelQueryCacheEntry? cachedQuery = null;

try
{
cachedQuery = await liteDbContext.CivitModelQueryCache
.IncludeAll()
.FindByIdAsync(ObjectHash.GetMd5Guid(modelRequest));
}
catch (Exception e)
{
// Suppress 'Training_Data' enum not found exceptions
// Caused by enum name change
// Ignore to do a new search to overwrite the cache
if (
!(
e is LiteException or LiteAsyncException
&& e.InnerException is ArgumentException inner
&& inner.Message.Contains("Training_Data")
)
)
{
// Otherwise log error
Logger.Error(e, "Error while querying CivitModelQueryCache");
}
}

// If cached, update model cards
if (cachedQuery is not null)
Expand Down

0 comments on commit e85f03a

Please sign in to comment.