feat: 动态生成资料包异常提示
This commit is contained in:
@@ -7,7 +7,12 @@ from apps.scenarios.services import list_scenarios
|
||||
|
||||
from .forms import DocumentUploadForm
|
||||
from .models import SubmissionBatch, UploadedDocument
|
||||
from .services import build_batch_rows, import_submission_batch, index_document
|
||||
from .services import (
|
||||
build_batch_rows,
|
||||
build_exception_items,
|
||||
import_submission_batch,
|
||||
index_document,
|
||||
)
|
||||
|
||||
|
||||
def document_list(request):
|
||||
@@ -18,14 +23,21 @@ def document_list(request):
|
||||
batches = batches.filter(
|
||||
Q(product_name__icontains=keyword) | Q(batch_id__icontains=keyword)
|
||||
)
|
||||
documents = UploadedDocument.objects.all()
|
||||
batches = list(batches)
|
||||
documents = list(UploadedDocument.objects.all())
|
||||
status_counts = {
|
||||
"pending": batches.filter(import_status=SubmissionBatch.STATUS_PENDING).count(),
|
||||
"completed": batches.filter(import_status=SubmissionBatch.STATUS_COMPLETED).count(),
|
||||
"review_required": batches.filter(
|
||||
import_status=SubmissionBatch.STATUS_REVIEW_REQUIRED
|
||||
).count(),
|
||||
"total": batches.count(),
|
||||
"pending": sum(
|
||||
1 for batch in batches if batch.import_status == SubmissionBatch.STATUS_PENDING
|
||||
),
|
||||
"completed": sum(
|
||||
1 for batch in batches if batch.import_status == SubmissionBatch.STATUS_COMPLETED
|
||||
),
|
||||
"review_required": sum(
|
||||
1
|
||||
for batch in batches
|
||||
if batch.import_status == SubmissionBatch.STATUS_REVIEW_REQUIRED
|
||||
),
|
||||
"total": len(batches),
|
||||
}
|
||||
processing_pipeline = [
|
||||
{"title": "原始文件接收", "detail": "校验格式、大小和场景归属后保存原件。"},
|
||||
@@ -34,11 +46,6 @@ def document_list(request):
|
||||
{"title": "章节点归类", "detail": "基于文件名、标题和正文线索识别 CH 节点。"},
|
||||
{"title": "切片与索引入库", "detail": "生成知识切片,供 RAG、规则定位和审计引用使用。"},
|
||||
]
|
||||
exception_items = [
|
||||
{"level": "待确认", "title": "CH1.2 监管信息目录.docx", "detail": "目录页码与正文页数存在偏差,建议人工复核。"},
|
||||
{"level": "低可信度", "title": "目标产品说明书.docx", "detail": "Word 页数为估算值,表格抽取质量良好。"},
|
||||
{"level": "失败", "title": "沟通记录扫描件.pdf", "detail": "疑似扫描件,需补做 OCR 或重新上传清晰版。"},
|
||||
]
|
||||
return render(
|
||||
request,
|
||||
"documents/document_list.html",
|
||||
@@ -49,7 +56,7 @@ def document_list(request):
|
||||
"keyword": keyword,
|
||||
"status_counts": status_counts,
|
||||
"processing_pipeline": processing_pipeline,
|
||||
"exception_items": exception_items,
|
||||
"exception_items": build_exception_items(batches, documents),
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user