mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-26 01:09:46 +00:00
refactor: duplicate state deleted & unused function deleted
This commit is contained in:
@@ -10,6 +10,7 @@ import { useComfyManagerStore } from '@/stores/comfyManagerStore'
|
|||||||
import { useConflictDetectionStore } from '@/stores/conflictDetectionStore'
|
import { useConflictDetectionStore } from '@/stores/conflictDetectionStore'
|
||||||
import { useSystemStatsStore } from '@/stores/systemStatsStore'
|
import { useSystemStatsStore } from '@/stores/systemStatsStore'
|
||||||
import type { components } from '@/types/comfyRegistryTypes'
|
import type { components } from '@/types/comfyRegistryTypes'
|
||||||
|
import { RegistryAccelerator } from '@/types/compatibility.types'
|
||||||
import type {
|
import type {
|
||||||
ConflictDetail,
|
ConflictDetail,
|
||||||
ConflictDetectionResponse,
|
ConflictDetectionResponse,
|
||||||
@@ -28,7 +29,6 @@ import {
|
|||||||
import {
|
import {
|
||||||
checkAcceleratorCompatibility,
|
checkAcceleratorCompatibility,
|
||||||
checkOSCompatibility,
|
checkOSCompatibility,
|
||||||
normalizeAcceleratorList,
|
|
||||||
normalizeOSList
|
normalizeOSList
|
||||||
} from '@/utils/simpleCompatibility'
|
} from '@/utils/simpleCompatibility'
|
||||||
import {
|
import {
|
||||||
@@ -663,37 +663,30 @@ export function useConflictDetection() {
|
|||||||
function checkNodeCompatibility(
|
function checkNodeCompatibility(
|
||||||
node: Node | components['schemas']['NodeVersion']
|
node: Node | components['schemas']['NodeVersion']
|
||||||
) {
|
) {
|
||||||
const systemStatsStore = useSystemStatsStore()
|
|
||||||
const systemStats = systemStatsStore.systemStats
|
|
||||||
if (!systemStats) return { hasConflict: false, conflicts: [] }
|
|
||||||
|
|
||||||
const conflicts: ConflictDetail[] = []
|
const conflicts: ConflictDetail[] = []
|
||||||
|
|
||||||
// Check OS compatibility
|
// Check OS compatibility
|
||||||
const currentOS = systemStats.system?.os
|
|
||||||
const osConflict = checkOSCompatibility(
|
const osConflict = checkOSCompatibility(
|
||||||
normalizeOSList(node.supported_os),
|
normalizeOSList(node.supported_os),
|
||||||
currentOS
|
systemEnvironment.value?.os
|
||||||
)
|
)
|
||||||
if (osConflict) {
|
if (osConflict) {
|
||||||
conflicts.push(osConflict)
|
conflicts.push(osConflict)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check Accelerator compatibility
|
// Check Accelerator compatibility
|
||||||
const currentAccelerator = systemStats.devices?.[0]?.type
|
|
||||||
const acceleratorConflict = checkAcceleratorCompatibility(
|
const acceleratorConflict = checkAcceleratorCompatibility(
|
||||||
normalizeAcceleratorList(node.supported_accelerators),
|
node.supported_accelerators as RegistryAccelerator[],
|
||||||
currentAccelerator
|
systemEnvironment.value?.accelerator
|
||||||
)
|
)
|
||||||
if (acceleratorConflict) {
|
if (acceleratorConflict) {
|
||||||
conflicts.push(acceleratorConflict)
|
conflicts.push(acceleratorConflict)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check ComfyUI version compatibility
|
// Check ComfyUI version compatibility
|
||||||
const currentComfyUIVersion = systemStats.system?.comfyui_version
|
|
||||||
const comfyUIVersionConflict = checkVersionCompatibility(
|
const comfyUIVersionConflict = checkVersionCompatibility(
|
||||||
'comfyui_version',
|
'comfyui_version',
|
||||||
currentComfyUIVersion,
|
systemEnvironment.value?.comfyui_version,
|
||||||
node.supported_comfyui_version
|
node.supported_comfyui_version
|
||||||
)
|
)
|
||||||
if (comfyUIVersionConflict) {
|
if (comfyUIVersionConflict) {
|
||||||
|
|||||||
@@ -124,23 +124,3 @@ export function normalizeOSList(
|
|||||||
|
|
||||||
return validOS.length > 0 ? validOS : undefined
|
return validOS.length > 0 ? validOS : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Normalizes accelerator values from Registry API
|
|
||||||
* @returns undefined if all accelerators supported, otherwise filtered valid list
|
|
||||||
*/
|
|
||||||
export function normalizeAcceleratorList(
|
|
||||||
accelerators?: string[] | null
|
|
||||||
): RegistryAccelerator[] | undefined {
|
|
||||||
if (isNil(accelerators) || isEmpty(accelerators)) return undefined
|
|
||||||
|
|
||||||
// Filter to valid Registry accelerator values only
|
|
||||||
const validAcc: RegistryAccelerator[] = []
|
|
||||||
accelerators.forEach((acc) => {
|
|
||||||
if (acc === 'CUDA' || acc === 'ROCm' || acc === 'Metal' || acc === 'CPU') {
|
|
||||||
if (!validAcc.includes(acc)) validAcc.push(acc)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return validAcc.length > 0 ? validAcc : undefined
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user