Skip to content

Commit a0888d9

Browse files
committed
Moving models download settings to user settings.
1 parent a4b0f5a commit a0888d9

File tree

2 files changed

+41
-14
lines changed

2 files changed

+41
-14
lines changed

Diff for: src/components/dialog/content/MissingModelsWarning.vue

+9-14
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,7 @@ import NoResultsPlaceholder from '@/components/common/NoResultsPlaceholder.vue'
4141
import { useSettingStore } from '@/stores/settingStore'
4242
import { isElectron } from '@/utils/envUtil'
4343
44-
// TODO: Read this from server internal API rather than hardcoding here
45-
// as some installations may wish to use custom sources
46-
const allowedSources = [
47-
'https://civitai.com/',
48-
'https://huggingface.co/',
49-
'http://localhost:' // Included for testing usage only
50-
]
51-
const allowedSuffixes = ['.safetensors', '.sft']
52-
// Models that fail above conditions but are still allowed
53-
const whiteListedUrls = new Set([
54-
'https://huggingface.co/stabilityai/stable-zero123/resolve/main/stable_zero123.ckpt',
55-
'https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_depth_sd14v1.pth?download=true',
56-
'https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth'
57-
])
44+
const settingsStore = useSettingStore()
5845
5946
interface ModelInfo {
6047
name: string
@@ -79,6 +66,14 @@ const doNotAskAgain = ref(false)
7966
8067
const modelDownloads = ref<Record<string, ModelInfo>>({})
8168
const missingModels = computed(() => {
69+
// Custom models sources, extension and whitelist can be customized in user settings.
70+
const allowedSources = settingsStore.get('Comfy.ModelLibrary.AllowedSources')
71+
const allowedSuffixes = settingsStore.get(
72+
'Comfy.ModelLibrary.AllowedSuffixes'
73+
)
74+
const whiteListedUrls = new Set(
75+
settingsStore.get('Comfy.ModelLibrary.WhitelistedUrls')
76+
)
8277
return props.missingModels.map((model) => {
8378
const paths = props.paths[model.directory]
8479
if (model.directory_invalid || !paths) {

Diff for: src/constants/coreSettings.ts

+32
Original file line numberDiff line numberDiff line change
@@ -744,5 +744,37 @@ export const CORE_SETTINGS: SettingParams[] = [
744744
type: 'boolean',
745745
defaultValue: true,
746746
versionAdded: '1.10.5'
747+
},
748+
{
749+
id: 'Comfy.ModelLibrary.AllowedSources',
750+
category: ['Comfy', 'Model', 'Download'],
751+
name: 'Model Download Allowed Sources',
752+
type: 'hidden',
753+
defaultValue: [
754+
'https://civitai.com/',
755+
'https://huggingface.co/',
756+
'http://localhost:'
757+
],
758+
versionAdded: '1.16.0'
759+
},
760+
{
761+
id: 'Comfy.ModelLibrary.AllowedSuffixes',
762+
category: ['Comfy', 'Model', 'Download'],
763+
name: 'Model Download Allowed Suffixes',
764+
type: 'hidden',
765+
defaultValue: ['.safetensors', '.sft'],
766+
versionAdded: '1.16.0'
767+
},
768+
{
769+
id: 'Comfy.ModelLibrary.WhitelistedUrls',
770+
category: ['Comfy', 'Model', 'Download'],
771+
name: 'Model Download Whitelisted Urls',
772+
type: 'hidden',
773+
defaultValue: [
774+
'https://huggingface.co/stabilityai/stable-zero123/resolve/main/stable_zero123.ckpt',
775+
'https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_depth_sd14v1.pth?download=true',
776+
'https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth'
777+
],
778+
versionAdded: '1.16.0'
747779
}
748780
]

0 commit comments

Comments
 (0)