feat: 拆解设置接入历史动作 AI 批量诊断及持久化任务进度
This commit is contained in:
1 parent
b00b3c4e77
commit
2c8487a7b2
1 file changed
+66
-1
@@ -13,7 +13,7 @@ import { Layers, LoaderCircle, ArrowRight, Settings2 } from '@lucide/vue'
|
|||||||
import { EmptyState, StatusBadge, WorkspaceTools } from '../../components/ui'
|
import { EmptyState, StatusBadge, WorkspaceTools } from '../../components/ui'
|
||||||
import { useProjectContext } from '../projects/context'
|
import { useProjectContext } from '../projects/context'
|
||||||
import { breakdownApi } from './api'
|
import { breakdownApi } from './api'
|
||||||
import type { BreakdownAction, BreakdownInput, BreakdownModule, BreakdownPreview, StoryboardHandOccupancyDiagnostics, StoryboardHandRepairPreview } from './types'
|
import type { BreakdownAction, BreakdownInput, BreakdownModule, BreakdownPreview, StoryboardHandOccupancyDiagnostics, StoryboardHandRepairPreview, LegacyActionDiagnosisPreview } from './types'
|
||||||
import { breakdownSnapshot, recoveryOptions, workflowCheckpoints } from '../workflows/selectors'
|
import { breakdownSnapshot, recoveryOptions, workflowCheckpoints } from '../workflows/selectors'
|
||||||
import { getOperation, isOperationRunning, runOperation } from '../workflows/operations'
|
import { getOperation, isOperationRunning, runOperation } from '../workflows/operations'
|
||||||
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
||||||
@@ -90,6 +90,43 @@ watch([toolsOpen, projectId], () => {
|
|||||||
handRepairBusy.value = false
|
handRepairBusy.value = false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/** 历史镜头 AI 诊断使用独立的持久化任务观察器,刷新后可恢复进度。 */
|
||||||
|
const legacyDiagnosisExecution = useWorkflowExecution(projectId, 'storyboard-legacy-action-diagnosis')
|
||||||
|
const legacyEpisodeNo = ref(3)
|
||||||
|
const legacyConcurrency = ref(3)
|
||||||
|
const legacyPreview = ref<LegacyActionDiagnosisPreview | null>(null)
|
||||||
|
const legacyPreviewBusy = ref(false)
|
||||||
|
const legacyStarting = ref(false)
|
||||||
|
const legacyDiagnosisScope = ref<'episode' | 'project'>('episode')
|
||||||
|
async function loadLegacyPreview() {
|
||||||
|
const id = projectId.value
|
||||||
|
const version = handDiagnosticsVersion
|
||||||
|
legacyPreviewBusy.value = true
|
||||||
|
try {
|
||||||
|
const data = await breakdownApi.legacyActionDiagnosisPreview(id, legacyEpisodeNo.value)
|
||||||
|
if (version === handDiagnosticsVersion && projectId.value === id && toolsOpen.value) legacyPreview.value = data
|
||||||
|
} catch (cause) {
|
||||||
|
if (version === handDiagnosticsVersion && projectId.value === id && toolsOpen.value) actionMessage?.error(errorMessage(cause))
|
||||||
|
} finally {
|
||||||
|
if (version === handDiagnosticsVersion) legacyPreviewBusy.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function startLegacyDiagnosis() {
|
||||||
|
const id = projectId.value
|
||||||
|
legacyStarting.value = true
|
||||||
|
try {
|
||||||
|
const result = await breakdownApi.startLegacyActionDiagnosis(id, {
|
||||||
|
confirmed: true,
|
||||||
|
...(legacyDiagnosisScope.value === 'episode' ? { episodeNo: legacyEpisodeNo.value } : {}),
|
||||||
|
concurrency: legacyConcurrency.value
|
||||||
|
})
|
||||||
|
await legacyDiagnosisExecution.track(result.executionId, id)
|
||||||
|
} catch (cause) {
|
||||||
|
actionMessage?.error(errorMessage(cause))
|
||||||
|
} finally {
|
||||||
|
legacyStarting.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
const backgroundExecution = useWorkflowExecution(projectId, 'breakdown')
|
const backgroundExecution = useWorkflowExecution(projectId, 'breakdown')
|
||||||
const recovery = computed(() => recoveryOptions(checkpoints.value))
|
const recovery = computed(() => recoveryOptions(checkpoints.value))
|
||||||
const execution = computed(() => snapshot.value?.workflowExecution)
|
const execution = computed(() => snapshot.value?.workflowExecution)
|
||||||
@@ -440,6 +477,34 @@ const rules = {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
<section class="workspace-panel">
|
||||||
|
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||||
|
<h3 class="text-sm font-medium">历史镜头 AI 动作诊断</h3>
|
||||||
|
<NButton text :loading="legacyPreviewBusy" @click="loadLegacyPreview">预览范围</NButton>
|
||||||
|
</div>
|
||||||
|
<div class="mt-3 flex flex-wrap items-center gap-3">
|
||||||
|
<NButton size="small" :type="legacyDiagnosisScope === 'episode' ? 'primary' : 'default'" @click="legacyDiagnosisScope = 'episode'">单集</NButton>
|
||||||
|
<NButton size="small" :type="legacyDiagnosisScope === 'project' ? 'primary' : 'default'" @click="legacyDiagnosisScope = 'project'">全项目</NButton>
|
||||||
|
<NInputNumber v-if="legacyDiagnosisScope === 'episode'" v-model:value="legacyEpisodeNo" :min="1" :precision="0" size="small" class="w-24" />
|
||||||
|
<span class="text-xs text-muted">并发</span>
|
||||||
|
<NInputNumber v-model:value="legacyConcurrency" :min="1" :max="5" :precision="0" size="small" class="w-20" />
|
||||||
|
</div>
|
||||||
|
<div v-if="legacyPreview" class="mt-3 text-xs text-muted">
|
||||||
|
第 {{ legacyPreview.episodeNo }} 集:{{ legacyPreview.candidateCount }} 个镜头,{{ legacyPreview.needsEvidenceCount }} 个待补证据
|
||||||
|
</div>
|
||||||
|
<div class="mt-3 flex justify-end">
|
||||||
|
<NButton size="small" type="primary" :loading="legacyStarting"
|
||||||
|
:disabled="legacyDiagnosisExecution.active.value || legacyStarting"
|
||||||
|
@click="startLegacyDiagnosis">确认启动 AI 诊断</NButton>
|
||||||
|
</div>
|
||||||
|
<WorkflowExecutionPanel v-if="legacyDiagnosisExecution.executionId.value"
|
||||||
|
title="历史动作诊断任务"
|
||||||
|
:execution="legacyDiagnosisExecution.query.data.value ?? null"
|
||||||
|
:loading="legacyDiagnosisExecution.query.loading.value"
|
||||||
|
:error="legacyDiagnosisExecution.query.error.value ?? ''"
|
||||||
|
@refresh="legacyDiagnosisExecution.query.refresh()"
|
||||||
|
@dismiss="legacyDiagnosisExecution.dismiss()" />
|
||||||
|
</section>
|
||||||
<section v-if="handDiagnostics?.warningCount" class="workspace-panel">
|
<section v-if="handDiagnostics?.warningCount" class="workspace-panel">
|
||||||
<div class="flex items-center justify-between gap-3">
|
<div class="flex items-center justify-between gap-3">
|
||||||
<h3 class="text-sm font-medium">局部修复候选</h3>
|
<h3 class="text-sm font-medium">局部修复候选</h3>
|
||||||
|
|||||||
Reference in new issue
Block a user