backup of SD extensions as of 20240303
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +5 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/.github/ISSUE_TEMPLATE/simple-issue-template.md +20 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/.gitignore +4 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/CHANGELOG.md +148 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/README.cn.md +251 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/README.jp.md +236 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/README.kr.md +215 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/README.md +252 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/icon/.keep +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/all_in_one.png +3 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/all_the_mothers.png +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/check_model_new_version.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/check_model_new_version_output.png +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/download_model.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/extension_tab.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/extra_network.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/get_one_model_info.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/model_card.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/model_info_file.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/other_setting.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/refresh_ch.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/thumb_mode.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/blame_sdweui_update_to_this_ext.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/changed_model_folder_name_then_forget_part1.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/changed_model_folder_name_then_forget_part2.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/changed_model_folder_name_then_forget_part3.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/changed_model_folder_name_then_forget_part4.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/css_issue_part1.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/css_issue_part2.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/css_issue_part3.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/css_issue_part4.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/did_not_relaunch_sdwebui.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/do_not_even_use_this_ext.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/have_not_scan_model.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/have_not_update_sdwebui.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/request_a_feature_it_already_has.jpg +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/webui_metadata_button.png +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/webui_metadata_editor.png +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/javascript/civitai_helper.js +1012 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/scripts/__pycache__/civitai_helper.cpython-310.pyc +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/scripts/ch_lib/__init__.py +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/scripts/ch_lib/__pycache__/__init__.cpython-310.pyc +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/scripts/ch_lib/__pycache__/civitai.cpython-310.pyc +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/scripts/ch_lib/__pycache__/downloader.cpython-310.pyc +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/scripts/ch_lib/__pycache__/js_action_civitai.cpython-310.pyc +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/scripts/ch_lib/__pycache__/model.cpython-310.pyc +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/scripts/ch_lib/__pycache__/model_action_civitai.cpython-310.pyc +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/scripts/ch_lib/__pycache__/msg_handler.cpython-310.pyc +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/scripts/ch_lib/__pycache__/templates.cpython-310.pyc +0 -0
- AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/scripts/ch_lib/__pycache__/util.cpython-310.pyc +0 -0
.gitattributes
CHANGED
@@ -33,3 +33,8 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/all_in_one.png filter=lfs diff=lfs merge=lfs -text
|
37 |
+
AiAF/Backup-SD-Extensions-Folder/sd-civitai-browser-plus-1.15.2/aria2/lin/aria2 filter=lfs diff=lfs merge=lfs -text
|
38 |
+
AiAF/Backup-SD-Extensions-Folder/sd-civitai-browser-plus-1.15.2/aria2/win/aria2.exe filter=lfs diff=lfs merge=lfs -text
|
39 |
+
AiAF/Backup-SD-Extensions-Folder/sd-dynamic-prompts/images/weighting-colours.png filter=lfs diff=lfs merge=lfs -text
|
40 |
+
AiAF/Backup-SD-Extensions-Folder/sd-dynamic-prompts/images/weighting-us-population.png filter=lfs diff=lfs merge=lfs -text
|
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/.github/ISSUE_TEMPLATE/simple-issue-template.md
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
name: Simple Issue template
|
3 |
+
about: Describe this issue template's purpose here.
|
4 |
+
title: ''
|
5 |
+
labels: ''
|
6 |
+
assignees: ''
|
7 |
+
|
8 |
+
---
|
9 |
+
|
10 |
+
## Have you read document?
|
11 |
+
|
12 |
+
## Have you checked console log window's msg?
|
13 |
+
|
14 |
+
## Describe Issue
|
15 |
+
|
16 |
+
|
17 |
+
## Screenshot for UI issue
|
18 |
+
|
19 |
+
|
20 |
+
## Console log's msg or screenshot for function issue
|
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/.gitignore
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
scripts/__pycache__/
|
2 |
+
scripts/ch_lib/__pycache__/
|
3 |
+
setting.json
|
4 |
+
**/*.kate-swp
|
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/CHANGELOG.md
ADDED
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Change Log
|
2 |
+
## 1.7.7
|
3 |
+
* Implemented authentication via API Key.
|
4 |
+
* This allows the user to download models that require authentication.
|
5 |
+
|
6 |
+
## 1.7.6
|
7 |
+
* Downloader rewrite:
|
8 |
+
* Downloading models will now show download progress in webui.
|
9 |
+
* Download errors will now be displayed in webui, with more detailed information still in console output.
|
10 |
+
* The current model filename will now be included when renaming models.
|
11 |
+
* Extension should now at least run in [Vladmandic's stable diffusion webui](https://github.com/vladmandic/automatic) thanks to [#32](https://github.com/zixaphir/Stable-Diffusion-Webui-Civitai-Helper/pull/32).
|
12 |
+
* I do not run Vladmandic and have not personally tested functionality. Users who would like to address issues with Vladmandic compatibility may send a [Pull Request](https://github.com/zixaphir/Stable-Diffusion-Webui-Civitai-Helper/pulls).
|
13 |
+
|
14 |
+
## 1.7.5
|
15 |
+
* Missing image generation info in civitai.info files can now be retrieved from civitai by downloading the image and parsing its EXIF data. Most people should not need this, but it can be helpful if you're trying to recreate an image or more like it from the model's preview page. This will only work if the model author left metadata in the image.
|
16 |
+
* Added some compatibility code for the Lobe theme extension
|
17 |
+
* Reduce timeout errors, retry failed downloads.
|
18 |
+
* Added an option to use sd webui's SHA256 hashing function instead of our own.
|
19 |
+
|
20 |
+
## 1.7.4
|
21 |
+
* Added "Remove Model" button. From butaixianran's repo.
|
22 |
+
* Added "Rename Model" button.
|
23 |
+
* New `.json` files will now have their descriptions surrounded by HTML comments as to not break model cards when card descriptions are enabled. If you want to display these descriptions on cards, you can remove the leading `<!--` and tailing `-->`, but you will be responsible for any issues that arise.
|
24 |
+
* Card buttons can now be hidden individually. By default, the "insert trigger words" button is hidden on newer versions of sdwebui, where this functionality happens automatically if the metadata `JSON` exists, which is created when models are scanned with default settings.
|
25 |
+
* Model names on cards now have a maximum height when not hovered, which should prevent the model name from occupying the whole card.
|
26 |
+
* Fix downloading size check issue. From butaixianran's repo.
|
27 |
+
* NSFW previews can now be blocked by severity, from Soft, Mature, X, and Allow All. From sdy623's repo. These don't seem to be documented on Civitai's end, but here's what I've been able to gather by pinging the API and seeing what images were returned.
|
28 |
+
* Soft images do not appear to contain explicit nudity, but may have implicitly suggestive elements or clothing that outline the underlying body closely enough that details underneath poke out or have their silhoutte visible.
|
29 |
+
* Mature images may contain nudity, but could just as easily show a little too much cleavage or are otherwise actively sexually suggestive.
|
30 |
+
* X are explicitly pornographic.
|
31 |
+
|
32 |
+
## v1.7.3
|
33 |
+
* Downloading webui model information (`[model_name].json`) is now optional and can be configured in the webui settings.
|
34 |
+
* When a model is not found on Civitai, this extension will attempt to read the model header for activation keywords. This only works with safetensors files with kohya_ss metadata and may be inaccurate depending on how the model was trained. This method assumes the model was trained with each trained concept having its own training folder. This is not always the case.
|
35 |
+
* This information can also be found in webui without any extensions by clicking the :information_source: button and reading the `"ss_tag_frequency":` section. This section may prove more helpful on models that are trained on multiple concepts but with all the training data under one directory. For instance, if it was trained for certain characters, search the list for that character's name. Often model authors will use a name plus a unique identifier as to not cause the character to "bleed into" other characters with the same name. For instance, we can the [All The Mothers](https://civitai.com/models/48200) lora has all of its trained characters as tagged images under one dataset:
|
36 |
+
|
37 |
+
![](img/all_the_mothers.png)
|
38 |
+
|
39 |
+
## v1.7.2
|
40 |
+
* Better HTML sanitization/removal from Descrition/Note fields.
|
41 |
+
* CivitAI Anti-DDOS false-positive delay lowered. This may be reverted if it causes issues, tho <5 API hits a second shouldn't be too bad.
|
42 |
+
* CivitAI Anti-DDOS false-positive delay added to all models, not just embeddings, when performing model scans.
|
43 |
+
* However, delay has been removed when a scanned model does not need to perform an API hit to CivitAI.
|
44 |
+
* Enabled functionality to re-download model data if the current data is from an older version of SD-Webui-Civitai-Helper.
|
45 |
+
* For many people, this will not be necessary. For those migrating from the original extension, missing data for WebUI is handled separately and will be downloaded on scan anyways.
|
46 |
+
* For more details, see the [wiki](https://github.com/zixaphir/Stable-Diffusion-Webui-Civitai-Helper/wiki/Metadata-Format-Changes).
|
47 |
+
* **HOTFIX**: if a model has been deleted from Civitai, the `Replace Old Metadata Formats` option will no longer overwrite working data with dummy data.
|
48 |
+
|
49 |
+
## v1.7.1
|
50 |
+
* Settings are now in the settings menu.
|
51 |
+
* Model previews following the name format `[model name].preview.[format]` in JPEG, GIF, and WEBP formats are now checked before downloading model previews from civitai.
|
52 |
+
* HTML in the model description and version information should be removed and replaced more eloquently.
|
53 |
+
* Improved layout of Model Update interface.
|
54 |
+
* Added options for behaviors when downloading a model with the same filename as one already existing.
|
55 |
+
* The new default is to skip downloading, replacing the old default of renaming the new model.
|
56 |
+
* **Post-release Hotfix**: fixed skeleton JSON generation for models not found on CivitAI.
|
57 |
+
|
58 |
+
## v1.7.0
|
59 |
+
* Added compatibility with Stable Diffusion WebUI v1.5.0-v1.6.0.
|
60 |
+
* Downloading metadata from Civitai should now include more exhaustive data, including correct description and tags.
|
61 |
+
* NSFW preview detection should be accurate.
|
62 |
+
* Native and Extension LyCoris support should function.
|
63 |
+
* Buttons added by this extension no longer require a separate button to add to UI.
|
64 |
+
* Extension populates Stable Diffusion WebUI's new metadata editor with description, Checkpoint model version, version information, and activation prompt(s).
|
65 |
+
* This should allow simply clicking a card to add model activation prompts.
|
66 |
+
* Model Download UI requires fewer clicks to download a model.
|
67 |
+
|
68 |
+
## v1.6.4
|
69 |
+
* Add "Download All files" checkbox for downloading model section. Uncheck means only download 1 file.
|
70 |
+
|
71 |
+
## v1.6.3
|
72 |
+
* Support downloading multiple files, not avaiable when checking new version.
|
73 |
+
|
74 |
+
## v1.6.2.1
|
75 |
+
* when parsing civitai url, remove query string by PR
|
76 |
+
|
77 |
+
## v1.6.2
|
78 |
+
* When downloading, re-name file if file already exists
|
79 |
+
|
80 |
+
## v1.6.1.1
|
81 |
+
* Support bilingual localization extension by PR
|
82 |
+
|
83 |
+
## v1.6.1
|
84 |
+
* Fix Localization issue for 4 addtional buttons on cards. (Forgot that again...)
|
85 |
+
|
86 |
+
## v1.6.0
|
87 |
+
* Fix some UI issues to work with gradio 3.23.0
|
88 |
+
* Support Proxy when connecting to civitai. Check document for detail.
|
89 |
+
* check realpath when opening file, to fix error when using junction
|
90 |
+
* Fix multiple addtional buttons issue after switching tabs.
|
91 |
+
|
92 |
+
## v1.5.7
|
93 |
+
* Fix Localization issue for 4 addtional buttons on cards
|
94 |
+
|
95 |
+
## v1.5.6
|
96 |
+
* update error msg when can not connect to civitai API service
|
97 |
+
* update thumb mode for SD webui new version's metadata button
|
98 |
+
|
99 |
+
## v1.5.5
|
100 |
+
* update SHA256 function, now it just use the code from pip
|
101 |
+
|
102 |
+
## v1.5.4
|
103 |
+
* set sys.stdout to utf-8
|
104 |
+
* Add default header for requests to prevent from being blocked by civitai.
|
105 |
+
* merge other v1.5.x change log to v1.5.4
|
106 |
+
* When downloading a model by url, check if target model version is already existed in user selected sub-folder.
|
107 |
+
* Support scanning only selected model types.
|
108 |
+
* Force TI scanning delay 1 second to prevent from civitai treating this extension's requests as attacking.
|
109 |
+
|
110 |
+
## v1.5.0
|
111 |
+
* Download a model by Civitai model page's url
|
112 |
+
* Resume downloading from break-point
|
113 |
+
* Download new version into SD Webui's model folder
|
114 |
+
* Addtional button now works on thumbnail mode
|
115 |
+
* Option to always show addtion button, for touch screen.
|
116 |
+
|
117 |
+
## v1.4.2
|
118 |
+
* ignore .vae file in model folder when scanning
|
119 |
+
|
120 |
+
## v1.4.1
|
121 |
+
* When checking new versions, also searching and ignore already existed ones.
|
122 |
+
* Add version number to the bottom of this extension's tab
|
123 |
+
|
124 |
+
## v1.4
|
125 |
+
* Support checking model's new version, display the result in UI and offer download url
|
126 |
+
* Remove addintional sub tabs on extension tab. make ui simpler.
|
127 |
+
|
128 |
+
## v1.3
|
129 |
+
* Open url at client side
|
130 |
+
* Link selected model to civitai by url or model id
|
131 |
+
* Save and load extension setting to file
|
132 |
+
* Show button action's output to UI
|
133 |
+
* Code refactoring
|
134 |
+
|
135 |
+
## v1.2.1
|
136 |
+
* Add more error checking to work with different versions of SD webui.
|
137 |
+
|
138 |
+
## v1.2
|
139 |
+
* Support customer model folder
|
140 |
+
* Support readable model info file
|
141 |
+
* Support download preview image with max size
|
142 |
+
* Remove card buttons when extra network is in thumbnail mode
|
143 |
+
|
144 |
+
## v1.1
|
145 |
+
* Support subfolders
|
146 |
+
* Check if refresh is needed when clicking "Refresh Civitai Helper"
|
147 |
+
* Add space when adding trigger words
|
148 |
+
* Add memory Optimized sha256 as an option
|
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/README.cn.md
ADDED
@@ -0,0 +1,251 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# 这份文件已由ChatGPT从英语翻译而来。
|
2 |
+
|
3 |
+
**[贡献者](https://github.com/zixaphir/Stable-Diffusion-Webui-Civitai-Helper/graphs/contributors)**
|
4 |
+
|
5 |
+
##关于Civitai助手
|
6 |
+
这个扩展提供了从Civitai下载模型和模型元数据的能力。您可以轻松获得托管在Civitai上的模型的激活关键词、模型描述、版本信息以及模型预览等数据,而无需离开稳定的扩散WebUI。
|
7 |
+
|
8 |
+
##关于Civitai助手的这个版本
|
9 |
+
这是我个人版本的Stable-Diffusion-Webui-Civitai-Helper。我完全是因为我使用的版本在SD-webui v1.5发布时崩溃了,我需要它能够正常工作,所以开始了这个项目。从那时起,我添加了我想要的功能,并尽力维护与较旧版本的sd-webui的兼容性,但我不使用较旧版本,因此不会在较旧版本上进行测试。
|
10 |
+
|
11 |
+
我打算尽我所能使其保持正常运行,但这只是一个业余项目,我远没有其他更有经验的扩展开发者那么娴熟。我可能会长时间离开,如果失去兴趣甚至可能永远离开。我容易犯错,也可能会出现错误和漏洞。
|
12 |
+
|
13 |
+
如果有更有兴趣的人决定接手开发,我将乐意放弃对这个项目的控制,并尝试将我的更改推送到他们的项目中,如果有需要的话。
|
14 |
+
|
15 |
+
|
16 |
+
# Civitai Helper
|
17 |
+
Stable Diffusion Webui 扩展Civitai助手,用于更轻松的管理和使用Civitai模型。
|
18 |
+
|
19 |
+
[Civitai Url](https://civitai.com/models/16768/civitai-helper-sd-webui-civitai-extension)
|
20 |
+
|
21 |
+
# 注意
|
22 |
+
**本插件现在非常稳定,很多人用得很好,如果碰到问题,先看[常见问题](#常见问题),并检查命令行窗口的详情。**
|
23 |
+
开issue前,请先看文档。找茬行为的用户将会被拉黑,参考:[找茬行为会被拉黑](https://github.com/butaixianran/Stable-Diffusion-Webui-Civitai-Helper/issues/96#issuecomment-1500310981)
|
24 |
+
|
25 |
+
|
26 |
+
# 功能
|
27 |
+
[中文介绍视频(非官方)](https://youtu.be/x4tPWPmeAgM?t=373)
|
28 |
+
|
29 |
+
* 扫描所有模型,从Civitai下载模型信息和预览图
|
30 |
+
* 通过civitai模型页面url,连接本地模型和civitai模型信息
|
31 |
+
* 通过Civitai模型页面url,下载模型(含信息和预览图)到SD目录或子目录。
|
32 |
+
* 下载支持断点续传
|
33 |
+
* 批量检查本地模型,在civitai上的新版本
|
34 |
+
* 直接下载新版本模型到SD模型目录内(含信息和预览图)
|
35 |
+
* 修改了内置的"Extra Network"模型卡片,每个卡片增加了如下功能按钮:
|
36 |
+
- 🖼: 修改文字"replace preview"为这个图标
|
37 |
+
- 🌐: 在新标签页打开这个模型的Civitai页面
|
38 |
+
- 💡: 一键添加这个模型的触发词到关键词输入框
|
39 |
+
- 🏷: 一键使用这个模型预览图所使用的关键词
|
40 |
+
* 以上额外功能按钮支持thumbnail模式
|
41 |
+
* 增加一直显示按钮的选项,以供触屏用户使用
|
42 |
+
|
43 |
+
|
44 |
+
# 安装
|
45 |
+
下载本项目为zip文件,解压到`你的SD webui目录/extensions`下即可。
|
46 |
+
|
47 |
+
不管是安装还是升级本插件,都要整个关闭SD Webui,重新启动它。只是Reload UI不起作用。
|
48 |
+
|
49 |
+
(如果用SD webui的插件界面安装,请先给git配置代理。它不是通过浏览器下载,是通过git下载。)
|
50 |
+
|
51 |
+
|
52 |
+
# 使用方法
|
53 |
+
|
54 |
+
## 更新你的SD webui
|
55 |
+
本扩展需要取到 Extra Network的卡片列表id。**这个是2023-02-06,才添加到SD webui里面的。**
|
56 |
+
|
57 |
+
所以,如果你用的版本比这个早,你就需要先更新你的SD Webui!
|
58 |
+
|
59 |
+
|
60 |
+
## 扫描模型
|
61 |
+
前往扩展页面"Civitai Helper",有个按钮叫:"Scan Model"
|
62 |
+
|
63 |
+
![](img/extension_tab.jpg)
|
64 |
+
|
65 |
+
点击,就会扫描所有模型,生成SHA256码,用于从civitai获取模型信息和预览图。**扫描需要很久,耐心等待**。
|
66 |
+
|
67 |
+
每个模型,本扩展都会创建一个json文件,用来保存从civitai得到的模型信息。这个文件会保存在模型同目录下,名称为:"模型名字.civitai.info"。
|
68 |
+
|
69 |
+
![](img/model_info_file.jpg)
|
70 |
+
|
71 |
+
如果模型信息文件已经存在,扫描时就会跳过这个模型。如果模型不是civitai的,就会创建个空信息文件,以避免以后重复扫描。
|
72 |
+
|
73 |
+
### 添加新模型
|
74 |
+
当你下载了新模型之后,只要再次点击扫描按钮即可。已经扫描过的文件不会重复扫描,会自动得到新模型的信息和预览图。无须重启SD webui。
|
75 |
+
|
76 |
+
## 模型卡片
|
77 |
+
**(先完成扫描,再使用卡片功能)**
|
78 |
+
打开SD webui's 内置的 "Extra Network" 页面,显示模型卡片
|
79 |
+
|
80 |
+
![](img/extra_network.jpg)
|
81 |
+
|
82 |
+
|
83 |
+
移动鼠标到模型卡片底部,就会显示4个按钮:
|
84 |
+
- 🖼: 修改文字"replace preview"为这个图标
|
85 |
+
- 🌐: 在新标签页打开这个模型的Civitai页面
|
86 |
+
- 💡: 一键添加这个模型的触发词到关键词输入框
|
87 |
+
- 🏷: 一键使用这个模型预览图所使用的关键词
|
88 |
+
|
89 |
+
![](img/model_card.jpg)
|
90 |
+
|
91 |
+
如果你没有看到这些额外的按钮,只要点击`Refresh Civitai Helper`,他们就会被重新添加到卡片上。
|
92 |
+
|
93 |
+
![](img/refresh_ch.jpg)
|
94 |
+
|
95 |
+
每次当Extra Network刷新,他都会删除掉额外的修改,我们的按钮就会��失。这时你就需要点击`Refresh Civitai Helper`把这些功能添加回去。
|
96 |
+
|
97 |
+
|
98 |
+
### 小图模式
|
99 |
+
以上功能按钮支持小图模式,但受制于SD Webui的CSS问题,目前,只能要么一直显示,要么一直不显示,不能鼠标滑过才显示。
|
100 |
+
![](img/thumb_mode.jpg)
|
101 |
+
|
102 |
+
## 下载
|
103 |
+
**(单任务,下载完一个再下另一个)**
|
104 |
+
通过Civitai模型页面Url下载模型,要3个步骤:
|
105 |
+
* 填入url,点击按钮获取模型信息
|
106 |
+
* 扩展会自动填入模型名称和类型,你需要选择下载的子目录和模型版本。
|
107 |
+
* 点击下载
|
108 |
+
![](img/download_model.jpg)
|
109 |
+
|
110 |
+
下载过程会显示在命令行界面带个进度条。
|
111 |
+
支持断点续传,无畏大文件。
|
112 |
+
|
113 |
+
|
114 |
+
## 批量检查模型新版本
|
115 |
+
你可以按照模型类型,批量检查你的本地模型,在civitai上的新版本。你可以选择多个模型类型。
|
116 |
+
![](img/check_model_new_version.jpg)
|
117 |
+
|
118 |
+
检查新版本的时候,每检查完一个模型,都会有一个1秒的延迟,所以速度有点慢。
|
119 |
+
|
120 |
+
这是为了保护Civitai避免因为本插件而短暂陷入类似DDos的局面。有些云服务商,有类似“免费用户每秒API请求不能超过1次”的保护机制。Civitai还没有这种设置。但我们还是得自觉保护它。因为如果它挂了,对大家都没有好处。
|
121 |
+
|
122 |
+
**检查完毕之后**,就会如下图,在UI上显示所有找到的新版本的信息。
|
123 |
+
|
124 |
+
每个模型新版本,都有3个链接。
|
125 |
+
* 第一个是这个模型的网页。
|
126 |
+
* 第二个是这个新版本的下载地址。
|
127 |
+
* 第三个是个按钮,在python端,直接下载新版本到模型目录内。
|
128 |
+
这种方式下载,下载详情显示在"Download Model"的区域和命令行窗口中。一次一个任务,不支持多任务。
|
129 |
+
![](img/check_model_new_version_output.jpg)
|
130 |
+
|
131 |
+
|
132 |
+
|
133 |
+
## 根据URL获取模型信息
|
134 |
+
如果无法在civitai上找到你的模型的SHA256,但你还是希望能把你的模型连接到一个civitai模型,你可以在本扩展页面,从列表中选择你的模型,并提供一个civitai模型页面的url。
|
135 |
+
|
136 |
+
点击按钮之后,扩展就会下载那个civitai模型的信息,作为你这个本地模型的信息使用。
|
137 |
+
|
138 |
+
![](img/get_one_model_info.jpg)
|
139 |
+
|
140 |
+
## 代理
|
141 |
+
**如果你是刚更新新版本,你需要重启SD webui再来使用**
|
142 |
+
|
143 |
+
代理输入框在插件页面最下方。
|
144 |
+
|
145 |
+
**每次填入或清除代理后,都要保存,并用SDwebui设置页面的Reload UI按钮刷新UI**
|
146 |
+
|
147 |
+
然后所有发到civitai的请求就会用代理。
|
148 |
+
|
149 |
+
有些sock5代理, 需要使用socks5h开头的形式"socks5h://xxxxx"才能生效。
|
150 |
+
|
151 |
+
|
152 |
+
|
153 |
+
## 其他设置
|
154 |
+
**保存设置按钮, 会保存扫描模型区域,以及其他设置 这两个区域的选项**
|
155 |
+
|
156 |
+
* "一直显示按钮" 是为了方便触屏。
|
157 |
+
* "小图模式显示功能按钮" 会开关功能按钮在小图模式的显示
|
158 |
+
![](img/other_setting.jpg)
|
159 |
+
|
160 |
+
## 预览图
|
161 |
+
Extra Network支持两种预览图命名:`model_name.png` 和 `model_name.preview.png`。其中,`model_name.png`优先级较高。
|
162 |
+
|
163 |
+
当优先级较高的预览图不存在,他就会自动使用`model_name.preview.png`。
|
164 |
+
|
165 |
+
这样,你自己创建的预览图 和 网络下载的预览图,能够同时存在,并优先使用你自己创建的。
|
166 |
+
|
167 |
+
## 关键词
|
168 |
+
卡片上,添加关键词按钮,是添加从civitai预览图中得到的关键词,而不是你自己创建的图片的关键词。
|
169 |
+
|
170 |
+
civitai不是每个图片都有关键词,一个模型中,也不是所有预览图关键词都一样。所以这里是遍历所有civitai预览图信息,加载第一个有关键词的。
|
171 |
+
|
172 |
+
|
173 |
+
## SHA256
|
174 |
+
为了创建文件的SHA256,插件需要读取整个文件。对于大尺寸文件,就会很慢。
|
175 |
+
|
176 |
+
有两种情况,这个SHA256无法从civitai找到对应模型:
|
177 |
+
* 太老的模型,civitai没有存储SHA256.
|
178 |
+
* 模型作者,静静的换掉了模型文件,但没有修改描述和版本。所以,虽然网页上看不出来,但实际上civitai上的 和你本地的模型文件,已经不是同一个文件了。
|
179 |
+
|
180 |
+
这些情况下,你可以在插件上,通过提供模型页面的url,来获取模型信息文件。
|
181 |
+
|
182 |
+
|
183 |
+
|
184 |
+
## 新特性
|
185 |
+
从v1.5开始,v1.x不再接受任何新特性。所有新特性进入2.x。
|
186 |
+
|
187 |
+
2.x专注于自定义模型信息,并可能改名为"Model Info Helper"。因为不再是专注Civitai了。
|
188 |
+
|
189 |
+
从v1.5开始。v1.x进入维护阶段。
|
190 |
+
|
191 |
+
|
192 |
+
Enjoy!
|
193 |
+
|
194 |
+
|
195 |
+
## 常见问题
|
196 |
+
### 4个卡片按钮不显示
|
197 |
+
#### 汉化原因
|
198 |
+
下载新版,最新版已经处理汉化导致的问题。**双语汉化插件需要v1.6.1.1之后的版本才开始支持。**
|
199 |
+
|
200 |
+
#### 使用了云端汉化功能
|
201 |
+
如果是秋叶启动器,就关闭启动器“云端汉化”功能。如果是专门的云端汉化插件,就换用普通汉化插件。
|
202 |
+
|
203 |
+
#### 其他情况
|
204 |
+
首先,确保你点过了"Refresh Civitai Helper"刷新按钮。
|
205 |
+
|
206 |
+
然后,如果还有这个问题,那么唯一原因,是你没有使用最新版SD webui。
|
207 |
+
|
208 |
+
如果���修改过SD webui的文件, 你的更新操作可能会失败。你需要检查git命令行的输出信息,来确定你更新成功了。
|
209 |
+
|
210 |
+
git在很多时候,会拒绝升级,并告诉你有些冲突需要你手动先解决。如果你不看命令行输出,你就会以为你已经更新成功了,但其实并没有。
|
211 |
+
|
212 |
+
|
213 |
+
### Request model info from civitai
|
214 |
+
意思就是正在连接civitai,如果没有后面的信息,就是连不上,请挂代理。
|
215 |
+
|
216 |
+
|
217 |
+
### 扫描或获取模型信息失败
|
218 |
+
这个插件现在很稳定,所以,这个问题的原因,基本是是因为Civitai拒绝了你的连接请求。
|
219 |
+
|
220 |
+
Civitai不像那些大网站那么稳定。他网站会挂,会拒绝API连接,还会把API请求转到真人验证页面,来挡住。
|
221 |
+
|
222 |
+
Civitai还有连接池的设定。基本上,就是同时能允许的最大连接数。一旦达到这个数字,接下来的API连接请求,都会被拒绝。
|
223 |
+
|
224 |
+
所以,这种时候你只能等一下再试。
|
225 |
+
|
226 |
+
另外,对于国内用户,还有代理问题。现在国内都要用代理才能连上。
|
227 |
+
|
228 |
+
|
229 |
+
### 扫描之后得到了错误的预览图和模型信息
|
230 |
+
坏消息是,有些模型在civitai数据库中,保存的sha256完全是错的。查看下面的issue了解详情:
|
231 |
+
[https://github.com/civitai/civitai/issues/426](https://github.com/civitai/civitai/issues/426)
|
232 |
+
|
233 |
+
对于这种模型,那这个插件自然就无法获得正确的模型信息和预览图。
|
234 |
+
|
235 |
+
这种情况下,请删除扫描得到的模型信息和预览图,在插件界面提供正确的模型url来获取。
|
236 |
+
|
237 |
+
另外,civitai官方有个页面,专门用于回报带有错误sha256的模型:
|
238 |
+
[https://discord.com/channels/1037799583784370196/1096271712959615100/1096271712959615100](https://discord.com/channels/1037799583784370196/1096271712959615100/1096271712959615100)
|
239 |
+
|
240 |
+
请把这类模型反馈给civitai,好让他们进行修复。
|
241 |
+
|
242 |
+
|
243 |
+
|
244 |
+
|
245 |
+
### 使用colab时扫描失败
|
246 |
+
首先,在google中搜索你看到的错误信息。更有可能是,你碰到的是个colab的问题。
|
247 |
+
|
248 |
+
然后,如果colab连接了google drive,会有一次性访问文件数量的限制,而导致扫描失败。这是google drive的限制,请自行google搜索了解详情。
|
249 |
+
|
250 |
+
|
251 |
+
|
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/README.jp.md
ADDED
@@ -0,0 +1,236 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# この文書はChatGPTによって英語から翻訳されました。
|
2 |
+
|
3 |
+
**[寄稿者](https://github.com/zixaphir/Stable-Diffusion-Webui-Civitai-Helper/graphs/contributors)**
|
4 |
+
|
5 |
+
### Language
|
6 |
+
[中文(ChatGPT)](README.cn.md)
|
7 |
+
[English](README.md)
|
8 |
+
[한국어(ChatGPT)](README.kr.md)
|
9 |
+
|
10 |
+
## Civitai Helperについて
|
11 |
+
|
12 |
+
この拡張機能は、Civitaiからモデルとモデルのメタデータをダウンロードできる機能を提供します。Civitaiにホストされているモデルのアクティベーションキーワード、モデルの説明、バージョン情報、モデルのプレビューなどのデータが、安定した拡散WebUIから離れることなく手に入ります。
|
13 |
+
|
14 |
+
## このバージョンのCivitai Helperについて
|
15 |
+
|
16 |
+
これは私の個人的なバージョンのStable-Diffusion-Webui-Civitai-Helperです。SD-webui v1.5がリリースされたとき、私が使用していたバージョンが壊れたため、完全に新たに始めました。それ以来、自分が必要とする機能を追加し、古いバージョンのsd-webuiとの互換性を維持するために最善の努力をしましたが、古いバージョンは使用しないため、古いバージョンでのテストは行いません。
|
17 |
+
|
18 |
+
私はできる限りこれを動作させるつもりですが、これは単なる趣味のプロジェクトであり、他のより経験豊富な拡張機能開発者と比べてスキルが圧倒的に不足しています。私は長い間姿を消すことがあり、興味を失った場合は恐らく永遠になるかもしれません。私はエラーを起こしやすく、バグが予想されます。
|
19 |
+
|
20 |
+
もしもっと興味を持った誰かが開発を引き継ぐことを決定した場合、喜んでこのプロジェクトの制御権を譲渡し、彼らのプロジェクトへの変更を希望される場合にはそれをサポートします。
|
21 |
+
|
22 |
+
# お知らせ
|
23 |
+
**この拡張機能は現在、非常に安定しています。もし問題があれば、コンソールログの詳細を確認し、[よくある質問](#よくある質問)を確認してください。**
|
24 |
+
|
25 |
+
# Civitai Helper
|
26 |
+
この拡張機能は、Civitaiのモデルをより簡単に扱えるようにするためのものです。
|
27 |
+
|
28 |
+
Civitai: [Civitai Url](https://civitai.com/models/16768/civitai-helper-sd-webui-civitai-extension)
|
29 |
+
|
30 |
+
# 機能
|
31 |
+
* 全てのモデルをスキャンし、Civitaiからモデル情報とプレビューをダウンロード
|
32 |
+
* CivitaiモデルページのURLを使って、ローカルモデルとCivitaiモデル情報を取得
|
33 |
+
* CivitaiモデルページのURLから、モデル(情報とプレビューを含む)をSDディレクトリまたはサブディレクトリにダウンロードする。
|
34 |
+
* ダウンロードは途中から再開可能
|
35 |
+
* ローカルのモデルとCivitai上の新しいバージョンを一括でチェック
|
36 |
+
* 新しいバージョンのモデルを直接モデルのディレクトリにダウンロード(情報とプレビュー画像を含む)
|
37 |
+
* 内蔵の**Extra Network**モデルカードを変更し、各カードに以下の機能ボタンを追加しました。
|
38 |
+
- 🖼: `replace preview`のテキストをこのアイコンに変更
|
39 |
+
- 🌐: このモデルのCivitaiページを新しいタブで開く
|
40 |
+
- 💡: このモデルのトリガーワードをキーワード入力欄に一括で追加する
|
41 |
+
- 🏷: このモデルのプレビュー画像で使用されているキーワードを一括で使用する
|
42 |
+
* 上記の追加機能ボタンは、サムネイルモードにも対応しています。
|
43 |
+
* タッチスクリーンデバイス向けに、常に表示されるボタンのオプションを追加しました。
|
44 |
+
|
45 |
+
|
46 |
+
# インストール
|
47 |
+
SD webui's extensionタブから、`Install from url`のタブに移動。
|
48 |
+
このリポジトリのURLをコピーペーストし、インストールする。
|
49 |
+
|
50 |
+
または、このリポジトリをzipでダウンロードし、`./webui/extensions`へ展開してください。
|
51 |
+
|
52 |
+
この拡張機能をインストール、またはアップデートするたびに、SD Webui再起動する必要があります。
|
53 |
+
この拡張機能は、**UIを再読み込みする**だけでは動作しません。
|
54 |
+
|
55 |
+
# 使い方
|
56 |
+
|
57 |
+
## WebUIをアップデート
|
58 |
+
この拡張機能は`network cards id`を取得する必要があります。この機能は**2023-02-06**に追加されました。
|
59 |
+
**SD webuiがこれより前のバージョンである場合は、アップデートする必要があります!**
|
60 |
+
|
61 |
+
## モデルのスキャン
|
62 |
+
拡張機能タブから<kbd>Civitai Helper</kbd>へ。
|
63 |
+
<kbd>Scan model</kbd>というボタンがあります。
|
64 |
+
|
65 |
+
![](img/extension_tab.jpg)
|
66 |
+
|
67 |
+
これをクリックすると、拡張機能がすべてのモデルをスキャンしてSHA256ハッシュを生成し、それを使ってCivitaiからモデル情報とプレビュー画像を取得します。
|
68 |
+
**スキャンには時間がかかります。 終了までお待ちください。**
|
69 |
+
|
70 |
+
各モデルに対して、Civitaiからすべてのモデル情報を保存するためのjsonファイルを作成します。このモデル情報ファイルは、modelsディレクトリ内の`Your_model_name.civitai.info`となります。
|
71 |
+
|
72 |
+
![](img/model_info_file.jpg)
|
73 |
+
|
74 |
+
モデル情報ファイルがすでに存在する場合は、スキップされます。Civitaiでモデルが見つからない場合、空のモデル情報ファイルを作成するので、モデルが2回スキャンされることはありません。
|
75 |
+
|
76 |
+
### 新しいモデルを追加
|
77 |
+
新規のモデルがある場合、もう一度スキャンボタンをクリックするだけで、新しいモデルの情報とプレビューを取得できます。同じモデルを2回スキャンすることはありません。
|
78 |
+
|
79 |
+
## モデルカード
|
80 |
+
**(スキャン終了後に使用)**
|
81 |
+
SD webuiの`Extra Network`タブを開き、モデルカードを表示します。
|
82 |
+
|
83 |
+
![](img/extra_network.jpg)
|
84 |
+
|
85 |
+
|
86 |
+
マウスをモデルカードの下部に移動すると、4つのボタンが表示されます。
|
87 |
+
- 🖼: プレビューを置き換えるためのテキストを`replace preview`からこのアイコンに変更します
|
88 |
+
- 🌐: このモデルのCivitaiページを新しいタブで開きます
|
89 |
+
- 💡: このモデルのトリガーワードをキーワード入力欄に一括追加します
|
90 |
+
- 🏷: このモデルのプレビュー画像に使用されているキーワードを一括で使用します
|
91 |
+
|
92 |
+
![](img/model_card.jpg)
|
93 |
+
|
94 |
+
これらのボタンが表示されない場合は、<kbd>Refresh Civitai Helper</kbd>をクリックすると、ボタンがカードに再追加されます。
|
95 |
+
|
96 |
+
![](img/refresh_ch.jpg)
|
97 |
+
|
98 |
+
`Extra Network`が更新されるたびに、余分な変更が削除され、ボタンが消えてしまいます。その場合は、「Refresh Civitai Helper」をクリックして、これらの機能を再度追加する必要があります。
|
99 |
+
|
100 |
+
|
101 |
+
### サムネイル
|
102 |
+
これらのボタンは、サムネイルをサポートしていますが、SD WebuiのCSSの問題により、現在は常に表示か非表示かのどちらかに制限されています。マウスをスライドして表示することはできません。
|
103 |
+
![](img/thumb_mode.jpg)
|
104 |
+
|
105 |
+
|
106 |
+
## ダウンロード
|
107 |
+
**(タスクが一つ完了してから、次のタスクをダウンロードしてください)**
|
108 |
+
CivitaiモデルページのURLを使用してモデルをダウンロードするには、3つのステップが必要です。
|
109 |
+
1. URLを入力し、モデル情報を取得するためにボタンをクリック
|
110 |
+
2. 拡張機能が自動的にモデル名とタイプを入力します。ダウンロードするサブディレクトリとモデルバージョンを選択
|
111 |
+
3. ダウンロードをクリックします
|
112 |
+
![](img/download_model.jpg)
|
113 |
+
|
114 |
+
ダウンロード状況は、CLIに進行状況バーを表示します。
|
115 |
+
断片的に再開することができ、大きなファイルをダウンロードする際にも心配する必要はありません。
|
116 |
+
|
117 |
+
|
118 |
+
## 新しいモデルのバージョンを確認する
|
119 |
+
モデルの種類に従って、ローカルのモデルを一括でCivitaiの新バージョンがないかをチェックすることができます。複数のモデルの種類を選択できます。
|
120 |
+
![](img/check_model_new_version.jpg)
|
121 |
+
|
122 |
+
これを押すと、各モデルをチェックするたびに1秒の遅延が発生するため、速度がやや遅くなります。
|
123 |
+
|
124 |
+
これは、本拡張機能のユーザーの過失によるDDoSを回避し、Civitaiを保護するために行われます。
|
125 |
+
一部のクラウドサービスプロバイダーには、「無料ユーザーのAPIリクエストは1秒あたり1回を超えてはいけない」というような保護があります。Civitaiにはまだこのような設定がありませんが、我々はそれを自衛しなければなりません。
|
126 |
+
なぜなら、もしCivitaiがダウンした場合、誰にとっても良いことではないからです。
|
127 |
+
|
128 |
+
チェックが完了すると、すべての新しいバージョンがUIに表示されます。
|
129 |
+
|
130 |
+
各モデルの新しいバージョンには、3つのリンクがあります。
|
131 |
+
* 最初のものは、このモデルのWebページです。
|
132 |
+
* 2つ目は、この新しいバージョンのダウンロードアドレスです。
|
133 |
+
* 3つ目は、Python(拡張機能)側で新しいバージョンをモデルディレクトリに直接ダウンロードするボタンです。
|
134 |
+
この方法でダウンロードすると、ダウンロードの詳細が「Download Model」の領域とコマンドラインに表示されます。一度に1つのタスクしかサポートされていません。
|
135 |
+
![](img/check_model_new_version_output.jpg)
|
136 |
+
|
137 |
+
|
138 |
+
|
139 |
+
## URLからモデル情報を取得する
|
140 |
+
Civitai上で自分のモデルのSHA256が見つからない場合でも、自分��モデルをCivitaiモデルに接続したい場合は、この拡張機能のページから、モデルをリストから選択し、CivitaiモデルページのURLを提供することができます。
|
141 |
+
|
142 |
+
ボタンをクリックすると、拡張機能はCivitaiモデルの情報をダウンロードし、それをローカルモデルの情報として使用します。
|
143 |
+
|
144 |
+
![](img/get_one_model_info.jpg)
|
145 |
+
|
146 |
+
|
147 |
+
|
148 |
+
## その他の設定
|
149 |
+
**設定保存ボタンを押すと、<kbd>Scan Model</kbd>の設定とその他の設定の両方が保存されます。**
|
150 |
+
|
151 |
+
* <kbd>Always Display Button</kbd>は、タッチデバイスでの操作を容易にするためです。
|
152 |
+
* <kbd>Show Buttons on Thumb Mode</kbd>は、小さな画像モードでの機能ボタンの表示を切り替えます。
|
153 |
+
![](img/other_setting.jpg)
|
154 |
+
|
155 |
+
## プレビュー
|
156 |
+
Extra Networkは、2つのプレビュー画像の命名をサポートしています:`model_name.png`と`model_name.preview.png`。
|
157 |
+
デフォルトでは自動で`model_name.png`が優先的に使われます。
|
158 |
+
|
159 |
+
優先度が高いプレビュー画像が存在しない場合は、自動的に`model_name.preview.png`が使用されます。
|
160 |
+
|
161 |
+
これにより、自分で作成したプレビュー画像とネットからダウンロードしたプレビュー画像を同時に使用し、自分で作成したプレビュー画像を優先的に使用できます。
|
162 |
+
|
163 |
+
## プロンプト
|
164 |
+
カード上の<kbd>Use prompt from preview image</kbd>ボタンは、Civitaiプレビュー画像から取得したキーワードであり、自分で作成した画像のキーワードではありません。
|
165 |
+
|
166 |
+
Civitaiにはすべての画像にキーワードがあるわけではなく、1つのモデルに含まれるすべてのプレビュー画像のキーワードが同じであるわけでもありません。したがって、ここではすべてのCivitaiプレビュー画像情報を走査し、最初にキーワードがあるものを読み込みます。
|
167 |
+
|
168 |
+
|
169 |
+
## SHA256
|
170 |
+
ファイルのSHA256を作成するために、はファイル全体を読み取る必要があります。大きなファイルの場合、処理が遅くなります。
|
171 |
+
|
172 |
+
Civitaiで対応するモデルのSHA256が見つからない場合は、次の2つの場合が考えられます:
|
173 |
+
* 古すぎるモデルには、SHA256が保存されていません。
|
174 |
+
* モデルの作成者が静かにモデルファイルを変更しましたが、説明やバージョンを変更していないため、サイト上ではわかりませんが、実際にはCivitaiに保存されているモデルファイルとローカルのモデルファイルは異なるものとなっています。
|
175 |
+
|
176 |
+
これらの場合は、拡張機能にモデルページのURLを提供することで、モデルの情報ファイルを取得できます。
|
177 |
+
|
178 |
+
## Feature Request
|
179 |
+
v1.5以降のv1.xには新機能はありません。すべての新機能は2.xに移行されます。
|
180 |
+
2.xでは、カスタムモデル情報にフォーカスし、Civitaiだけではなく、`Model Info Helper`という名称に変更する可能性があります。
|
181 |
+
v1.5からv1.xはメンテナンスのフェーズに入ります。
|
182 |
+
|
183 |
+
お楽しみに!
|
184 |
+
|
185 |
+
|
186 |
+
## よくある質問
|
187 |
+
### 4つのカードボタンが表示されない
|
188 |
+
#### ローカライズの問題
|
189 |
+
新しいバージョンをダウンロードしてください。
|
190 |
+
最新バージョンでは、ローカライズによる問題が解決されています。
|
191 |
+
[バイリンガル拡張機能](https://github.com/journey-ad/sd-webui-bilingual-localization)は、v1.6.1.1以降のバージョンでサポートされるようになりました。
|
192 |
+
|
193 |
+
#### クラウドサービスベースの翻訳機能を使用した
|
194 |
+
クラウドサービスベースの翻訳機能を使用している場合は、通常のローカライズに変更してください。
|
195 |
+
|
196 |
+
#### その他の場合
|
197 |
+
まず、<kbd>Refresh Civitai Helper</kbd>をクリックして更新しましたか?
|
198 |
+
|
199 |
+
それでもこの問題が発生する場合は、おそらく最新バージョンのSD webuiを使用していないためです。
|
200 |
+
|
201 |
+
SD webuiのファイルを変更した場合、更新操作が失敗する可能性があります。更新が成功したかどうかを確認するには、gitコマンドラインの出力情報を確認する必要があります。
|
202 |
+
|
203 |
+
gitは、多くの場合、アップグレードを拒否し、手動で解決する必要があるいくつかの競合状態を示します。コマンドライン出力を見ない場合、更新が成功したと思うかもしれませんが、実際には成功していません。
|
204 |
+
|
205 |
+
|
206 |
+
### Request model info from civitai
|
207 |
+
これはcivitaiに接続しています。情報がない場合は接続できないため、プロキシを使用してください。
|
208 |
+
|
209 |
+
|
210 |
+
### スキャンまたはモデル情報の取得に失敗しました
|
211 |
+
この拡張機能は現在非常に安定しているため、この問題の原因は基本��にはCivitaiが接続要求を拒否したためです。
|
212 |
+
|
213 |
+
Civitaiは大きなウェブサイトとは異なり、安定していません。彼らのウェブサイトはダウンしたり、API接続を拒否したり、APIリクエストをCpatchaページに転送してブロックしたりすることがあります。
|
214 |
+
|
215 |
+
Civitaiには接続プールの上限もあります。基本的に、同時に許可される最大接続数です。この数字に達すると、以降のAPI接続要求はすべて拒否されます。
|
216 |
+
|
217 |
+
そのため、このような場合はしばらく待ってから再試行するしかありません。
|
218 |
+
|
219 |
+
### civitaiから誤ったモデル情報とプレビュー画像を取得する(Translated by ChatGPT)
|
220 |
+
悪いニュースですが、civitaiのデータベースには誤ったsha256で保存されたモデルがいくつかあります。詳細についてはこちらをご覧ください:
|
221 |
+
[https://github.com/civitai/civitai/issues/426](https://github.com/civitai/civitai/issues/426)
|
222 |
+
|
223 |
+
したがって、これらのモデルについては、この拡張機能では正しいモデル情報やプレビュー画像を取得できません。
|
224 |
+
|
225 |
+
この場合、モデル情報ファイルを削除し、この拡張機能のタブページでcivitaiのURLから正しいモデル情報を取得する必要があります。
|
226 |
+
|
227 |
+
また、誤ったsha256を持つこれらのモデルをcivitaiに報告することもできます。
|
228 |
+
[https://discord.com/channels/1037799583784370196/1096271712959615100/1096271712959615100](https://discord.com/channels/1037799583784370196/1096271712959615100/1096271712959615100)
|
229 |
+
|
230 |
+
civitaiにそのモデルを報告して修正してもらうようにしてください。
|
231 |
+
|
232 |
+
|
233 |
+
### colabを使用した際にスキャンに失敗する
|
234 |
+
まず、表示されたエラーメッセージをGoogleで検索してください。おそらくcolabの問題が発生している可能性があります。表示されたエラーメッセージを検索して、原因を特定してください。
|
235 |
+
|
236 |
+
Google Driveに接続する際には、ファイルへのアクセス数に制限があるため、スキャンが失敗することがよくあります。これはGoogle Drive側の制限です。詳細についてはインターネットで[検索](https://google.com)してください。
|
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/README.kr.md
ADDED
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# 이 문서는 ChatGPT에 의해 영어로 번역되었습니다.
|
2 |
+
|
3 |
+
**[기여자](https://github.com/zixaphir/Stable-Diffusion-Webui-Civitai-Helper/graphs/contributors)**
|
4 |
+
|
5 |
+
## Civitai Helper 소개
|
6 |
+
|
7 |
+
이 확장 프로그램은 Civitai에서 모델 및 모델 메타데이터를 다운로드하는 기능을 제공합니다. Civitai에서 호스팅되는 모델에 대한 활성화 키워드, 모델 설명, 버전 정보 및 모델 미리보기와 같은 데이터를 안정적인 확산 웹 사용자 인터페이스에서 벗어나지 않고도 손쉽게 얻을 수 있습니다.
|
8 |
+
|
9 |
+
## 이 버전의 Civitai Helper에 대해
|
10 |
+
|
11 |
+
이것은 Stable-Diffusion-Webui-Civitai-Helper의 개인 버전입니다. SD-webui v1.5가 출시될 때 사용하던 버전이 고장나서 필요한 경우에 완전히 시작했습니다. 그 이후로 원하는 기능을 추가했으며, 이전 버전의 sd-webui와의 호환성을 유지하기 위해 최선의 노력을 기울였지만, 이전 버전을 사용하지 않고 테스트하지 않기 때문에 이전 버전에서의 테스트는 하지 않습니다.
|
12 |
+
|
13 |
+
가능한 한 오랫동안 이 작업을 계속할 계획이지만, 이것은 단순히 취미 프로젝트일 뿐이며, 다른 확장 프로그램 개발자들보다 경험이 풍부하지 않습니다. 때때로 오랜 기간 동안 사라질 가능성이 있으며, 흥미를 잃으면 아마 영원히 그렇게 될 것입니다. 오류를 범하기 쉽고 버그가 예상됩니다.
|
14 |
+
|
15 |
+
더 관심 있는 사람이 개발을 진행하기로 결정하면, 이 프로젝트의 제어권을 기꺼이 양도하고 원하는 경우 그들의 프로젝트로 변경 사항을 밀어넣을 것을 시도할 것입니다.
|
16 |
+
|
17 |
+
# 주의사항
|
18 |
+
**이 플러그인은 지금 매우 안정적이며 많은 사용자들이 잘 사용하고 있습니다. 문제가 발생하면, [자주 묻는 질문](#자주-묻는-질문)을 먼저 확인하고 명령 프롬프트 창의 세부 정보를 확인하세요.**
|
19 |
+
|
20 |
+
|
21 |
+
# 기능
|
22 |
+
* 모든 모델을 스캔하여 Civitai에서 모델 정보 및 미리보기 이미지 다운로드
|
23 |
+
* Civitai 모델 페이지 URL을 통해 로컬 모델 및 Civitai 모델 정보 연결
|
24 |
+
* Civitai 모델 페이지 URL을 통해 모델(정보 및 미리보기 이미지 포함) 다운로드하여 SD 디렉토리 또는 하위 디렉토리에 저장
|
25 |
+
* 이어받기 지원 다운로드
|
26 |
+
* 로컬 모델에서 Civitai에 새 버전이 있는지 일괄 확인
|
27 |
+
* 새 버전 모델을 SD 모델 디렉토리에 직접 다운로드(정보 및 미리보기 이미지 포함)
|
28 |
+
* "Extra Network" 모델 카드 내부를 수정하여 다음과 같은 기능 버튼을 추가:
|
29 |
+
- 🖼: "replace preview" 텍스트를 이 아이콘으로 변경
|
30 |
+
- 🌐: 해당 모델의 Civitai 페이지를 새 탭에서 열기
|
31 |
+
- 💡: 이 모델의 트리거 단어를 키워드 입력란에 일괄 추가
|
32 |
+
- 🏷: 이 모델 미리보기 이미지에 사용된 키워드 사용
|
33 |
+
* 위의 추가 기능 버튼은 썸네일 모드를 지원합니다.
|
34 |
+
* 터치 스크린 사용자를 위해 항상 표시되는 버튼 옵션 추가
|
35 |
+
|
36 |
+
|
37 |
+
# 설치
|
38 |
+
이 프로젝트를 zip 파일로 다운로드하고 SD webui 디렉토리/extensions에 압축 해제하면 됩니다.
|
39 |
+
|
40 |
+
이 플러그인을 설치하거나 업그레이드하려면 SD Webui를 완전히 종료하고 다시 시작해야 합니다. UI 다시로드는 작동하지 않습니다.
|
41 |
+
|
42 |
+
# 사용 방법
|
43 |
+
|
44 |
+
## SD Webui 업데이트
|
45 |
+
이 확장 기능은 Extra Network 카드 목록 ID를 가져와야 합니다. 이것은 2023-02-06에 SD Webui에 추가된 것입니다.
|
46 |
+
|
47 |
+
따라서, 만약 사용 중인 버전이 이보다 이전 버전이라면, 먼저 SD Webui를 업데이트해야 합니다!
|
48 |
+
|
49 |
+
|
50 |
+
## 모델 스캔
|
51 |
+
확장 페이지 "Civitai Helper"로 이동하고 "Scan Model"이라는 버튼을 클릭합니다.
|
52 |
+
|
53 |
+
![](img/extension_tab.jpg)
|
54 |
+
|
55 |
+
클릭하면 모든 모델을 스캔하고 SHA256 코드를 생성하여 Civitai에서 모델 정보 및 미리보기 이미지를 가져옵니다. 스캔에는 시간이 걸리므로 인내심을 가지고 기다려주세요.
|
56 |
+
|
57 |
+
이 확장 기능은 각 모델마다 Civitai에서 얻은 모델 정보를 저장하는 JSON 파일을 생성합니다. 이 파일은 모델이 있는 디렉토리에 "모델 이름.civitai.info"라는 이름으로 저장됩니다.
|
58 |
+
|
59 |
+
![](img/model_info_file.jpg)
|
60 |
+
|
61 |
+
모델 정보 파일이 이미 존재하는 경우 해당 모델은 스캔하지 않습니다. 모델이 Civitai가 아닌 경우 빈 정보 파일이 생성되어 나중에 중복 스캔을 피합니다.
|
62 |
+
|
63 |
+
### 새 모델 추가
|
64 |
+
새 모델을 다운로드한 후 스캔 버튼을 다시 클릭하면 됩니다. 이미 스캔된 파일은 다시 스캔하지 않으며 새 모델의 정보와 미리보기 이미지를 자동으로 얻을 수 있습니다. SD Webui를 다시 시작할 필요가 없습니다.
|
65 |
+
|
66 |
+
## 모델 카드
|
67 |
+
**(스캔을 완료한 후에 카드 기능을 사용하세요)**
|
68 |
+
SD Webui의 내장 "Extra Network" 페이지를 열어 모델 카드를 표시합니다.
|
69 |
+
|
70 |
+
![](img/extra_network.jpg)
|
71 |
+
|
72 |
+
|
73 |
+
마우스를 모델 카드 아래쪽으로 이동하면 4개의 버튼이 표시됩니다:
|
74 |
+
- 🖼: "replace preview" 텍스트를이 아이콘으로 변경
|
75 |
+
- 🌐:이 모델의 Civitai 페이지를 새 탭에서 엽니다.
|
76 |
+
- 💡:이 모델의 트리거 단어를 키워드 입력 상자에 추가합니다.
|
77 |
+
- 🏷:이 모델 미리보기에 사용되는 키워드를 사용합니다.
|
78 |
+
|
79 |
+
![](img/model_card.jpg)
|
80 |
+
|
81 |
+
이러한 추가 버튼이 표시되지 않으면 Refresh Civitai Helper를 클릭하여 다시 추가하십시오.
|
82 |
+
|
83 |
+
![](img/refresh_ch.jpg)
|
84 |
+
|
85 |
+
Extra Network가 새로 고침될 때마다이 추가 수정이 제거되므로 버튼이 사라지면 Refresh Civitai Helper를 클릭하여 기능을 다시 추가해야합니다.
|
86 |
+
|
87 |
+
|
88 |
+
### 작은 미리보기 모드
|
89 |
+
이러한 기능 버튼은 작은 미리보기 모드를 지원하지만 SD Webui의 CSS 문제로 인해 현재 항상 표시하거나 항상 표시하지 않아야합니다.
|
90 |
+
![](img/thumb_mode.jpg)
|
91 |
+
|
92 |
+
## 다운로드
|
93 |
+
**(한 번에 하나씩, 하나를 다운로드하고 다른 것을 다운로드하세요)**
|
94 |
+
Civitai 모델 페이지 URL을 통해 모델을 다운로드하려면 3 단계가 필요합니다:
|
95 |
+
* URL을 입력하고 모델 정보를 가져 오는 버튼을 클릭합니다.
|
96 |
+
* 확장 프로그램이 모델 이름과 유형을 자동으로 입력합니다. 다운로드 할 하위 디렉토리와 모델 버전을 선택해야합니다.
|
97 |
+
* 다운로드를 클릭하십시오.
|
98 |
+
![](img/download_model.jpg)
|
99 |
+
|
100 |
+
다운로드 과정은 진행률 표시 줄이있는 명령 줄 인터페이스에서 표시됩니다.
|
101 |
+
일시 중지 및 다시 시작을 지원하며 대용량 파일도 문제없이 처리합니다.
|
102 |
+
|
103 |
+
|
104 |
+
## 일괄적으로 모델 새 버전 확인
|
105 |
+
Civitai에서 새 버전을 확인하기 위해 로컬 모델을 모델 유형 별로 일괄적으로 확인할 수 있습니다. 여러 모델 유형을 선택할 수 있습니다.
|
106 |
+
![](img/check_model_new_version.jpg)
|
107 |
+
|
108 |
+
새 버전을 확인 할 때마다 모델이 모두 확인 될 때까지 1 초의 지연이 있으므로 속도가 다소 느립니다.
|
109 |
+
|
110 |
+
이것은 Civitai가 이 플러그인으로 인해 일시적으로 DDos와 유사한 상황에 빠지지 않도록 보호하기 위한 것입니다. 일부 클라우드 서비스 제공 업체는 "무료 사용자의 초당 API 요청 수는 1 회를 초과 할 수 없다"는 보호 메커니즘이 있습니다. Civitai는 이러한 설정이 없습니다. 그러나 우리는 여전히 그것을 보호해야합니다. 왜냐하면 그것이 다운되면 모두에게 좋지 않기 때문입니다.
|
111 |
+
|
112 |
+
확인이 완료되면 다음과 같이 UI에 모든 새 버전을 찾은 정보가 표시됩니다.
|
113 |
+
|
114 |
+
각 모델 새 버전에는 3 개의 링크가 있습니다.
|
115 |
+
* 첫 번째는 이 모델의 웹 페이지입니다.
|
116 |
+
* 두 번째는이 새 버전의 다운로드 주소입니다.
|
117 |
+
* 세 번째는 버튼입니다. Python 측에서 새 버전을 모델 디렉토리로 직접 다운로드합니다.
|
118 |
+
이 방식으로 다운로드하면 "모델 다운로드" 영역과 명령 줄 창에 다운로드 세부 정보가 표시됩니다. 한 번에 하나의 작업만 지원됩니다.
|
119 |
+
![](img/check_model_new_version_output.jpg)
|
120 |
+
|
121 |
+
|
122 |
+
|
123 |
+
## URL을 기반으로 모델 정보 가져오기
|
124 |
+
Civitai에서 모델의 SHA256을 찾을 수 없지만 여전히 Civitai 모델에 모델을 연결하고 싶다면 해당 확장 프로그램 페이지에서 모델을 선택하고 Civitai 모델 페이지의 URL을 제공할 수 있습니다.
|
125 |
+
|
126 |
+
버튼을 클릭하면 확장 프로그램이 해당 Civitai 모델의 정보를 다운로드하여 로컬 모델의 정보로 사용합니다.
|
127 |
+
|
128 |
+
![](img/get_one_model_info.jpg)
|
129 |
+
|
130 |
+
|
131 |
+
|
132 |
+
## 기타 설정
|
133 |
+
**설정 저장 버튼은 스캔 모델 영역 및 기타 설정 두 영역의 옵션을 저장합니다.**
|
134 |
+
|
135 |
+
* "항상 표시 버튼"은 터치 스크린에서 편리하게 사용하기 위한 것입니다.
|
136 |
+
* "작은 그림 모드에서 기능 버튼 표시"는 작은 그림 모드에서 기능 버튼을 표시할지 여부를 전환합니다.
|
137 |
+
![](img/other_setting.jpg)
|
138 |
+
|
139 |
+
## 미리보기 이미지
|
140 |
+
Extra Network는 model_name.png 및 model_name.preview.png 두 가지 미리보기 이미지 이름을 지원합니다. 여기서 model_name.png이 우선순위가 높습니다.
|
141 |
+
|
142 |
+
우선순위가 높은 미리보기 이미지가 없으면 자동으로 model_name.preview.png를 사용합니다.
|
143 |
+
|
144 |
+
이렇게 하면 직접 만든 미리보기 이미지와 인터넷에서 다운로드한 미리보기 이미지를 함께 사용할 수 있으며, 우선순위는 직접 만든 이미지가 높습니다.
|
145 |
+
|
146 |
+
## 키워드
|
147 |
+
카드에 키워드 추가 버튼은 civitai 미리보기 이미지에서 얻은 키워드를 추가하는 것이며, 사용자가 직접 만든 이미지의 키워드가 아닙니다.
|
148 |
+
|
149 |
+
모든 이미지에 키워드가 있는 것은 아니며, 모델에 따라 미리��기 이미지의 키워드가 모두 같지 않을 수 있습니다. 따라서 여기서는 civitai 모든 미리보기 이미지 정보를 탐색하여 첫 번째 키워드가 있는 이미지를 로드합니다.
|
150 |
+
|
151 |
+
|
152 |
+
## SHA256
|
153 |
+
파일의 SHA256을 생성하려면 플러그인에서 전체 파일을 읽어야 합니다. 대형 파일의 경우 시스템이 느려질 수 있습니다.
|
154 |
+
|
155 |
+
SHA256은 civitai에서 해당 모델을 찾을 수 없는 두 가지 경우가 있습니다.
|
156 |
+
* 너무 오래된 모델이므로 civitai에 SHA256이 저장되어 있지 않습니다.
|
157 |
+
* 모델 작성자가 모델 파일을 조용히 교체했지만 설명 및 버전을 수정하지 않았습니다. 따라서 웹 페이지에서는 확인할 수 없지만 civitai 및 로컬 모델 파일은 이미 다른 파일입니다.
|
158 |
+
|
159 |
+
이러한 경우에는 플러그인에서 모델 페이지 URL을 제공하여 모델 정보 파일을 얻을 수 있습니다
|
160 |
+
|
161 |
+
|
162 |
+
## 자주 묻는 질문
|
163 |
+
### 4개의 카드 버튼이 표시되지 않습니다.
|
164 |
+
#### 한국어 플러그인을 사용했습니다
|
165 |
+
새 버전을 다운로드하면, 최신 버전에서 한국어 번역으로 인한 문제가 해결되었습니다. 양방향 다국어 플러그인은 v1.6.1.1 이후 버전부터 지원됩니다.
|
166 |
+
|
167 |
+
#### 클라우드 기반 한국어 플러그인을 사용했습니다
|
168 |
+
클라우드 기반 한국어 플러그인을 사용한 경우 일반적인 한국어 플러그인으로 변경하십시오.
|
169 |
+
|
170 |
+
|
171 |
+
#### 다른 경우
|
172 |
+
먼저 "Refresh Civitai Helper" 버튼을 클릭하여 Civitai Helper를 새로고침했는지 확인하세요.
|
173 |
+
|
174 |
+
그런 다음 이 문제가 계속되는 경우, 유일한 이유는 최신 버전의 SD webui를 사용하지 않았기 때문입니다.
|
175 |
+
|
176 |
+
만약 SD webui의 파일을 수정했다면, 업데이트 작업이 실패할 수 있습니다. 업데이트가 제대로 이루어졌는지 확인하려면 git 명령 줄의 출력 정보를 확인해야 합니다.
|
177 |
+
|
178 |
+
git은 종종 업그레이드를 거부하고, 일부 충돌을 수동으로 해결해야 한다는 메시지를 보여줍니다. 명령 줄 출력을 확인하지 않으면 업그레이드가 성공했다고 잘못 생각할 수 있습니다.
|
179 |
+
|
180 |
+
|
181 |
+
### Request model info from civitai
|
182 |
+
이것은 Civitai에 연결하고 있음을 나타내며, 정보가 없으면 연결할 수 없으므로 프록시를 사용해야 합니다.
|
183 |
+
|
184 |
+
|
185 |
+
### 모델 정보 스캔 또는 가져오기 실패
|
186 |
+
이 플러그인은 이제 매우 안정적이므로, 이 문제의 원인은 대부분 Civitai가 연결 요청을 거부했기 때문입니다.
|
187 |
+
|
188 |
+
Civitai는 대형 웹사이트와 같이 안정적이지 않습니다. 웹사이트가 다운되거나 API 연결을 거부할 수 있고, API 요청을 실제 검증 페이지로 전환하여 차단할 수도 있습니다.
|
189 |
+
|
190 |
+
Civitai에는 연결 풀 설정이 있습니다. 이는 동시에 허용되는 최대 연결 수입니다. 이 수치에 도달하면 다음 API 연결 요청은 모두 거부됩니다. 이 때는 잠시 기다렸다가 다시 시도해야 합니다.
|
191 |
+
|
192 |
+
또한 국내 사용자들에게는 프록시 문제가 있습니다. 대개는 프록시를 사용해야만 연결할 수 있습니다.
|
193 |
+
|
194 |
+
|
195 |
+
### civitai에서 잘못된 모델 정보 및 미리보기 이미지 가져오기
|
196 |
+
안타깝게도, civitai의 데이터베이스에 일부 모델이 잘못된 sha256으로 저장되어 있습니다. 자세한 내용은 여기를 확인하십시오:
|
197 |
+
[https://github.com/civitai/civitai/issues/426](https://github.com/civitai/civitai/issues/426)
|
198 |
+
|
199 |
+
따라서 이 확장 프로그램은 해당 모델의 올바른 모델 정보나 미리보기 이미지를 가져올 수 없습니다.
|
200 |
+
|
201 |
+
이 경우 모델 정보 파일을 제거하고 이 확장 프로그램의 탭 페이지에서 civitai url로 올바른 모델 정보를 가져와야 합니다.
|
202 |
+
|
203 |
+
또한, 잘못된 sha256을 가진 해당 모델을 civitai에 신고할 수 있습니다.
|
204 |
+
[https://discord.com/channels/1037799583784370196/1096271712959615100/1096271712959615100](https://discord.com/channels/1037799583784370196/1096271712959615100/1096271712959615100)
|
205 |
+
|
206 |
+
civitai에 그 모델을 신고하여 수정할 수 있도록 해주시기 바랍니다.
|
207 |
+
|
208 |
+
|
209 |
+
### Colab 사용시 스캔 실패
|
210 |
+
먼저 보이는 오류 메시지를 Google에서 검색해보세요. 대개 Colab의 문제일 가능성이 높습니다.
|
211 |
+
|
212 |
+
그리고 Colab이 Google 드라이브에 연결되어 있다면, 파일에 대한 일회성 액세스 제한으로 인해 스캔이 실패할 수 있습니다. 이는 Google 드라이브의 제한 사항으로, 자세한 내용은 Google 검색을 통해 알아보세요.
|
213 |
+
|
214 |
+
|
215 |
+
|
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/README.md
ADDED
@@ -0,0 +1,252 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
**[Contributors](https://github.com/zixaphir/Stable-Diffusion-Webui-Civitai-Helper/graphs/contributors)**
|
2 |
+
|
3 |
+
### Language
|
4 |
+
[中文(ChatGPT)](README.cn.md)
|
5 |
+
[日本語(ChatGPT)](README.jp.md)
|
6 |
+
[한국어(ChatGPT)](README.kr.md)
|
7 |
+
|
8 |
+
## About Civitai Helper
|
9 |
+
This extension provides the ability to download models and model metadata from Civitai. Data such as activation keywords, model description, version information, and model previews for models hosted on Civitai can be at your fingertips without having to navigate away from stable diffusion webui.
|
10 |
+
|
11 |
+
## About This Version of Civitai Helper
|
12 |
+
This is my personal version of Stable-Diffusion-Webui-Civitai-Helper. I started it entirely because the version I was using broke when SD-webui v1.5 came out and I needed it to work. Since then, I have added functionality that I wanted and have made best-effort attempts to maintain compatibility with older versions of sd-webui, but I do not use older versions and therefore do not test on older versions.
|
13 |
+
|
14 |
+
I intend to keep this working for as long as I am able, but this is simply a hobby project and I am nowhere near as skilled as other extension developers with more experience. I am likely to dip out for long periods at a time, possibly forever if I lose interest. I am prone to errors and bugs are to be expected.
|
15 |
+
|
16 |
+
If a more interested part decides to pick up development, I will happily cede control of this project and attempt to push my changes to their projects if they are wanted.
|
17 |
+
|
18 |
+
# Civitai Helper
|
19 |
+
Stable Diffusion Webui Extension for Civitai, to handle your models much more easily.
|
20 |
+
|
21 |
+
Civitai: ![Civitai Url](https://civitai.com/models/16768/civitai-helper-sd-webui-civitai-extension)
|
22 |
+
|
23 |
+
# Features
|
24 |
+
* Scans all models to download model information and preview images from Civitai.
|
25 |
+
* Link local model to a civitai model by civitai model's url
|
26 |
+
* Download a model(with info+preview) by Civitai Url into SD's model folder or subfolder.
|
27 |
+
* Downloading can resume at break-point, which is good for large file.
|
28 |
+
* Checking all your local model's new version from Civitai
|
29 |
+
* Download a new version directly into SD model folder (with info+preview)
|
30 |
+
* Modified Built-in "Extra Network" cards, to add the following buttons on each card:
|
31 |
+
- 🖼️: Modified "replace preview" text into this icon
|
32 |
+
- 🌐: Open this model's Civitai url in a new tab
|
33 |
+
- 💡: Add this model's trigger words to prompt
|
34 |
+
- 🏷️: Use this model's preview image's prompt
|
35 |
+
- ✏️: Rename model
|
36 |
+
- ❌: Remove/Delete model
|
37 |
+
* Above buttons support thumbnail mode of Extra Network in versions of webui prior to 1.5.0.
|
38 |
+
* Thumbnail mode was removed in v1.5.0 of webui and replaced customizable model card sizes.
|
39 |
+
* Option to always show additional buttons, to work with touchscreen.
|
40 |
+
* To the best of my knowledge, this extension should still work in versions of webui prior to v1.5.0, but it is not tested. I make best-effort attempts to write code that *should* maintain compatibility with older versions, but if you have run into problems, please file an issue and I'll attempt to resolve it.
|
41 |
+
|
42 |
+
# Install
|
43 |
+
Go to SD webui's extension tab, go to `Install from url` sub-tab.
|
44 |
+
Copy this project's url into it, click install.
|
45 |
+
|
46 |
+
Alternatively, download this project as a zip file, and unzip it to `Your SD webui folder/extensions`.
|
47 |
+
|
48 |
+
Everytime you install or update this extension, you need to shutdown SD Webui and Relaunch it. Just "Reload UI" won't work for this extension.
|
49 |
+
|
50 |
+
Done.
|
51 |
+
|
52 |
+
## Branches
|
53 |
+
Development of this extension happens in three development branches:
|
54 |
+
* **`master`**: The current version of the extension intended for end users. Out-of-version changes to this branch only exist to hotfix critical issues found after the release of a new version.
|
55 |
+
* **`dev`**: The active development version of this extension. This will always have the most up-to-date changes but is also the most likely to contain bugs
|
56 |
+
* **`v1.6ONLY`**: Not supported and not really intended for anybody except for me. Slowest to update and less tested than other branches, this branch only runs on the latest version of webui. Compatibility code for older versions is actively removed, and whether I'm running it on webui stable or webui dev is in flux. In theory, this is the most optimized version of the extension, but it's often just me chasing waterfalls. Do not submit issues if you use this branch. They will be marked as invalid, closed, and otherwise ignored.
|
57 |
+
|
58 |
+
## Update Your SD Webui
|
59 |
+
This extension need to get extra network's cards id. Which is added since **2023-02-06**.
|
60 |
+
**If your SD webui is an earlier version, you need to update it!**
|
61 |
+
|
62 |
+
### Some of the following information may not up-to-date. Most functionality should be the same or similar, but many changes post-v1.6 have not been documented as of yet. Images may not match 1:1 with the current state of the extension.
|
63 |
+
|
64 |
+
## Scanning Models
|
65 |
+
Go to extension tab "Civitai Helper". There is a button called "Scan model".
|
66 |
+
|
67 |
+
![](img/extension_tab.jpg)
|
68 |
+
|
69 |
+
Click it and the extension will scan all your models to generate SHA256 hashes, using them to retreive model information and preview images from Civitai.
|
70 |
+
|
71 |
+
**Scanning takes time, just wait it finish**
|
72 |
+
|
73 |
+
For each model, it will create two files to save all model info from Civitai. These model info files will be `[model_name].civitai.info` and `[model_name].json` in your model folder.
|
74 |
+
|
75 |
+
![](img/model_info_file.jpg)
|
76 |
+
|
77 |
+
If a model info file already exists, by default it will be skipped. If a model cannot be found in Civitai, a minimal model info file will be created with any information that can be extracted from the model. By default, a model with model pre-existing model info files will not be scanned.
|
78 |
+
|
79 |
+
### Adding New Models
|
80 |
+
When you have some new models, just click scan button again to get new model's information and preview images. Only new models will be scanned with default options.
|
81 |
+
|
82 |
+
## Model Card
|
83 |
+
|
84 |
+
### The following section is outdated!
|
85 |
+
The following text block and image only applies to Stable Diffution Webui versions before v1.5.0. While the added buttons are still up-to-date, the "Extra Networks" tab button has been removed and is now always active by default.
|
86 |
+
|
87 |
+
---
|
88 |
+
|
89 |
+
**(Use this only after scanning finished)**
|
90 |
+
Open SD webui's build-in "Extra Network" tab, to show model cards.
|
91 |
+
|
92 |
+
![](img/extra_network.jpg)
|
93 |
+
|
94 |
+
|
95 |
+
Move your mouse on to the bottom of a model card. It will show 4 icon buttons:
|
96 |
+
- 🖼: Replace preview (a build-in button, modified from text to icon)
|
97 |
+
- 🌐: Open this model's Civitai url in a new tab
|
98 |
+
- 💡: Add this model's trigger words to prompt
|
99 |
+
- 🏷: Use this model's preview image's prompt
|
100 |
+
- ✏️: Rename model
|
101 |
+
- ❌: Remove/Delete model
|
102 |
+
|
103 |
+
![](img/model_card.jpg)
|
104 |
+
|
105 |
+
## Webui Metadata Editor
|
106 |
+
As of v1.7.0, this extension also downloads data for Webui's Metadata Editor by default. This data includes information you'd previously have to read unruly JSON files or navigate to Civitai to read.
|
107 |
+
|
108 |
+
![](img/webui_metadata_editor.png)
|
109 |
+
|
110 |
+
This data can be accessed by clicking the metadata button on the model card.
|
111 |
+
|
112 |
+
![](img/webui_metadata_button.png)
|
113 |
+
|
114 |
+
## Download
|
115 |
+
To download a model by Civitai Model Page's Url, you need 3 steps:
|
116 |
+
* Fill the Civitai URL or Model ID
|
117 |
+
* Click "1. Get Model Information by Civitai Url.
|
118 |
+
* It will fill model name, type, sub-folder, and model version automatically, but you can change the sub-folder and model version if you need to.
|
119 |
+
* If you need to add more sub-folders, you must do this by navigating to the model directory on the system running your webui version.
|
120 |
+
* Click download.
|
121 |
+
|
122 |
+
![](img/download_model.jpg)
|
123 |
+
|
124 |
+
Detail will be displayed on console log, with a progress bar.
|
125 |
+
Downloading can resume from break-point, so no fear for large file.
|
126 |
+
|
127 |
+
## Checking Model's New Version
|
128 |
+
You can checking your local model's new version from civitai by model types. You can select multiple model types.
|
129 |
+
|
130 |
+
![](img/check_model_new_version.jpg)
|
131 |
+
|
132 |
+
The checking process has a small delay after each model's new version checking request. So it is a little slow.
|
133 |
+
|
134 |
+
This is to protect Civitai from issue like DDos from this extension. There is no good for us if it is down.
|
135 |
+
|
136 |
+
**After checking process done**, it will display all new version's information on UI.
|
137 |
+
|
138 |
+
There are 3 urls for each new version.
|
139 |
+
* First one is model's civitai page.
|
140 |
+
* Second one is new version's download url.
|
141 |
+
* Third one is a button to download it into your SD's model folder with python.
|
142 |
+
With this one, output information is on "Download Model" section's log and console log. **One task at a time**.
|
143 |
+
|
144 |
+
![](img/check_model_new_version_output.png)
|
145 |
+
|
146 |
+
## Get Model Info By Url
|
147 |
+
This is used to force a local model links to a Civitai model. For example, you converted a model's format or pruned it. Then it can not be found on civitai when scanning.
|
148 |
+
|
149 |
+
In that case, if you still want to link it to a civitai model. You can use this funcion.
|
150 |
+
|
151 |
+
Choose this model from list, then offer a civitai model page's url.
|
152 |
+
|
153 |
+
After clicking button, extension will download that civitai model's info and preview image for the local file you picked.
|
154 |
+
|
155 |
+
![](img/get_one_model_info.jpg)
|
156 |
+
|
157 |
+
## Proxy
|
158 |
+
**If you are updating to new version, you need to re-lanuch SD webui before using it.**
|
159 |
+
|
160 |
+
Proxy textbox is at the bottom of extension tab.
|
161 |
+
|
162 |
+
**Each time you fill or clear a proxy value, you need to save setting, and Re-load UI with setting tab's reload button.**
|
163 |
+
|
164 |
+
Then all requests to civitai will use the proxy.
|
165 |
+
|
166 |
+
For some sock5 proxy, need to be used as "socks5h://xxxxx".
|
167 |
+
|
168 |
+
## Other Setting
|
169 |
+
**The Save Setting button, will save both "Scan Model"'s setting and other setting.**
|
170 |
+
|
171 |
+
* "Always Display Button" is good for touch screen.
|
172 |
+
* "Show Buttons on Thumb Mode" will turn on/off additional Buttons on thumbnail.
|
173 |
+
* Thumbnail Mode was removed in v1.5.0 of webui.
|
174 |
+
|
175 |
+
![](img/other_setting.jpg)
|
176 |
+
|
177 |
+
## Preview Image
|
178 |
+
Extra network uses both `model_file.png` and `model_file.preview.png` as preview image. But `model_file.png` has higher priority, because it is created by yourself.
|
179 |
+
|
180 |
+
When you don't have the higher priority one, it will use the other automatically.
|
181 |
+
|
182 |
+
## Prompt
|
183 |
+
When you click the button "Use prompt from preview image", it does not use the prompt from your own preview image. It uses the one from civitai's preview image.
|
184 |
+
|
185 |
+
On civitai, a model's preview images may not has prompt. This extension will check this model's all civitai preview images' information and use the first one has prompt in it.
|
186 |
+
|
187 |
+
## SHA256
|
188 |
+
To create a file SHA256, it need to read the whole file to generate a hash code. It gonna be slow for large files.
|
189 |
+
|
190 |
+
Also, extension uses Memory Optimized SHA256, which won't stuck your system and works with colab.
|
191 |
+
|
192 |
+
There are 2 cases this hash code can not find the model on civitai:
|
193 |
+
* Some old models, which do not have SHA256 code on civitai.
|
194 |
+
* The model's owner changed file on civitai, but does not change version name and description. So, the file on civitai is actually not the one on your manchine.
|
195 |
+
|
196 |
+
In these cases, you can always link a model to civitai by filling its URL in this extension.
|
197 |
+
|
198 |
+
## Feature Request
|
199 |
+
Feel free to submit feature requests, but pull requests are preferred.
|
200 |
+
|
201 |
+
Enjoy!
|
202 |
+
|
203 |
+
## Pull Requests
|
204 |
+
All pull requests should target the dev branch. For those who take a stab at the code, I apologize for the lack of consistency in coding style, naming, and other syntactical oddities. At some point, I intend to clean up the code and have everything pass linting, but we're not there yet.
|
205 |
+
|
206 |
+
## Common Issue
|
207 |
+
### 4 Buttons on card didn't show
|
208 |
+
#### Localization
|
209 |
+
There was a Localization issue if you are not using English version of SD webui. This is fixed in the latest version of this extension. **Bilingual localization extension is supported by PR since v1.6.1.1.**
|
210 |
+
|
211 |
+
##### Using cloud based localization extension
|
212 |
+
Turn off cloud based localization extension, use normal localization extension.
|
213 |
+
|
214 |
+
#### Other case
|
215 |
+
First of all, make sure you clicked "Refresh Civitai Helper" button.
|
216 |
+
|
217 |
+
If issue is still there, then only reason is you are not using the latest SD webui. So, Make sure you updated it.
|
218 |
+
|
219 |
+
Your update could be failed if you have modified SD webui's file. You need to check git command's console log to make sure it is updated.
|
220 |
+
|
221 |
+
In many cases, git will just refuse to update and tell you there are some conflicts need you to handle manually. If you don't check the consloe log, you will think your SD webui is updated, but it is not.
|
222 |
+
|
223 |
+
### Request, Scan or Get model info failed
|
224 |
+
Usually the reason for this most likely is the connection to Civitai API service failed. This can be for a number of reasons.
|
225 |
+
|
226 |
+
Sometimes Civitai can be down or refuse your API connection. Civitai has a connection pool setting. Basicly, it's a max connection number that civitai can have at the same time. So if there are already too manny connections on civitai, it will refuse your API connection.
|
227 |
+
|
228 |
+
In those cases, the only thing you can do is just wait a while then try again. I suggest making a cup of tea!
|
229 |
+
|
230 |
+
### Get Wrong model info and preview images from civitai
|
231 |
+
A bad news is, some models are saved with a wrong sha256 in civitai's database. Check here for more detail:
|
232 |
+
[https://github.com/civitai/civitai/issues/426](https://github.com/civitai/civitai/issues/426)
|
233 |
+
|
234 |
+
So, for those models, this extension can not get the right model info or preview images.
|
235 |
+
|
236 |
+
In this case, you have to remove the model info file and get the right model info by a civitai url on this extension's tab page.
|
237 |
+
|
238 |
+
Also, you can report those models with wrong sha256 to civitai at following page:
|
239 |
+
[https://discord.com/channels/1037799583784370196/1096271712959615100/1096271712959615100](https://discord.com/channels/1037799583784370196/1096271712959615100/1096271712959615100)
|
240 |
+
|
241 |
+
Please report that model to civitai, so they can fix it.
|
242 |
+
|
243 |
+
### Scanning fail when using colab
|
244 |
+
First of, search your error message with google. Most likely, it will be a colab issue.
|
245 |
+
|
246 |
+
If you are sure it is a out of memory issue when scanning models, and you are using this extension's latest version, then there is nothing we can do.
|
247 |
+
|
248 |
+
Since v1.5.5, we've already optimized the SHA256 function to the top. So the only 2 choices for you are:
|
249 |
+
* try again
|
250 |
+
* or use a pro account of colab.
|
251 |
+
|
252 |
+
### [Changes](https://github.com/zixaphir/Stable-Diffusion-Webui-Civitai-Helper/blob/master/README.md)
|
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/icon/.keep
ADDED
File without changes
|
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/all_in_one.png
ADDED
![]() |
Git LFS Details
|
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/all_the_mothers.png
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/check_model_new_version.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/check_model_new_version_output.png
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/download_model.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/extension_tab.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/extra_network.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/get_one_model_info.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/model_card.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/model_info_file.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/other_setting.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/refresh_ch.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/thumb_mode.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/blame_sdweui_update_to_this_ext.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/changed_model_folder_name_then_forget_part1.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/changed_model_folder_name_then_forget_part2.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/changed_model_folder_name_then_forget_part3.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/changed_model_folder_name_then_forget_part4.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/css_issue_part1.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/css_issue_part2.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/css_issue_part3.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/css_issue_part4.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/did_not_relaunch_sdwebui.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/do_not_even_use_this_ext.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/have_not_scan_model.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/have_not_update_sdwebui.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/user_claim_wall/request_a_feature_it_already_has.jpg
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/webui_metadata_button.png
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/img/webui_metadata_editor.png
ADDED
![]() |
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/javascript/civitai_helper.js
ADDED
@@ -0,0 +1,1012 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"use strict";
|
2 |
+
|
3 |
+
|
4 |
+
function ch_convert_file_path_to_url(path) {
|
5 |
+
let prefix = "file=";
|
6 |
+
let path_to_url = path.replaceAll('\\', '/');
|
7 |
+
return prefix+path_to_url;
|
8 |
+
}
|
9 |
+
|
10 |
+
function ch_img_node_str(path) {
|
11 |
+
return `<img src='${ch_convert_file_path_to_url(path)}' style="width:24px"/>`;
|
12 |
+
}
|
13 |
+
|
14 |
+
function ch_gradio_version() {
|
15 |
+
let foot = gradioApp().getElementById("footer");
|
16 |
+
if (!foot) { return null; }
|
17 |
+
|
18 |
+
let versions = foot.querySelector(".versions");
|
19 |
+
if (!versions) { return null; }
|
20 |
+
|
21 |
+
if (versions.textContent.indexOf("gradio: 3.16.2")>0) {
|
22 |
+
return "3.16.2";
|
23 |
+
} else {
|
24 |
+
return "3.23.0";
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
|
29 |
+
// send msg to python side by filling a hidden text box
|
30 |
+
// then will click a button to trigger an action
|
31 |
+
// msg is an object, not a string, will be stringify in this function
|
32 |
+
function send_ch_py_msg(msg) {
|
33 |
+
console.log("run send_ch_py_msg");
|
34 |
+
let js_msg_txtbox = gradioApp().querySelector("#ch_js_msg_txtbox textarea");
|
35 |
+
if (js_msg_txtbox && msg) {
|
36 |
+
// fill to msg box
|
37 |
+
js_msg_txtbox.value = JSON.stringify(msg);
|
38 |
+
js_msg_txtbox.dispatchEvent(new Event("input"));
|
39 |
+
}
|
40 |
+
|
41 |
+
}
|
42 |
+
|
43 |
+
// get msg from python side from a hidden textbox
|
44 |
+
// normally this is an old msg, need to wait for a new msg
|
45 |
+
function get_ch_py_msg() {
|
46 |
+
console.log("run get_ch_py_msg");
|
47 |
+
const py_msg_txtbox = gradioApp().querySelector("#ch_py_msg_txtbox textarea");
|
48 |
+
if (py_msg_txtbox && py_msg_txtbox.value) {
|
49 |
+
console.log("find py_msg_txtbox");
|
50 |
+
console.log("py_msg_txtbox value: ");
|
51 |
+
console.log(py_msg_txtbox.value);
|
52 |
+
return py_msg_txtbox.value;
|
53 |
+
} else {
|
54 |
+
return "";
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
|
59 |
+
// get msg from python side from a hidden textbox
|
60 |
+
// it will try once in every sencond, until it reach the max try times
|
61 |
+
const get_new_ch_py_msg = (max_count=5) => new Promise((resolve, reject) => {
|
62 |
+
console.log("run get_new_ch_py_msg");
|
63 |
+
|
64 |
+
let count = 0;
|
65 |
+
let new_msg = "";
|
66 |
+
let find_msg = false;
|
67 |
+
const interval = setInterval(() => {
|
68 |
+
const py_msg_txtbox = gradioApp().querySelector("#ch_py_msg_txtbox textarea");
|
69 |
+
count++;
|
70 |
+
|
71 |
+
if (py_msg_txtbox && py_msg_txtbox.value) {
|
72 |
+
console.log("find py_msg_txtbox");
|
73 |
+
console.log("py_msg_txtbox value: ");
|
74 |
+
console.log(py_msg_txtbox.value);
|
75 |
+
|
76 |
+
new_msg = py_msg_txtbox.value;
|
77 |
+
if (new_msg != "") {
|
78 |
+
find_msg = true;
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
if (find_msg) {
|
83 |
+
//clear msg in both sides
|
84 |
+
py_msg_txtbox.value = "";
|
85 |
+
py_msg_txtbox.dispatchEvent(new Event("input"));
|
86 |
+
|
87 |
+
resolve(new_msg);
|
88 |
+
clearInterval(interval);
|
89 |
+
} else if (count > max_count) {
|
90 |
+
//clear msg in both sides
|
91 |
+
py_msg_txtbox.value = "";
|
92 |
+
py_msg_txtbox.dispatchEvent(new Event("input"));
|
93 |
+
|
94 |
+
reject('');
|
95 |
+
clearInterval(interval);
|
96 |
+
}
|
97 |
+
|
98 |
+
}, 1000);
|
99 |
+
});
|
100 |
+
|
101 |
+
|
102 |
+
function getActiveTabType() {
|
103 |
+
const currentTab = get_uiCurrentTabContent();
|
104 |
+
switch (currentTab.id) {
|
105 |
+
case "tab_txt2img":
|
106 |
+
return "txt2img";
|
107 |
+
case "tab_img2img":
|
108 |
+
return "img2img";
|
109 |
+
}
|
110 |
+
return null;
|
111 |
+
}
|
112 |
+
|
113 |
+
function getExtraTabs(prefix) {
|
114 |
+
return gradioApp().getElementById(prefix + "_extra_tabs");
|
115 |
+
}
|
116 |
+
|
117 |
+
function getActivePrompt() {
|
118 |
+
const currentTab = get_uiCurrentTabContent();
|
119 |
+
switch (currentTab.id) {
|
120 |
+
case "tab_txt2img":
|
121 |
+
return currentTab.querySelector("#txt2img_prompt textarea");
|
122 |
+
case "tab_img2img":
|
123 |
+
return currentTab.querySelector("#img2img_prompt textarea");
|
124 |
+
}
|
125 |
+
return null;
|
126 |
+
}
|
127 |
+
|
128 |
+
function getActiveNegativePrompt() {
|
129 |
+
const currentTab = get_uiCurrentTabContent();
|
130 |
+
switch (currentTab.id) {
|
131 |
+
case "tab_txt2img":
|
132 |
+
return currentTab.querySelector("#txt2img_neg_prompt textarea");
|
133 |
+
case "tab_img2img":
|
134 |
+
return currentTab.querySelector("#img2img_neg_prompt textarea");
|
135 |
+
}
|
136 |
+
return null;
|
137 |
+
}
|
138 |
+
|
139 |
+
|
140 |
+
//button's click function
|
141 |
+
async function open_model_url(event, model_type, search_term) {
|
142 |
+
console.log("start open_model_url");
|
143 |
+
|
144 |
+
//get hidden components of extension
|
145 |
+
let js_open_url_btn = gradioApp().getElementById("ch_js_open_url_btn");
|
146 |
+
if (!js_open_url_btn) {
|
147 |
+
console.log("Failed to find js_open_url_btn");
|
148 |
+
return;
|
149 |
+
}
|
150 |
+
|
151 |
+
//msg to python side
|
152 |
+
let msg = {
|
153 |
+
"action": "",
|
154 |
+
"model_type": "",
|
155 |
+
"search_term": "",
|
156 |
+
"prompt": "",
|
157 |
+
"neg_prompt": "",
|
158 |
+
};
|
159 |
+
|
160 |
+
msg["action"] = "open_url";
|
161 |
+
msg["model_type"] = model_type;
|
162 |
+
msg["search_term"] = search_term;
|
163 |
+
msg["prompt"] = "";
|
164 |
+
msg["neg_prompt"] = "";
|
165 |
+
|
166 |
+
// fill to msg box
|
167 |
+
send_ch_py_msg(msg);
|
168 |
+
|
169 |
+
//click hidden button
|
170 |
+
js_open_url_btn.click();
|
171 |
+
|
172 |
+
// stop parent event
|
173 |
+
event.stopPropagation();
|
174 |
+
event.preventDefault();
|
175 |
+
|
176 |
+
//check response msg from python
|
177 |
+
let new_py_msg = null;
|
178 |
+
try {
|
179 |
+
new_py_msg = await get_new_ch_py_msg();
|
180 |
+
} catch (error) {
|
181 |
+
console.log(error);
|
182 |
+
}
|
183 |
+
|
184 |
+
console.log("new_py_msg:");
|
185 |
+
console.log(new_py_msg);
|
186 |
+
|
187 |
+
//check msg
|
188 |
+
if (new_py_msg) {
|
189 |
+
let py_msg_json = JSON.parse(new_py_msg);
|
190 |
+
//check for url
|
191 |
+
if (py_msg_json && py_msg_json.content) {
|
192 |
+
if (py_msg_json.content.url) {
|
193 |
+
window.open(py_msg_json.content.url, "_blank");
|
194 |
+
}
|
195 |
+
}
|
196 |
+
}
|
197 |
+
|
198 |
+
console.log("end open_model_url");
|
199 |
+
|
200 |
+
}
|
201 |
+
|
202 |
+
function add_trigger_words(event, model_type, search_term) {
|
203 |
+
console.log("start add_trigger_words");
|
204 |
+
|
205 |
+
//get hidden components of extension
|
206 |
+
let js_add_trigger_words_btn = gradioApp().getElementById("ch_js_add_trigger_words_btn");
|
207 |
+
if (!js_add_trigger_words_btn) {
|
208 |
+
return;
|
209 |
+
}
|
210 |
+
|
211 |
+
|
212 |
+
//msg to python side
|
213 |
+
let msg = {
|
214 |
+
"action": "",
|
215 |
+
"model_type": "",
|
216 |
+
"search_term": "",
|
217 |
+
"prompt": "",
|
218 |
+
"neg_prompt": "",
|
219 |
+
};
|
220 |
+
|
221 |
+
msg["action"] = "add_trigger_words";
|
222 |
+
msg["model_type"] = model_type;
|
223 |
+
msg["search_term"] = search_term;
|
224 |
+
msg["neg_prompt"] = "";
|
225 |
+
|
226 |
+
// get active prompt
|
227 |
+
let act_prompt = getActivePrompt();
|
228 |
+
msg["prompt"] = act_prompt.value;
|
229 |
+
|
230 |
+
// fill to msg box
|
231 |
+
send_ch_py_msg(msg);
|
232 |
+
|
233 |
+
//click hidden button
|
234 |
+
js_add_trigger_words_btn.click();
|
235 |
+
|
236 |
+
console.log("end add_trigger_words");
|
237 |
+
|
238 |
+
event.stopPropagation();
|
239 |
+
event.preventDefault();
|
240 |
+
|
241 |
+
|
242 |
+
}
|
243 |
+
|
244 |
+
function use_preview_prompt(event, model_type, search_term) {
|
245 |
+
console.log("start use_preview_prompt");
|
246 |
+
|
247 |
+
//get hidden components of extension
|
248 |
+
let js_use_preview_prompt_btn = gradioApp().getElementById("ch_js_use_preview_prompt_btn");
|
249 |
+
if (!js_use_preview_prompt_btn) {
|
250 |
+
return;
|
251 |
+
}
|
252 |
+
|
253 |
+
//msg to python side
|
254 |
+
let msg = {
|
255 |
+
"action": "",
|
256 |
+
"model_type": "",
|
257 |
+
"search_term": "",
|
258 |
+
"prompt": "",
|
259 |
+
"neg_prompt": "",
|
260 |
+
};
|
261 |
+
|
262 |
+
msg["action"] = "use_preview_prompt";
|
263 |
+
msg["model_type"] = model_type;
|
264 |
+
msg["search_term"] = search_term;
|
265 |
+
|
266 |
+
// get active prompt
|
267 |
+
let act_prompt = getActivePrompt();
|
268 |
+
msg["prompt"] = act_prompt.value;
|
269 |
+
|
270 |
+
// get active neg prompt
|
271 |
+
let neg_prompt = getActiveNegativePrompt();
|
272 |
+
msg["neg_prompt"] = neg_prompt.value;
|
273 |
+
|
274 |
+
// fill to msg box
|
275 |
+
send_ch_py_msg(msg);
|
276 |
+
|
277 |
+
//click hidden button
|
278 |
+
js_use_preview_prompt_btn.click();
|
279 |
+
|
280 |
+
console.log("end use_preview_prompt");
|
281 |
+
|
282 |
+
event.stopPropagation();
|
283 |
+
event.preventDefault();
|
284 |
+
|
285 |
+
}
|
286 |
+
|
287 |
+
|
288 |
+
async function remove_card(event, model_type, search_term) {
|
289 |
+
console.log("start remove_card");
|
290 |
+
|
291 |
+
//get hidden components of extension
|
292 |
+
let js_remove_card_btn = gradioApp().getElementById("ch_js_remove_card_btn");
|
293 |
+
if (!js_remove_card_btn) {
|
294 |
+
return;
|
295 |
+
}
|
296 |
+
|
297 |
+
// must confirm before removing
|
298 |
+
let rm_confirm = "\nConfirm to remove this model and all related files. This process is irreversible.";
|
299 |
+
if (!confirm(rm_confirm)) {
|
300 |
+
return;
|
301 |
+
}
|
302 |
+
|
303 |
+
//msg to python side
|
304 |
+
let msg = {
|
305 |
+
"action": "",
|
306 |
+
"model_type": "",
|
307 |
+
"search_term": "",
|
308 |
+
}
|
309 |
+
|
310 |
+
msg["action"] = "remove_card";
|
311 |
+
msg["model_type"] = model_type;
|
312 |
+
msg["search_term"] = search_term;
|
313 |
+
|
314 |
+
// fill to msg box
|
315 |
+
send_ch_py_msg(msg)
|
316 |
+
|
317 |
+
//click hidden button
|
318 |
+
js_remove_card_btn.click();
|
319 |
+
|
320 |
+
// stop parent event
|
321 |
+
event.stopPropagation()
|
322 |
+
event.preventDefault()
|
323 |
+
|
324 |
+
//check response msg from python
|
325 |
+
let new_py_msg = "";
|
326 |
+
try {
|
327 |
+
new_py_msg = await get_new_ch_py_msg();
|
328 |
+
} catch (error) {
|
329 |
+
console.log(error);
|
330 |
+
new_py_msg = error;
|
331 |
+
}
|
332 |
+
|
333 |
+
console.log("new_py_msg:");
|
334 |
+
console.log(new_py_msg);
|
335 |
+
|
336 |
+
//check msg
|
337 |
+
let result = "Done";
|
338 |
+
//check msg
|
339 |
+
if (new_py_msg) {
|
340 |
+
result = new_py_msg;
|
341 |
+
}
|
342 |
+
|
343 |
+
if (result == "Done") {
|
344 |
+
refresh_cards_list();
|
345 |
+
}
|
346 |
+
|
347 |
+
console.log("end remove_card");
|
348 |
+
|
349 |
+
}
|
350 |
+
|
351 |
+
|
352 |
+
async function rename_card(event, model_type, search_term, model_name) {
|
353 |
+
console.log("start rename_card");
|
354 |
+
|
355 |
+
//get hidden components of extension
|
356 |
+
let js_rename_card_btn = gradioApp().getElementById("ch_js_rename_card_btn");
|
357 |
+
if (!js_rename_card_btn) {
|
358 |
+
return;
|
359 |
+
}
|
360 |
+
|
361 |
+
// must confirm before removing
|
362 |
+
let rename_prompt = "\nRename this model to:";
|
363 |
+
let new_name = prompt(rename_prompt, model_name);
|
364 |
+
if (!new_name) {
|
365 |
+
return;
|
366 |
+
}
|
367 |
+
|
368 |
+
//msg to python side
|
369 |
+
let msg = {
|
370 |
+
"action": "",
|
371 |
+
"model_type": "",
|
372 |
+
"search_term": "",
|
373 |
+
"new_name": "",
|
374 |
+
}
|
375 |
+
|
376 |
+
msg["action"] = "rename_card";
|
377 |
+
msg["model_type"] = model_type;
|
378 |
+
msg["search_term"] = search_term;
|
379 |
+
msg["new_name"] = new_name;
|
380 |
+
|
381 |
+
// fill to msg box
|
382 |
+
send_ch_py_msg(msg)
|
383 |
+
|
384 |
+
//click hidden button
|
385 |
+
js_rename_card_btn.click();
|
386 |
+
|
387 |
+
// stop parent event
|
388 |
+
event.stopPropagation()
|
389 |
+
event.preventDefault()
|
390 |
+
|
391 |
+
//check response msg from python
|
392 |
+
let new_py_msg = "";
|
393 |
+
try {
|
394 |
+
new_py_msg = await get_new_ch_py_msg();
|
395 |
+
} catch (error) {
|
396 |
+
console.log(error);
|
397 |
+
new_py_msg = error;
|
398 |
+
}
|
399 |
+
|
400 |
+
console.log("new_py_msg:");
|
401 |
+
console.log(new_py_msg);
|
402 |
+
|
403 |
+
//check msg
|
404 |
+
let result = "Done";
|
405 |
+
//check msg
|
406 |
+
if (new_py_msg) {
|
407 |
+
result = new_py_msg;
|
408 |
+
}
|
409 |
+
|
410 |
+
if (result == "Done") {
|
411 |
+
refresh_cards_list();
|
412 |
+
}
|
413 |
+
|
414 |
+
console.log("end rename_card");
|
415 |
+
|
416 |
+
}
|
417 |
+
|
418 |
+
|
419 |
+
function replace_preview(e, page, type, name) {
|
420 |
+
// we have to create a whole hidden editor window to access preview replace functionality
|
421 |
+
extraNetworksEditUserMetadata(e, page, type, name);
|
422 |
+
|
423 |
+
// the editor window takes quite some time to populate
|
424 |
+
waitForEditor(page, type, name).then(editor => {
|
425 |
+
// Gather the buttons we need to both replace the preview and close the editor
|
426 |
+
let cancel_button = editor.querySelector('.edit-user-metadata-buttons button:first-of-type');
|
427 |
+
let replace_preview_button = editor.querySelector('.edit-user-metadata-buttons button:nth-of-type(2)');
|
428 |
+
|
429 |
+
replace_preview_button.click();
|
430 |
+
cancel_button.click();
|
431 |
+
});
|
432 |
+
}
|
433 |
+
|
434 |
+
|
435 |
+
// download model's new version into SD at python side
|
436 |
+
function ch_dl_model_new_version(event, model_path, version_id, download_url, model_type) {
|
437 |
+
console.log("start ch_dl_model_new_version");
|
438 |
+
|
439 |
+
// must confirm before downloading
|
440 |
+
let dl_confirm = "\nConfirm to download.\n\nCheck Download Model Section's log and console log for detail.";
|
441 |
+
if (!confirm(dl_confirm)) {
|
442 |
+
return;
|
443 |
+
}
|
444 |
+
|
445 |
+
//get hidden components of extension
|
446 |
+
let js_dl_model_new_version_btn = gradioApp().getElementById("ch_js_dl_model_new_version_btn");
|
447 |
+
if (!js_dl_model_new_version_btn) {
|
448 |
+
return;
|
449 |
+
}
|
450 |
+
|
451 |
+
//msg to python side
|
452 |
+
let msg = {
|
453 |
+
"action": "",
|
454 |
+
"model_path": "",
|
455 |
+
"version_id": "",
|
456 |
+
"download_url": "",
|
457 |
+
};
|
458 |
+
|
459 |
+
msg["action"] = "dl_model_new_version";
|
460 |
+
msg["model_path"] = model_path;
|
461 |
+
msg["version_id"] = version_id;
|
462 |
+
msg["download_url"] = download_url;
|
463 |
+
msg["model_type"] = model_type;
|
464 |
+
|
465 |
+
// fill to msg box
|
466 |
+
send_ch_py_msg(msg);
|
467 |
+
|
468 |
+
//click hidden button
|
469 |
+
js_dl_model_new_version_btn.click();
|
470 |
+
|
471 |
+
console.log("end dl_model_new_version");
|
472 |
+
|
473 |
+
event.stopPropagation();
|
474 |
+
event.preventDefault();
|
475 |
+
|
476 |
+
|
477 |
+
}
|
478 |
+
|
479 |
+
|
480 |
+
function refresh_cards_list() {
|
481 |
+
console.log("refresh card list");
|
482 |
+
//refresh card list
|
483 |
+
let active_tab = getActiveTabType();
|
484 |
+
console.log(`get active tab id: ${active_tab}`);
|
485 |
+
if (active_tab) {
|
486 |
+
let refresh_btn_id = `${active_tab}_extra_refresh`;
|
487 |
+
let refresh_btn = gradioApp().getElementById(refresh_btn_id);
|
488 |
+
if (refresh_btn) {
|
489 |
+
console.log(`click button: ${refresh_btn_id}`);
|
490 |
+
refresh_btn.click();
|
491 |
+
}
|
492 |
+
}
|
493 |
+
}
|
494 |
+
|
495 |
+
function processCards(tab, extra_tab_els) {
|
496 |
+
if (!(opts && "ch_always_display" in opts)) {
|
497 |
+
// Lobe theme can cause a race condition.
|
498 |
+
console.log("Waiting for webui settings to become available");
|
499 |
+
console.log(opts);
|
500 |
+
const try_again = function () {
|
501 |
+
processCards(tab, extra_tab_els);
|
502 |
+
}
|
503 |
+
return setTimeout(try_again, 500);
|
504 |
+
}
|
505 |
+
|
506 |
+
const prefix_length = tab.length + 1;
|
507 |
+
for (const el of extra_tab_els) {
|
508 |
+
const model_type = el.id.slice(prefix_length, -6);
|
509 |
+
const cards = el.querySelectorAll('.card');
|
510 |
+
for (const card of cards) {
|
511 |
+
processSingleCard(tab, getShortModelTypeFromFull(model_type), card);
|
512 |
+
}
|
513 |
+
}
|
514 |
+
}
|
515 |
+
|
516 |
+
|
517 |
+
function getModelCardsEl(prefix, model_type) {
|
518 |
+
const id = prefix + "_" + model_type + "_cards";
|
519 |
+
return gradioApp().getElementById(id);
|
520 |
+
}
|
521 |
+
|
522 |
+
|
523 |
+
function waitForExtraTabs(tab, extra_tabs) {
|
524 |
+
function findTabs() {
|
525 |
+
const tab_elements = [];
|
526 |
+
for (const extra_tab of extra_tabs) {
|
527 |
+
const extra_tab_el = getModelCardsEl(tab, extra_tab);
|
528 |
+
|
529 |
+
if (extra_tab_el == null) {
|
530 |
+
|
531 |
+
// XXX lycoris models do not have their own tab in sdwebui 1.5
|
532 |
+
// most of the time. In the case that there is a LyCoris tab,
|
533 |
+
// it would have been added at the same time as the others,
|
534 |
+
// making it almost impossible to be null by the time we're at
|
535 |
+
// this point in the code if the other tabs are loaded.
|
536 |
+
if (extra_tab == 'lycoris') { continue; }
|
537 |
+
|
538 |
+
return null;
|
539 |
+
}
|
540 |
+
|
541 |
+
tab_elements.push(extra_tab_el);
|
542 |
+
}
|
543 |
+
return tab_elements;
|
544 |
+
}
|
545 |
+
|
546 |
+
const tab_elements = findTabs(tab, extra_tabs);
|
547 |
+
if (tab_elements) {
|
548 |
+
processCards(tab, tab_elements);
|
549 |
+
}
|
550 |
+
|
551 |
+
const observer = new MutationObserver(records => {
|
552 |
+
let tab_elements;
|
553 |
+
for (const record of records) {
|
554 |
+
if (record.type != "childList") {
|
555 |
+
continue;
|
556 |
+
}
|
557 |
+
|
558 |
+
tab_elements = findTabs(tab, extra_tabs);
|
559 |
+
if (!tab_elements) {
|
560 |
+
return;
|
561 |
+
}
|
562 |
+
|
563 |
+
processCards(tab, tab_elements);
|
564 |
+
return;
|
565 |
+
}
|
566 |
+
});
|
567 |
+
|
568 |
+
const extra_networks = getExtraTabs(tab);
|
569 |
+
|
570 |
+
const options = {
|
571 |
+
subtree: true,
|
572 |
+
childList: true,
|
573 |
+
};
|
574 |
+
|
575 |
+
observer.observe(extra_networks, options);
|
576 |
+
|
577 |
+
}
|
578 |
+
|
579 |
+
|
580 |
+
function waitForEditor(page, type, name) {
|
581 |
+
const id = page + '_' + type + '_edit_user_metadata';
|
582 |
+
|
583 |
+
return new Promise(resolve => {
|
584 |
+
let name_field;
|
585 |
+
const gradio = gradioApp();
|
586 |
+
|
587 |
+
const editor = gradio.getElementById(id);
|
588 |
+
const popup = gradio.querySelector(".global-popup");
|
589 |
+
|
590 |
+
if (popup != null) {
|
591 |
+
// hide the editor window so it doesn't get in the user's
|
592 |
+
// way while we wait for the replace preview functionality
|
593 |
+
// to become available.
|
594 |
+
popup.style.display = "none";
|
595 |
+
}
|
596 |
+
|
597 |
+
// not only do we need to wait for the editor,
|
598 |
+
// but also for it to populate with the model metadata.
|
599 |
+
if (editor != null) {
|
600 |
+
name_field = editor.querySelector('.extra-network-name');
|
601 |
+
if (name_field.textContent.trim() == name) {
|
602 |
+
return resolve(editor);
|
603 |
+
}
|
604 |
+
}
|
605 |
+
|
606 |
+
const observer = new MutationObserver(() => {
|
607 |
+
const editor = gradioApp().getElementById(id);
|
608 |
+
let name_field;
|
609 |
+
if (editor != null) {
|
610 |
+
name_field = editor.querySelector('.extra-network-name');
|
611 |
+
if (name_field.textContent.trim() == name) {
|
612 |
+
resolve(editor);
|
613 |
+
observer.disconnect();
|
614 |
+
}
|
615 |
+
}
|
616 |
+
});
|
617 |
+
|
618 |
+
observer.observe(document.body, {
|
619 |
+
subtree: true,
|
620 |
+
childList: true,
|
621 |
+
});
|
622 |
+
});
|
623 |
+
}
|
624 |
+
|
625 |
+
|
626 |
+
function getShortModelTypeFromFull(model_type_full) {
|
627 |
+
switch (model_type_full) {
|
628 |
+
case "textual_inversion":
|
629 |
+
return "ti";
|
630 |
+
case "hypernetworks":
|
631 |
+
return "hyper";
|
632 |
+
case "checkpoints":
|
633 |
+
return "ckp";
|
634 |
+
case "lora":
|
635 |
+
case "lycoris":
|
636 |
+
return model_type_full;
|
637 |
+
}
|
638 |
+
}
|
639 |
+
|
640 |
+
|
641 |
+
function getLongModelTypeFromShort(model_type_short) {
|
642 |
+
switch (model_type_short) {
|
643 |
+
case "ti":
|
644 |
+
return "textual_inversion";
|
645 |
+
case "hyper":
|
646 |
+
return "hypernetworks";
|
647 |
+
case "ckp":
|
648 |
+
return "checkpoints";
|
649 |
+
case "lora":
|
650 |
+
case "lycoris":
|
651 |
+
return model_type_short;
|
652 |
+
}
|
653 |
+
}
|
654 |
+
|
655 |
+
|
656 |
+
function isThumbMode(extra_network_node) {
|
657 |
+
if (extra_network_node?.className == "extra-network-thumbs") {
|
658 |
+
return true;
|
659 |
+
}
|
660 |
+
return false;
|
661 |
+
}
|
662 |
+
|
663 |
+
|
664 |
+
function processSingleCard(active_tab_type, active_extra_tab_type, card) {
|
665 |
+
let metadata_button = null;
|
666 |
+
let additional_node = null;
|
667 |
+
let replace_preview_btn = null;
|
668 |
+
let ul_node = null;
|
669 |
+
let search_term_node = null;
|
670 |
+
let model_name = "";
|
671 |
+
let search_term = "";
|
672 |
+
let model_type = active_extra_tab_type;
|
673 |
+
let js_model_type = getLongModelTypeFromShort(model_type);
|
674 |
+
let addedNodes = [];
|
675 |
+
|
676 |
+
let is_thumb_mode = isThumbMode(getModelCardsEl(active_tab_type, js_model_type));
|
677 |
+
|
678 |
+
//metadata_buttoncard
|
679 |
+
metadata_button = card.querySelector(".metadata-button");
|
680 |
+
//additional node
|
681 |
+
additional_node = card.querySelector(".actions .additional");
|
682 |
+
//get ul node, which is the parent of all buttons
|
683 |
+
ul_node = card.querySelector(".actions .additional ul");
|
684 |
+
|
685 |
+
// check thumb mode
|
686 |
+
if (is_thumb_mode) {
|
687 |
+
additional_node.style.display = null;
|
688 |
+
|
689 |
+
if (!ul_node) {
|
690 |
+
// nothing to do.
|
691 |
+
return;
|
692 |
+
}
|
693 |
+
|
694 |
+
if (opts["ch_show_btn_on_thumb"]) {
|
695 |
+
ul_node.style.background = btn_thumb_background;
|
696 |
+
} else {
|
697 |
+
let ch_btn_txts = ["💡", "🌐", "🏷️", "✏️", "❌"];
|
698 |
+
|
699 |
+
// remove existed buttons
|
700 |
+
//reset
|
701 |
+
ul_node.style.background = null;
|
702 |
+
// find all .a child nodes
|
703 |
+
let atags = ul_node.querySelectorAll("a");
|
704 |
+
|
705 |
+
for (let atag of atags) {
|
706 |
+
//reset display
|
707 |
+
atag.style.display = null;
|
708 |
+
//remove extension's button
|
709 |
+
if (ch_btn_txts.indexOf(atag.textContent)>=0) {
|
710 |
+
//need to remove
|
711 |
+
ul_node.removeChild(atag);
|
712 |
+
} else {
|
713 |
+
//do not remove, just reset
|
714 |
+
atag.textContent = replace_preview_text;
|
715 |
+
atag.style.display = null;
|
716 |
+
atag.style.fontSize = null;
|
717 |
+
atag.style.position = null;
|
718 |
+
atag.style.backgroundImage = null;
|
719 |
+
}
|
720 |
+
}
|
721 |
+
|
722 |
+
//also remove br tag in ul
|
723 |
+
let brtag = ul_node.querySelector("br");
|
724 |
+
if (brtag) {
|
725 |
+
ul_node.removeChild(brtag);
|
726 |
+
}
|
727 |
+
|
728 |
+
//just reset and remove nodes, do nothing else
|
729 |
+
return;
|
730 |
+
|
731 |
+
}
|
732 |
+
|
733 |
+
} else {
|
734 |
+
// full preview mode
|
735 |
+
|
736 |
+
if (opts["ch_always_display"]) {
|
737 |
+
additional_node.style.display = "block";
|
738 |
+
} else {
|
739 |
+
additional_node.style.display = null;
|
740 |
+
}
|
741 |
+
|
742 |
+
if (!ul_node) {
|
743 |
+
ul_node = document.createElement("ul");
|
744 |
+
} else {
|
745 |
+
// remove br tag
|
746 |
+
let brtag = ul_node.querySelector("br");
|
747 |
+
if (brtag) {
|
748 |
+
ul_node.removeChild(brtag);
|
749 |
+
}
|
750 |
+
}
|
751 |
+
|
752 |
+
}
|
753 |
+
|
754 |
+
if (ul_node.dataset.ch_helper) {
|
755 |
+
return;
|
756 |
+
}
|
757 |
+
|
758 |
+
ul_node.dataset.ch_helper = true;
|
759 |
+
|
760 |
+
model_name = card.dataset.name;
|
761 |
+
|
762 |
+
// replace preview text button
|
763 |
+
replace_preview_btn = card.querySelector(".actions .additional a");
|
764 |
+
|
765 |
+
if ((replace_preview_btn == null) && !("replace_preview_button" in opts["ch_hide_buttons"])) {
|
766 |
+
/*
|
767 |
+
* in sdwebui 1.5, the replace preview button has been
|
768 |
+
* moved to a hard to reach location, so we have to do
|
769 |
+
* quite a lot to get to its functionality.
|
770 |
+
*/
|
771 |
+
|
772 |
+
// waste memory by keeping all of this in scope, per card.
|
773 |
+
let page = active_tab_type;
|
774 |
+
let type = js_model_type;
|
775 |
+
let name = card.dataset.name;
|
776 |
+
|
777 |
+
// create the replace_preview_btn, as it no longer exists
|
778 |
+
replace_preview_btn = document.createElement("a");
|
779 |
+
|
780 |
+
// create an event handler to redirect a click to the real replace_preview_button
|
781 |
+
replace_preview_btn.setAttribute("onclick", `replace_preview(event, '${page}', '${type}', '${model_name}')`);
|
782 |
+
}
|
783 |
+
|
784 |
+
// change replace preview text button into icon
|
785 |
+
if (!opts["ch_hide_buttons"].includes("replace_preview_button")) {
|
786 |
+
if (replace_preview_btn.textContent !== "🖼️") {
|
787 |
+
replace_preview_btn.textContent = "🖼️";
|
788 |
+
addedNodes.push(replace_preview_btn);
|
789 |
+
}
|
790 |
+
|
791 |
+
replace_preview_btn.classList.add("card-button", "removecard");
|
792 |
+
|
793 |
+
} else if (replace_preview_btn.parentElement) {
|
794 |
+
replace_preview_btn.parentElement.removeChild(replace_preview_btn);
|
795 |
+
}
|
796 |
+
|
797 |
+
// search_term node
|
798 |
+
// search_term = subfolder path + model name + ext
|
799 |
+
search_term_node = card.querySelector(".actions .additional .search_term");
|
800 |
+
if (!search_term_node) {
|
801 |
+
console.log("can not find search_term node for cards in " + active_tab_type + "_" + active_extra_tab_type + "_cards");
|
802 |
+
return;
|
803 |
+
}
|
804 |
+
|
805 |
+
// get search_term
|
806 |
+
search_term = search_term_node.textContent;
|
807 |
+
if (!search_term) {
|
808 |
+
console.log("search_term is empty for cards in " + active_tab_type + "_" + active_extra_tab_type + "_cards");
|
809 |
+
return;
|
810 |
+
}
|
811 |
+
|
812 |
+
// then we need to add buttons to each ul node:
|
813 |
+
if (!opts["ch_hide_buttons"].includes("open_url_button")) {
|
814 |
+
let open_url_node = document.createElement("a");
|
815 |
+
open_url_node.href = "#";
|
816 |
+
open_url_node.textContent = "🌐";
|
817 |
+
open_url_node.classList.add("card-button", "openurl");
|
818 |
+
open_url_node.title = "Open this model's civitai url";
|
819 |
+
open_url_node.setAttribute("onclick", `open_model_url(event, '${model_type}', '${search_term}')`);
|
820 |
+
addedNodes.push(open_url_node);
|
821 |
+
}
|
822 |
+
|
823 |
+
// add br if metadata_button exists
|
824 |
+
if (is_thumb_mode && metadata_button) {
|
825 |
+
addedNodes.push(document.createElement("br"));
|
826 |
+
}
|
827 |
+
|
828 |
+
if (!opts["ch_hide_buttons"].includes("add_trigger_words_button")) {
|
829 |
+
let add_trigger_words_node = document.createElement("a");
|
830 |
+
add_trigger_words_node.href = "#";
|
831 |
+
add_trigger_words_node.textContent = "💡";
|
832 |
+
add_trigger_words_node.classList.add("card-button", "addtriggerwords");
|
833 |
+
add_trigger_words_node.title = "Add trigger words to prompt";
|
834 |
+
add_trigger_words_node.setAttribute("onclick", `add_trigger_words(event, '${model_type}', '${search_term}')`);
|
835 |
+
addedNodes.push(add_trigger_words_node);
|
836 |
+
}
|
837 |
+
|
838 |
+
if (!opts["ch_hide_buttons"].includes("add_preview_prompt_button")) {
|
839 |
+
let use_preview_prompt_node = document.createElement("a");
|
840 |
+
use_preview_prompt_node.href = "#";
|
841 |
+
use_preview_prompt_node.textContent = "🏷️";
|
842 |
+
use_preview_prompt_node.classList.add("card-button", "usepreviewprompt");
|
843 |
+
use_preview_prompt_node.title = "Use prompt from preview image";
|
844 |
+
use_preview_prompt_node.setAttribute("onclick", `use_preview_prompt(event, '${model_type}', '${search_term}')`);
|
845 |
+
addedNodes.push(use_preview_prompt_node);
|
846 |
+
}
|
847 |
+
|
848 |
+
if (!opts["ch_hide_buttons"].includes("rename_model_button")) {
|
849 |
+
let rename_card_node = document.createElement("a");
|
850 |
+
rename_card_node.href = "#";
|
851 |
+
rename_card_node.innerHTML = "✏️";
|
852 |
+
rename_card_node.classList.add("card-button", "renamecard");
|
853 |
+
rename_card_node.title = "Rename this model";
|
854 |
+
rename_card_node.setAttribute("onclick", `rename_card(event, '${model_type}', '${search_term}', '${model_name}')`);
|
855 |
+
addedNodes.push(rename_card_node);
|
856 |
+
}
|
857 |
+
|
858 |
+
if (!opts["ch_hide_buttons"].includes("remove_model_button")) {
|
859 |
+
let remove_card_node = document.createElement("a");
|
860 |
+
remove_card_node.href = "#";
|
861 |
+
remove_card_node.innerHTML = "❌";
|
862 |
+
remove_card_node.classList.add("card-button", "removecard");
|
863 |
+
remove_card_node.title = "Remove this model";
|
864 |
+
remove_card_node.setAttribute("onclick", `remove_card(event, '${model_type}', '${search_term}')`);
|
865 |
+
addedNodes.push(remove_card_node);
|
866 |
+
}
|
867 |
+
|
868 |
+
// add to buttons row
|
869 |
+
for (const node of addedNodes) {
|
870 |
+
ul_node.appendChild(node);
|
871 |
+
}
|
872 |
+
|
873 |
+
// add buttons to card
|
874 |
+
if (!ul_node.parentElement && ul_node.children) {
|
875 |
+
additional_node.appendChild(ul_node);
|
876 |
+
}
|
877 |
+
}
|
878 |
+
|
879 |
+
onUiLoaded(() => {
|
880 |
+
|
881 |
+
//get gradio version
|
882 |
+
const gradio_ver = ch_gradio_version();
|
883 |
+
console.log("Running Stable-Diffusion-Webui-Civitai-Helper on Gradio Version: " + gradio_ver);
|
884 |
+
|
885 |
+
// get all extra network tabs
|
886 |
+
const tab_prefix_list = ["txt2img", "img2img"];
|
887 |
+
const model_type_list = ["textual_inversion", "hypernetworks", "checkpoints", "lora", "lycoris"];
|
888 |
+
|
889 |
+
// update extra network tab pages' cards
|
890 |
+
// * replace "replace preview" text button into an icon
|
891 |
+
// * add 3 button to each card:
|
892 |
+
// - open model url 🌐
|
893 |
+
// - add trigger words 💡
|
894 |
+
// - use preview image's prompt 🏷️
|
895 |
+
// notice: javascript can not get response from python side
|
896 |
+
// so, these buttons just sent request to python
|
897 |
+
// then, python side gonna open url and update prompt text box, without telling js side.
|
898 |
+
function update_card_for_civitai() {
|
899 |
+
if (!(opts && "ch_always_display" in opts)) {
|
900 |
+
// Lobe theme can cause a race condition.
|
901 |
+
return setTimeout(update_card_for_civitai, 500);
|
902 |
+
}
|
903 |
+
|
904 |
+
let replace_preview_text = getTranslation("replace preview");
|
905 |
+
if (!replace_preview_text) {
|
906 |
+
replace_preview_text = "replace preview";
|
907 |
+
}
|
908 |
+
|
909 |
+
let extra_network_node = null;
|
910 |
+
let model_type = "";
|
911 |
+
let cards = null;
|
912 |
+
|
913 |
+
//get current tab
|
914 |
+
let active_tab_type = getActiveTabType();
|
915 |
+
if (!active_tab_type) {active_tab_type = "txt2img";}
|
916 |
+
|
917 |
+
for (const tab_prefix of tab_prefix_list) {
|
918 |
+
if (tab_prefix != active_tab_type) {continue;}
|
919 |
+
|
920 |
+
//get active extratab
|
921 |
+
const re = new RegExp(tab_prefix + "_(.+)_cards");
|
922 |
+
const active_extra_tab = Array.from(get_uiCurrentTabContent().querySelectorAll('.extra-network-cards,.extra-network-thumbs'))
|
923 |
+
.find(el => el.closest('.tabitem').style.display === 'block')
|
924 |
+
?.id.match(re)[1];
|
925 |
+
|
926 |
+
const active_extra_tab_type = getShortModelTypeFromFull(active_extra_tab);
|
927 |
+
|
928 |
+
for (const js_model_type of model_type_list) {
|
929 |
+
//get model_type for python side
|
930 |
+
model_type = getShortModelTypeFromFull(js_model_type);
|
931 |
+
|
932 |
+
if (!model_type) {
|
933 |
+
console.log("can not get model_type from: " + js_model_type);
|
934 |
+
continue;
|
935 |
+
}
|
936 |
+
|
937 |
+
|
938 |
+
//only handle current sub-tab
|
939 |
+
if (model_type != active_extra_tab_type) {
|
940 |
+
continue;
|
941 |
+
}
|
942 |
+
|
943 |
+
//console.log("handle active extra tab");
|
944 |
+
extra_network_id = tab_prefix + "_" + js_model_type + "_cards";
|
945 |
+
|
946 |
+
// console.log("searching extra_network_node: " + extra_network_id);
|
947 |
+
extra_network_node = getModelCardsEl(tab_prefix, js_model_type);
|
948 |
+
|
949 |
+
// get all card nodes
|
950 |
+
cards = extra_network_node.querySelectorAll(".card");
|
951 |
+
for (const card of cards) {
|
952 |
+
processSingleCard(active_tab_type, active_extra_tab_type, card);
|
953 |
+
}
|
954 |
+
|
955 |
+
}
|
956 |
+
|
957 |
+
}
|
958 |
+
|
959 |
+
}
|
960 |
+
|
961 |
+
/*
|
962 |
+
let extra_network_refresh_btn = null;
|
963 |
+
*/
|
964 |
+
let extra_networks_btn = null;
|
965 |
+
|
966 |
+
//add refresh button to extra network's toolbar
|
967 |
+
for (const prefix of tab_prefix_list) {
|
968 |
+
// load extra networks button
|
969 |
+
extra_networks_btn = gradioApp().getElementById(prefix + "_extra_networks");
|
970 |
+
|
971 |
+
|
972 |
+
// pre-1.6
|
973 |
+
if (extra_networks_btn) {
|
974 |
+
function extraNetworksClick() {
|
975 |
+
waitForExtraTabs(prefix, model_type_list);
|
976 |
+
extra_networks_btn.removeEventListener("click", extraNetworksClick);
|
977 |
+
}
|
978 |
+
|
979 |
+
// add listener to extra_networks_btn
|
980 |
+
extra_networks_btn.addEventListener("click", extraNetworksClick);
|
981 |
+
continue;
|
982 |
+
|
983 |
+
}
|
984 |
+
|
985 |
+
// 1.6 and higher
|
986 |
+
const extra_tab = getExtraTabs(prefix);
|
987 |
+
const headers = extra_tab.firstChild.children;
|
988 |
+
|
989 |
+
for (const header of headers) {
|
990 |
+
const model_type = header.textContent.trim().replace(" ", "_").toLowerCase();
|
991 |
+
|
992 |
+
function extraNetworksClick() {
|
993 |
+
waitForExtraTabs(prefix, [model_type]);
|
994 |
+
header.removeEventListener("click", extraNetworksClick);
|
995 |
+
}
|
996 |
+
|
997 |
+
header.addEventListener("click", extraNetworksClick);
|
998 |
+
}
|
999 |
+
|
1000 |
+
//get toolbar
|
1001 |
+
extra_networks_btn = gradioApp().getElementById(prefix + "_extra_networks");
|
1002 |
+
|
1003 |
+
}
|
1004 |
+
|
1005 |
+
//run it once
|
1006 |
+
// update_card_for_civitai();
|
1007 |
+
|
1008 |
+
|
1009 |
+
});
|
1010 |
+
|
1011 |
+
|
1012 |
+
|
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/scripts/__pycache__/civitai_helper.cpython-310.pyc
ADDED
Binary file (11 kB). View file
|
|
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/scripts/ch_lib/__init__.py
ADDED
File without changes
|
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/scripts/ch_lib/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (218 Bytes). View file
|
|
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/scripts/ch_lib/__pycache__/civitai.cpython-310.pyc
ADDED
Binary file (13.2 kB). View file
|
|
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/scripts/ch_lib/__pycache__/downloader.cpython-310.pyc
ADDED
Binary file (6.25 kB). View file
|
|
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/scripts/ch_lib/__pycache__/js_action_civitai.cpython-310.pyc
ADDED
Binary file (8.06 kB). View file
|
|
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/scripts/ch_lib/__pycache__/model.cpython-310.pyc
ADDED
Binary file (13.9 kB). View file
|
|
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/scripts/ch_lib/__pycache__/model_action_civitai.cpython-310.pyc
ADDED
Binary file (12.4 kB). View file
|
|
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/scripts/ch_lib/__pycache__/msg_handler.cpython-310.pyc
ADDED
Binary file (1.62 kB). View file
|
|
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/scripts/ch_lib/__pycache__/templates.cpython-310.pyc
ADDED
Binary file (1.49 kB). View file
|
|
AiAF/Backup-SD-Extensions-Folder/Stable-Diffusion-Webui-Civitai-Helper/scripts/ch_lib/__pycache__/util.cpython-310.pyc
ADDED
Binary file (11 kB). View file
|
|