-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Feature: Extra Networks Tree View #14588
Feature: Extra Networks Tree View #14588
Conversation
Should I be resolving conflicts with the |
Only dev. PRs are to be merged with the dev. People generally don't resolve conflicts, I do that, but if you do, that would help. |
Understood. I'll resolve the conflicts. It could be a load off your shoulders if you require the PR creator to resolve conflicts though... :) |
Now, as for the feature itself, I'm not a big fan of having a second mode for extra networks page so that the user chooses to either have cards with pictures, or a folder tree. I feel a better solution is if a tree is added (if enabled in settings), into the main mode with cards: only directories are shown in the tree, and clicking on the directory sets the search filter to only show cards from this directory. Do you have any thoughts about this way to implement the tree? |
I think I get what you're asking for. Were you thinking maybe something like GitHub's Personally I think that would be the cleanest looking option. Could also chuck that search bar at the top of the file explorer like github did. I'll work on a quick demo of this solution and get back to you. |
Yes. Thanks. With the exception that github's tree also shows files, and we would just show directories - three in your screenshot, or four if you include root. |
oh nice after all this time someone finally decide actually work on this tree view I think the extra network path should be truncated to its extra network directory, no need to display the absolute path |
Which of these options would you prefer (using the Lora directory as an example)?
One issue I'm running into is that the current card filter will display all cards in the filtered directory and its subdirectories. I'm not really sure how we'd like to handle this, though. My preference would be to only show cards in that directory and not in any subdirectories but I can also see some arguments for showing all of it. The other issue is I don't know any javascript which is making this take longer than I'd hoped. :\ |
fourth option, none also if you are using a custom dir with |
If someone is putting their models at system root they deserve an error haha. Good point though I didn't think about that. My concern is that the Lora tab looks inside of both the Lora and LyCORIS directories by default. What if they have a subdirectory in each of those directories with the same name? So Also the textual inversion tab looks in the |
irrc if you have two models of the same name at the same relative position in both Lora and LyCORIS only one will work (I forgot which one has priority) also the LyCORIS dir is left for compatibility reasons only (you don't have to use it and I think it's better you don't use it) if this tree view can display multiple networks from different roots with the same relative position and name then one can consider this to be a bug because extra networks doesn't support it basically unless non-unique names and multiple root is supported by the extra network the tree should not display the networks that can't be used |
Okay I've updated the format a bit. Now the tree view is on a left pane alongside the cards. The filters work and when you click on directories it will use that as the search filter. Clicking on a directory will expand that directory and use that directory as a search filter for the right side of the pane. Clicking an already opened directory will just select that directory but leave it expanded. To collapse a directory, you just click that directory again if it is already selected. Currently if your search is a directory then all networks within that directory and subdirectories will be shown. This is because the search is just checking for a substring in the search terms and relative paths are included in the search terms for each network. I also updated the code so that switching between tabs clears the search box. Having the search filter stay the same when switching between tabs was annoying since the models don't have the same search terms. I also decided to keep the networks in the directory tree since I personally find it much quicker to just use the tree view to select my models. It's still unpolished because I don't know any html/css/js so this is about as good as I can get it within a reasonable time. One thing I would have liked to see is the search textbox with an Below is a quick demo video showing how clicking on directories updates the search box. 2024-01-11.15-02-36.-.Copy.mp4The code still definitely needs to be cleaned up. I also need to resolve conflicts with
In the |
Hey so I'm running into an issue that I cant seem to resolve. In Am I correct in this assumption and is there any way to have a |
I think one of these callbacks might work for you stable-diffusion-webui/script.js Lines 27 to 31 in cb5b335
|
… and finish cleanup.
Thank you that helped. I wasn't able to use any of these predefined callbacks but I was able to figure out a solution using a similar approach to var uiAfterScriptsCallbacks = []
var uiAfterScriptsTimeout = null;
var executedAfterScripts = false;
function scheduleAfterScriptsCallbacks() {
clearTimeout(uiAfterScriptsTimeout);
uiAfterScriptsTimeout = setTimeout(function() {
executeCallbacks(uiAfterScriptsCallbacks);
}, 200);
}
document.addEventListener("DOMContentLoaded", function() {
var mutationObserver = new MutationObserver(function(m) {
if (!executedAfterScripts &&
gradioApp().querySelectorAll("[id$='_extra_search']").length == 8) {
executedAfterScripts = true;
scheduleAfterScriptsCallbacks();
}
});
mutationObserver.observe(gradioApp(), {childList: true, subtree: true});
});
uiAfterScriptsCallbacks.push(setupExtraNetworks); This method waits for all of the elements matching |
@AUTOMATIC1111 |
fix path sortkey not including the filename for #14588
is there a way to roll back having folders? When you have more than 2000 loras the new tree view is unusable. Also, the "change preview" button doesn't update automatically. |
This is a controversial feature, I like to train lora myself, so there are different directories to divide and I know very well the location and role of each folder, the previous version can click on the folder and go directly to the directory, but now you have to click on the tree network several times to enter, very troublesome. Of course, I can only represent individuals, so if you need to add this function, please also add a button that does not enable this function, thank you |
All changes are current up to eee46a5 extensions-builtin/Lora/ui_extra_networks_lora.py Rollback to d4945f4 html/extra-networks-card.html Rollback to 699108b javascript/extraNetworks.js Rollback to a2f23f9 modules/shared_options.py Remove options: - "extra_networks_tree_view_default_enabled" - "extra_networks_tree_view_default_width" - "extra_networks_card_description_is_html" modules/ui_extra_networks.py Rollback to 320a217 Apply 321b2db modules/ui_extra_networks_checkpoints.py Rollback to 337bc4a modules/ui_extra_networks_hypernets.py Rollback to 74b80e7 modules/ui_extra_networks_textual_inversion.py Rollback to 74b80e7 modules/ui_extra_networks_user_metadata.py Rollback to 5d7d182 style.css Rollback to 2f98a35 Apply 9f3ba38..1466dae
All changes are current up to 58f7410 • extensions-builtin/Lora/ui_extra_networks_lora.py Rollback to d4945f4 • html/extra-networks-card.html Rollback to 699108b • javascript/extraNetworks.js Rollback to a2f23f9 Apply 801461e..ecffe85 • modules/shared_options.py Rollback to 1ddb886 Apply 569dc19..e3fa46f Remove unnecessary options: - "extra_networks_tree_view_default_enabled" - "extra_networks_tree_view_default_width" - "extra_networks_card_description_is_html" • modules/ui_extra_networks.py Rollback to 320a217 Apply 321b2db • modules/ui_extra_networks_checkpoints.py Rollback to 337bc4a • modules/ui_extra_networks_hypernets.py Rollback to 74b80e7 • modules/ui_extra_networks_textual_inversion.py Rollback to 74b80e7 • modules/ui_extra_networks_user_metadata.py Rollback to 5d7d182 • style.css Rollback to 2f98a35 Apply 9f3ba38..1466dae
fix path sortkey not including the filename for AUTOMATIC1111#14588
Latest Update
Most recent major update to this PR: #14588 (comment)
Description
This PR adds an option to the
Extra Networks
section to switch from the "Card View" to a "Tree View". This allows users to easily navigate more complex directory structures in order to find networks.Along with this, a new button has been added to both the existing Cards in the extra networks tabs and to the entries in this new tree view. This button (shown in the screenshot) can be clicked to copy the file path of the network to the clipboard.
Finally, if an Extra Networks tab's corresponding root directory (in
stable-diffusion-webui/models
) is empty, that directory will remain expanded and display the messageDIRECTORY IS EMPTY
(see the screenshots below).I made these changes after getting sick of the existing Card View format for these networks. They become too cumbersome when you have many networks in a more complex directory structure.
Screenshots/videos:
Shown below is the new entry in the
Extra Networks
section of the settings page. This setting is off by default so the user will have to actually go and change this setting to see any of the changes in this PR.The following screenshot shows what the Extra Networks tabs look like with this new change enabled in the settings.
The folders that appear in these tabs are collapsed by default and can be clicked to expand.
Additionally, this is the new
Copy Path
button that was added to the existing network cards.Checklist:
Additional Notes:
The
Search
andSort
options are not implemented in the tree view. If anyone wants to tackle that beast then be my guest.This is pretty low priority and I really just made it for my own use anyway so no rush.