refactor: remove identity/pending concepts

- identity_uuid → group_uuid
- Remove status: 'pending'
- Remove starred: false
- Keep only: face, FS, face group
This commit is contained in:
2026-07-25 15:51:38 +08:00
parent 464ddd16a9
commit aa25600580

View File

@@ -50,7 +50,7 @@
</template> </template>
</div> </div>
<div class="ms-ppl-face-grid"> <div class="ms-ppl-face-grid">
<div v-for="c in faceGroups" :key="c.identity_uuid" class="ms-ppl-face-card ms-ppl-cluster-card" :class="{ 'ms-ppl-face-card-selected': isGroupSelected(c) }" @click="batchMode ? toggleGroupSelection(c) : selectCluster(c)" title="View member faces"> <div v-for="c in faceGroups" :key="c.group_uuid" class="ms-ppl-face-card ms-ppl-cluster-card" :class="{ 'ms-ppl-face-card-selected': isGroupSelected(c) }" @click="batchMode ? toggleGroupSelection(c) : selectCluster(c)" title="View member faces">
<div v-if="batchMode" class="ms-ppl-card-checkbox" @click.stop="toggleGroupSelection(c)"> <div v-if="batchMode" class="ms-ppl-card-checkbox" @click.stop="toggleGroupSelection(c)">
<span v-if="isGroupSelected(c)"></span> <span v-if="isGroupSelected(c)"></span>
</div> </div>
@@ -283,7 +283,7 @@
<h2 class="ms-ppl-section-title">Select Target Group</h2> <h2 class="ms-ppl-section-title">Select Target Group</h2>
<p class="ms-merge-hint">Choose which group to keep. Other selected groups will be merged into this one.</p> <p class="ms-merge-hint">Choose which group to keep. Other selected groups will be merged into this one.</p>
<div class="ms-merge-grid"> <div class="ms-merge-grid">
<div v-for="c in mergeCandidateGroups" :key="c.identity_uuid" class="ms-merge-face-card" @click="executeMerge(c.identity_uuid)"> <div v-for="c in mergeCandidateGroups" :key="c.group_uuid" class="ms-merge-face-card" @click="executeMerge(c.group_uuid)">
<div class="ms-merge-face-img"> <div class="ms-merge-face-img">
<img v-if="c.rep_trace && faceThumbsCache[thumbTraceKey(c.rep_trace)]" :src="faceThumbsCache[thumbTraceKey(c.rep_trace)]" alt=""> <img v-if="c.rep_trace && faceThumbsCache[thumbTraceKey(c.rep_trace)]" :src="faceThumbsCache[thumbTraceKey(c.rep_trace)]" alt="">
<svg v-else viewBox="0 0 120 120" fill="none" style="width:100%;height:100%;"> <svg v-else viewBox="0 0 120 120" fill="none" style="width:100%;height:100%;">
@@ -313,7 +313,7 @@
<hr class="ms-merge-divider"> <hr class="ms-merge-divider">
<div class="ms-merge-grid"> <div class="ms-merge-grid">
<div v-for="c in faceGroups" :key="c.identity_uuid" class="ms-merge-face-card" @click="moveToGroup(c)"> <div v-for="c in faceGroups" :key="c.group_uuid" class="ms-merge-face-card" @click="moveToGroup(c)">
<div class="ms-merge-face-img"> <div class="ms-merge-face-img">
<img v-if="c.rep_trace && faceThumbsCache[thumbTraceKey(c.rep_trace)]" :src="faceThumbsCache[thumbTraceKey(c.rep_trace)]" alt=""> <img v-if="c.rep_trace && faceThumbsCache[thumbTraceKey(c.rep_trace)]" :src="faceThumbsCache[thumbTraceKey(c.rep_trace)]" alt="">
<svg v-else viewBox="0 0 120 120" fill="none" style="width:100%;height:100%;"> <svg v-else viewBox="0 0 120 120" fill="none" style="width:100%;height:100%;">
@@ -537,7 +537,7 @@ function isFaceSelected(t: any): boolean {
} }
function isGroupSelected(c: any): boolean { function isGroupSelected(c: any): boolean {
return selectedGroups.value.includes(c.identity_uuid) return selectedGroups.value.includes(c.group_uuid)
} }
function isClusterTraceSelected(t: any): boolean { function isClusterTraceSelected(t: any): boolean {
@@ -650,11 +650,9 @@ const faceGroups = computed(() => {
const defaultName = `group ${String(idx + 1).padStart(2, '0')}` const defaultName = `group ${String(idx + 1).padStart(2, '0')}`
if (!c.name) c.name = defaultName if (!c.name) c.name = defaultName
return { return {
identity_uuid: `cluster_${c.cluster_id ?? c.group_id}`, group_uuid: `group_${c.cluster_id ?? c.group_id}`,
identity_id: `cluster_${String(c.cluster_id ?? c.group_id).padStart(2, '0')}`, group_id: c.cluster_id ?? c.group_id,
name: c.name, name: c.name,
status: 'pending',
starred: false,
trace_count: c.trace_count, trace_count: c.trace_count,
representative_trace: repTraceId, representative_trace: repTraceId,
cluster_id: c.cluster_id ?? c.group_id, cluster_id: c.cluster_id ?? c.group_id,
@@ -936,9 +934,9 @@ async function loadClusterResults() {
for (const tid of traceIds) { for (const tid of traceIds) {
const s = suggestions[String(tid)] const s = suggestions[String(tid)]
if (s) { if (s) {
const key = s.identity_uuid const key = s.group_uuid
if (!identityCounts[key]) { if (!identityCounts[key]) {
identityCounts[key] = { name: s.name, uuid: s.identity_uuid, count: 0 } identityCounts[key] = { name: s.name, uuid: s.group_uuid, count: 0 }
} }
identityCounts[key].count++ identityCounts[key].count++
} }
@@ -1471,12 +1469,12 @@ async function createNewIdentityFromFace() {
fileUuid: c.file_uuid, fileUuid: c.file_uuid,
traceIds: c.trace_id ? [c.trace_id] : undefined traceIds: c.trace_id ? [c.trace_id] : undefined
}) })
if (result?.identity_uuid) { if (result?.group_uuid) {
faceDetailModal.value.show = false faceDetailModal.value.show = false
if (c.trace_id) { if (c.trace_id) {
unassignedTracesCache.value = unassignedTracesCache.value.filter((t: any) => t.trace_id !== c.trace_id) unassignedTracesCache.value = unassignedTracesCache.value.filter((t: any) => t.trace_id !== c.trace_id)
} }
const cleanUuid = result.identity_uuid.replace(/-/g, '') const cleanUuid = result.group_uuid.replace(/-/g, '')
router.push(`/people/${cleanUuid}`) router.push(`/people/${cleanUuid}`)
} else { } else {
alert(t('people.detail.create_identity_failed')) alert(t('people.detail.create_identity_failed'))
@@ -1512,7 +1510,7 @@ function toggleFaceSelection(t: any) {
} }
function toggleGroupSelection(c: any) { function toggleGroupSelection(c: any) {
const key = c.identity_uuid const key = c.group_uuid
const idx = selectedGroups.value.indexOf(key) const idx = selectedGroups.value.indexOf(key)
if (idx >= 0) { if (idx >= 0) {
selectedGroups.value.splice(idx, 1) selectedGroups.value.splice(idx, 1)
@@ -1634,7 +1632,7 @@ async function batchDeleteGroups() {
if (!selectedGroups.value.length) return if (!selectedGroups.value.length) return
const groupIds = Array.from(selectedGroups.value) const groupIds = Array.from(selectedGroups.value)
const groupsToDelete = faceGroups.value.filter((c: any) => groupIds.includes(c.identity_uuid)) const groupsToDelete = faceGroups.value.filter((c: any) => groupIds.includes(c.group_uuid))
let totalTraces = 0 let totalTraces = 0
const allTraceIds: number[] = [] const allTraceIds: number[] = []
@@ -1687,7 +1685,7 @@ async function batchMergeGroups() {
const groupIds = Array.from(selectedGroups.value) const groupIds = Array.from(selectedGroups.value)
console.log('[batchMergeGroups] groupIds:', groupIds) console.log('[batchMergeGroups] groupIds:', groupIds)
mergeCandidateGroups.value = faceGroups.value.filter((c: any) => groupIds.includes(c.identity_uuid)) mergeCandidateGroups.value = faceGroups.value.filter((c: any) => groupIds.includes(c.group_uuid))
console.log('[batchMergeGroups] mergeCandidateGroups:', mergeCandidateGroups.value.length) console.log('[batchMergeGroups] mergeCandidateGroups:', mergeCandidateGroups.value.length)
showMergeTargetModal.value = true showMergeTargetModal.value = true
@@ -1697,7 +1695,7 @@ async function executeMerge(targetGroupId: string) {
console.log('[executeMerge] targetGroupId:', targetGroupId) console.log('[executeMerge] targetGroupId:', targetGroupId)
showMergeTargetModal.value = false showMergeTargetModal.value = false
const targetGroup = faceGroups.value.find((c: any) => c.identity_uuid === targetGroupId) const targetGroup = faceGroups.value.find((c: any) => c.group_uuid === targetGroupId)
console.log('[executeMerge] targetGroup:', targetGroup) console.log('[executeMerge] targetGroup:', targetGroup)
if (!targetGroup) return if (!targetGroup) return
@@ -1710,7 +1708,7 @@ async function executeMerge(targetGroupId: string) {
const groupIds = Array.from(selectedGroups.value) const groupIds = Array.from(selectedGroups.value)
const sourceGroupIds = groupIds.filter(id => id !== targetGroupId) const sourceGroupIds = groupIds.filter(id => id !== targetGroupId)
const sourceGroups = faceGroups.value.filter((c: any) => sourceGroupIds.includes(c.identity_uuid)) const sourceGroups = faceGroups.value.filter((c: any) => sourceGroupIds.includes(c.group_uuid))
console.log('[executeMerge] sourceGroups:', sourceGroups.length) console.log('[executeMerge] sourceGroups:', sourceGroups.length)
const sourceGroupNames = sourceGroups.map(g => g.name).filter(Boolean) const sourceGroupNames = sourceGroups.map(g => g.name).filter(Boolean)
@@ -1831,7 +1829,7 @@ async function createNewGroupAndMove() {
traceIds: traceList.map(t => t.trace_id) traceIds: traceList.map(t => t.trace_id)
}) })
if (result?.identity_uuid) { if (result?.group_uuid) {
clearSelection() clearSelection()
await refresh() await refresh()
} }