Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be383ac6e1 | ||
|
|
c2406a1fd1 |
@@ -130,7 +130,7 @@ async def list_model_types(request):
|
||||
Scan all models and read their information.
|
||||
"""
|
||||
try:
|
||||
result = utils.resolve_model_base_paths(request)
|
||||
result = utils.resolve_model_base_paths()
|
||||
return web.json_response({"success": True, "data": result})
|
||||
except Exception as e:
|
||||
error_msg = f"Read models failed: {str(e)}"
|
||||
|
||||
@@ -12,8 +12,7 @@ setting_key = {
|
||||
"max_task_count": "ModelManager.Download.MaxTaskCount",
|
||||
},
|
||||
"scan": {
|
||||
"include_hidden_files": "ModelManager.Scan.IncludeHiddenFiles",
|
||||
"exclude_scan_types": "ModelManager.Scan.excludeScanTypes",
|
||||
"include_hidden_files": "ModelManager.Scan.IncludeHiddenFiles"
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -116,13 +116,10 @@ def download_web_distribution(version: str):
|
||||
print_error(f"An unexpected error occurred: {e}")
|
||||
|
||||
|
||||
def resolve_model_base_paths(request):
|
||||
def resolve_model_base_paths():
|
||||
folders = list(folder_paths.folder_names_and_paths.keys())
|
||||
model_base_paths = {}
|
||||
folder_black_list = ["configs", "custom_nodes"]
|
||||
custom_folders = get_setting_value(request, "scan.exclude_scan_types", "")
|
||||
custom_black_list = [f.strip() for f in custom_folders.split(",") if f.strip()]
|
||||
folder_black_list.extend(custom_black_list)
|
||||
for folder in folders:
|
||||
if folder in folder_black_list:
|
||||
continue
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "comfyui-model-manager"
|
||||
description = "Manage models: browsing, download and delete."
|
||||
version = "2.2.0"
|
||||
version = "2.2.2"
|
||||
license = { file = "LICENSE" }
|
||||
dependencies = ["markdownify"]
|
||||
|
||||
|
||||
@@ -68,11 +68,12 @@ import ModelCard from 'components/ModelCard.vue'
|
||||
import ResponseInput from 'components/ResponseInput.vue'
|
||||
import ResponseScroll from 'components/ResponseScroll.vue'
|
||||
import ResponseSelect from 'components/ResponseSelect.vue'
|
||||
import { useConfig } from 'hooks/config'
|
||||
import { configSetting, useConfig } from 'hooks/config'
|
||||
import { useContainerQueries } from 'hooks/container'
|
||||
import { useModels } from 'hooks/model'
|
||||
import { defineResizeCallback } from 'hooks/resize'
|
||||
import { chunk } from 'lodash'
|
||||
import { app } from 'scripts/comfyAPI'
|
||||
import { Model } from 'types/typings'
|
||||
import { genModelKey } from 'utils/model'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
@@ -89,7 +90,20 @@ const searchContent = ref<string>()
|
||||
|
||||
const currentType = ref('all')
|
||||
const typeOptions = computed(() => {
|
||||
return ['all', ...Object.keys(folders.value)].map((type) => {
|
||||
const excludeScanTypes = app.ui?.settings.getSettingValue<string>(
|
||||
configSetting.excludeScanTypes,
|
||||
)
|
||||
const customBlackList =
|
||||
excludeScanTypes
|
||||
?.split(',')
|
||||
.map((type) => type.trim())
|
||||
.filter(Boolean) ?? []
|
||||
return [
|
||||
'all',
|
||||
...Object.keys(folders.value).filter(
|
||||
(folder) => !customBlackList.includes(folder),
|
||||
),
|
||||
].map((type) => {
|
||||
return {
|
||||
label: type,
|
||||
value: type,
|
||||
|
||||
@@ -41,6 +41,10 @@ declare module 'hooks/store' {
|
||||
}
|
||||
}
|
||||
|
||||
export const configSetting = {
|
||||
excludeScanTypes: 'ModelManager.Scan.excludeScanTypes',
|
||||
}
|
||||
|
||||
function useAddConfigSettings(store: import('hooks/store').StoreProvider) {
|
||||
const { toast } = useToast()
|
||||
const { t } = useI18n()
|
||||
@@ -191,7 +195,7 @@ function useAddConfigSettings(store: import('hooks/store').StoreProvider) {
|
||||
})
|
||||
|
||||
app.ui?.settings.addSetting({
|
||||
id: 'ModelManager.Scan.excludeScanTypes',
|
||||
id: configSetting.excludeScanTypes,
|
||||
category: [t('modelManager'), t('setting.scan'), 'ExcludeScanTypes'],
|
||||
name: t('setting.excludeScanTypes'),
|
||||
defaultValue: undefined,
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
unref,
|
||||
} from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { configSetting } from './config'
|
||||
|
||||
type ModelFolder = Record<string, string[]>
|
||||
|
||||
@@ -56,8 +57,20 @@ export const useModels = defineStore('models', (store) => {
|
||||
const refreshAllModels = async (force = false) => {
|
||||
const forceRefresh = force ? refreshFolders() : Promise.resolve()
|
||||
models.value = {}
|
||||
const excludeScanTypes = app.ui?.settings.getSettingValue<string>(
|
||||
configSetting.excludeScanTypes,
|
||||
)
|
||||
const customBlackList =
|
||||
excludeScanTypes
|
||||
?.split(',')
|
||||
.map((type) => type.trim())
|
||||
.filter(Boolean) ?? []
|
||||
return forceRefresh.then(() =>
|
||||
Promise.allSettled(Object.keys(folders.value).map(refreshModels)),
|
||||
Promise.allSettled(
|
||||
Object.keys(folders.value)
|
||||
.filter((folder) => !customBlackList.includes(folder))
|
||||
.map(refreshModels),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user