Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5e4b4fae04 | ||
|
|
7a73a5b1b3 | ||
|
|
47635d5aea | ||
|
|
4415e22744 |
@@ -92,7 +92,12 @@ Also, displaying related tags is not supported.
|
||||
|
||||
### User CSV
|
||||
|
||||
Users can also use their own CSV files. For example, frequently used meta tags can be added to the autocomplete suggestions by placing a file named `danbooru_tags_meta.csv` in the `data` folder.
|
||||
Users can also use their own CSV files. CSV files should be placed in the `data` folder according to the following naming convention:
|
||||
|
||||
- **CSV for Autocomplete**: `<danbooru | e621>_tags*.csv`
|
||||
- **CSV for Related Tags**: `<danbooru | e621>_tags_cooccurrence*.csv`
|
||||
|
||||
For example, you can add frequently used meta tags to the autocomplete suggestions by placing a file named `danbooru_tags_meta.csv` in the `data` folder.
|
||||
A header row is not required. A browser reload is necessary to apply the changes.
|
||||
|
||||
**Example of meta tags:**
|
||||
@@ -106,6 +111,15 @@ low_quality,5,9999999,
|
||||
worst_quality,5,9999999,
|
||||
```
|
||||
|
||||
When the browser is reloaded, you can check the list of loaded CSV files in the ComfyUI console log. If a file is not included in the log output, please verify that the file name follows the naming convention.
|
||||
|
||||
**Example of ComfyUI console log output:**
|
||||
```
|
||||
[Autocomplete-Plus] CSV file status:
|
||||
* Danbooru -> base: True, extra: danbooru_tags_meta.csv // If displayed here, meta tags can be autocompleted
|
||||
* E621 -> base: False, extra:
|
||||
```
|
||||
|
||||
>[!NOTE]
|
||||
> If there are multiple user CSV files, they are loaded in alphabetical order. If the same tag exists in multiple files, the one loaded first is retained. The basic CSV is loaded last.
|
||||
|
||||
|
||||
+15
-1
@@ -90,7 +90,12 @@
|
||||
|
||||
### ユーザーCSV
|
||||
|
||||
ユーザーが自身で用意した CSV を使用することも可能です。例として、よく使うメタタグを `danbooru_tags_meta.csv` の名前で `data` フォルダーに配置することでオートコンプリート候補に追加できます。
|
||||
ユーザーが自身で用意した CSV を使用することも可能です。 CSV ファイルは以下の命名規則に従って `data` フォルダーに配置してください。
|
||||
|
||||
- **オートコンプリート用 CSV**: <danbooru | e621>_tags*.csv
|
||||
- **関連タグ用 CSV**: <danbooru | e621>_tags_cooccurrence*.csv
|
||||
|
||||
例として、よく使うメタタグを `danbooru_tags_meta.csv` の名前で `data` フォルダーに配置することでオートコンプリート候補に追加できます。
|
||||
ヘッダー行はなくても構いません。反映にはブラウザのリロードが必要です。
|
||||
|
||||
**メタタグの例**
|
||||
@@ -104,6 +109,15 @@ low_quality,5,9999999,
|
||||
worst_quality,5,9999999,
|
||||
```
|
||||
|
||||
ブラウザリロード時、ロードされる CSV ファイル一覧をComfyUIのコンソールのログで確認出来ます。ログ出力に含まれていない場合はファイル名が命名規則に沿っているか確認してください。
|
||||
|
||||
**ComfyUIコンソールログ出力の例:**
|
||||
```
|
||||
[Autocomplete-Plus] CSV file status:
|
||||
* Danbooru -> base: True, extra: danbooru_tags_meta.csv // ここに表示されていればメタタグを入力補完できます
|
||||
* E621 -> base: False, extra:
|
||||
```
|
||||
|
||||
>[!NOTE]
|
||||
> ユーザー CSV が複数ある場合アルファベット順に読み込まれます。同じタグが複数のファイルに存在する場合は先に読み込まれた方が保持されます。基本 CSV は最後にロードされます。
|
||||
|
||||
|
||||
+10
-4
@@ -103,17 +103,23 @@ async def get_csv_list(_request):
|
||||
response = {
|
||||
DANBOORU_PREFIX: {
|
||||
'base_tags': csv_file_status[DANBOORU_PREFIX]['base_tags'],
|
||||
'extra_tags': len(csv_file_status[DANBOORU_PREFIX]['extra_tags']),
|
||||
'extra_tags': csv_file_status[DANBOORU_PREFIX]['extra_tags'],
|
||||
'base_cooccurrence': csv_file_status[DANBOORU_PREFIX]['base_cooccurrence'],
|
||||
'extra_cooccurrence': len(csv_file_status[DANBOORU_PREFIX]['extra_cooccurrence']),
|
||||
'extra_cooccurrence': csv_file_status[DANBOORU_PREFIX]['extra_cooccurrence'],
|
||||
},
|
||||
E621_PREFIX: {
|
||||
'base_tags': csv_file_status[E621_PREFIX]['base_tags'],
|
||||
'extra_tags': len(csv_file_status[E621_PREFIX]['extra_tags']),
|
||||
'extra_tags': csv_file_status[E621_PREFIX]['extra_tags'],
|
||||
'base_cooccurrence': csv_file_status[E621_PREFIX]['base_cooccurrence'],
|
||||
'extra_cooccurrence': len(csv_file_status[E621_PREFIX]['extra_cooccurrence']),
|
||||
'extra_cooccurrence': csv_file_status[E621_PREFIX]['extra_cooccurrence'],
|
||||
}
|
||||
}
|
||||
|
||||
# Print csv file status to the console for debugging
|
||||
print(f"""[Autocomplete-Plus] CSV file status:
|
||||
* Danbooru -> base: {response[DANBOORU_PREFIX]['base_tags']}, extra: {", ".join(response[DANBOORU_PREFIX]['extra_tags'])}
|
||||
* E621 -> base: {response[E621_PREFIX]['base_tags']}, extra: {", ".join(response[E621_PREFIX]['extra_tags'])}""")
|
||||
|
||||
return web.json_response(response)
|
||||
|
||||
@server.PromptServer.instance.routes.get('/autocomplete-plus/csv/{source}/{suffix}/base')
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "comfyui-autocomplete-plus"
|
||||
description = "Autocomplete and Related Tag display for ComfyUI"
|
||||
version = "1.0.1"
|
||||
version = "1.0.2"
|
||||
license = {file = "LICENSE"}
|
||||
dependencies = ["",]
|
||||
|
||||
|
||||
+10
-9
@@ -340,8 +340,8 @@ export async function initializeData(csvListData, source) {
|
||||
return;
|
||||
}
|
||||
|
||||
const extraTagsCount = csvListData[source].extra_tags || 0;
|
||||
const extraCooccurrenceCount = csvListData[source].extra_cooccurrence || 0;
|
||||
const extraTagsFileList = csvListData[source].extra_tags || [];
|
||||
const extraCooccurrenceFileList = csvListData[source].extra_cooccurrence || [];
|
||||
|
||||
const tagsUrl = `/autocomplete-plus/csv/${source}/tags`;
|
||||
const cooccurrenceUrl = `/autocomplete-plus/csv/${source}/tags_cooccurrence`;
|
||||
@@ -349,7 +349,7 @@ export async function initializeData(csvListData, source) {
|
||||
// Factory for loading tags for the current sourte
|
||||
const siteTagsLoaderFactory = async () => {
|
||||
let promiseChain = Promise.resolve();
|
||||
for (let i = 0; i < extraTagsCount; i++) {
|
||||
for (let i = 0; i < extraTagsFileList.length; i++) {
|
||||
promiseChain = promiseChain.then(() => loadTags(`${tagsUrl}/extra/${i}`, source));
|
||||
}
|
||||
if (csvListData[source].base_tags) {
|
||||
@@ -362,7 +362,7 @@ export async function initializeData(csvListData, source) {
|
||||
// Factory for loading cooccurrence data for the current sourte
|
||||
const siteCooccurrenceLoaderFactory = async () => {
|
||||
let promiseChain = Promise.resolve();
|
||||
for (let i = 0; i < extraCooccurrenceCount; i++) {
|
||||
for (let i = 0; i < extraCooccurrenceFileList.length; i++) {
|
||||
promiseChain = promiseChain.then(() => loadCooccurrence(`${cooccurrenceUrl}/extra/${i}`, source));
|
||||
}
|
||||
if (csvListData[source].base_cooccurrence) {
|
||||
@@ -377,14 +377,15 @@ export async function initializeData(csvListData, source) {
|
||||
await Promise.all([
|
||||
Promise.all(tagsLoadPromiseFactories.map(factory => factory())).then(() => {
|
||||
const endTime = performance.now();
|
||||
console.log(`[Autocomplete-Plus] "${source}" Tags loading complete in ${(endTime - startTime).toFixed(2)}ms`);
|
||||
if (csvListData[source].base_tags) {
|
||||
console.log(`[Autocomplete-Plus] "${source}" Tags loading complete in ${(endTime - startTime).toFixed(2)}ms`);
|
||||
}
|
||||
}),
|
||||
Promise.all(cooccurrenceLoadPromiseFactories.map(factory => factory())).then(() => {
|
||||
const endTime = performance.now();
|
||||
// The original log for extraCooccurrenceCount was potentially misleading as it showed
|
||||
// the count for the last processed sourte. Removed for clarity.
|
||||
// If a total count is needed, it should be calculated across all sites.
|
||||
console.log(`[Autocomplete-Plus] "${source}" Co-occurrence loading complete in ${(endTime - startTime).toFixed(2)}ms.`);
|
||||
if (csvListData[source].base_cooccurrence) {
|
||||
console.log(`[Autocomplete-Plus] "${source}" Co-occurrence loading complete in ${(endTime - startTime).toFixed(2)}ms.`);
|
||||
}
|
||||
})
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user