From beea6b1c357a226fc6053c38c86dc70977c7d98c Mon Sep 17 00:00:00 2001 From: Momentry Studio Date: Sat, 1 Aug 2026 05:50:10 +0800 Subject: [PATCH] fix: moveToGroup should rename traces, not merge them Changed from apiCall('merge_trace', ...) to updateTraceProfileGroup(name=targetGroup.name). This just changes the trace profile name to join the target group, without actually merging trace data together. --- src/views/PeopleView.vue | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/src/views/PeopleView.vue b/src/views/PeopleView.vue index 0b2724c..44b3fec 100644 --- a/src/views/PeopleView.vue +++ b/src/views/PeopleView.vue @@ -1814,43 +1814,37 @@ async function batchMoveFaces() { async function moveToGroup(targetGroup: any) { showMoveFacesModal.value = false - const targetTraceId = targetGroup.trace_ids?.[0] - if (!targetTraceId) { - alert('Target group has no traces') - return - } - - const targetTrace = clusterTracesMap.value[String(targetTraceId)] - const targetFileUuid = targetTrace?.file_uuid - if (!targetFileUuid) { - alert('Target trace has no file_uuid') - return - } - const traceList: { file_uuid: string; trace_id: number }[] = [] for (const key of selectedFaces.value) { const [file_uuid, trace_id] = key.split(':') traceList.push({ file_uuid, trace_id: parseInt(trace_id) }) } + if (!traceList.length) return if (!confirm(`Move ${traceList.length} trace(s) to "${targetGroup.name}"?`)) return operationLoading.value = true operationMessage.value = `Moving ${traceList.length} trace(s)...` + // Group by file_uuid for batch update + const byFile: Record = {} for (const t of traceList) { + if (!byFile[t.file_uuid]) byFile[t.file_uuid] = [] + byFile[t.file_uuid].push(t.trace_id) + } + + for (const [fileUuid, traceIds] of Object.entries(byFile)) { try { - await apiCall('merge_trace', { - file_uuid: t.file_uuid, - source_id: t.trace_id, - target_id: targetTraceId - }) + await updateTraceProfileGroup(fileUuid, traceIds, { name: targetGroup.name }) } catch (e) { - console.error('Move trace failed:', t, e) + console.error('Move traces failed:', fileUuid, traceIds, e) } } - removeTracesFromCache(selectedFaces.value) + // Refresh cluster results + if (selectedFileUuid.value) { + await loadClusterResults() + } operationLoading.value = false operationMessage.value = ''