64 lines
2.5 KiB
JavaScript
64 lines
2.5 KiB
JavaScript
|
|
const { invoke } = require('@tauri-apps/api/tauri');
|
|
|
|
async function testBatchTaskDetail() {
|
|
try {
|
|
console.log('🔍 开始调用 get_batch_task_detail...');
|
|
const result = await invoke('get_batch_task_detail', {
|
|
batchId: 'test_batch_1e75f2f3'
|
|
});
|
|
|
|
console.log('✅ API调用成功!');
|
|
console.log('📊 批量任务详情:');
|
|
console.log(JSON.stringify(result, null, 2));
|
|
|
|
// 验证返回数据结构
|
|
const requiredFields = [
|
|
'batch_id', 'workflow_name', 'total_count', 'completed_count',
|
|
'failed_count', 'running_count', 'status', 'progress_percentage',
|
|
'failed_tasks', 'completed_tasks_sample'
|
|
];
|
|
|
|
const missingFields = requiredFields.filter(field => !(field in result));
|
|
if (missingFields.length > 0) {
|
|
console.log('❌ 缺少必要字段:', missingFields);
|
|
} else {
|
|
console.log('✅ 所有必要字段都存在');
|
|
}
|
|
|
|
// 验证数据内容
|
|
console.log('📈 数据验证:');
|
|
console.log(` - 批量ID: ${result.batch_id}`);
|
|
console.log(` - 工作流: ${result.workflow_name}`);
|
|
console.log(` - 总任务数: ${result.total_count}`);
|
|
console.log(` - 完成任务数: ${result.completed_count}`);
|
|
console.log(` - 失败任务数: ${result.failed_count}`);
|
|
console.log(` - 运行中任务数: ${result.running_count}`);
|
|
console.log(` - 进度: ${result.progress_percentage}%`);
|
|
console.log(` - 失败任务列表长度: ${result.failed_tasks.length}`);
|
|
console.log(` - 完成任务样本长度: ${result.completed_tasks_sample.length}`);
|
|
|
|
if (result.failed_tasks.length > 0) {
|
|
console.log('❌ 失败任务详情:');
|
|
result.failed_tasks.forEach((task, index) => {
|
|
console.log(` ${index + 1}. 任务ID: ${task.id}, 错误: ${task.error_message}`);
|
|
});
|
|
}
|
|
|
|
if (result.completed_tasks_sample.length > 0) {
|
|
console.log('✅ 完成任务样本:');
|
|
result.completed_tasks_sample.forEach((task, index) => {
|
|
console.log(` ${index + 1}. 任务ID: ${task.id}, 状态: ${task.status}`);
|
|
});
|
|
}
|
|
|
|
console.log('🎉 测试完成!');
|
|
|
|
} catch (error) {
|
|
console.error('❌ API调用失败:', error);
|
|
console.error('错误详情:', error.message);
|
|
}
|
|
}
|
|
|
|
testBatchTaskDetail();
|