Skip to content

Allow using full path when 'Save As' a workflow. #3071

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/services/workflowService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,20 @@ export const useWorkflowService = () => {
* @param workflow The workflow to save
*/
const saveWorkflowAs = async (workflow: ComfyWorkflow) => {
const newFilename = await dialogService.prompt({
// Remove the basePath prefix from the path, since it never show to the user
const oldFileFullPath = (
workflow.directory +
'/' +
workflow.filename
).substring(ComfyWorkflow.basePath.length)
const newFileFullPath = await dialogService.prompt({
title: t('workflowService.saveWorkflow'),
message: t('workflowService.enterFilename') + ':',
defaultValue: workflow.filename
defaultValue: oldFileFullPath
})
if (!newFilename) return
if (!newFileFullPath) return

const newPath = workflow.directory + '/' + appendJsonExt(newFilename)
const newPath = ComfyWorkflow.basePath + appendJsonExt(newFileFullPath)
const newKey = newPath.substring(ComfyWorkflow.basePath.length)
const existingWorkflow = workflowStore.getWorkflowByPath(newPath)

Expand Down