Skip to content

Conversation

@richardtallent
Copy link

@richardtallent richardtallent commented Nov 3, 2025

As discussed in Discord, this allows users to select a preset for any model or LoRA. The preset is added when the model/LoRA are selected. These are stored as user settings.

For models, the preset is unselected (if not applied already) if the user clicks another model that has a different preset.

Documentation is included.

This adds two optional user settings as well:

  • Whether to auto-apply presets when selecting a model/LoRA rather than just selecting the corresponding preset.
  • Whether to ignore LoRA presets for LoRA loaded through a model's preset, if the LoRA is loaded with a weight of 0 (so the model can effectively disable the LoRA).

This is my first deep trip into the code, so please let me know if I've accidentally re-implemented utility functions, etc. that already exist. I've tried to follow the conventions and style of this repo as much as I can, and to minimize the "blast radius" of the new code.

function applyOnePreset(preset) {
function applyOnePreset(preset, isNestedPreset = false) {
// Collect LoRA updates before applying to handle merging
let presetLoras = preset.param_map.loras ? preset.param_map.loras.split(',').map(l => l.trim()).filter(l => l.length > 0) : [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imo any changes to how loras are handled in presets is out-of-scope and should be a separate followup. This is already a very big PR, try to keep it focused to the core function.

* @param {string} itemName - The full model/LoRA name (path or filename)
* @returns {string} The base filename without path or extension
*/
function extractItemKeyNameFromPath(itemName) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get rid of this, no. bad.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What specifically are you concerned about here?

My concern was that as I reorganize my models, I don't want them to lose their presets just because they moved to a new folder path. That wasn't an issue when it was custom metadata, but as a user setting, need a durable key.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintaining model list vs user list sync is... an open question to be discussed, but the solution is definitely not this.

public string ImageShiftingCycles = "true";

[ConfigComment("When a model with a linked preset is selected, should the preset parameters be applied immediately? By default, the preset is just selected for review.")]
public bool AutoApplyModelPresets = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd probably make more sense for this to be a setting on each Preset rather than a global user setting. Some presets should autoapply, others shouldn't. The functionality would probably be beneficial for all presets rather than specific to model. This should aaalso probably be a separate PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants