mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-03 22:59:14 +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 { useSystemStatsStore } from '@/stores/systemStatsStore'
|
||||
import type { components } from '@/types/comfyRegistryTypes'
|
||||
import { RegistryAccelerator } from '@/types/compatibility.types'
|
||||
import type {
|
||||
ConflictDetail,
|
||||
ConflictDetectionResponse,
|
||||
@@ -28,7 +29,6 @@ import {
|
||||
import {
|
||||
checkAcceleratorCompatibility,
|
||||
checkOSCompatibility,
|
||||
normalizeAcceleratorList,
|
||||
normalizeOSList
|
||||
} from '@/utils/simpleCompatibility'
|
||||
import {
|
||||
@@ -663,37 +663,30 @@ export function useConflictDetection() {
|
||||
function checkNodeCompatibility(
|
||||
node: Node | components['schemas']['NodeVersion']
|
||||
) {
|
||||
const systemStatsStore = useSystemStatsStore()
|
||||
const systemStats = systemStatsStore.systemStats
|
||||
if (!systemStats) return { hasConflict: false, conflicts: [] }
|
||||
|
||||
const conflicts: ConflictDetail[] = []
|
||||
|
||||
// Check OS compatibility
|
||||
const currentOS = systemStats.system?.os
|
||||
const osConflict = checkOSCompatibility(
|
||||
normalizeOSList(node.supported_os),
|
||||
currentOS
|
||||
systemEnvironment.value?.os
|
||||
)
|
||||
if (osConflict) {
|
||||
conflicts.push(osConflict)
|
||||
}
|
||||
|
||||
// Check Accelerator compatibility
|
||||
const currentAccelerator = systemStats.devices?.[0]?.type
|
||||
const acceleratorConflict = checkAcceleratorCompatibility(
|
||||
normalizeAcceleratorList(node.supported_accelerators),
|
||||
currentAccelerator
|
||||
node.supported_accelerators as RegistryAccelerator[],
|
||||
systemEnvironment.value?.accelerator
|
||||
)
|
||||
if (acceleratorConflict) {
|
||||
conflicts.push(acceleratorConflict)
|
||||
}
|
||||
|
||||
// Check ComfyUI version compatibility
|
||||
const currentComfyUIVersion = systemStats.system?.comfyui_version
|
||||
const comfyUIVersionConflict = checkVersionCompatibility(
|
||||
'comfyui_version',
|
||||
currentComfyUIVersion,
|
||||
systemEnvironment.value?.comfyui_version,
|
||||
node.supported_comfyui_version
|
||||
)
|
||||
if (comfyUIVersionConflict) {
|
||||
|
||||
@@ -124,23 +124,3 @@ export function normalizeOSList(
|
||||
|
||||
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