feat: 身份图片任务运行时临时轮询
This commit is contained in:
1 parent
76dabe67e2
commit
eb7de5c86f
1 file changed
+8
-2
@@ -80,7 +80,13 @@ export function useSubjectIdentity() {
|
||||
)
|
||||
const subject = computed(() => subjects.value.find(item => item.id === selectedId.value))
|
||||
const selectionKey = computed(() => subject.value?.id ?? '')
|
||||
const detail = usePolling(
|
||||
let detail!: ReturnType<typeof usePolling<{ identity: SubjectIdentity | null; images: IdentityImage[] }>>
|
||||
const detailPollInterval = computed(() =>
|
||||
detail?.data.value?.images.some(image => image.status === 'pending' || image.status === 'generating')
|
||||
? 4000
|
||||
: false
|
||||
)
|
||||
detail = usePolling(
|
||||
selectionKey,
|
||||
async (id, signal) => {
|
||||
if (!id) return null
|
||||
@@ -91,7 +97,7 @@ export function useSubjectIdentity() {
|
||||
if (images.some(image => image.identityId !== identity.id)) throw new Error('身份图片与当前主体不匹配。')
|
||||
return { identity, images }
|
||||
},
|
||||
false
|
||||
detailPollInterval
|
||||
)
|
||||
const identity = computed(() => detail.data.value?.identity ?? null)
|
||||
const images = computed(() => detail.data.value?.images ?? [])
|
||||
|
||||
Reference in new issue
Block a user