fix(short-drama-agent-front): 修复代码格式检查问题

This commit is contained in:
GJ committed 2026-10-21 17:04:02 +08:00
1 parent 81d6a85260
commit 48fce3975f
87 files changed
+5714 -1436

No files matched your search

+208 -59
View File
@@ -92,9 +92,21 @@ const plans = computed(() => result.value?.storyboardPlans ?? [])
const shots = computed(() => result.value?.storyboardEpisodeShots ?? [])
const summary = computed(() => snapshot.value?.taskSummary)
/** 候选审核读取完成前不展示旧错误。 */
const validation = computed(() => quality.value.structureValid === null ? undefined : { valid: quality.value.structureValid, issues: quality.value.structuralIssues })
const validation = computed(() =>
quality.value.structureValid === null
? undefined
: { valid: quality.value.structureValid, issues: quality.value.structuralIssues }
)
/** 数据来源在桌面和移动端正文均明确显示,候选数量不冒充正式资产。 */
const sourceLabel = computed(() => ({ candidate: '拆解候选 · 尚未提交正式结果', formal: '正式拆解结果', history: '历史结果 · 仅供回看', empty: '' })[quality.value.source])
const sourceLabel = computed(
() =>
({
candidate: '拆解候选 · 尚未提交正式结果',
formal: '正式拆解结果',
history: '历史结果 · 仅供回看',
empty: ''
})[quality.value.source]
)
const operation = computed(() => getOperation(projectId.value))
/** 分镜阅读和诊断入口共用当前剧集,不维护独立的诊断集号输入。 */
const selectedEpisodeNo = ref<number>()
@@ -204,17 +216,25 @@ async function locateIssue(issue: ShotValidation['issues'][number]) {
selectedEpisodeNo.value = issue.episodeNo
await nextTick()
if (issue.beatNo)
await storyboardList.value?.locate({
episodeNo: issue.episodeNo,
beatNo: issue.beatNo,
...(issue.shotNo ? { shotNo: issue.shotNo } : {})
}, { problem: true })
await storyboardList.value?.locate(
{
episodeNo: issue.episodeNo,
beatNo: issue.beatNo,
...(issue.shotNo ? { shotNo: issue.shotNo } : {})
},
{ problem: true }
)
}
const taskStopped = computed(() => execution.value?.status === 'failed' || execution.value?.status === 'completed')
/** 后续候选修订已替代旧任务结果时,只在明确的历史记录中展示回执。 */
const executionHistorical = computed(() => {
const record = backgroundExecution.query.data.value
return !!record && !!latestCheckpoint.value && !!record.completedAt && Date.parse(latestCheckpoint.value.createdAt) > Date.parse(record.completedAt)
return (
!!record &&
!!latestCheckpoint.value &&
!!record.completedAt &&
Date.parse(latestCheckpoint.value.createdAt) > Date.parse(record.completedAt)
)
})
/** 后台拆解结束后自动刷新项目、Checkpoint 与正式主体/分镜数据。 */
watch(
@@ -244,10 +264,32 @@ const hasBreakdownIssues = computed(() =>
)
/** 问题按钮按真实问题类型展示,不把质量待审或执行异常误称为结构校验失败。 */
const issueEntryLabel = computed(() =>
quality.value.error ? '候选审核待刷新' : validation.value?.valid === false ? '分镜校验未通过' : pendingQuality.value ? '分镜质量待修订' : '拆解问题待处理'
quality.value.error
? '候选审核待刷新'
: validation.value?.valid === false
? '分镜校验未通过'
: pendingQuality.value
? '分镜质量待修订'
: '拆解问题待处理'
)
/** 当前状态颜色只取当前质量和活动任务,不继承历史执行失败。 */
const qualityStatus = computed(() => breakdownBusy.value ? 'running' : quality.value.loading ? 'pending' : quality.value.needsRefresh ? 'unknown' : currentWorkflowError.value ? 'failed' : quality.value.problems.length ? 'blocked' : quality.value.structureValid === true ? quality.value.isCandidate ? 'candidate_pending' : 'completed' : 'unknown')
const qualityStatus = computed(() =>
breakdownBusy.value
? 'running'
: quality.value.loading
? 'pending'
: quality.value.needsRefresh
? 'unknown'
: currentWorkflowError.value
? 'failed'
: quality.value.problems.length
? 'blocked'
: quality.value.structureValid === true
? quality.value.isCandidate
? 'candidate_pending'
: 'completed'
: 'unknown'
)
/** 当前生命周期与审核文案集中展示。 */
const qualityLabel = computed(() => {
if (breakdownBusy.value) return '拆解进行中'
@@ -271,8 +313,9 @@ const issueActionsDisabled = computed(
operation.value.pending ||
breakdownBusy.value ||
backgroundExecution.discovering.value ||
!!backgroundExecution.discoveryError.value
|| quality.value.loading || !!quality.value.error
!!backgroundExecution.discoveryError.value ||
quality.value.loading ||
!!quality.value.error
)
const configValid = computed(
() => Number.isSafeInteger(groupSize.value) && groupSize.value > 0 && modules.value.length > 0
@@ -304,7 +347,13 @@ watch(
() => {
const executionError = currentWorkflowError.value
const invalid = quality.value.issueCount > 0
if (quality.value.needsRefresh || quality.value.loading || breakdownBusy.value || backgroundExecution.discovering.value) return
if (
quality.value.needsRefresh ||
quality.value.loading ||
breakdownBusy.value ||
backgroundExecution.discovering.value
)
return
if ((!executionError && !invalid) || notifiedIssues.has(issueSignature.value)) return
notifiedIssues.add(issueSignature.value)
actionMessage?.warning(
@@ -361,10 +410,20 @@ const rulesAcknowledged = ref(false)
/** 每次真实模型启动仍需核对后台任务是否停止。 */
const startAcknowledged = ref(false)
/** 规则、目标或步骤变化后重新确认,不沿用旧勾选。 */
watch([startPolicy.reviewOpen, startPolicy.editorKey, startScope], () => { rulesAcknowledged.value = false })
watch(startPolicy.startOpen, () => { startAcknowledged.value = false })
watch([startPolicy.reviewOpen, startPolicy.editorKey, startScope], () => {
rulesAcknowledged.value = false
})
watch(startPolicy.startOpen, () => {
startAcknowledged.value = false
})
/** 关闭整个设置时中断只读确认,不能在关闭后打开迟到的弹窗。 */
watch(toolsOpen, shown => { if (!shown) startPolicy.cancel() }, { flush: 'sync' })
watch(
toolsOpen,
shown => {
if (!shown) startPolicy.cancel()
},
{ flush: 'sync' }
)
/** 校验用户编辑的规则,成功后进入普通启动确认;此步骤不运行模型。 */
async function confirmStartRules() {
@@ -452,7 +511,11 @@ async function run(action: BreakdownAction) {
id,
labels[action],
async () => {
const started = await breakdownApi.run(id, action, action === 'start' ? { ...input.value, ...permit! } : undefined)
const started = await breakdownApi.run(
id,
action,
action === 'start' ? { ...input.value, ...permit! } : undefined
)
await backgroundExecution.track(started.executionId)
return started
},
@@ -460,8 +523,13 @@ async function run(action: BreakdownAction) {
)
await refresh()
const cause = operation.value.cause
if (!success && action === 'start' && id === projectId.value && cause instanceof ApiError &&
['QUALITY_POLICY_NOT_CONFIRMED', 'QUALITY_POLICY_VERSION_CONFLICT'].includes(cause.code ?? ''))
if (
!success &&
action === 'start' &&
id === projectId.value &&
cause instanceof ApiError &&
['QUALITY_POLICY_NOT_CONFIRMED', 'QUALITY_POLICY_VERSION_CONFLICT'].includes(cause.code ?? '')
)
await startPolicy.prepare()
}
@@ -533,8 +601,13 @@ const rules = {
@closed="finishOpeningIssues"
>
<!-- 以下是在同一全屏抽屉内核对真实质量规则的模块,不叠加第二个抽屉 -->
<div v-if="startPolicy.reviewOpen.value && startPolicy.policy.value" class="breakdown-policy-review">
<p class="text-sm leading-6 text-muted">请核对动作与物理规则,修改将在继续时保存。确认会保存到当前项目,规则未变时不再重复提醒。</p>
<div
v-if="startPolicy.reviewOpen.value && startPolicy.policy.value"
class="breakdown-policy-review"
>
<p class="text-sm leading-6 text-muted">
请核对动作与物理规则,修改将在继续时保存。确认会保存到当前项目,规则未变时不再重复提醒。
</p>
<QualityPolicySettings
ref="qualityForm"
:key="startPolicy.editorKey.value"
@@ -542,13 +615,22 @@ const rules = {
:initial-policy="startPolicy.policy.value"
:disabled="!canStart || startPolicy.busy.value"
/>
<NCheckbox v-model:checked="rulesAcknowledged" :disabled="startPolicy.busy.value || !canStart" class="mt-5">
<NCheckbox
v-model:checked="rulesAcknowledged"
:disabled="startPolicy.busy.value || !canStart"
class="mt-5"
>
我已核对本次拆解使用的质量规则
</NCheckbox>
<p v-if="startPolicy.error.value" role="alert" class="mt-4 text-sm text-danger">{{ startPolicy.error.value }}</p>
<p v-if="startPolicy.error.value" role="alert" class="mt-4 text-sm text-danger">
{{ startPolicy.error.value }}
</p>
</div>
<!-- 以下是拆解分组设置模块,规则确认时保留已有预览和草稿 -->
<section v-show="!startPolicy.reviewOpen.value" class="panel workspace-panel breakdown-settings-panel">
<section
v-show="!startPolicy.reviewOpen.value"
class="panel workspace-panel breakdown-settings-panel"
>
<p
v-if="backgroundExecution.discoveryError.value"
class="mb-4 text-xs leading-6 text-danger"
@@ -658,7 +740,9 @@ const rules = {
type="primary"
:disabled="!canStart || startPolicy.busy.value"
@click="startPolicy.prepare"
><template #icon><ShieldCheck :size="16" aria-hidden="true" /></template>{{ candidateOnly ? '生成拆解候选' : '开始拆解' }}</NButton>
><template #icon><ShieldCheck :size="16" aria-hidden="true" /></template
>{{ candidateOnly ? '生成拆解候选' : '开始拆解' }}</NButton
>
</div>
<div class="flex flex-wrap gap-2">
<div v-for="group in preview.groups" :key="group.groupId" class="group-chip">
@@ -667,7 +751,13 @@ const rules = {
</div>
</div>
</div>
<p v-if="startPolicy.error.value && !startPolicy.startOpen.value" role="alert" class="mt-4 text-sm text-danger">{{ startPolicy.error.value }}</p>
<p
v-if="startPolicy.error.value && !startPolicy.startOpen.value"
role="alert"
class="mt-4 text-sm text-danger"
>
{{ startPolicy.error.value }}
</p>
<p v-if="project.status === 'generating'" class="mt-4 text-xs text-danger">
剧本仍在生成,暂不允许启动拆解,避免读取到不完整的剧集。
</p>
@@ -688,40 +778,79 @@ const rules = {
@refresh="refreshCandidate"
/>
<!-- 以下是明确标记的历史执行回执,旧任务结论不表示当前候选质量 -->
<component :is="executionHistorical ? NCollapse : 'div'" v-if="backgroundExecution.executionId.value" v-show="!startPolicy.reviewOpen.value" :class="{ 'breakdown-execution-history': executionHistorical }">
<component :is="executionHistorical ? NCollapseItem : 'div'" :name="executionHistorical ? 'history' : undefined" :title="executionHistorical ? '历史拆解执行记录(不代表当前质量)' : undefined">
<WorkflowExecutionPanel
<component
:is="executionHistorical ? NCollapse : 'div'"
v-if="backgroundExecution.executionId.value"
:title="executionHistorical ? '历史拆解任务' : '剧本拆解任务'"
class="breakdown-execution-panel"
:show-status-hint="false"
:execution="backgroundExecution.query.data.value"
:loading="backgroundExecution.query.loading.value"
:error="backgroundExecution.query.error.value"
@refresh="backgroundExecution.query.refresh"
@dismiss="backgroundExecution.dismiss"
/>
</component>
v-show="!startPolicy.reviewOpen.value"
:class="{ 'breakdown-execution-history': executionHistorical }"
>
<component
:is="executionHistorical ? NCollapseItem : 'div'"
:name="executionHistorical ? 'history' : undefined"
:title="executionHistorical ? '历史拆解执行记录(不代表当前质量)' : undefined"
>
<WorkflowExecutionPanel
v-if="backgroundExecution.executionId.value"
:title="executionHistorical ? '历史拆解任务' : '剧本拆解任务'"
class="breakdown-execution-panel"
:show-status-hint="false"
:execution="backgroundExecution.query.data.value"
:loading="backgroundExecution.query.loading.value"
:error="backgroundExecution.query.error.value"
@refresh="backgroundExecution.query.refresh"
@dismiss="backgroundExecution.dismiss"
/>
</component>
</component>
<!-- 以下是固定的规则确认底栏,返回不记录确认,继续不会直接调用模型 -->
<template v-if="startPolicy.reviewOpen.value" #footer>
<NButton :disabled="startPolicy.saving.value" @click="startPolicy.cancel">取消</NButton>
<NButton type="primary" :loading="startPolicy.busy.value" :disabled="!rulesAcknowledged || !qualityForm?.canSave || startPolicy.busy.value || !canStart" @click="confirmStartRules"><template #icon><ShieldCheck :size="16" aria-hidden="true" /></template>确认规则并继续</NButton>
<NButton
type="primary"
:loading="startPolicy.busy.value"
:disabled="
!rulesAcknowledged || !qualityForm?.canSave || startPolicy.busy.value || !canStart
"
@click="confirmStartRules"
><template #icon><ShieldCheck :size="16" aria-hidden="true" /></template
>确认规则并继续</NButton
>
</template>
</WorkspaceTools>
<!-- 以下是每次真实模型调用前的费用与任务确认,规则未变时直接进入此步骤 -->
<AppDialog
:open="startPolicy.startOpen.value"
:title="candidateOnly ? '生成拆解候选' : '开始拆解'"
:description="candidateOnly ? '将按当前分组调用模型生成主体、形态与分镜候选,可能产生模型费用。现有正式数据会保留,候选需经独立确认后才提交。' : '将按当前预览启动完整拆解并调用模型,可能产生模型费用。抽取结束后仍需完成主体整理、分镜生成与入库。'"
:description="
candidateOnly
? '将按当前分组调用模型生成主体、形态与分镜候选,可能产生模型费用。现有正式数据会保留,候选需经独立确认后才提交。'
: '将按当前预览启动完整拆解并调用模型,可能产生模型费用。抽取结束后仍需完成主体整理、分镜生成与入库。'
"
:busy="operation.pending"
@update:open="updateStartOpen"
>
<NCheckbox v-if="records.length > 0" v-model:checked="startAcknowledged" :disabled="startPolicy.busy.value">我已确认后台任务停止,当前没有同项目的生成或拆解任务在运行。</NCheckbox>
<p v-if="startPolicy.error.value" role="alert" class="mt-4 text-sm text-danger">{{ startPolicy.error.value }}</p>
<NCheckbox
v-if="records.length > 0"
v-model:checked="startAcknowledged"
:disabled="startPolicy.busy.value"
>我已确认后台任务停止,当前没有同项目的生成或拆解任务在运行。</NCheckbox
>
<p v-if="startPolicy.error.value" role="alert" class="mt-4 text-sm text-danger">
{{ startPolicy.error.value }}
</p>
<template #footer>
<NButton :disabled="operation.pending" @click="startPolicy.cancel">取消</NButton>
<NButton type="primary" :loading="startPolicy.reading.value" :disabled="!canStart || startPolicy.busy.value || (records.length > 0 && !startAcknowledged)" @click="confirmStart"><template #icon><ShieldCheck :size="16" aria-hidden="true" /></template>确认{{ candidateOnly ? '生成拆解候选' : '开始拆解' }}</NButton>
<NButton
type="primary"
:loading="startPolicy.reading.value"
:disabled="
!canStart || startPolicy.busy.value || (records.length > 0 && !startAcknowledged)
"
@click="confirmStart"
><template #icon><ShieldCheck :size="16" aria-hidden="true" /></template>确认{{
candidateOnly ? '生成拆解候选' : '开始拆解'
}}</NButton
>
</template>
</AppDialog>
</div>
@@ -736,7 +865,9 @@ const rules = {
<template v-else>
<section class="breakdown-results-section" :data-breakdown-source="quality.source">
<!-- 以下是候选与正式数据来源提示,手机也不隐藏,防止把候选镜头当作正式资产 -->
<p v-if="sourceLabel" class="text-xs text-muted" role="status">{{ sourceLabel }}<span v-if="quality.loading"> · 正在读取当前质量审核…</span></p>
<p v-if="sourceLabel" class="text-xs text-muted" role="status">
{{ sourceLabel }}<span v-if="quality.loading"> · 正在读取当前质量审核…</span>
</p>
<div class="result-toolbar tabs-toolbar">
<NTabs v-model:value="tab" class="workspace-tabs" type="line" size="small" aria-label="拆解结果"
><!-- 以下是仅显示分类名称的拆解标签模块,主体数量保留在搜索统计中 -->
@@ -765,16 +896,16 @@ const rules = {
</NButton>
<!-- 以下是手机分类导航中的拆解设置入口,共用原有设置弹窗 -->
<WorkspaceActionTooltip label="拆解设置">
<NButton
quaternary
class="icon-button breakdown-mobile-tools"
aria-label="拆解设置"
aria-haspopup="dialog"
:aria-expanded="toolsOpen"
@click="toolsOpen = true"
>
<template #icon><Settings2 :size="15" aria-hidden="true" /></template>
</NButton>
<NButton
quaternary
class="icon-button breakdown-mobile-tools"
aria-label="拆解设置"
aria-haspopup="dialog"
:aria-expanded="toolsOpen"
@click="toolsOpen = true"
>
<template #icon><Settings2 :size="15" aria-hidden="true" /></template>
</NButton>
</WorkspaceActionTooltip>
<!-- 以下是拆解快照直接导出模块,与剧本创作共用图标和悬浮说明 -->
<WorkspaceExportButton
@@ -803,13 +934,21 @@ const rules = {
v-model:episode-no="selectedEpisodeNo"
:plans="plans"
:episodes="shots"
:diagnosis-disabled="quality.source !== 'formal' || breakdownBusy || backgroundExecution.discovering.value"
:diagnosis-disabled="
quality.source !== 'formal' ||
breakdownBusy ||
backgroundExecution.discovering.value
"
@diagnose="openShotDiagnosis"
>
<!-- 以下是跟随当前剧集的一行诊断摘要,诊断弹窗独立于列表滚动 -->
<template #diagnosis>
<StoryboardDiagnosis
v-if="quality.source === 'formal' && !breakdownBusy && !backgroundExecution.discovering.value"
v-if="
quality.source === 'formal' &&
!breakdownBusy &&
!backgroundExecution.discovering.value
"
ref="diagnosisPanel"
:project-id="projectId"
:episode-no="currentEpisodeNo"
@@ -902,7 +1041,14 @@ const rules = {
</p>
<!-- 以下是从当前动作冲突带入角色和动作的例外入口,独立保存规则且保留旧例外 -->
<ActionExceptionRepair
v-if="issuesOpen && qualityObservation.source.value.state && quality.source !== 'history' && quality.actionBlocks.some(block => [...block.blockingCodes, ...block.warningCodes].includes('action_resource_conflict'))"
v-if="
issuesOpen &&
qualityObservation.source.value.state &&
quality.source !== 'history' &&
quality.actionBlocks.some(block =>
[...block.blockingCodes, ...block.warningCodes].includes('action_resource_conflict')
)
"
:project-id="projectId"
:checkpoint-id="latestCheckpoint?.checkpointId || ''"
:state="qualityObservation.source.value.state"
@@ -962,7 +1108,10 @@ const rules = {
<style>
/* 历史折叠只保留一层内容留白,避免 Naive 内容间距叠加任务卡片的 mt-4。 */
.breakdown-execution-history.n-collapse .n-collapse-item .n-collapse-item__content-wrapper .n-collapse-item__content-inner {
.breakdown-execution-history.n-collapse
.n-collapse-item
.n-collapse-item__content-wrapper
.n-collapse-item__content-inner {
padding-top: 8px;
}
.breakdown-execution-history .breakdown-execution-panel {