feat: add confirm_identity API endpoint

- Add POST /api/v1/agents/identity/confirm endpoint
- Calls confirm_identity.py to bind trace to identity
- Updates TKG, Qdrant _faces, PG face_detections, _seeds
- Optional Round 2 propagation after confirmation
- Fix trace_id=0 check in confirm_identity.py (use 'is not None')
- Document API endpoint in 08_identity_agent.md
This commit is contained in:
Accusys
2026-06-26 08:30:03 +08:00
parent 615f9da2df
commit 6cbc11efda
3 changed files with 274 additions and 7 deletions

View File

@@ -65,4 +65,63 @@ curl -s -X POST "$API/api/v1/agents/identity/match-from-trace" \
```
---
*Updated: 2026-05-19 12:49:24*
### `POST /api/v1/agents/identity/confirm`
**Auth**: Required
**Scope**: file-level
Confirm identity binding for a trace. This marks the trace as confirmed in TKG, updates face_detections, adds to _seeds, and optionally triggers Round 2 propagation.
#### Request Parameters
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `file_uuid` | string | Yes | Video file UUID |
| `trace_id` | integer | Yes | Face trace ID to confirm |
| `identity_id` | integer | Yes | Identity internal ID |
| `identity_uuid` | string | Yes | Identity UUID |
| `name` | string | Yes | Identity name |
| `propagate` | boolean | No | Auto-trigger Round 2 matching (default: true) |
#### Example
```bash
curl -s -X POST "$API/api/v1/agents/identity/confirm" \
-H "Authorization: Bearer $JWT" \
-H "Content-Type: application/json" \
-d '{"file_uuid": "'"$FILE_UUID"'", "trace_id": 10, "identity_id": 42, "identity_uuid": "'"$IDENTITY_UUID"'", "name": "Cary Grant", "propagate": false}'
```
#### Response (200)
```json
{
"success": true,
"file_uuid": "384b0ff44aaaa1f1",
"trace_id": 10,
"identity_uuid": "a9a90105...",
"name": "Cary Grant",
"steps": {
"tkg_updated": true,
"qdrant_updated": 150,
"pg_updated": 150,
"seed_added": true
},
"propagation": {
"matched": 5,
"message": "Propagation completed"
}
}
```
#### Side Effects
1. TKG face_track node status → 'confirmed'
2. Qdrant _faces: identity_uuid added to payload
3. PG face_detections: identity_id set
4. Trace centroid added to _seeds (source='propagation')
5. Round 2 matching triggered (if propagate=true)
---
*Updated: 2026-06-26 00:30:00*