feat(文档): 增加转换失败报错提醒和重试功能

- 在文档列表添加「重试转换」和「查看错误」操作按钮
- 在文档详情页添加「重试转换」功能和转换错误信息展示
- 创建错误详情视图,提供友好的错误信息和解决方案
- 重试功能会重置文档状态并重新派发转换任务
- 优化用户体验,提供清晰的错误提示和操作指引
This commit is contained in:
2026-03-11 15:19:58 +08:00
parent 267bb9a36f
commit ec54f0958d
4 changed files with 253 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
<div class="space-y-4">
<div class="rounded-lg bg-danger-50 dark:bg-danger-900/20 p-4">
<div class="flex items-start">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-danger-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" clip-rule="evenodd" />
</svg>
</div>
<div class="ml-3 flex-1">
<h3 class="text-sm font-medium text-danger-800 dark:text-danger-200">
文档转换失败
</h3>
<div class="mt-2 text-sm text-danger-700 dark:text-danger-300">
<p><strong>文档:</strong>{{ $document->title }}</p>
<p><strong>文件名:</strong>{{ $document->file_name }}</p>
<p><strong>失败时间:</strong>{{ $document->updated_at->format('Y年m月d日 H:i:s') }}</p>
</div>
</div>
</div>
</div>
<div>
<h4 class="text-sm font-medium text-gray-900 dark:text-gray-100 mb-2">错误信息:</h4>
<div class="rounded-lg bg-gray-50 dark:bg-gray-800 p-4">
<pre class="text-xs text-gray-700 dark:text-gray-300 whitespace-pre-wrap break-words font-mono">{{ $error }}</pre>
</div>
</div>
<div class="rounded-lg bg-info-50 dark:bg-info-900/20 p-4">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-info-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z" clip-rule="evenodd" />
</svg>
</div>
<div class="ml-3 flex-1">
<h3 class="text-sm font-medium text-info-800 dark:text-info-200">
常见问题及解决方案
</h3>
<div class="mt-2 text-sm text-info-700 dark:text-info-300">
<ul class="list-disc list-inside space-y-1">
<li>如果错误提示无法连接到 Meilisearch请确保搜索服务正常运行</li>
<li>如果错误提示文件损坏或格式不支持,请检查原始文档是否完整</li>
<li>如果错误提示超时,可能是文档过大或包含大量图片,请尝试优化文档</li>
<li>您可以点击"重试转换"按钮重新尝试转换此文档</li>
</ul>
</div>
</div>
</div>
</div>
</div>