mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-05 05:00:03 +00:00
Switch to new desktop types packages
This commit is contained in:
@@ -68,22 +68,22 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { TorchDeviceType } from '@comfyorg/comfyui-electron-types'
|
||||
import Tag from 'primevue/tag'
|
||||
import { computed } from 'vue'
|
||||
|
||||
import HardwareOption from '@/components/install/HardwareOption.vue'
|
||||
import { st } from '@/i18n'
|
||||
import type { DesktopTorchDeviceType } from '@/types/desktop/torchTypes'
|
||||
import { electronAPI } from '@/utils/envUtil'
|
||||
|
||||
const selected = defineModel<DesktopTorchDeviceType | null>('device', {
|
||||
const selected = defineModel<TorchDeviceType | null>('device', {
|
||||
required: true
|
||||
})
|
||||
|
||||
const electron = electronAPI()
|
||||
const platform = electron.getPlatform()
|
||||
|
||||
const recommendedDevices: DesktopTorchDeviceType[] = ['mps', 'nvidia', 'amd']
|
||||
const recommendedDevices: TorchDeviceType[] = ['mps', 'nvidia', 'amd']
|
||||
const showRecommendedBadge = computed(() =>
|
||||
selected.value ? recommendedDevices.includes(selected.value) : false
|
||||
)
|
||||
@@ -101,7 +101,7 @@ const descriptionText = computed(() => {
|
||||
return st(`install.gpuPicker.${key}Description`, '')
|
||||
})
|
||||
|
||||
function pickGpu(value: DesktopTorchDeviceType) {
|
||||
function pickGpu(value: TorchDeviceType) {
|
||||
selected.value = value
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -105,6 +105,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { TorchMirrorUrl } from '@comfyorg/comfyui-electron-types'
|
||||
import type { TorchDeviceType } from '@comfyorg/comfyui-electron-types'
|
||||
import { isInChina } from '@comfyorg/shared-frontend-utils/networkUtil'
|
||||
import Accordion from 'primevue/accordion'
|
||||
import AccordionContent from 'primevue/accordioncontent'
|
||||
@@ -120,7 +121,6 @@ import { useI18n } from 'vue-i18n'
|
||||
|
||||
import { PYPI_MIRROR, PYTHON_MIRROR } from '@/constants/uvMirrors'
|
||||
import type { UVMirror } from '@/constants/uvMirrors'
|
||||
import type { DesktopTorchDeviceType } from '@/types/desktop/torchTypes'
|
||||
import { electronAPI } from '@/utils/envUtil'
|
||||
import { ValidationState } from '@/utils/validationUtil'
|
||||
|
||||
@@ -143,7 +143,7 @@ const torchMirror = defineModel<string>('torchMirror', {
|
||||
default: ''
|
||||
})
|
||||
|
||||
const { device } = defineProps<{ device: DesktopTorchDeviceType | null }>()
|
||||
const { device } = defineProps<{ device: TorchDeviceType | null }>()
|
||||
|
||||
const pathExists = ref(false)
|
||||
const nonDefaultDrive = ref(false)
|
||||
@@ -155,7 +155,7 @@ const activeAccordionIndex = ref<string[] | undefined>(undefined)
|
||||
const electron = electronAPI()
|
||||
|
||||
// Mirror configuration logic
|
||||
function getTorchMirrorItem(device: DesktopTorchDeviceType): UVMirror {
|
||||
function getTorchMirrorItem(device: TorchDeviceType): UVMirror {
|
||||
const settingId = 'Comfy-Desktop.UV.TorchInstallMirror'
|
||||
switch (device) {
|
||||
case 'mps':
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
import type { TorchDeviceType } from '@comfyorg/comfyui-electron-types'
|
||||
|
||||
export type DesktopTorchDeviceType = TorchDeviceType | 'amd'
|
||||
@@ -53,7 +53,10 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { InstallOptions } from '@comfyorg/comfyui-electron-types'
|
||||
import type {
|
||||
InstallOptions,
|
||||
TorchDeviceType
|
||||
} from '@comfyorg/comfyui-electron-types'
|
||||
import StepPanel from 'primevue/steppanel'
|
||||
import StepPanels from 'primevue/steppanels'
|
||||
import Stepper from 'primevue/stepper'
|
||||
@@ -64,15 +67,10 @@ import DesktopSettingsConfiguration from '@/components/install/DesktopSettingsCo
|
||||
import GpuPicker from '@/components/install/GpuPicker.vue'
|
||||
import InstallFooter from '@/components/install/InstallFooter.vue'
|
||||
import InstallLocationPicker from '@/components/install/InstallLocationPicker.vue'
|
||||
import type { DesktopTorchDeviceType } from '@/types/desktop/torchTypes'
|
||||
import { electronAPI } from '@/utils/envUtil'
|
||||
import BaseViewTemplate from '@/views/templates/BaseViewTemplate.vue'
|
||||
|
||||
type DesktopInstallOptions = Omit<InstallOptions, 'device'> & {
|
||||
device: DesktopTorchDeviceType
|
||||
}
|
||||
|
||||
const device = ref<DesktopTorchDeviceType | null>(null)
|
||||
const device = ref<TorchDeviceType | null>(null)
|
||||
|
||||
const installPath = ref('')
|
||||
const pathError = ref('')
|
||||
@@ -147,7 +145,7 @@ const router = useRouter()
|
||||
const install = async () => {
|
||||
if (!device.value) return
|
||||
|
||||
const options: DesktopInstallOptions = {
|
||||
const options: InstallOptions = {
|
||||
installPath: installPath.value,
|
||||
autoUpdate: autoUpdate.value,
|
||||
allowMetrics: allowMetrics.value,
|
||||
@@ -158,7 +156,7 @@ const install = async () => {
|
||||
torchMirror: torchMirror.value,
|
||||
device: device.value
|
||||
}
|
||||
electron.installComfyUI(options as InstallOptions)
|
||||
electron.installComfyUI(options)
|
||||
|
||||
const nextPage =
|
||||
options.device === 'unsupported' ? '/manual-configuration' : '/server-start'
|
||||
@@ -168,8 +166,7 @@ const install = async () => {
|
||||
onMounted(async () => {
|
||||
if (!electron) return
|
||||
|
||||
const detectedGpu =
|
||||
(await electron.Config.getDetectedGpu()) as DesktopTorchDeviceType | null
|
||||
const detectedGpu = await electron.Config.getDetectedGpu()
|
||||
if (
|
||||
detectedGpu === 'mps' ||
|
||||
detectedGpu === 'nvidia' ||
|
||||
|
||||
Reference in New Issue
Block a user