feat: 同步精简接口并统一表单校验

This commit is contained in:
GJ committed 2026-09-10 22:34:47 +08:00
1 parent 82d7bde631
commit 2eea0ea72e
66 files changed
+1611 -1100

No files matched your search

+2 -21
View File
@@ -67,28 +67,9 @@ export function canBeAnchor(image: IdentityImage): boolean {
return image.viewType === 'primary' && image.status === 'completed' && !!image.imageUrl
}
/** 使用后端 isAnchor,不把 front/full-body 的 enabled 错当成母版。 */
/** 使用后端明确的 isAnchor 标记,并校验图片已完成且为 primary 视角。 */
export function currentAnchor(images: IdentityImage[]): IdentityImage | undefined {
return images.find(image => image.isAnchor && image.enabled && canBeAnchor(image))
}
/** 仅读取追溯所需 ID,不把原始 Provider 数据渲染为 HTML。 */
export function readImageProvenance(rawJson?: string | null): {
referenceImageId?: string
identityAnchorImageId?: string
} {
try {
const parsed: unknown = JSON.parse(rawJson || '{}')
if (!parsed || typeof parsed !== 'object') return {}
const value = parsed as Record<string, unknown>
return {
referenceImageId: typeof value.referenceImageId === 'string' ? value.referenceImageId : undefined,
identityAnchorImageId:
typeof value.identityAnchorImageId === 'string' ? value.identityAnchorImageId : undefined
}
} catch {
return {}
}
return images.find(image => image.isAnchor && canBeAnchor(image))
}
/** 批量回执按项目保存在当前会话,切页不丢失,刷新浏览器后不伪造恢复。 */