implement exclusion

main
Haoming 2024-09-03 17:17:23 +08:00
parent 952efce941
commit 8f6cfa6fc3
4 changed files with 32 additions and 0 deletions

View File

@ -27,6 +27,9 @@ Sometimes, when you type too fast or copy prompts from all over the places, you
- [x] Toggle whether the above features are enabled / disabled by default in the `Prompt Format` section under the <ins>System</ins> category of the **Settings** tab - [x] Toggle whether the above features are enabled / disabled by default in the `Prompt Format` section under the <ins>System</ins> category of the **Settings** tab
- [x] Pressing `Alt` + `Shift` + `F` can also trigger formatting - [x] Pressing `Alt` + `Shift` + `F` can also trigger formatting
- [x] Assign "[alias](#tag-alias)" that counts as duplicates for the specified tags - [x] Assign "[alias](#tag-alias)" that counts as duplicates for the specified tags
- [x] Exclude specific tags from `Remove Underscores`
- [x] Click `Reload Cached Cards & Alias` to force a reload
- By default, the `ExtraNetwork` cards are cached once at the start, to be excluded from `Remove Underscores`. If you add more cards while the Webui is still running, you may click this to re-cache again.
### Tag Alias ### Tag Alias

View File

@ -27,6 +27,9 @@
- [x] 在 **Settings** 頁面 <ins>System</ins> 下的 `Prompt Format` 區可以 開啟/關閉 上述功能 - [x] 在 **Settings** 頁面 <ins>System</ins> 下的 `Prompt Format` 區可以 開啟/關閉 上述功能
- [x] 按下 `Alt` + `Shift` + `F` 亦可觸發格式化 - [x] 按下 `Alt` + `Shift` + `F` 亦可觸發格式化
- [x] 為指定單字新增 "[同義詞](#同義詞)" - [x] 為指定單字新增 "[同義詞](#同義詞)"
- [x] 將指定字詞除外 `Remove Underscores` 的影響
- [x] 點擊 `Reload Cached Cards & Alias` 以重新載入
- 在一開始, `ExtraNetwork` 中的卡片會被緩存一次以防被 `Remove Underscores` 影響。如果你在 Webui 仍在運行時加入更多的卡片,點擊此按鈕來重新緩存。
### 同義詞 ### 同義詞

View File

@ -63,6 +63,9 @@ class LeFormatterConfig {
button.id = "setting_pf_reload"; button.id = "setting_pf_reload";
button.textContent = "Reload Cached Cards & Alias"; button.textContent = "Reload Cached Cards & Alias";
button.style.borderRadius = "1em";
button.style.margin = "1em 0em 0em 0em";
page.appendChild(button); page.appendChild(button);
return button; return button;
} }
@ -79,6 +82,13 @@ class LeFormatterConfig {
cards.push(card.textContent); cards.push(card.textContent);
}); });
const config = document.getElementById('setting_pf_exclusion').querySelector('input').value;
if (config.trim()) {
config.split(",").forEach((tag) => {
cards.push(tag.trim());
});
}
return cards; return cards;
} }

View File

@ -44,6 +44,22 @@ def on_settings():
), ),
) )
opts.add_option(
"pf_exclusion",
OptionInfo(
default="",
label="Exclude Tags from Remove Underscores",
component=gr.Textbox,
component_args={
"placeholder": "score_9, score_8_up, score_7_up",
"lines": 1,
"max_lines": 1,
},
section=section,
category_id="system",
),
)
opts.add_option( opts.add_option(
"pf_alias", "pf_alias",
OptionInfo( OptionInfo(