Skip to content

Commit 8257ad5

Browse files
Merge pull request #65 from bedovyy/feature/prefixArtist
feat: add prefixArtist for artist tags
2 parents b8c250e + 7f08952 commit 8257ad5

7 files changed

Lines changed: 27 additions & 2 deletions

File tree

locales/en/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
"AutocompletePlus_Autocompletion_EnableModels": {
3232
"name": "Enable Loras and Embeddings"
3333
},
34+
"AutocompletePlus_Autocompletion_PrefixArtist": {
35+
"name": "String to add before artist tags"
36+
},
3437
"AutocompletePlus_Autocompletion_ReplaceUnderscoreWithSpace": {
3538
"name": "Replace '_' with 'Space'",
3639
"tooltip": "This setting also affects related tags display."

locales/ja/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
"AutocompletePlus_Autocompletion_EnableModels": {
3232
"name": "LoraとEmbeddingを候補に表示する"
3333
},
34+
"AutocompletePlus_Autocompletion_PrefixArtist": {
35+
"name": "アーティストタグの前に追加する文字列"
36+
},
3437
"AutocompletePlus_Autocompletion_ReplaceUnderscoreWithSpace": {
3538
"name": "'_' を 'スペース' に置き換える",
3639
"tooltip": "この設定は関連タグ表示にも影響します"

locales/zh-TW/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
"AutocompletePlus_Autocompletion_EnableModels": {
3232
"name": "顯示Lora和Embedding"
3333
},
34+
"AutocompletePlus_Autocompletion_PrefixArtist": {
35+
"name": "在藝術家標籤前添加的字串"
36+
},
3437
"AutocompletePlus_Autocompletion_ReplaceUnderscoreWithSpace": {
3538
"name": "將'_'替換為'空格'",
3639
"tooltip": "此設定也會影響相關標籤顯示"

locales/zh/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
"AutocompletePlus_Autocompletion_EnableModels": {
3232
"name": "显示Lora和Embedding"
3333
},
34+
"AutocompletePlus_Autocompletion_PrefixArtist": {
35+
"name": "在艺术家标签前添加的字符串"
36+
},
3437
"AutocompletePlus_Autocompletion_ReplaceUnderscoreWithSpace": {
3538
"name": "将'_'替换为'空格'",
3639
"tooltip": "此设置也会影响相关标签显示"

web/js/autocomplete.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,13 @@ function insertTagToTextArea(inputElement, tagDataToInsert) {
351351
const needsSpaceBefore = text[replaceStart - 1] === ',';
352352
const prefix = needsSpaceBefore ? ' ' : '';
353353

354+
const prefixArtist = tagDataToInsert.categoryText == 'artist' ? settingValues.prefixArtist : '';
355+
354356
// Standard separator (comma + space, or empty if autoInsertComma is disabled)
355357
const needsSuffixAfter = !",:".includes(text[replaceEnd]); // TODO: If ":" is part of the emoticon, a suffix is ​​required (e.g. ":o")
356358
const suffix = (needsSuffixAfter && settingValues.autoInsertComma) ? ', ' : '';
357359

358-
const textToInsertWithAffixes = prefix + normalizedTag + suffix;
360+
const textToInsertWithAffixes = prefix + prefixArtist + normalizedTag + suffix;
359361

360362
// --- Use execCommand for Undo support ---
361363
// 1. Select the text range to be replaced

web/js/main.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,16 @@ app.registerExtension({
377377
settingValues.enableModels = newVal;
378378
}
379379
},
380+
{
381+
id: id + ".Autocompletion.PrefixArtist",
382+
name: "String to add before artist tags",
383+
type: "text",
384+
defaultValue: '',
385+
category: [name, "Autocompletion", "String to add before artist tags"],
386+
onChange: (newVal, oldVal) => {
387+
settingValues.prefixArtist = newVal;
388+
}
389+
},
380390
{
381391
id: id + ".Autocompletion.ReplaceUnderscoreWithSpace",
382392
name: "Replace '_' with 'Space'",
@@ -535,4 +545,4 @@ app.registerExtension({
535545
},
536546
},
537547
]
538-
});
548+
});

web/js/settings.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const settingValues = {
1010
enableModels: true, // Enable Lora and Embedding suggestions
1111
useFastSearch: false,
1212
replaceUnderscoreWithSpace: true, // Replace underscores with spaces in tag insertion
13+
prefixArtist: '', // Prefix to be attached before artist tags
1314
autoInsertComma: true,
1415

1516
// Related tags feature settings

0 commit comments

Comments
 (0)