diff --git a/src/scripts/ui/menu/workflows.ts b/src/scripts/ui/menu/workflows.ts index 0ed3b281d..33478a58c 100644 --- a/src/scripts/ui/menu/workflows.ts +++ b/src/scripts/ui/menu/workflows.ts @@ -4,8 +4,9 @@ import { $el } from '../../ui' import { api } from '../../api' import { ComfyPopup } from '../components/popup' import { createSpinner } from '../spinner' -import { ComfyWorkflow, trimJsonExt } from '../../workflows' +import { ComfyWorkflow } from '../../workflows' import { ComfyAsyncDialog } from '../components/asyncDialog' +import { trimJsonExt } from '@/utils/formatUtil' import type { ComfyApp } from '@/scripts/app' import type { ComfyComponent } from '../components' diff --git a/src/scripts/workflows.ts b/src/scripts/workflows.ts index 30e70ccbb..bb7087220 100644 --- a/src/scripts/workflows.ts +++ b/src/scripts/workflows.ts @@ -4,17 +4,7 @@ import { ChangeTracker } from './changeTracker' import { ComfyAsyncDialog } from './ui/components/asyncDialog' import { getStorageValue, setStorageValue } from './utils' import { LGraphCanvas, LGraph } from '@comfyorg/litegraph' - -function appendJsonExt(path: string) { - if (!path.toLowerCase().endsWith('.json')) { - path += '.json' - } - return path -} - -export function trimJsonExt(path: string) { - return path?.replace(/\.json$/, '') -} +import { appendJsonExt, trimJsonExt } from '@/utils/formatUtil' export class ComfyWorkflowManager extends EventTarget { executionStore: any = null diff --git a/src/utils/formatUtil.ts b/src/utils/formatUtil.ts index 0cecd4923..6bec35cec 100644 --- a/src/utils/formatUtil.ts +++ b/src/utils/formatUtil.ts @@ -22,3 +22,14 @@ export function formatCamelCase(str: string): string { // Join the words with spaces return processedWords.join(' ') } + +export function appendJsonExt(path: string) { + if (!path.toLowerCase().endsWith('.json')) { + path += '.json' + } + return path +} + +export function trimJsonExt(path: string) { + return path.replace(/\.json$/, '') +}