perf(short-drama-agent-front): 优化记录加载与工作区体验
This commit is contained in:
1 parent
d0264c08ce
commit
db9aea1694
111 files changed
+1680
-1290
No files matched your search
@@ -28,12 +28,28 @@ const props = withDefaults(
|
||||
)
|
||||
/** 正式项目、保存记录与导航状态共用同一个数据源。 */
|
||||
const context = useProjectContext()
|
||||
/** 审核需要完整创作保存记录中的原始结论和裁决。 */
|
||||
const dramaCheckpoints = context.useWorkflowCheckpoints('create-drama')
|
||||
/** 当前入口绑定的项目,异步响应必须核对归属。 */
|
||||
const projectId = computed(() => props.projectId)
|
||||
/** 外部项目错误只限制写入,仍可只读查看。 */
|
||||
const disabled = computed(() => props.disabled || !!context.error.value)
|
||||
const disabled = computed(
|
||||
() =>
|
||||
props.disabled ||
|
||||
!!context.error.value ||
|
||||
context.summaryBlocked.value ||
|
||||
dramaCheckpoints.loading.value ||
|
||||
!!dramaCheckpoints.error.value ||
|
||||
dramaCheckpoints.data.value === null
|
||||
)
|
||||
/** 人工确认与稳定原始索引选择。 */
|
||||
const flow = useDramaReview(projectId, context.refresh, disabled)
|
||||
/** 审核、改写及人工裁决只刷新创作记录和项目详情。 */
|
||||
async function refreshReview() {
|
||||
const id = projectId.value
|
||||
if (!id) return
|
||||
await Promise.all([context.refreshWorkflow('create-drama', id), context.refreshProject()])
|
||||
}
|
||||
const flow = useDramaReview(projectId, refreshReview, disabled)
|
||||
/** 最新正式审核。 */
|
||||
const latest = computed(() => flow.query.data.value?.latest ?? null)
|
||||
/** 当前已核对的处理预检。 */
|
||||
@@ -188,7 +204,7 @@ const groups = computed(() =>
|
||||
const recordedIssues = computed(() => latest.value?.qualityReview?.issues ?? [])
|
||||
/** 现有延期等裁决只作追溯,不能把接受视为已完成后续核验。 */
|
||||
const decisions = computed(() => {
|
||||
const checkpoint = workflowCheckpoints(context.checkpoints.value, 'create-drama').at(-1)
|
||||
const checkpoint = workflowCheckpoints(dramaCheckpoints.data.value ?? [], 'create-drama').at(-1)
|
||||
return preview.value && checkpoint?.checkpointId === preview.value.checkpointId
|
||||
? (savedReviewDecisions(checkpoint.state.review, preview.value.reviewId) ??
|
||||
latest.value?.manualUncertaintyDecisions ??
|
||||
@@ -200,9 +216,12 @@ watch(sourceEpisodes, value => {
|
||||
})
|
||||
/** 其它入口改写结束时,保存记录变化会触发一次重读,不定时查询。 */
|
||||
watch(
|
||||
() => workflowCheckpoints(context.checkpoints.value, 'create-drama').at(-1)?.checkpointId,
|
||||
(id, previous) => {
|
||||
if (id && id !== previous && !flow.writing.value) void flow.query.refresh()
|
||||
() => {
|
||||
const record = workflowCheckpoints(dramaCheckpoints.data.value ?? [], 'create-drama').at(-1)
|
||||
return record ? record.checkpointId + ':' + (record.updatedAt ?? '') : ''
|
||||
},
|
||||
(version, previous) => {
|
||||
if (previous && version && version !== previous && !flow.writing.value) void flow.query.refresh()
|
||||
}
|
||||
)
|
||||
|
||||
@@ -289,7 +308,7 @@ function editorClosed() {
|
||||
:project-id="projectId"
|
||||
:primary="primaryAction === 'review'"
|
||||
:disabled="disabled || flow.locked.value"
|
||||
@started="context.refresh"
|
||||
@started="refreshReview"
|
||||
/>
|
||||
<NButton
|
||||
v-if="hasManualIssues"
|
||||
@@ -306,7 +325,7 @@ function editorClosed() {
|
||||
:project-id="projectId"
|
||||
:primary="primaryAction === 'rewrite'"
|
||||
:disabled="disabled || flow.writing.value || latest?.passed === true"
|
||||
@started="context.refresh"
|
||||
@started="refreshReview"
|
||||
/>
|
||||
</template>
|
||||
</WorkspaceSectionHeading>
|
||||
@@ -320,7 +339,7 @@ function editorClosed() {
|
||||
<EmptyState
|
||||
v-else-if="!latest && !flow.query.error.value"
|
||||
title="暂无审核记录"
|
||||
description="正式审核完成后会显示结果;刷新不会重新启动审核。"
|
||||
description="审核完成后可查看结果。"
|
||||
/>
|
||||
<template v-if="latest">
|
||||
<div class="flex flex-wrap items-center gap-3">
|
||||
@@ -445,7 +464,7 @@ function editorClosed() {
|
||||
v-model:open="flow.editorOpen.value"
|
||||
class="review-confirm-drawer"
|
||||
title="审核人工确认"
|
||||
description="对照正式正文逐项核对。本次确认不调用模型,也不会自动改写。"
|
||||
description="对照剧本核对问题。确认免费,改写需另行启动。"
|
||||
:busy="flow.writing.value"
|
||||
@closed="editorClosed"
|
||||
>
|
||||
@@ -493,7 +512,7 @@ function editorClosed() {
|
||||
"
|
||||
class="text-muted"
|
||||
>
|
||||
原错误与警告选择已撤销,请对照当前问题重新选择。
|
||||
问题已更新,请重新选择。
|
||||
</p>
|
||||
</div>
|
||||
</NCollapseItem>
|
||||
@@ -513,7 +532,7 @@ function editorClosed() {
|
||||
<section v-if="groups.length || !flow.uncertaintyRows.value.length">
|
||||
<WorkspaceSectionHeading
|
||||
title="待确认问题"
|
||||
description="确认错误用于后续改写;接受警告表示保留当前处理。未选择的条目继续保留。"
|
||||
description="确认错误供改写使用。接受警告或未选条目会保留原处理。"
|
||||
/>
|
||||
<NCollapse
|
||||
v-if="groups.length"
|
||||
@@ -533,7 +552,7 @@ function editorClosed() {
|
||||
:data-review-issue="row.originalIndex"
|
||||
class="review-issue-card"
|
||||
:class="{
|
||||
'review-issue-error':
|
||||
'problem-surface':
|
||||
row.issue.severity === 'error' && !row.issue.policyException
|
||||
}"
|
||||
>
|
||||
@@ -615,7 +634,7 @@ function editorClosed() {
|
||||
<section>
|
||||
<WorkspaceSectionHeading
|
||||
title="待核对说明"
|
||||
description="默认保留待处理。可选择标有“建议”的处理方式,也可核对原文后另行决定;确认保存后才会生效。"
|
||||
description="可采纳建议,也可核对原文后决定。保存后生效。"
|
||||
/>
|
||||
<div v-if="flow.uncertaintyRows.value.length" class="mt-4 grid gap-4">
|
||||
<ReviewUncertaintyCard
|
||||
@@ -638,10 +657,7 @@ function editorClosed() {
|
||||
</section>
|
||||
<!-- 以下是人工补充表单,首次打开和新增空行不立即报错 -->
|
||||
<section v-if="!latest?.passed" ref="manualElement">
|
||||
<WorkspaceSectionHeading
|
||||
title="人工补充证据"
|
||||
description="仅补充你已核实的真实错误,不自动将不确定说明转换为错误。"
|
||||
>
|
||||
<WorkspaceSectionHeading title="人工补充证据" description="只补充已核实的错误。">
|
||||
<template #actions
|
||||
><NButton
|
||||
:disabled="flow.locked.value || !preview?.episodes.length"
|
||||
@@ -678,9 +694,7 @@ function editorClosed() {
|
||||
<NCollapse v-model:expanded-names="sourceExpanded">
|
||||
<NCollapseItem name="source" title="正式剧本原文">
|
||||
<div class="review-source-fields grid gap-4">
|
||||
<p class="text-xs leading-6 text-muted">
|
||||
引用必须逐字出现在所选剧集中,不能用事件编号代替。
|
||||
</p>
|
||||
<p class="text-xs leading-6 text-muted">请引用所选剧集的原句。</p>
|
||||
<NSelect
|
||||
v-model:value="sourceEpisode"
|
||||
:options="episodeOptions"
|
||||
@@ -768,9 +782,6 @@ function editorClosed() {
|
||||
padding: var(--app-content-gap);
|
||||
background: var(--app-subtle);
|
||||
}
|
||||
.review-issue-card.review-issue-error {
|
||||
background: var(--app-danger-soft);
|
||||
}
|
||||
.review-source-quote {
|
||||
@apply whitespace-pre-wrap wrap-anywhere text-sm leading-7;
|
||||
padding: var(--app-content-gap);
|
||||
|
||||
@@ -133,7 +133,7 @@ async function confirm() {
|
||||
本次核查已保存的 {{ query.data.value.episodeCount }} 集,不会重写正文、角色设定或世界观。
|
||||
</p>
|
||||
<ContextNotice type="info" title="本次操作会调用模型"
|
||||
>系统会检查完整正文,必要时再复核一次疑点。明确错误会保留为改写依据,无法确认的关键问题仍会保留;请勿重复提交。</ContextNotice
|
||||
>检查完整剧本,记录改写依据和待确认问题。请勿重复提交。</ContextNotice
|
||||
>
|
||||
<ContextNotice v-if="query.error.value || actionError" type="error" title="暂不能开始核查">{{
|
||||
actionError || query.error.value
|
||||
|
||||
@@ -148,7 +148,7 @@ function viewSource() {
|
||||
v-if="suggestion?.requiresEpisodeSelection || suggestion?.confidence !== 'high'"
|
||||
class="text-xs leading-6 text-muted"
|
||||
>
|
||||
请明确选择负责验证的剧集;建议候选之外的正式剧集也可选择。
|
||||
请选择用于验证的剧集,也可选建议之外的剧集。
|
||||
</p>
|
||||
<NFormItem label="负责验证的剧集" required>
|
||||
<NSelect
|
||||
|
||||
Reference in new issue
Block a user