fix(site-import): warningsLevel 补「跳过」关键词(Task9 备忘折入)

crawl 层注记(logo 下载失败/超限/格式不符、子页抓取失败/非 HTML/
过薄)均含「跳过」且影响产出内容——归 warning 级需人工复核;
钉 5 条 crawler 实文测试。vitest 207。

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-10-20 22:32:45 +08:00
parent 44c53429d9
commit bd3e193f28
2 changed files with 13 additions and 3 deletions
@@ -173,6 +173,14 @@ describe('warningsLevel', () => {
// 缺省兜底注记属「请人工确认」级——info
expect(warningsLevel('以下内容未生成,已用默认,请审核页确认:welcome、topics')).toBe('info')
})
it('crawl 层「跳过」注记=warning(Task 9 备忘——logo/子页跳过影响产出内容)', () => {
expect(warningsLevel('logo 下载失败,已跳过头像')).toBe('warning')
expect(warningsLevel('logo 超过 2MB 上限,已跳过头像')).toBe('warning')
expect(warningsLevel('logo 为不支持的格式,已跳过头像')).toBe('warning')
expect(warningsLevel('子页抓取失败已跳过:https://example.com/products')).toBe('warning')
expect(warningsLevel('子页内容过薄已跳过:https://example.com/about')).toBe('warning')
})
})
// ---- isTerminal404 ----------------------------------------------------------------
+5 -3
View File
@@ -272,12 +272,14 @@ export function wallPoolDispatch(
/**
* 草稿 warning 白话 → 展示级(ElTag type):「规格判定:…」前缀 = info
* (行业分支依据,供审核参考);含「剔除」/「移除」= warning(内容已被
* 改动,需人工复核);其余(缺省兜底「已用默认请确认」等)= info。
* (行业分支依据,供审核参考);含「剔除」/「移除」/「跳过」= warning
* (内容已被改动或产出缺料——剔除/移除来自生成层数字与模板清洗,「跳过」
* 来自 crawl 层 logo/子页注记,均需人工复核);其余(缺省兜底「已用
* 默认请确认」等)= info。
*/
export function warningsLevel(w: string): 'info' | 'warning' {
if (w.startsWith('规格判定:')) return 'info'
if (w.includes('剔除') || w.includes('移除')) return 'warning'
if (w.includes('剔除') || w.includes('移除') || w.includes('跳过')) return 'warning'
return 'info'
}