From 97a5fef0b22393ade47f167734dc694dc0954fbb Mon Sep 17 00:00:00 2001 From: Momentry Studio Date: Sat, 1 Aug 2026 05:55:33 +0800 Subject: [PATCH] fix: createNewGroupAndMove should rename trace profiles, not create identity Changed from apiCall('create_identity_from_face') to updateTraceProfileGroup(name). This correctly creates a new face group by renaming trace_profiles.name instead of trying to register a global identity. --- src/views/PeopleView.vue | 42 +++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/src/views/PeopleView.vue b/src/views/PeopleView.vue index 44b3fec..66974fd 100644 --- a/src/views/PeopleView.vue +++ b/src/views/PeopleView.vue @@ -1864,24 +1864,34 @@ async function createNewGroupAndMove() { traceList.push({ file_uuid, trace_id: parseInt(trace_id) }) } - const firstTrace = traceList[0] - if (!firstTrace) return + if (!traceList.length) return - try { - const result: any = await apiCall('create_identity_from_face', { - fileUuid: firstTrace.file_uuid, - name, - traceIds: traceList.map(t => t.trace_id) - }) - - if (result?.group_uuid) { - clearSelection() - await refresh() - } - } catch (e) { - console.error('Create new group failed:', e) - alert('Failed to create new group') + // 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) } + + operationLoading.value = true + operationMessage.value = `Creating group "${name}" with ${traceList.length} trace(s)...` + + for (const [fileUuid, traceIds] of Object.entries(byFile)) { + try { + await updateTraceProfileGroup(fileUuid, traceIds, { name }) + } catch (e) { + console.error('Create group failed:', fileUuid, traceIds, e) + } + } + + if (selectedFileUuid.value) { + await loadClusterResults() + } + + operationLoading.value = false + operationMessage.value = '' + + clearSelection() } async function deleteSelectedClusterTraces() {