Collect news text and image references without file attachments
Development CI / check-and-build (push) Successful in 4m44s
GitHub Git mirror / mirror (push) Successful in 6s
Development CI / deploy-development (push) Successful in 2m34s

Skip unsupported document formats and retire attachment work from active gap reporting. Preserve HTTP failures, normalize dynamic page content, and keep legacy bill queues resumable.
This commit is contained in:
eezd committed 2026-11-06 18:12:10 +08:00
1 parent 8766e829f9
commit 736a18def7
17 files changed
+547 -258

No files matched your search

+2
View File
@@ -38,6 +38,8 @@ export interface SourceInfo {
export interface CollectionRetry {
retired_at?: string
skipped_policy?: string
previous_error?: string
document: { url: string, canonical?: string }
attempts: number
next_at: number
@@ -69,7 +69,7 @@ const history = computed(() => {
const percent = Math.min(100, Math.max(0, Math.round(covered / span * 1000) / 10))
const reached = formatTime(position, "YYYY-MM-DD HH:mm")
if (done && position && new Date(position) <= new Date(target))
return { text: `列表遍历完成,已到 ${reached};正文及附件缺口以条目状态为准`, percent: 100, status: "success" } as const
return { text: `列表遍历完成,已到 ${reached};仅遍历支持的文字与图片;正文缺口及格式跳过见详情`, percent: 100, status: "success" } as const
if (done)
return { text: `来源最早只能翻到 ${reached},更早的数据接口不提供`, percent, status: "warning" } as const
return { text: position ? `进行中,已到 ${reached}` : "等待下一轮开始", percent, status: undefined }
@@ -153,6 +153,9 @@ onMounted(loadLatest)
<div v-if="source.collection_stats?.active_gaps !== 0 && source.collection_stats?.document_gaps" class="text-xs text-amber-600">
正文待核验 {{ source.collection_stats.document_gaps }};待重试 {{ source.collection_stats.document_retry_pending }};重试已耗尽 {{ source.collection_stats.document_retry_exhausted }},请核对来源日志
</div>
<p v-if="source.collection_stats?.policy_ignored" class="text-xs text-slate-500">
按文字与图片规则不再采集 {{ source.collection_stats.policy_ignored }} 项历史文件记录;原始原因保留。
</p>
<p v-if="source.collection_stats?.retired_count" class="text-xs text-slate-500">
已停止采集 {{ source.collection_stats.retired_count }} 条,原因及原文保留在详情中。
</p>
@@ -161,7 +164,7 @@ onMounted(loadLatest)
缺口详情({{ gaps.length }})
</summary>
<div v-for="gap in gaps" :key="gap.key" class="mt-2 border border-amber-200 rounded border-solid p-2">
<div>{{ gap.label }};已尝试 {{ gap.attempts }} 次;{{ gap.retired ? "已停止采集" : gap.exhausted ? "重试已耗尽" : `下次重试不早于 ${formatTime(gap.nextAt)}` }}</div>
<div>{{ gap.label }};已尝试 {{ gap.attempts }} 次;{{ gap.ignored ? "按规则不再采集" : gap.retired ? "已停止采集" : gap.exhausted ? "重试已耗尽" : `下次重试不早于 ${formatTime(gap.nextAt)}` }}</div>
<div class="my-1 whitespace-pre-wrap break-words">
{{ gap.error }}
</div>
@@ -169,7 +172,7 @@ onMounted(loadLatest)
</div>
</details>
<div v-if="source.collection_stats?.discovered" class="text-xs text-slate-500">
本轮发现 {{ source.collection_stats.discovered }};筛除 {{ source.collection_stats.excluded ?? 0 }};不完整包 {{ source.collection_stats.partial ?? 0 }}
本轮格式跳过 {{ source.collection_stats.policy_skipped ?? 0 }};发现 {{ source.collection_stats.discovered }};筛除 {{ source.collection_stats.excluded ?? 0 }};不完整包 {{ source.collection_stats.partial ?? 0 }}
</div>
<div class="flex justify-between text-xs text-slate-500">
<span>今日新增 <b class="num text-[var(--el-color-primary)]">+{{ source.today_new }}</b></span>
+2 -1
View File
@@ -47,8 +47,9 @@ export function collectionGaps(source: Pick<SourceInfo, "history_cursor">) {
key: `${key}:${url}`,
label,
url: originalUrl(retry.document.canonical ?? retry.document.url),
error: retry.error || "历史记录未保存具体原因,请核对原文",
error: retry.previous_error || retry.error || "历史记录未保存具体原因,请核对原文",
attempts: retry.attempts,
ignored: key === "attachment_retries" || !!retry.skipped_policy || /\.(?:pdf|docx?|xlsx?|pptx?|zip|gz|rar|7z|rtf|odt|ods|odp|exe|bin)(?:$|[?#/])/i.test(retry.document.url),
retired: !!retry.retired_at,
exhausted: retry.attempts >= 3,
nextAt: new Date(retry.next_at * 1000).toISOString()
+2 -1
View File
@@ -112,11 +112,12 @@ const diffStats = computed(() => ({
title="此条新闻仅采集公开摘要,完整内容请查看原文链接。"
type="info" :closable="false" show-icon
/>
<el-alert v-if="detail.extra.collection_policy === 'web_text_images_v1'" title="仅采集网页文字与图片引用,未读取链接中的 PDF 或附件。" type="info" :closable="false" />
<el-alert v-if="detail.extra.content_scope === 'partial'" title="正文或关键附件存在采集缺口,请核对官方原文。" type="warning" :closable="false" />
<div v-if="Array.isArray(detail.extra.attachments)" class="flex flex-wrap gap-2 text-xs">
<span v-for="attachment in (detail.extra.attachments as { url: string, title: string, status: string }[])" :key="attachment.url">
<el-link :href="attachment.url" target="_blank" type="primary">{{ attachment.title || '附件' }}</el-link>
({{ attachment.status === 'complete' ? '已采集' : '存在缺口' }})
({{ attachment.status === 'complete' ? '已采集' : attachment.status === 'skipped_policy' ? '按规则未采集' : '历史采集缺口' }})
</span>
</div>
<el-tabs v-model="activeTab" class="min-h-0 flex flex-1 flex-col">
+2
View File
@@ -62,6 +62,8 @@ test("gap details retain reasons, exhausted state and legacy records while colle
assert.equal(gaps[0].nextAt, new Date(1793853098 * 1000).toISOString())
assert.equal(gaps[1].url, "https://www.justice.gov/release")
assert.match(gaps[1].error, /图片/)
assert.equal(gaps[1].ignored, true)
assert.equal(gaps[0].ignored, false)
assert.equal(gaps[1].exhausted, false)
assert.equal(gaps[2].exhausted, true)
assert.equal(gaps[2].url, "https://www.congress.gov/bill/119th-congress/house-bill/1")