Expose review policy in frontend
这个提交存在于:
父节点
9de0996eb6
当前提交
60d9854405
共有 10 个文件被更改,包括 104 次插入 和 26 次删除
|
|
@ -24,6 +24,8 @@ export const endpoints = {
|
||||||
nodeMarkCompleted: (nodeId: string) => `nodes/${nodeId}/mark-completed`,
|
nodeMarkCompleted: (nodeId: string) => `nodes/${nodeId}/mark-completed`,
|
||||||
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`,
|
||||||
|
reviewPolicy: "review/policy",
|
||||||
|
reviewPolicyValidate: "review/policy/validate",
|
||||||
nodeReview: (nodeId: string) => `nodes/${nodeId}/review`,
|
nodeReview: (nodeId: string) => `nodes/${nodeId}/review`,
|
||||||
nodeImages: (nodeId: string) => `nodes/${nodeId}/images`,
|
nodeImages: (nodeId: string) => `nodes/${nodeId}/images`,
|
||||||
workflowReview: (workflowId: string) => `workflows/${workflowId}/review`,
|
workflowReview: (workflowId: string) => `workflows/${workflowId}/review`,
|
||||||
|
|
|
||||||
|
|
@ -13,3 +13,18 @@ export interface ReviewResult {
|
||||||
summary: Record<string, unknown>
|
summary: Record<string, unknown>
|
||||||
nodes?: ReviewResult[]
|
nodes?: ReviewResult[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ReviewPolicy {
|
||||||
|
version: string
|
||||||
|
warn_without_images: boolean
|
||||||
|
require_selected_image_for_statuses: string[]
|
||||||
|
fail_on_selected_image_not_found: boolean
|
||||||
|
fail_on_archived_selected_image: boolean
|
||||||
|
workflow_terminal_statuses: string[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ReviewPolicyValidation {
|
||||||
|
valid: boolean
|
||||||
|
policy: ReviewPolicy
|
||||||
|
errors: ReviewMessage[]
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import type { GenerationJob, JobListResult } from "../../shared/types/job"
|
||||||
import type { EventStreamResult, LogBundle } from "../../shared/types/logs"
|
import type { EventStreamResult, LogBundle } from "../../shared/types/logs"
|
||||||
import type { Material, MaterialCategory, MaterialListResult } from "../../shared/types/material"
|
import type { Material, MaterialCategory, MaterialListResult } from "../../shared/types/material"
|
||||||
import type { CharacterProfile, ProfileListResult, QuickProfileDraftResult } from "../../shared/types/profile"
|
import type { CharacterProfile, ProfileListResult, QuickProfileDraftResult } from "../../shared/types/profile"
|
||||||
import type { ReviewResult } from "../../shared/types/review"
|
import type { ReviewPolicy, ReviewPolicyValidation, ReviewResult } from "../../shared/types/review"
|
||||||
import type {
|
import type {
|
||||||
CurrentSettings,
|
CurrentSettings,
|
||||||
DiffSettingsResult,
|
DiffSettingsResult,
|
||||||
|
|
@ -138,6 +138,10 @@ const text = {
|
||||||
history: "\u5386\u53f2",
|
history: "\u5386\u53f2",
|
||||||
review: "\u8bc4\u5ba1",
|
review: "\u8bc4\u5ba1",
|
||||||
reviewResult: "\u8bc4\u5ba1\u7ed3\u679c",
|
reviewResult: "\u8bc4\u5ba1\u7ed3\u679c",
|
||||||
|
reviewPolicy: "\u8bc4\u5ba1\u7b56\u7565",
|
||||||
|
loadPolicy: "\u52a0\u8f7d\u7b56\u7565",
|
||||||
|
validatePolicy: "\u6821\u9a8c\u7b56\u7565",
|
||||||
|
policyDraftInvalid: "\u7b56\u7565 JSON \u683c\u5f0f\u65e0\u6548",
|
||||||
emptyImages: "\u6682\u65e0\u56fe\u7247",
|
emptyImages: "\u6682\u65e0\u56fe\u7247",
|
||||||
emptyHistory: "\u6682\u65e0\u5386\u53f2",
|
emptyHistory: "\u6682\u65e0\u5386\u53f2",
|
||||||
modelRoute: "\u6a21\u578b\u8def\u7531",
|
modelRoute: "\u6a21\u578b\u8def\u7531",
|
||||||
|
|
@ -260,6 +264,9 @@ const workflowDetail = ref<WorkflowDetail | null>(null)
|
||||||
const workflowBranches = ref<WorkflowBranch[]>([])
|
const workflowBranches = ref<WorkflowBranch[]>([])
|
||||||
const workflowHistory = ref<WorkflowHistoryEntry[]>([])
|
const workflowHistory = ref<WorkflowHistoryEntry[]>([])
|
||||||
const reviewResult = ref<ReviewResult | null>(null)
|
const reviewResult = ref<ReviewResult | null>(null)
|
||||||
|
const reviewPolicy = ref<ReviewPolicy | null>(null)
|
||||||
|
const reviewPolicyValidation = ref<ReviewPolicyValidation | null>(null)
|
||||||
|
const reviewPolicyDraft = ref("")
|
||||||
const selectedNodeId = ref("")
|
const selectedNodeId = ref("")
|
||||||
const nodeImages = ref<GenerationImage[]>([])
|
const nodeImages = ref<GenerationImage[]>([])
|
||||||
const nodeGenerateResult = ref<NodeGenerateResult | null>(null)
|
const nodeGenerateResult = ref<NodeGenerateResult | null>(null)
|
||||||
|
|
@ -474,6 +481,7 @@ async function load() {
|
||||||
materialData,
|
materialData,
|
||||||
dialectData,
|
dialectData,
|
||||||
capabilityData,
|
capabilityData,
|
||||||
|
reviewPolicyData,
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
getJson<UiBootstrap>(endpoints.uiBootstrap),
|
getJson<UiBootstrap>(endpoints.uiBootstrap),
|
||||||
getJson<DashboardSummary>(endpoints.dashboardSummary),
|
getJson<DashboardSummary>(endpoints.dashboardSummary),
|
||||||
|
|
@ -486,6 +494,7 @@ async function load() {
|
||||||
getJson<MaterialListResult>(endpoints.materials, { page: 1, page_size: 24 }),
|
getJson<MaterialListResult>(endpoints.materials, { page: 1, page_size: 24 }),
|
||||||
getJson<ApiDialect[]>(endpoints.apiDiscoveryDialects),
|
getJson<ApiDialect[]>(endpoints.apiDiscoveryDialects),
|
||||||
getJson<CapabilityProfile[]>(endpoints.apiDiscoveryCapabilities),
|
getJson<CapabilityProfile[]>(endpoints.apiDiscoveryCapabilities),
|
||||||
|
getJson<ReviewPolicy>(endpoints.reviewPolicy),
|
||||||
])
|
])
|
||||||
bootstrap.value = bootstrapData
|
bootstrap.value = bootstrapData
|
||||||
dashboard.value = dashboardData
|
dashboard.value = dashboardData
|
||||||
|
|
@ -499,6 +508,7 @@ async function load() {
|
||||||
materials.value = materialData
|
materials.value = materialData
|
||||||
dialects.value = dialectData
|
dialects.value = dialectData
|
||||||
capabilities.value = capabilityData
|
capabilities.value = capabilityData
|
||||||
|
setReviewPolicy(reviewPolicyData)
|
||||||
await loadWardrobe(profileData.items[0]?.profile_id)
|
await loadWardrobe(profileData.items[0]?.profile_id)
|
||||||
await loadWorkflows(profileData.items[0]?.profile_id)
|
await loadWorkflows(profileData.items[0]?.profile_id)
|
||||||
await loadLogs()
|
await loadLogs()
|
||||||
|
|
@ -983,6 +993,41 @@ function reviewSelectedNode() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setReviewPolicy(policy: ReviewPolicy) {
|
||||||
|
reviewPolicy.value = policy
|
||||||
|
reviewPolicyDraft.value = JSON.stringify(policy, null, 2)
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadReviewPolicy() {
|
||||||
|
return runOperation(
|
||||||
|
text.loadPolicy,
|
||||||
|
async () => {
|
||||||
|
const policy = await getJson<ReviewPolicy>(endpoints.reviewPolicy)
|
||||||
|
setReviewPolicy(policy)
|
||||||
|
return policy
|
||||||
|
},
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function validateReviewPolicyDraft() {
|
||||||
|
let payload: unknown
|
||||||
|
try {
|
||||||
|
payload = JSON.parse(reviewPolicyDraft.value || "{}")
|
||||||
|
} catch {
|
||||||
|
lastOperation.value = text.policyDraftInvalid
|
||||||
|
return Promise.resolve()
|
||||||
|
}
|
||||||
|
return runOperation(
|
||||||
|
text.validatePolicy,
|
||||||
|
async () => {
|
||||||
|
reviewPolicyValidation.value = await postJson<ReviewPolicyValidation>(endpoints.reviewPolicyValidate, payload)
|
||||||
|
return reviewPolicyValidation.value
|
||||||
|
},
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
function generateSelectedNode() {
|
function generateSelectedNode() {
|
||||||
const nodeId = selectedNodeId.value
|
const nodeId = selectedNodeId.value
|
||||||
if (!nodeId) return Promise.resolve()
|
if (!nodeId) return Promise.resolve()
|
||||||
|
|
@ -2049,6 +2094,22 @@ function planStorageMigration() {
|
||||||
</header>
|
</header>
|
||||||
<pre>{{ JSON.stringify(reviewResult, null, 2) }}</pre>
|
<pre>{{ JSON.stringify(reviewResult, null, 2) }}</pre>
|
||||||
</section>
|
</section>
|
||||||
|
<section class="editor-panel">
|
||||||
|
<header>
|
||||||
|
<h2>{{ text.reviewPolicy }}</h2>
|
||||||
|
<div class="inline-actions">
|
||||||
|
<button type="button" :disabled="Boolean(busy)" @click="loadReviewPolicy">
|
||||||
|
{{ text.loadPolicy }}
|
||||||
|
</button>
|
||||||
|
<button type="button" :disabled="Boolean(busy) || !reviewPolicyDraft" @click="validateReviewPolicyDraft">
|
||||||
|
{{ text.validatePolicy }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<textarea v-model="reviewPolicyDraft" spellcheck="false" />
|
||||||
|
<pre v-if="reviewPolicyValidation">{{ JSON.stringify(reviewPolicyValidation, null, 2) }}</pre>
|
||||||
|
<pre v-else-if="reviewPolicy">{{ JSON.stringify(reviewPolicy, null, 2) }}</pre>
|
||||||
|
</section>
|
||||||
<pre v-if="workflowDetail">{{ JSON.stringify(workflowDetail.workflow, null, 2) }}</pre>
|
<pre v-if="workflowDetail">{{ JSON.stringify(workflowDetail.workflow, null, 2) }}</pre>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
文件差异因一行或多行过长而隐藏
|
|
@ -1,3 +1,3 @@
|
||||||
<script type="module" crossorigin src="/assets/index-mEivAbcm.js"></script>
|
<script type="module" crossorigin src="/assets/index-Cds4ME1g.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-DJ52Rx93.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-DJ52Rx93.css">
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|
|
||||||
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
文件差异因一行或多行过长而隐藏
17
web/assets/index-CPaM0DMS.js
普通文件
17
web/assets/index-CPaM0DMS.js
普通文件
文件差异因一行或多行过长而隐藏
|
|
@ -1,3 +1,3 @@
|
||||||
<script type="module" crossorigin src="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-1P8ns5-A.js"></script>
|
<script type="module" crossorigin src="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-CPaM0DMS.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-BA90ZIGa.css">
|
<link rel="stylesheet" crossorigin href="/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web/assets/index-BpA_z04Q.css">
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|
|
||||||
正在加载…
添加表格
在新工单中引用