feat: 增强文档转换失败处理机制
- 新增 FixStuckDocuments 命令用于修复卡住的文档 - 支持批量检测和修复超时的转换任务 - 改进重试按钮,支持 failed/processing/pending 状态 - 在确认对话框中显示当前状态和错误信息 - 提供 dry-run 模式预览修复操作
This commit is contained in:
@@ -226,12 +226,20 @@ class DocumentResource extends Resource
|
||||
->label('重试转换')
|
||||
->icon('heroicon-o-arrow-path')
|
||||
->color('warning')
|
||||
->visible(fn (Document $record): bool => $record->conversion_status === 'failed')
|
||||
->visible(fn (Document $record): bool =>
|
||||
in_array($record->conversion_status, ['failed', 'processing', 'pending'])
|
||||
)
|
||||
->requiresConfirmation()
|
||||
->modalHeading('重试文档转换')
|
||||
->modalDescription(fn (Document $record): string =>
|
||||
'确定要重新转换文档 "' . $record->title . '" 吗?' .
|
||||
($record->conversion_error ? "\n\n上次失败原因:" . $record->conversion_error : '')
|
||||
"\n\n当前状态:" . match($record->conversion_status) {
|
||||
'failed' => '转换失败',
|
||||
'processing' => '转换中(可能卡住)',
|
||||
'pending' => '等待转换',
|
||||
default => $record->conversion_status,
|
||||
} .
|
||||
($record->conversion_error ? "\n\n错误信息:" . $record->conversion_error : '')
|
||||
)
|
||||
->modalSubmitActionLabel('确认重试')
|
||||
->action(function (Document $record) {
|
||||
|
||||
Reference in New Issue
Block a user