Skip to content

Checkpoint/Lora info menu not being added to Efficient SDXL Loader #477

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
druggedhippo opened this issue May 10, 2025 · 0 comments
Open

Comments

@druggedhippo
Copy link

druggedhippo commented May 10, 2025

This line:

const split = pos === -1 ? [n] : [n.substring(0, pos), n.substring(pos + 1)];

Is incorrect. It assumes that the "." represents a nested object and doesn't work correctly with the text in the default setting:

["CheckpointLoader.ckpt_name", "CheckpointLoaderSimple", "CheckpointLoader|pysssss", "Efficient Loader", "Eff. Loader SDXL"].join(",")

When parsed it results in an array like so:

{"CheckpointLoader":{"ckpt_name":true},"CheckpointLoaderSimple":{"":true},"CheckpointLoader|pysssss":{"":true},"Efficient Loader":{"":true},"Eff":{" Loader SDXL":true}}

Which fails matching the "Eff. Loader SDXL" and the menu is not created. Example of a suggested fix is to check if there a space immediately after the dot, and if there is, assume it is not a nested object.

lookups[type] = value.split(",").reduce((p, n) => {
    n = n.trim();
    const pos = n.indexOf(".");

    // Determine if the string should be split based on the dot.
    // Split only if a dot exists AND the part after the dot contains no spaces.
    // This is a heuristic based on the observed data like "Eff. Loader SDXL".
    const shouldSplit = pos !== -1 && n.substring(pos + 1).indexOf(" ") === -1;

    let mainKey;
    let nestedKey;

    if (shouldSplit) {
        mainKey = n.substring(0, pos);
        nestedKey = n.substring(pos + 1);
    } else {
        // If not splitting, the entire string is the main key
        mainKey = n;
        // Use an empty string as the nested key for items without a clear nested part
        nestedKey = "";
    }

    // Ensure the main key exists as an object
    p[mainKey] ??= {};

    // Set the nested key within the main key's object
    p[mainKey][nestedKey] = true;

    return p;
}, {}); // Added initial value for reduce as an empty object
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

No branches or pull requests

1 participant