diff --git a/CHANGELOG.md b/CHANGELOG.md index 546b1b81..c644343d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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.10.1 +### Fixed +- Fixed package launch not working when environment variable `SETUPTOOLS_USE_DISTUTILS` is set due to conflict with a default environment variable. User environment variables will now correctly override any default environment variables. + ## v2.10.0 ### Added - Added Reference-Only mode for Inference ControlNet, used for guiding the sampler with an image without a pretrained model. Part of the latent and attention layers will be connected to the reference image, similar to Image to Image or Inpainting. diff --git a/StabilityMatrix.Core/Models/Settings/Settings.cs b/StabilityMatrix.Core/Models/Settings/Settings.cs index 01e22fd2..ff65f104 100644 --- a/StabilityMatrix.Core/Models/Settings/Settings.cs +++ b/StabilityMatrix.Core/Models/Settings/Settings.cs @@ -118,10 +118,22 @@ public class Settings public Dictionary? UserEnvironmentVariables { get; set; } [JsonIgnore] - public IReadOnlyDictionary EnvironmentVariables => - DefaultEnvironmentVariables - .Concat(UserEnvironmentVariables ?? []) - .ToDictionary(x => x.Key, x => x.Value); + public IReadOnlyDictionary EnvironmentVariables + { + get + { + if (UserEnvironmentVariables is null || UserEnvironmentVariables.Count == 0) + { + return DefaultEnvironmentVariables; + } + + return DefaultEnvironmentVariables + .Concat(UserEnvironmentVariables) + .GroupBy(pair => pair.Key) + // User variables override default variables with the same key + .ToDictionary(grouping => grouping.Key, grouping => grouping.Last().Value); + } + } public HashSet? InstalledModelHashes { get; set; } = new();