feat: add ASR status display in search results, fix unassigned traces param name
This commit is contained in:
@@ -127,7 +127,7 @@ function buildHttpRequest(cmd: string, args: Record<string, any>): { url: string
|
||||
return { url: `/api/v1/faces/candidates?page=${a.page || 1}&page_size=${a.perPage || 100}`, method: 'GET' }
|
||||
}
|
||||
case 'get_unassigned_traces': {
|
||||
let url = `/api/v1/traces/unassigned?page=${a.page || 1}&per_page=${a.perPage || 20}`
|
||||
let url = `/api/v1/traces/unassigned?page=${a.page || 1}&page_size=${a.perPage || 20}`
|
||||
if (a.fileUuid) url += `&file_uuid=${a.fileUuid}`
|
||||
return { url, method: 'GET' }
|
||||
}
|
||||
@@ -437,16 +437,43 @@ case 'get_unassigned_traces': {
|
||||
}
|
||||
case 'search_llm_smart': {
|
||||
const results = data.results || data.data || data || []
|
||||
return results.map((r: any) => ({
|
||||
file_uuid: r.file_uuid || '',
|
||||
start_time: r.start_time ?? 0,
|
||||
end_time: r.end_time ?? 0,
|
||||
start_frame: r.start_frame ?? 0,
|
||||
end_frame: r.end_frame ?? 0,
|
||||
summary: r.summary || r.raw_text || '',
|
||||
similarity: r.similarity || 0,
|
||||
file_name: r.file_name || null,
|
||||
}))
|
||||
return results.map((r: any) => {
|
||||
const asr = r.asr || null
|
||||
const asrSegments = asr?.segments || []
|
||||
const asrLang = asr?.language || ''
|
||||
const asrLangProb = asr?.language_probability || 0
|
||||
|
||||
let asrStatus: 'no_audio_track' | 'silent_audio' | 'has_transcript' | 'processing' = 'processing'
|
||||
let asrMessage = '處理中'
|
||||
|
||||
if (asrSegments.length === 0) {
|
||||
if (asrLang === '' && asrLangProb === 0) {
|
||||
asrStatus = 'no_audio_track'
|
||||
asrMessage = '無音軌'
|
||||
} else {
|
||||
asrStatus = 'silent_audio'
|
||||
asrMessage = asrLang ? `無語音 (${asrLang})` : '無語音'
|
||||
}
|
||||
} else {
|
||||
asrStatus = 'has_transcript'
|
||||
asrMessage = `${asrSegments.length} 段語音 (${asrLang || 'unknown'})`
|
||||
}
|
||||
|
||||
return {
|
||||
file_uuid: r.file_uuid || '',
|
||||
start_time: r.start_time ?? 0,
|
||||
end_time: r.end_time ?? 0,
|
||||
start_frame: r.start_frame ?? 0,
|
||||
end_frame: r.end_frame ?? 0,
|
||||
summary: r.summary || r.raw_text || '',
|
||||
similarity: r.similarity || 0,
|
||||
file_name: r.file_name || null,
|
||||
asr_status: asrStatus,
|
||||
asr_message: asrMessage,
|
||||
asr_segment_count: asrSegments.length,
|
||||
asr_language: asrLang,
|
||||
}
|
||||
})
|
||||
}
|
||||
case 'search_identities': {
|
||||
const results = data.results || data.data || data || []
|
||||
|
||||
Reference in New Issue
Block a user