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.
This commit is contained in:
2026-08-01 05:55:33 +08:00
parent beea6b1c35
commit 97a5fef0b2

View File

@@ -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<string, number[]> = {}
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() {