fix(short-drama-agent-front): 完善素材准入与选角审核读取
This commit is contained in:
1 parent
75e86f7486
commit
3503926d62
13 files changed
+355
-42
No files matched your search
+21
-3
@@ -140,6 +140,7 @@ const menuOptions = computed<MenuOption[]>(() => {
|
||||
const sectionAccess = currentProjectAccess.value?.sections[path]
|
||||
const disabled = sectionAccess ? !sectionAccess.enabled : path !== 'create-drama'
|
||||
const target = '/projects/' + projectId.value + '/' + path
|
||||
const reason = sectionAccess?.reason || '正在核对项目制作条件'
|
||||
return {
|
||||
key: target,
|
||||
disabled,
|
||||
@@ -148,11 +149,14 @@ const menuOptions = computed<MenuOption[]>(() => {
|
||||
? h(
|
||||
'span',
|
||||
{
|
||||
class: 'admin-menu-label',
|
||||
title: sectionAccess?.reason || '请先完成前面的制作步骤',
|
||||
class: 'admin-menu-label admin-menu-label-blocked',
|
||||
title: reason,
|
||||
'aria-label': `${label},${reason}`,
|
||||
'aria-disabled': 'true'
|
||||
},
|
||||
label
|
||||
sectionAccess
|
||||
? [h('span', label), h('small', { class: 'admin-menu-reason' }, reason)]
|
||||
: label
|
||||
)
|
||||
: h(RouterLink, { to: target }, () =>
|
||||
h('span', { class: 'admin-menu-label' }, label)
|
||||
@@ -369,6 +373,20 @@ const menuOptions = computed<MenuOption[]>(() => {
|
||||
color 0.18s ease,
|
||||
opacity 0.18s ease;
|
||||
}
|
||||
/* 保留菜单行高,在禁用项名称下展示当前步骤的简短原因。 */
|
||||
.admin-menu-label-blocked {
|
||||
display: block;
|
||||
line-height: 16px;
|
||||
min-width: 0;
|
||||
}
|
||||
.admin-menu-reason {
|
||||
display: block;
|
||||
font-size: 10px;
|
||||
line-height: 14px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.admin-brand {
|
||||
@apply flex shrink-0 items-center gap-3 h-[74px] overflow-hidden py-0 px-5 text-ink whitespace-nowrap;
|
||||
min-width: var(--admin-sider-expanded);
|
||||
|
||||
@@ -28,11 +28,6 @@ import SubjectIdentitySkeleton from '../subject-identity/SubjectIdentitySkeleton
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const id = computed(() => String(route.params.projectId))
|
||||
// 图库使用手动刷新,父布局也停止轮询,避免浏览素材时被周期性更新打断。
|
||||
const isGallery = computed(() => {
|
||||
const path = route.path.replace(/\/+$/, '')
|
||||
return path.endsWith('/subject-images') || path.endsWith('/assets')
|
||||
})
|
||||
const context = useProjectData(id)
|
||||
provide(projectContextKey, context)
|
||||
/** 项目全局配置保存后更新已挂载生成表单。 */
|
||||
@@ -343,7 +338,7 @@ onScopeDispose(() => {
|
||||
v-else-if="context.project.value?.id === id"
|
||||
class="project-access-gate"
|
||||
:title="currentAccess?.reason || '当前步骤还不能开始'"
|
||||
:description="`完成前面的制作步骤后,这里会自动开放。${isGallery ? '如刚完成操作,请刷新项目状态。' : ''}`"
|
||||
description="如刚完成前置步骤,请刷新项目状态。正式分镜的复检详情可在「制作前检查」查看。"
|
||||
>
|
||||
<NButton
|
||||
v-if="currentAccess?.nextPath"
|
||||
@@ -353,7 +348,7 @@ onScopeDispose(() => {
|
||||
>
|
||||
<!-- 以下是手动刷新项目状态模块,图标位常驻以保持加载前后的按钮尺寸 -->
|
||||
<WorkspaceRefreshButton
|
||||
v-if="isGallery"
|
||||
v-if="currentAccess"
|
||||
label="刷新项目状态"
|
||||
:loading="context.loading.value"
|
||||
@refresh="context.refresh"
|
||||
|
||||
@@ -17,14 +17,27 @@ export function useProjectData(id: Ref<string>) {
|
||||
})
|
||||
const project = computed<ProjectDetail | null>(() => query.data.value?.project ?? null)
|
||||
const checkpoints = computed<Checkpoint[]>(() => query.data.value?.checkpoints ?? [])
|
||||
const stageReadiness = computed(() => query.data.value?.stageReadiness ?? null)
|
||||
/** 导航只消费当前项目的准入响应。 */
|
||||
const stageReadiness = computed(() => {
|
||||
const readiness = query.data.value?.stageReadiness
|
||||
return readiness?.projectId === id.value ? readiness : null
|
||||
})
|
||||
/** 同项目并发轻量刷新只采用最后一次请求。 */
|
||||
let readinessRefresh = 0
|
||||
/** 子页面完成当前步骤后调用,只刷新轻量项目状态与导航门禁。 */
|
||||
async function refreshStageReadiness() {
|
||||
const projectId = id.value
|
||||
if (!projectId || !query.data.value) return
|
||||
const snapshot = query.data.value
|
||||
if (!projectId || snapshot?.project.id !== projectId) return
|
||||
const request = ++readinessRefresh
|
||||
const nextReadiness = await projectsApi.stageReadiness(projectId)
|
||||
if (id.value === projectId && query.data.value)
|
||||
query.data.value = { ...query.data.value, stageReadiness: nextReadiness }
|
||||
if (
|
||||
request === readinessRefresh &&
|
||||
id.value === projectId &&
|
||||
query.data.value === snapshot &&
|
||||
nextReadiness.projectId === projectId
|
||||
)
|
||||
query.data.value = { ...snapshot, stageReadiness: nextReadiness }
|
||||
}
|
||||
return { ...query, project, checkpoints, stageReadiness, refreshStageReadiness }
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { ProjectAccess, ProjectSection } from './access'
|
||||
import type { ProjectStageReadiness } from './types'
|
||||
|
||||
function accessState(ready: boolean | undefined, reason: string | null | undefined, fallback: string) {
|
||||
return { enabled: Boolean(ready), reason: reason || fallback }
|
||||
return { enabled: ready === true, reason: reason || fallback }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -16,7 +16,12 @@ function accessState(ready: boolean | undefined, reason: string | null | undefin
|
||||
export function useProjectStageAccess(projectId: Ref<string>, readiness: Ref<ProjectStageReadiness | null>) {
|
||||
/** 当前步骤能否进入及对应中文说明,不改变原始准备状态。 */
|
||||
const sections = computed<Record<ProjectSection, ProjectAccess['sections'][ProjectSection]>>(() => {
|
||||
const state = readiness.value
|
||||
const state = readiness.value?.projectId === projectId.value ? readiness.value : null
|
||||
const preparationReady = state?.preparation?.ready === true
|
||||
const preparationReason = state?.preparation?.reason
|
||||
const materialReason = preparationReady
|
||||
? state?.visualStyle.reason || '请先准备视觉风格'
|
||||
: preparationReason || '请先核对正式分镜的素材准备条件'
|
||||
const result: Record<ProjectSection, ProjectAccess['sections'][ProjectSection]> = {
|
||||
'create-drama': { enabled: true, reason: '' },
|
||||
breakdown: {
|
||||
@@ -30,18 +35,18 @@ export function useProjectStageAccess(projectId: Ref<string>, readiness: Ref<Pro
|
||||
nextLabel: '前往剧本拆解'
|
||||
},
|
||||
'subject-identity': {
|
||||
enabled: Boolean(state?.preparation?.ready && state?.visualStyle.ready),
|
||||
reason: state?.preparation?.reason || state?.visualStyle.reason || '请先准备视觉风格',
|
||||
nextPath: state?.preparation?.ready ? 'visual-style' : 'breakdown',
|
||||
nextLabel: state?.preparation?.ready ? '前往视觉风格' : '前往剧本拆解'
|
||||
enabled: preparationReady && state?.visualStyle.ready === true,
|
||||
reason: materialReason,
|
||||
nextPath: preparationReady ? 'visual-style' : 'breakdown',
|
||||
nextLabel: preparationReady ? '前往视觉风格' : '前往剧本拆解'
|
||||
},
|
||||
'subject-images': {
|
||||
// 此页同时准备单个素材的Prompt与规格;全项目身份未齐备不阻断只读检查和逐项准备。
|
||||
// 付费生成仍由本素材的实际预览、身份/规格与版本门禁决定。
|
||||
enabled: Boolean(state?.preparation?.ready && state?.visualStyle.ready),
|
||||
reason: state?.preparation?.reason || state?.visualStyle.reason || '请先准备视觉风格',
|
||||
nextPath: state?.preparation?.ready ? 'visual-style' : 'breakdown',
|
||||
nextLabel: state?.preparation?.ready ? '前往视觉风格' : '前往剧本拆解'
|
||||
enabled: preparationReady && state?.visualStyle.ready === true,
|
||||
reason: materialReason,
|
||||
nextPath: preparationReady ? 'visual-style' : 'breakdown',
|
||||
nextLabel: preparationReady ? '前往视觉风格' : '前往剧本拆解'
|
||||
},
|
||||
storyboard: {
|
||||
enabled: Boolean(state?.breakdown.ready && state?.subjectAssets.ready),
|
||||
@@ -56,21 +61,24 @@ export function useProjectStageAccess(projectId: Ref<string>, readiness: Ref<Pro
|
||||
state?.subjectAssets.reason ||
|
||||
state?.storyboard.reason ||
|
||||
'请先完成镜头制作准备',
|
||||
nextPath: state?.subjectAssets.ready
|
||||
? 'storyboard'
|
||||
: state?.breakdown.ready
|
||||
? 'subject-images'
|
||||
: 'breakdown',
|
||||
nextLabel: state?.subjectAssets.ready
|
||||
? '前往分镜设计'
|
||||
: state?.breakdown.ready
|
||||
? '前往形态图片'
|
||||
: '前往剧本拆解'
|
||||
nextPath: !state?.breakdown.ready
|
||||
? 'breakdown'
|
||||
: state.subjectAssets.ready
|
||||
? 'storyboard'
|
||||
: 'subject-images',
|
||||
nextLabel: !state?.breakdown.ready
|
||||
? '前往剧本拆解'
|
||||
: state.subjectAssets.ready
|
||||
? '前往分镜设计'
|
||||
: '前往形态图片'
|
||||
}
|
||||
}
|
||||
for (const section of Object.values(result)) section.reason = userFacingText(section.reason)
|
||||
return result
|
||||
})
|
||||
const scriptReady = computed(() => readiness.value?.script.ready === true)
|
||||
/** 只认当前项目的剧本就绪状态。 */
|
||||
const scriptReady = computed(
|
||||
() => readiness.value?.projectId === projectId.value && readiness.value.script.ready === true
|
||||
)
|
||||
return { projectId, scriptReady, sections }
|
||||
}
|
||||
@@ -91,6 +91,8 @@ const {
|
||||
confirmStableAnchor,
|
||||
confirmCasting,
|
||||
validateImage,
|
||||
readSavedValidation,
|
||||
readingSavedReviewId,
|
||||
generateStableAnchorQuality,
|
||||
pendingImageOperation,
|
||||
validationResult
|
||||
@@ -994,6 +996,8 @@ function runNextAction() {
|
||||
"
|
||||
:pending-operation="pendingImageOperation"
|
||||
:validation-result="validationResult"
|
||||
:reading-saved-review-id="readingSavedReviewId"
|
||||
@read-review="readSavedValidation"
|
||||
:retry-disabled-reason="imageRetryDisabledReason"
|
||||
@validate="validateImage"
|
||||
@anchor="chooseAnchor"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { request } from '../../lib/http'
|
||||
import type {
|
||||
IdentityImagePreview,
|
||||
IdentityImageDetails,
|
||||
IdentityImageGenerationStart,
|
||||
IdentityValidationResult,
|
||||
StableAnchorQualityInput,
|
||||
@@ -74,6 +75,15 @@ export const subjectIdentityApi = {
|
||||
),
|
||||
listImages: (subjectId: string, signal?: AbortSignal) =>
|
||||
request<IdentityImage[]>(`${identityPath(subjectId)}/images`, { signal }),
|
||||
/**
|
||||
* 读取指定候选及已保存的审核记录。
|
||||
* @param subjectId 正式主体
|
||||
* @param imageId 当前候选
|
||||
* @param signal 取消过期查询
|
||||
* @returns 正式图片详情,不调用视觉模型
|
||||
*/
|
||||
imageDetails: (subjectId: string, imageId: string, signal?: AbortSignal) =>
|
||||
request<IdentityImageDetails>(`${identityPath(subjectId)}/images/${encodeURIComponent(imageId)}`, { signal }),
|
||||
generateImage: (subjectId: string, input: GenerateIdentityImageInput) =>
|
||||
request<IdentityImageGenerationStart>(`${identityPath(subjectId)}/images`, {
|
||||
method: 'POST',
|
||||
|
||||
@@ -24,6 +24,8 @@ const props = defineProps<{
|
||||
disabled: boolean
|
||||
/** 当前固定图片目标的确认或校验操作。 */
|
||||
pendingOperation?: IdentityImageOperation | null
|
||||
/** 当前正在读取历史审核的候选编号。 */
|
||||
readingSavedReviewId?: string
|
||||
/** 重新生成暂不可用的具体恢复步骤。 */
|
||||
retryDisabledReason?: string
|
||||
/** 本主体最近一次显式图片审核结果。 */
|
||||
@@ -35,6 +37,8 @@ const emit = defineEmits<{
|
||||
anchor: [imageId: string]
|
||||
/** 校验指定图片。 */
|
||||
validate: [imageId: string]
|
||||
/** 只读查看已保存的审核。 */
|
||||
readReview: [imageId: string]
|
||||
/** 打开失败图片对应类型的生成参数弹窗。 */
|
||||
regenerate: [imageId: string]
|
||||
}>()
|
||||
@@ -129,12 +133,14 @@ defineExpose({ openCandidates, closeCandidates })
|
||||
:identity-locked="identityLocked"
|
||||
:disabled="disabled"
|
||||
:pending-operation="pendingOperation"
|
||||
:reading-saved-review-id="readingSavedReviewId"
|
||||
:validation-result="validationResult"
|
||||
:retry-disabled-reason="retryDisabledReason"
|
||||
:active="true"
|
||||
:description="displayImage.isAnchor ? anchorDescription : undefined"
|
||||
@anchor="emit('anchor', $event)"
|
||||
@validate="emit('validate', $event)"
|
||||
@read-review="emit('readReview', $event)"
|
||||
@regenerate="regenerate"
|
||||
/>
|
||||
</div>
|
||||
@@ -171,11 +177,13 @@ defineExpose({ openCandidates, closeCandidates })
|
||||
:identity-locked="identityLocked"
|
||||
:disabled="disabled"
|
||||
:pending-operation="pendingOperation"
|
||||
:reading-saved-review-id="readingSavedReviewId"
|
||||
:validation-result="validationResult"
|
||||
:retry-disabled-reason="retryDisabledReason"
|
||||
:active="candidatesOpen"
|
||||
@anchor="emit('anchor', $event)"
|
||||
@validate="emit('validate', $event)"
|
||||
@read-review="emit('readReview', $event)"
|
||||
@regenerate="regenerate"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -22,6 +22,8 @@ const props = defineProps<{
|
||||
disabled: boolean
|
||||
/** 当前固定目标的图片操作。 */
|
||||
pendingOperation?: IdentityImageOperation | null
|
||||
/** 当前正在读取历史审核的候选编号。 */
|
||||
readingSavedReviewId?: string
|
||||
/** 重新生成暂不可用的具体恢复步骤。 */
|
||||
retryDisabledReason?: string
|
||||
/** 当前母版的使用说明,候选卡片不展示。 */
|
||||
@@ -37,6 +39,8 @@ const emit = defineEmits<{
|
||||
anchor: [imageId: string]
|
||||
/** 校验指定图片。 */
|
||||
validate: [imageId: string]
|
||||
/** 只读查看已保存的审核。 */
|
||||
readReview: [imageId: string]
|
||||
/** 打开失败图片对应的生成参数弹窗。 */
|
||||
regenerate: [imageId: string]
|
||||
}>()
|
||||
@@ -235,6 +239,15 @@ function regenerate() {
|
||||
>
|
||||
{{ character ? '确认选角并锁定' : '设为身份母版' }}
|
||||
</NButton>
|
||||
<!-- 以下是角色候选的只读审核入口。 -->
|
||||
<NButton
|
||||
v-if="character && image.viewType === 'primary'"
|
||||
size="small"
|
||||
:loading="readingSavedReviewId === image.id"
|
||||
:disabled="readingSavedReviewId === image.id"
|
||||
@click="emit('readReview', image.id)"
|
||||
>查看已保存审核</NButton
|
||||
>
|
||||
<ConfirmAction
|
||||
:key="image.id"
|
||||
label="校验此身份图片"
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
import type { IdentityImage, IdentityImageDetails, IdentityValidationResult } from './types'
|
||||
|
||||
/**
|
||||
* 收敛未知元数据,避免访问错误类型的历史字段。
|
||||
* @param value 正式详情中的任意字段
|
||||
* @returns 可读取的记录
|
||||
*/
|
||||
function record(value: unknown): Record<string, unknown> {
|
||||
return value && typeof value === 'object' && !Array.isArray(value) ? (value as Record<string, unknown>) : {}
|
||||
}
|
||||
|
||||
/**
|
||||
* 只展示与当前候选、当次生成输入绑定的已保存审核。当前来源仍由正式确认接口复核。
|
||||
* @param detail 同一候选的只读详情
|
||||
* @param image 图库中当前候选
|
||||
* @param subjectId 当前正式主体
|
||||
* @returns 可展示的已保存审核结果
|
||||
*/
|
||||
export function savedIdentityValidation(
|
||||
detail: IdentityImageDetails,
|
||||
image: IdentityImage,
|
||||
subjectId: string
|
||||
): IdentityValidationResult {
|
||||
if (
|
||||
!detail ||
|
||||
detail.id !== image.id ||
|
||||
detail.identityId !== image.identityId ||
|
||||
detail.viewType !== 'primary' ||
|
||||
detail.status !== 'completed' ||
|
||||
detail.imageUrl !== image.imageUrl ||
|
||||
detail.updatedAt !== image.updatedAt
|
||||
)
|
||||
throw new Error('候选图片记录已变化,请刷新图库后重新查看审核。')
|
||||
|
||||
let metadata: Record<string, unknown>
|
||||
try {
|
||||
metadata = record(JSON.parse(detail.rawJson ?? '{}'))
|
||||
} catch {
|
||||
throw new Error('候选的审核记录无法读取。')
|
||||
}
|
||||
|
||||
const quality = record(metadata.qualityValidation)
|
||||
const validation = record(quality.validation)
|
||||
const fingerprint = record(metadata.providerInputSnapshot).fingerprint
|
||||
if (
|
||||
quality.imageId !== image.id ||
|
||||
validation.imageId !== image.id ||
|
||||
validation.subjectId !== subjectId ||
|
||||
validation.imageUrl !== image.imageUrl ||
|
||||
!quality.subjectFormId ||
|
||||
validation.subjectFormId !== quality.subjectFormId ||
|
||||
quality.sourceCurrent !== true ||
|
||||
!metadata.sourceFingerprint ||
|
||||
quality.generationSourceFingerprint !== metadata.sourceFingerprint ||
|
||||
typeof fingerprint !== 'string' ||
|
||||
!/^[a-f0-9]{64}$/i.test(fingerprint) ||
|
||||
metadata.providerInputFingerprint !== fingerprint ||
|
||||
quality.providerInputFingerprint !== fingerprint ||
|
||||
validation.providerInputFingerprint !== fingerprint ||
|
||||
typeof quality.passed !== 'boolean' ||
|
||||
typeof validation.passed !== 'boolean' ||
|
||||
typeof validation.summary !== 'string' ||
|
||||
!Array.isArray(validation.issues) ||
|
||||
(validation.characterCheckResults !== undefined && !Array.isArray(validation.characterCheckResults)) ||
|
||||
(validation.sourceVisualRequirementResults !== undefined &&
|
||||
!Array.isArray(validation.sourceVisualRequirementResults)) ||
|
||||
!Array.isArray(validation.sourceVisualRequirements) ||
|
||||
!validation.sourceVisualRequirements.every(item => Array.isArray(record(item).quantities))
|
||||
)
|
||||
throw new Error('此候选没有可核对的已保存审核,或审核与生成依据不一致。')
|
||||
|
||||
const rejected =
|
||||
['formConsistent', 'physicalStructureValid', 'spatialLayoutValid'].some(
|
||||
key => quality[key] !== undefined && quality[key] !== true
|
||||
) ||
|
||||
(Array.isArray(quality.issues) && quality.issues.some(issue => record(issue).severity === 'error'))
|
||||
return {
|
||||
...validation,
|
||||
passed: quality.passed && validation.passed && !rejected
|
||||
} as unknown as IdentityValidationResult
|
||||
}
|
||||
@@ -35,6 +35,15 @@ export interface IdentityImage {
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
/** 只读图片详情中核对候选和历史审核所需的字段。 */
|
||||
export interface IdentityImageDetails extends Pick<
|
||||
IdentityImage,
|
||||
'id' | 'identityId' | 'viewType' | 'status' | 'imageUrl' | 'updatedAt'
|
||||
> {
|
||||
/** 后端保存的生成与审核元数据,仅在数据层提取结构化证据。 */
|
||||
rawJson: string | null
|
||||
}
|
||||
|
||||
/** 普通身份生图接口的异步提交回执,图片记录位于 image 字段。 */
|
||||
export interface IdentityImageGenerationStart {
|
||||
/** 已持久化的后台任务编号。 */
|
||||
|
||||
@@ -2,6 +2,7 @@ import { ApiError } from '../../lib/http'
|
||||
import { imageValidationPassed } from '../subject-images/validation'
|
||||
import type { ImageGenerationSubmission } from '../subject-images/generation-preview'
|
||||
import { computed, ref, shallowRef, watch } from 'vue'
|
||||
import { useQuery } from '../../composables/useQuery'
|
||||
import { usePolling } from '../../composables/usePolling'
|
||||
import { visualStyleApi } from '../visual-style'
|
||||
import { useProjectGenerationRevision } from '../generation-config/context'
|
||||
@@ -12,6 +13,7 @@ import { batchResultNotice, getOperation, runOperation, type OperationNotice } f
|
||||
import { useProjectMutationGuard } from '../workflows/useProjectMutationGuard'
|
||||
import { useProjectContext } from '../projects/context'
|
||||
import { subjectIdentityApi } from './api'
|
||||
import { savedIdentityValidation } from './saved-validation'
|
||||
import { canBeAnchor, getIdentitySession, groupIdentitySubjects, mergeCastingSubjects } from './model'
|
||||
import type {
|
||||
IdentityImageOperation,
|
||||
@@ -214,16 +216,54 @@ export function useSubjectIdentity() {
|
||||
const validationSourceKey = computed(() =>
|
||||
JSON.stringify([projectId.value, selectedId.value, identity.value, images.value])
|
||||
)
|
||||
/** 仅在用户打开已保存审核时读取当前候选。 */
|
||||
const savedReviewImageId = ref('')
|
||||
/** 读取正式详情,并绑定当前候选与请求发出时的主体。 */
|
||||
const savedReview = useQuery(savedReviewImageId, async (imageId, signal) => {
|
||||
if (!imageId) return null
|
||||
const current = subject.value
|
||||
const image = images.value.find(item => item.id === imageId)
|
||||
if (current?.module !== 'character' || !image || !canBeAnchor(image)) return null
|
||||
const details = await subjectIdentityApi.imageDetails(current.id, imageId, signal)
|
||||
return savedIdentityValidation(details, image, current.id)
|
||||
})
|
||||
/** 单独标记读审核中的候选,不锁定抽屉关闭。 */
|
||||
const readingSavedReviewId = computed(() => (savedReview.loading.value ? savedReviewImageId.value : ''))
|
||||
|
||||
/**
|
||||
* 打开已保存的角色审核,不发起视觉校验。
|
||||
* @param imageId 用户选择的角色候选
|
||||
*/
|
||||
function readSavedValidation(imageId: string) {
|
||||
if (
|
||||
subject.value?.module !== 'character' ||
|
||||
!images.value.some(item => item.id === imageId && canBeAnchor(item))
|
||||
)
|
||||
return
|
||||
delete validationResults.value[selectedId.value]
|
||||
if (savedReviewImageId.value === imageId) void savedReview.refresh()
|
||||
else savedReviewImageId.value = imageId
|
||||
}
|
||||
|
||||
/** 来源变化或切换主体后清除旧审核展示,不能沿用历史通过。 */
|
||||
watch(
|
||||
validationSourceKey,
|
||||
() => {
|
||||
delete validationResults.value[selectedId.value]
|
||||
savedReviewImageId.value = ''
|
||||
},
|
||||
{ flush: 'sync' }
|
||||
)
|
||||
/** 当前主体的指定图片校验结果。 */
|
||||
const validationResult = computed(() => validationResults.value[selectedId.value] ?? null)
|
||||
const validationResult = computed(
|
||||
() =>
|
||||
validationResults.value[selectedId.value] ??
|
||||
(!savedReview.loading.value &&
|
||||
!savedReview.error.value &&
|
||||
savedReview.data.value?.imageId === savedReviewImageId.value
|
||||
? savedReview.data.value
|
||||
: null)
|
||||
)
|
||||
/** 当前主体的质量闭环回执。 */
|
||||
const qualityResult = computed(() => qualityResults.value[selectedId.value] ?? null)
|
||||
/** 固定图片请求目标,切换主体后不把旧请求的加载状态附在新图片上。 */
|
||||
@@ -284,6 +324,7 @@ export function useSubjectIdentity() {
|
||||
const name = subject.value.name
|
||||
const project = projectId.value
|
||||
const module = subject.value.module
|
||||
savedReviewImageId.value = ''
|
||||
delete validationResults.value[id]
|
||||
const sourceKey = validationSourceKey.value
|
||||
await runImageOperation(
|
||||
@@ -712,6 +753,7 @@ export function useSubjectIdentity() {
|
||||
{ type: 'success', content: `${name} 的角色选角已确认,身份已锁定。` }
|
||||
)
|
||||
if (!confirmed) {
|
||||
if (projectId.value === project && selectedId.value === subjectId) savedReviewImageId.value = ''
|
||||
delete validationResults.value[subjectId]
|
||||
await refreshImageConfirmation(project, subjectId)
|
||||
}
|
||||
@@ -762,6 +804,8 @@ export function useSubjectIdentity() {
|
||||
confirmStableAnchor,
|
||||
confirmCasting,
|
||||
validateImage,
|
||||
readSavedValidation,
|
||||
readingSavedReviewId,
|
||||
pendingImageOperation,
|
||||
generateStableAnchorQuality,
|
||||
validationResult,
|
||||
|
||||
Reference in new issue
Block a user