### Language
[䏿](README.cn.md)
[æ¥æ¬èª](README.jp.md)
[íêµì´(ChatGPT)](README.kr.md)
## About Civitai Helper2: Model Info Helper
Civitai Helper 2 will be renamed to **ModelInfo Helper**. It is under development, you can watch its UI demo video to see how it gonna look like:
[YouTube](https://youtu.be/mPcKwQDDH8s)
# Notice
**This extension now is very stable and works well for many people. If you have an issue, check console log window's detail and read [common issue](#common-issue) part**
If you want to claim it doesn't work, check this first: [Claim Wall](claim_wall.md)
# Civitai Helper
Stable Diffusion Webui Extension for Civitai, to handle your models much more easily.
Civitai: [Civitai Url](https://civitai.com/models/16768/civitai-helper-sd-webui-civitai-extension)
# Features
* Scans all models to download model information and preview images from Civitai.
* Link local model to a civitai model by civitai model's url
* Download a model(with info+preview) by Civitai Url into SD's model folder or subfolder.
* Downloading can resume at break-point, which is good for large file.
* Checking all your local model's new version from Civitai
* Download a new version directly into SD model folder (with info+preview)
* Modified Built-in "Extra Network" cards, to add the following buttons on each card:
- ð¼ï¸: Modified "replace preview" text into this icon
- ð: Open this model's Civitai url in a new tab
- ð¡: Add this model's trigger words to prompt
- ð·ï¸: Use this model's preview image's prompt
* Above buttons support thumbnail mode of Extra Network
* Option to always show additional buttons, to work with touchscreen.
# Install
Go to SD webui's extension tab, go to `Install from url` sub-tab.
Copy this project's url into it, click install.
Alternatively, download this project as a zip file, and unzip it to `Your SD webui folder/extensions`.
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.
Done.
# How to Use
## Update Your SD Webui
This extension need to get extra network's cards id. Which is added since **2023-02-06**.
**If your SD webui is an earlier version, you need to update it!**
## Scanning Models
Go to extension tab "Civitai Helper". There is a button called "Scan model".

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.
**Scanning takes time, just wait it finish**
For each model, it will create a json file to save all model info from Civitai. This model info file will be "Your_model_name.civitai.info" in your model folder.

If a model info file already exists, it will be skipped. If a model cannot be found in Civitai, it will create an empty model info file, so the model won't be scanned twice.
### Adding New Models
When you have some new models, just click scan button again, to get new model's information and preview images. It won't scan the same model twice.
## Model Card
**(Use this only after scanning finished)**
Open SD webui's build-in "Extra Network" tab, to show model cards.

Move your mouse on to the bottom of a model card. It will show 4 icon buttons:
- ð¼: Replace preview (a build-in button, modified from text to icon)
- ð: Open this model's Civitai url in a new tab
- ð¡: Add this model's trigger words to prompt
- ð·: Use this model's preview image's prompt

**If these additional buttons are not there**, click the `Refresh Civitai Helper` button to bring them back.

Everytime after Extra Network tab refreshed, it will remove all these additional buttons. So, you need to click `Refresh Civitai Helper` button to bring them back.
### Thumbnail Mode
Additional buttons work on thumbnail too, but due to SD webui's CSS issue, for now, they must be always displayed on thumbnail or don't display at all.

## Download
To download a model by Civitai Model Page's Url, you need 3 steps:
* Fill url, click button to get model info
* It will show model name and type automatically. Just choose sub-folder and model version
* Click download.

Detail will be displayed on console log, with a progress bar.
Downloading can resume from break-point, so no fear for large file.
## Checking Model's New Version
You can checking your local model's new version from civitai by model types. You can select multiple model types.

The checking process has a "1 second delay" after each model's new version checking request. So it is a little slow.
This is to protect Civitai from issue like DDos from this extension. Some cloud service provider has a rule as "no more than 1 API request in a second for free user". Civitai doesn't have this rule yet, but we still need to protect it. There is no good for us if it is down.
**After checking process done**, it will display all new version's information on UI.
There are 3 urls for each new version.
* First one is model's civitai page.
* Second one is new version's download url.
* Third one is a button to download it into your SD's model folder with python.
With this one, output information is on "Download Model" section's log and console log. **One task at a time**.

## Get Model Info By Url
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.
In that case, if you still want to link it to a civitai model. You can use this funcion.
Choose this model from list, then offer a civitai model page's url.
After clicking button, extension will download that civitai model's info and preview image for the local file you picked.

## Proxy
**If you are updating to new version, you need to re-lanuch SD webui before using it.**
Proxy textbox is at the bottom of extension tab.
**Each time you fill or clear a proxy value, you need to save setting, and Re-load UI with setting tab's reload button.**
Then all requests to civitai will use the proxy.
For some sock5 proxy, need to be used as "socks5h://xxxxx".
## Other Setting
**The Save Setting button, will save both "Scan Model"'s setting and other setting.**
* "Always Display Button" is good for touch screen.
* "Show Buttons on Thumb Mode" will turn on/off additional Buttons on thumbnail.

## Preview Image
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.
When you don't have the higher priority one, it will use the other automatically.
## Prompt
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.
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.
## SHA256
To create a file SHA256, it need to read the whole file to generate a hash code. It gonna be slow for large files.
Also, extension uses Memory Optimized SHA256, which won't stuck your system and works with colab.
There are 2 cases this hash code can not find the model on civitai:
* Some old models, which do not have SHA256 code on civitai.
* 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.
In these cases, you can always link a model to civitai by filling it