From 8bb40b8a0797d5fd19a0d2fa4264da72b343aabf Mon Sep 17 00:00:00 2001 From: YokiiroBW Date: Sun, 5 Jul 2026 14:26:39 +0800 Subject: [PATCH] feat: add workflow node editing controls --- frontend/shared/api/endpoints.ts | 1 + frontend/standalone-web/src/App.vue | 136 +++++++++++++++++- .../{index-B68-Ulnb.js => index-BrYe7WRe.js} | 2 +- pages/imagestudio/index.html | 2 +- web/assets/index-B9Xfpa3T.js | 17 +++ web/assets/index-DFZwElJS.css | 1 + web/assets/index-I4d2eAkn.js | 17 --- web/assets/index-qdHYgK-6.css | 1 - web/index.html | 4 +- 9 files changed, 158 insertions(+), 23 deletions(-) rename pages/imagestudio/assets/{index-B68-Ulnb.js => index-BrYe7WRe.js} (91%) create mode 100644 web/assets/index-B9Xfpa3T.js create mode 100644 web/assets/index-DFZwElJS.css delete mode 100644 web/assets/index-I4d2eAkn.js delete mode 100644 web/assets/index-qdHYgK-6.css diff --git a/frontend/shared/api/endpoints.ts b/frontend/shared/api/endpoints.ts index 251bf6b..917e649 100644 --- a/frontend/shared/api/endpoints.ts +++ b/frontend/shared/api/endpoints.ts @@ -15,6 +15,7 @@ export const endpoints = { workflowBranches: (workflowId: string) => `workflows/${workflowId}/branches`, workflowSwitchBranch: (workflowId: string) => `workflows/${workflowId}/switch-branch`, workflowHistory: (workflowId: string) => `workflows/${workflowId}/history`, + node: (nodeId: string) => `nodes/${nodeId}`, nodeGenerate: (nodeId: string) => `nodes/${nodeId}/generate`, nodeSelectImage: (nodeId: string) => `nodes/${nodeId}/select-image`, nodeAdoptImage: (nodeId: string) => `nodes/${nodeId}/adopt-image`, diff --git a/frontend/standalone-web/src/App.vue b/frontend/standalone-web/src/App.vue index fd68d15..ea05495 100644 --- a/frontend/standalone-web/src/App.vue +++ b/frontend/standalone-web/src/App.vue @@ -24,7 +24,13 @@ import type { } from "../../shared/types/settings" import type { MediaSignResult, StorageStatus } from "../../shared/types/storage" import type { WardrobeItem, WardrobeMatchResult } from "../../shared/types/wardrobe" -import type { ProfileWorkflow, WorkflowBranch, WorkflowDetail, WorkflowHistoryEntry } from "../../shared/types/workflow" +import type { + ProfileWorkflow, + WorkflowBranch, + WorkflowDetail, + WorkflowHistoryEntry, + WorkflowNode, +} from "../../shared/types/workflow" type ViewKey = | "dashboard" @@ -110,6 +116,12 @@ const text = { workflowCreated: "\u5de5\u4f5c\u6d41\u5df2\u521b\u5efa", emptyWorkflows: "\u6682\u65e0\u5de5\u4f5c\u6d41", nodes: "\u8282\u70b9", + nodeKey: "NodeKey", + nodeTitle: "\u8282\u70b9\u6807\u9898", + nodeType: "\u8282\u70b9\u7c7b\u578b", + status: "\u72b6\u6001", + nodeCreated: "\u8282\u70b9\u5df2\u521b\u5efa", + nodeUpdated: "\u8282\u70b9\u5df2\u66f4\u65b0", images: "\u56fe\u7247", branches: "\u5206\u652f", branchName: "\u5206\u652f\u540d", @@ -267,6 +279,17 @@ const workflowDraft = ref({ const branchDraft = ref({ branch_name: "", }) +const nodeDraft = ref({ + node_id: "", + node_key: "", + title: "", + description: "", + node_type: "generation", + status: "pending", + prompt: "", + negative_prompt: "", + model_route: "", +}) const nodeGenerateDraft = ref({ model_route: "", prompt: "", @@ -720,6 +743,76 @@ function switchWorkflowBranch(branchName: string) { ) } +function resetNodeDraft() { + nodeDraft.value = { + node_id: "", + node_key: "", + title: "", + description: "", + node_type: "generation", + status: "pending", + prompt: "", + negative_prompt: "", + model_route: "", + } +} + +function editNodeDraft(node: WorkflowNode) { + nodeDraft.value = { + node_id: node.node_id, + node_key: node.node_key, + title: node.title, + description: node.description ?? "", + node_type: node.node_type, + status: node.status, + prompt: node.prompt ?? "", + negative_prompt: node.negative_prompt ?? "", + model_route: node.model_route ?? "", + } +} + +function saveNodeDraft() { + const workflowId = workflowDetail.value?.workflow.workflow_id + if (!workflowId || !nodeDraft.value.node_key || !nodeDraft.value.title) return Promise.resolve() + const payload = { + node_key: nodeDraft.value.node_key, + title: nodeDraft.value.title, + description: nodeDraft.value.description || undefined, + node_type: nodeDraft.value.node_type || "generation", + status: nodeDraft.value.status || "pending", + prompt: nodeDraft.value.prompt || undefined, + negative_prompt: nodeDraft.value.negative_prompt || undefined, + model_route: nodeDraft.value.model_route || undefined, + } + if (nodeDraft.value.node_id) { + return runOperation( + text.update, + async () => { + const node = await request(endpoints.node(nodeDraft.value.node_id), { + method: "PUT", + body: payload, + }) + resetNodeDraft() + await refreshSelectedWorkflow() + lastOperation.value = text.nodeUpdated + return node + }, + false, + ) + } + return runOperation( + text.create, + async () => { + const node = await postJson(endpoints.workflowNodes(workflowId), payload) + resetNodeDraft() + await refreshSelectedWorkflow() + lastOperation.value = text.nodeCreated + return node + }, + false, + ) +} + function reviewWorkflow() { const workflowId = workflowDetail.value?.workflow.workflow_id if (!workflowId) return Promise.resolve() @@ -1503,6 +1596,44 @@ function storageRootBytes(uriPrefix: string) { +
+ + + + + + + + + + +