fix: trace debug — show Stranger_NNN for unnamed traces instead of unknown

This commit is contained in:
Accusys
2026-05-14 15:12:21 +08:00
parent 8f013cbdbc
commit c90394897d
42 changed files with 1806 additions and 1722 deletions
+53 -3
View File
@@ -60,7 +60,6 @@
<thead class="text-xs text-gray-500 uppercase bg-gray-700">
<tr>
<th scope="col" class="px-6 py-3 rounded-l-lg">影片名稱</th>
<th scope="col" class="px-6 py-3">區域 ID</th>
<th scope="col" class="px-6 py-3">出現次數</th>
<th scope="col" class="px-6 py-3 rounded-r-lg">首次出現</th>
</tr>
@@ -68,7 +67,6 @@
<tbody>
<tr v-for="video in videos" :key="video.file_uuid" class="bg-gray-800 border-b border-gray-700 hover:bg-gray-750">
<td class="px-6 py-4 font-medium text-white">{{ video.file_name }}</td>
<td class="px-6 py-4 font-mono text-blue-300">{{ video.person_id }}</td>
<td class="px-6 py-4">{{ video.appearance_count }}</td>
<td class="px-6 py-4">{{ video.first_appearance?.toFixed(2) || '-' }}s</td>
</tr>
@@ -76,12 +74,25 @@
</table>
</div>
</div>
<!-- 3D Face Viewer -->
<div class="bg-gray-800 rounded-lg p-6 border border-gray-700">
<h3 class="text-lg font-semibold mb-4 text-blue-400">3D 臉部</h3>
<p class="text-sm text-gray-400 mb-3">立體臉部網格(MediaPipe Face Mesh,468 landmarks)</p>
<div class="h-[350px]">
<Face3DViewer v-if="faceLandmarks.length" :landmarks="faceLandmarks" />
<div v-else class="flex items-center justify-center h-full text-gray-500 text-sm">
{{ faceLoading ? '正在取得臉部資料...' : '尚無臉部資料' }}
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import Face3DViewer from '@/components/Face3DViewer.vue'
import { useRoute } from 'vue-router'
import { httpFetch, getCurrentConfig } from '@/api/client'
@@ -91,9 +102,11 @@ const loading = ref(false)
const detail = ref<any>(null)
const profile = ref<any>({})
const videos = ref<any[]>([])
const faceLandmarks = ref<number[][]>([])
const faceLoading = ref(false)
const loadDetail = async () => {
identityId.value = route.params.id as string
identityId.value = route.params.identity_uuid as string
loading.value = true
try {
@@ -110,7 +123,44 @@ const loadDetail = async () => {
}
}
async function loadFaceLandmarks() {
faceLoading.value = true
try {
const config = getCurrentConfig()
// Use first video's file_uuid for thumbnail (identity UUID doesn't work for thumbnails)
const firstFileUuid = videos.value?.[0]?.file_uuid || identityId.value
const thumbUrl = `${config.api_base_url}/api/v1/file/${firstFileUuid}/thumbnail?frame=1`
const thumbResp = await fetch(thumbUrl, {
headers: config.api_key ? { 'X-API-Key': config.api_key } : {}
})
const blob = await thumbResp.blob()
const reader = new FileReader()
reader.onload = async () => {
const b64 = (reader.result as string).split(',')[1]
try {
const lmResp = await fetch('http://localhost:11437/v1/face/landmarks', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ image: b64 })
})
const data = await lmResp.json()
if (data?.landmarks?.length) {
faceLandmarks.value = data.landmarks.map((lm: any) => [lm.x, lm.y, lm.z])
}
} catch {
// Fallback to sample
const fallback = await fetch('/sample_face_landmarks.json')
const fbData = await fallback.json()
if (fbData?.landmarks?.length) faceLandmarks.value = fbData.landmarks
}
}
reader.readAsDataURL(blob)
} catch { /* ignore */ }
faceLoading.value = false
}
onMounted(() => {
loadDetail()
loadFaceLandmarks()
})
</script>