feat: 功能优化
This commit is contained in:
@@ -38,6 +38,7 @@ const {
|
||||
globalLoadingText,
|
||||
analyzeVideo,
|
||||
batchAnalyze,
|
||||
getVoiceText,
|
||||
} = useBenchmarkAnalysis(data, expandedRowKeys, saveTableDataToSession)
|
||||
|
||||
// ==================== 表单状态 ====================
|
||||
@@ -115,22 +116,31 @@ async function handleExportToExcel() {
|
||||
}
|
||||
|
||||
const selectedRows = data.value.filter(item => selectedRowKeys.value.includes(item.id))
|
||||
const unanalyzedRows = selectedRows.filter(row => !row.transcriptions && !row.prompt)
|
||||
|
||||
if (unanalyzedRows.length > 0) {
|
||||
const rowsNeedTranscription = selectedRows.filter(row => !row.transcriptions)
|
||||
|
||||
// 导出时只获取语音转写,不进行 AI 对话分析
|
||||
if (rowsNeedTranscription.length > 0) {
|
||||
globalLoading.value = true
|
||||
globalLoadingText.value = `正在分析 ${unanalyzedRows.length} 条数据...`
|
||||
|
||||
globalLoadingText.value = `正在分析中...`
|
||||
|
||||
try {
|
||||
for (let i = 0; i < unanalyzedRows.length; i++) {
|
||||
const row = unanalyzedRows[i]
|
||||
globalLoadingText.value = `正在分析第 ${i + 1}/${unanalyzedRows.length} 条数据...`
|
||||
await analyzeVideo(row)
|
||||
const transcriptions = await getVoiceText(rowsNeedTranscription)
|
||||
|
||||
// 更新转写数据
|
||||
for (const row of rowsNeedTranscription) {
|
||||
const transcription = transcriptions.find(item => item.audio_url === row.audio_url)
|
||||
if (transcription) {
|
||||
const index = data.value.findIndex(item => item.id === row.id)
|
||||
if (index !== -1) {
|
||||
data.value[index].transcriptions = transcription.value
|
||||
}
|
||||
}
|
||||
}
|
||||
globalLoadingText.value = '分析完成,正在导出...'
|
||||
|
||||
globalLoadingText.value = '正在导出...'
|
||||
} catch (error) {
|
||||
console.error('分析失败:', error)
|
||||
message.error('部分数据分析失败,将导出已分析的数据')
|
||||
console.error('获取语音转写失败:', error)
|
||||
message.warning('部分数据语音转写失败,将导出已有数据')
|
||||
}
|
||||
} else {
|
||||
globalLoading.value = true
|
||||
|
||||
@@ -152,6 +152,7 @@ export function useBenchmarkAnalysis(data, expandedRowKeys, saveTableDataToSessi
|
||||
globalLoadingText,
|
||||
analyzeVideo,
|
||||
batchAnalyze,
|
||||
getVoiceText,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user