Switch to new desktop types packages

This commit is contained in:
Benjamin Lu
2025-12-30 15:09:26 -08:00
parent b1d94b6619
commit ebf11faeea
6 changed files with 29 additions and 30 deletions

View File

@@ -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>

View File

@@ -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':

View File

@@ -1,3 +0,0 @@
import type { TorchDeviceType } from '@comfyorg/comfyui-electron-types'
export type DesktopTorchDeviceType = TorchDeviceType | 'amd'

View File

@@ -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' ||

21
pnpm-lock.yaml generated
View File

@@ -10,8 +10,8 @@ catalogs:
specifier: ^5.2.0
version: 5.2.0
'@comfyorg/comfyui-electron-types':
specifier: 0.5.5
version: 0.5.5
specifier: 0.6.2
version: 0.6.2
'@eslint/js':
specifier: ^9.39.1
version: 9.39.1
@@ -337,7 +337,7 @@ importers:
version: 1.3.1
'@comfyorg/comfyui-electron-types':
specifier: 'catalog:'
version: 0.5.5
version: 0.6.2
'@comfyorg/design-system':
specifier: workspace:*
version: link:packages/design-system
@@ -737,7 +737,7 @@ importers:
dependencies:
'@comfyorg/comfyui-electron-types':
specifier: 'catalog:'
version: 0.5.5
version: 0.6.2
'@comfyorg/shared-frontend-utils':
specifier: workspace:*
version: link:../../packages/shared-frontend-utils
@@ -1472,8 +1472,8 @@ packages:
'@cacheable/utils@2.3.2':
resolution: {integrity: sha512-8kGE2P+HjfY8FglaOiW+y8qxcaQAfAhVML+i66XJR3YX5FtyDqn6Txctr3K2FrbxLKixRRYYBWMbuGciOhYNDg==}
'@comfyorg/comfyui-electron-types@0.5.5':
resolution: {integrity: sha512-f3XOXpMsALIwHakz7FekVPm4/Fh2pvJPEi8tRe8jYGBt8edsd4Mkkq31Yjs2Weem3BP7yNwbdNuSiQdP/pxJyg==}
'@comfyorg/comfyui-electron-types@0.6.2':
resolution: {integrity: sha512-r3By5Wbizq8jagUrhtcym79HYUTinsvoBnYkFFWbUmrURBWIaC0HduFVkRkI1PNdI76piW+JSOJJnw00YCVXeg==}
'@csstools/color-helpers@5.1.0':
resolution: {integrity: sha512-S11EXWJyy0Mz5SYvRmY8nJYTFFd1LCNV+7cXyAgQtOOuzb4EsgfqDufL+9esx72/eLhsRdGZwaldu/h+E4t4BA==}
@@ -7971,6 +7971,9 @@ packages:
vue-component-type-helpers@3.1.8:
resolution: {integrity: sha512-oaowlmEM6BaYY+8o+9D9cuzxpWQWHqHTMKakMxXu0E+UCIOMTljyIPO15jcnaCwJtZu/zWDotK7mOIHvWD9mcw==}
vue-component-type-helpers@3.2.1:
resolution: {integrity: sha512-gKV7XOkQl4urSuLHNY1tnVQf7wVgtb/mKbRyxSLWGZUY9RK7aDPhBenTjm+i8ZFe0zC2PZeHMPtOZXZfyaFOzQ==}
vue-demi@0.14.10:
resolution: {integrity: sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==}
engines: {node: '>=12'}
@@ -9134,7 +9137,7 @@ snapshots:
hashery: 1.3.0
keyv: 5.5.5
'@comfyorg/comfyui-electron-types@0.5.5': {}
'@comfyorg/comfyui-electron-types@0.6.2': {}
'@csstools/color-helpers@5.1.0': {}
@@ -10945,7 +10948,7 @@ snapshots:
storybook: 10.1.9(@testing-library/dom@10.4.1)(prettier@3.7.4)(react-dom@19.2.3(react@19.2.3))(react@19.2.3)
type-fest: 2.19.0
vue: 3.5.13(typescript@5.9.3)
vue-component-type-helpers: 3.1.8
vue-component-type-helpers: 3.2.1
'@swc/helpers@0.5.17':
dependencies:
@@ -16838,6 +16841,8 @@ snapshots:
vue-component-type-helpers@3.1.8: {}
vue-component-type-helpers@3.2.1: {}
vue-demi@0.14.10(vue@3.5.13(typescript@5.9.3)):
dependencies:
vue: 3.5.13(typescript@5.9.3)

View File

@@ -4,7 +4,7 @@ packages:
catalog:
'@alloc/quick-lru': ^5.2.0
'@comfyorg/comfyui-electron-types': 0.5.5
'@comfyorg/comfyui-electron-types': 0.6.2
'@eslint/js': ^9.39.1
'@iconify-json/lucide': ^1.1.178
'@iconify/json': ^2.2.380