mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 11:11:53 +00:00
[Desktop] Fix torch mirror setting (#2475)
This commit is contained in:
@@ -80,11 +80,28 @@ const getTorchMirrorItem = (device: TorchDeviceType): UVMirror => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mirrors = computed<[UVMirror, ModelRef<string>][]>(() => [
|
const userIsInChina = ref(false)
|
||||||
[PYTHON_MIRROR, pythonMirror],
|
onMounted(async () => {
|
||||||
[PYPI_MIRROR, pypiMirror],
|
userIsInChina.value = await isInChina()
|
||||||
[getTorchMirrorItem(device), torchMirror]
|
})
|
||||||
])
|
|
||||||
|
const useFallbackMirror = (mirror: UVMirror) => ({
|
||||||
|
...mirror,
|
||||||
|
mirror: mirror.fallbackMirror
|
||||||
|
})
|
||||||
|
|
||||||
|
const mirrors = computed<[UVMirror, ModelRef<string>][]>(() =>
|
||||||
|
(
|
||||||
|
[
|
||||||
|
[PYTHON_MIRROR, pythonMirror],
|
||||||
|
[PYPI_MIRROR, pypiMirror],
|
||||||
|
[getTorchMirrorItem(device), torchMirror]
|
||||||
|
] as [UVMirror, ModelRef<string>][]
|
||||||
|
).map(([item, modelValue]) => [
|
||||||
|
userIsInChina.value ? useFallbackMirror(item) : item,
|
||||||
|
modelValue
|
||||||
|
])
|
||||||
|
)
|
||||||
|
|
||||||
const validationStates = ref<ValidationState[]>(
|
const validationStates = ref<ValidationState[]>(
|
||||||
mirrors.value.map(() => ValidationState.IDLE)
|
mirrors.value.map(() => ValidationState.IDLE)
|
||||||
@@ -102,13 +119,4 @@ const validationStateTooltip = computed(() => {
|
|||||||
return t('install.settings.checkingMirrors')
|
return t('install.settings.checkingMirrors')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
// Check if user is in China and set fallback mirrors directly
|
|
||||||
if (await isInChina()) {
|
|
||||||
for (const [item, modelValue] of mirrors.value) {
|
|
||||||
modelValue.value = item.fallbackMirror
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -44,10 +44,7 @@ const normalizedSettingId = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// Set mirror value if not already set
|
modelValue.value = item.mirror
|
||||||
if (!modelValue.value) {
|
|
||||||
modelValue.value = item.mirror
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(validationState, (newState) => {
|
watch(validationState, (newState) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user