feat: add workflow node editing controls
这个提交存在于:
父节点
0091e2ace7
当前提交
8bb40b8a07
共有 9 个文件被更改,包括 158 次插入 和 23 次删除
|
|
@ -15,6 +15,7 @@ export const endpoints = {
|
||||||
workflowBranches: (workflowId: string) => `workflows/${workflowId}/branches`,
|
workflowBranches: (workflowId: string) => `workflows/${workflowId}/branches`,
|
||||||
workflowSwitchBranch: (workflowId: string) => `workflows/${workflowId}/switch-branch`,
|
workflowSwitchBranch: (workflowId: string) => `workflows/${workflowId}/switch-branch`,
|
||||||
workflowHistory: (workflowId: string) => `workflows/${workflowId}/history`,
|
workflowHistory: (workflowId: string) => `workflows/${workflowId}/history`,
|
||||||
|
node: (nodeId: string) => `nodes/${nodeId}`,
|
||||||
nodeGenerate: (nodeId: string) => `nodes/${nodeId}/generate`,
|
nodeGenerate: (nodeId: string) => `nodes/${nodeId}/generate`,
|
||||||
nodeSelectImage: (nodeId: string) => `nodes/${nodeId}/select-image`,
|
nodeSelectImage: (nodeId: string) => `nodes/${nodeId}/select-image`,
|
||||||
nodeAdoptImage: (nodeId: string) => `nodes/${nodeId}/adopt-image`,
|
nodeAdoptImage: (nodeId: string) => `nodes/${nodeId}/adopt-image`,
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,13 @@ import type {
|
||||||
} from "../../shared/types/settings"
|
} from "../../shared/types/settings"
|
||||||
import type { MediaSignResult, StorageStatus } from "../../shared/types/storage"
|
import type { MediaSignResult, StorageStatus } from "../../shared/types/storage"
|
||||||
import type { WardrobeItem, WardrobeMatchResult } from "../../shared/types/wardrobe"
|
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 =
|
type ViewKey =
|
||||||
| "dashboard"
|
| "dashboard"
|
||||||
|
|
@ -110,6 +116,12 @@ const text = {
|
||||||
workflowCreated: "\u5de5\u4f5c\u6d41\u5df2\u521b\u5efa",
|
workflowCreated: "\u5de5\u4f5c\u6d41\u5df2\u521b\u5efa",
|
||||||
emptyWorkflows: "\u6682\u65e0\u5de5\u4f5c\u6d41",
|
emptyWorkflows: "\u6682\u65e0\u5de5\u4f5c\u6d41",
|
||||||
nodes: "\u8282\u70b9",
|
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",
|
images: "\u56fe\u7247",
|
||||||
branches: "\u5206\u652f",
|
branches: "\u5206\u652f",
|
||||||
branchName: "\u5206\u652f\u540d",
|
branchName: "\u5206\u652f\u540d",
|
||||||
|
|
@ -267,6 +279,17 @@ const workflowDraft = ref({
|
||||||
const branchDraft = ref({
|
const branchDraft = ref({
|
||||||
branch_name: "",
|
branch_name: "",
|
||||||
})
|
})
|
||||||
|
const nodeDraft = ref({
|
||||||
|
node_id: "",
|
||||||
|
node_key: "",
|
||||||
|
title: "",
|
||||||
|
description: "",
|
||||||
|
node_type: "generation",
|
||||||
|
status: "pending",
|
||||||
|
prompt: "",
|
||||||
|
negative_prompt: "",
|
||||||
|
model_route: "",
|
||||||
|
})
|
||||||
const nodeGenerateDraft = ref({
|
const nodeGenerateDraft = ref({
|
||||||
model_route: "",
|
model_route: "",
|
||||||
prompt: "",
|
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<WorkflowNode>(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<WorkflowNode>(endpoints.workflowNodes(workflowId), payload)
|
||||||
|
resetNodeDraft()
|
||||||
|
await refreshSelectedWorkflow()
|
||||||
|
lastOperation.value = text.nodeCreated
|
||||||
|
return node
|
||||||
|
},
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
function reviewWorkflow() {
|
function reviewWorkflow() {
|
||||||
const workflowId = workflowDetail.value?.workflow.workflow_id
|
const workflowId = workflowDetail.value?.workflow.workflow_id
|
||||||
if (!workflowId) return Promise.resolve()
|
if (!workflowId) return Promise.resolve()
|
||||||
|
|
@ -1503,6 +1596,44 @@ function storageRootBytes(uriPrefix: string) {
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
<div class="form-grid">
|
||||||
|
<label>
|
||||||
|
<span>{{ text.nodeKey }}</span>
|
||||||
|
<input v-model="nodeDraft.node_key" type="text" />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<span>{{ text.nodeTitle }}</span>
|
||||||
|
<input v-model="nodeDraft.title" type="text" />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<span>{{ text.nodeType }}</span>
|
||||||
|
<input v-model="nodeDraft.node_type" type="text" />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<span>{{ text.status }}</span>
|
||||||
|
<input v-model="nodeDraft.status" type="text" />
|
||||||
|
</label>
|
||||||
|
<label class="wide-field">
|
||||||
|
<span>{{ text.description }}</span>
|
||||||
|
<input v-model="nodeDraft.description" type="text" />
|
||||||
|
</label>
|
||||||
|
<label class="wide-field">
|
||||||
|
<span>{{ text.prompt }}</span>
|
||||||
|
<input v-model="nodeDraft.prompt" type="text" />
|
||||||
|
</label>
|
||||||
|
<label class="wide-field">
|
||||||
|
<span>{{ text.negativePrompt }}</span>
|
||||||
|
<input v-model="nodeDraft.negative_prompt" type="text" />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<span>{{ text.modelRoute }}</span>
|
||||||
|
<input v-model="nodeDraft.model_route" type="text" />
|
||||||
|
</label>
|
||||||
|
<button type="button" :disabled="Boolean(busy) || !nodeDraft.node_key || !nodeDraft.title" @click="saveNodeDraft">
|
||||||
|
{{ nodeDraft.node_id ? text.update : text.create }}
|
||||||
|
</button>
|
||||||
|
<button type="button" :disabled="Boolean(busy)" @click="resetNodeDraft">{{ text.reset }}</button>
|
||||||
|
</div>
|
||||||
<div class="form-grid">
|
<div class="form-grid">
|
||||||
<label>
|
<label>
|
||||||
<span>{{ text.modelRoute }}</span>
|
<span>{{ text.modelRoute }}</span>
|
||||||
|
|
@ -1532,6 +1663,9 @@ function storageRootBytes(uriPrefix: string) {
|
||||||
<div class="inline-actions">
|
<div class="inline-actions">
|
||||||
<span>{{ node.branch_name }}</span>
|
<span>{{ node.branch_name }}</span>
|
||||||
<span class="badge">{{ node.status }}</span>
|
<span class="badge">{{ node.status }}</span>
|
||||||
|
<button type="button" :disabled="Boolean(busy)" @click="editNodeDraft(node)">
|
||||||
|
{{ text.edit }}
|
||||||
|
</button>
|
||||||
<button type="button" :disabled="Boolean(busy)" @click="loadNodeImages(node.node_id)">
|
<button type="button" :disabled="Boolean(busy)" @click="loadNodeImages(node.node_id)">
|
||||||
{{ text.images }}
|
{{ text.images }}
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
文件差异因一行或多行过长而隐藏
|
|
@ -1,3 +1,3 @@
|
||||||
<script type="module" crossorigin src="/assets/index-B68-Ulnb.js"></script>
|
<script type="module" crossorigin src="/assets/index-BrYe7WRe.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-KxvCyOGk.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-KxvCyOGk.css">
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|
|
||||||
17
web/assets/index-B9Xfpa3T.js
普通文件
17
web/assets/index-B9Xfpa3T.js
普通文件
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
|
|
@ -1,3 +1,3 @@
|
||||||
<script type="module" crossorigin src="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-I4d2eAkn.js"></script>
|
<script type="module" crossorigin src="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-B9Xfpa3T.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-qdHYgK-6.css">
|
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-DFZwElJS.css">
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|
|
||||||
正在加载…
添加表格
在新工单中引用