完善训练模块
This commit is contained in:
@@ -18,6 +18,12 @@ export function executeOfficialAccountWorkflowStep(taskId, stepKey, data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function regenerateOfficialAccountImage(taskId, imageKey) {
|
||||
return http.post(`/official-account/tasks/${taskId}/images/${imageKey}/regenerate`, {}, {
|
||||
timeout: 0,
|
||||
})
|
||||
}
|
||||
|
||||
export function exportOfficialAccountDocument(taskId, format) {
|
||||
return http.get(`/official-account/tasks/${taskId}/export`, {
|
||||
params: { format },
|
||||
|
||||
@@ -410,6 +410,16 @@
|
||||
/>
|
||||
<div class="image-section">{{ item.section || item.key }}</div>
|
||||
<div class="image-prompt">{{ item.prompt }}</div>
|
||||
<div class="image-actions">
|
||||
<el-button
|
||||
size="small"
|
||||
:loading="regeneratingImageKey === item.key"
|
||||
:disabled="Boolean(runningStepKey || pollingStepKey || regeneratingImageKey)"
|
||||
@click.stop="regenerateSingleImage(item)"
|
||||
>
|
||||
重生成本张
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="empty-text">当前还没有图片结果。</div>
|
||||
@@ -501,6 +511,7 @@ import {
|
||||
executeOfficialAccountWorkflowStep,
|
||||
exportOfficialAccountDocument,
|
||||
getOfficialAccountWorkflow,
|
||||
regenerateOfficialAccountImage,
|
||||
updateOfficialAccountTask,
|
||||
} from '@/api/officialAccount'
|
||||
|
||||
@@ -546,6 +557,7 @@ const expandedHotspotKeys = ref([])
|
||||
const pollingToken = ref(0)
|
||||
const pollingStepKey = ref('')
|
||||
const exportingFormat = ref('')
|
||||
const regeneratingImageKey = ref('')
|
||||
const imagePreviewSources = ref({})
|
||||
const imageExportSources = ref({})
|
||||
const imagePreviewStates = ref({})
|
||||
@@ -1585,6 +1597,26 @@ async function runStep(stepKey) {
|
||||
}
|
||||
}
|
||||
|
||||
async function regenerateSingleImage(item) {
|
||||
if (!selectedTaskId.value || !item?.key) {
|
||||
ElMessage.warning('当前没有可重生成的图片')
|
||||
return
|
||||
}
|
||||
try {
|
||||
regeneratingImageKey.value = item.key
|
||||
ElMessage.success(`开始重生成「${item.section || item.key}」`)
|
||||
await regenerateOfficialAccountImage(selectedTaskId.value, item.key)
|
||||
await loadWorkflow(selectedTaskId.value, { silent: true, preserveNodeState: true, syncRuntime: false })
|
||||
await workerRuntime.loadTasks(workspaceKey.value)
|
||||
await workerRuntime.loadTaskDetail(selectedTaskId.value)
|
||||
ElMessage.success(`已重生成「${item.section || item.key}」`)
|
||||
} catch (error) {
|
||||
ElMessage.error(error?.message || '单张图片重生成失败')
|
||||
} finally {
|
||||
regeneratingImageKey.value = ''
|
||||
}
|
||||
}
|
||||
|
||||
function findRunningStepKey(workflowState = workflow.value) {
|
||||
const steps = workflowState?.steps || {}
|
||||
return workflowStepKeys.find(key => steps?.[key]?.status === 'running') || ''
|
||||
@@ -2248,6 +2280,12 @@ onBeforeUnmount(() => {
|
||||
color: #b91c1c;
|
||||
}
|
||||
|
||||
.image-actions {
|
||||
margin-top: 10px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.image-thumb {
|
||||
margin-top: 8px;
|
||||
width: 100%;
|
||||
|
||||
Reference in New Issue
Block a user