@@ -29,6 +29,20 @@ const adviceFor = (stage: string, code: string) => {
return '确认错误码后可直接重试;尝试次数耗尽将进入死信队列。'
}
// failureHint turns a dead-letter row's machine code into a plain-Chinese
// diagnosis of what actually went wrong and what to do.
const failureHint = ( failure : JobFailure ) = > {
const detail = ` ${ failure . error_code } ${ failure . last_error || '' } `
if ( detail . includes ( 'not ingestable' ) ) return '钉钉侧该类型不是可下载文档(快捷方式、占位或内部对象),重试也不会成功;建议用“文件名筛选”把它排除,或在钉钉确认它是否为空目录残留。'
if ( detail . includes ( 'source_auth_required' ) ) return '来源存储需要网页登录授权(服务凭据未配置),请联系管理员在“系统设置”重新扫码。'
if ( detail . includes ( 'invalid_format' ) ) return '取回的内容不是有效的文档/文本格式,可能源头文件本身损坏;可下载原件确认后重试。'
if ( detail . includes ( 'source_unavailable' ) ) return '来源服务当时不可达(网络/接口抖动)。任务若已自动重试成功,这里只是历史记录;仍在列表说明源头仍不可达。'
if ( failure . error_code === 'test_upload_remote_failed' || detail . includes ( 'test_upload_remote_failed' ) ) return '向测试知识库上传被拒:确认 WeKnora 测试实例可达、目标知识库未停用后,点击重新入队。'
if ( failure . error_code === 'remote_parse_failed' ) return '文档解析失败:建议先在 WeKnora 手动解析该文件确认格式,再重新入队。'
if ( failure . error_code === 'handler_error' ) return '处理环节报错,展开原始错误定位;确认原因后可重新入队。'
return ` 错误码 ${ failure . error_code } :确认原因后可重新入队。 `
}
const pipelineStages = [ '源头取件' , 'Hash' , 'OSS' , '文档解析' , 'WeKnora 上传' , '索引' , '完成' ]
const stageIndex = ( label : string ) = > label === 'Hash / 文件校验' ? 1 : label === 'OSS' ? 2 : label === '文档解析' ? 3 : label === 'WeKnora 上传' ? 4 : label === '索引 / 增强' || label === '测试知识移除' || label === '治理策略' || label === '处理链路' ? 5 : - 1
function chainSteps ( item : TestPublication ) {
@@ -179,8 +193,8 @@ export function WeKnoraMonitorView({
< div className = "section-head" > < h2 > 需 要 你 出 手 ( { attentionItems . length } ) < / h2 > < span className = "spacer" / > < button className = "danger" disabled = { ! batchTargets . length || retryingIDs . length > 0 } onClick = { ( ) = > onBatchRetry ( batchTargets ) } > { retryingIDs . length ? '重试中…' : ` 批量重试所选( ${ batchTargets . length } ) ` } < / button > < / div >
{ batchMessage ? < p className = "queue-batch-message" role = "status" > { batchMessage } < / p > : null }
{ attentionItems . length ? attentionItems . map ( actionTask ) : emptyLane ( '没有失败或停滞的任务。' ) }
< div className = "section-head sub" > < h3 > 死 信 ( 尝 试 耗 尽 , 不 可 自 动 重 试 ) < / h3 > < span className = "tiny" > 原 始 任 务 与 审 计 行 保 留 不 动 ; 重 新 入 队 会 创 建 新 尝 试 < / span > < / div >
{ failures . length ? < ul className = "dlq-list" > { failures . map ( ( failure ) = > < li key = { failure . id } > < span className = "monitor-status failed" > { failure . error_code } < / span > < b > { failure . job_type === 'test.upload' ? '上传解析' : failure . job_type === 'artifact.fetch' ? '源头取件' : failure . job_type } < / b > { failure . publication_id ? < code > { failure . publication_id } < / code > : null } < small > { failure . attempt } / { failure . max_attempts_at_failure } 次 · { new Date ( failure . created_at ) . toLocaleString ( 'zh-CN' , { hour12 : false } ) } < / small > { failure . publication_id ? < button disabled = { retryingIDs . includes ( failure . publication_id ) } onClick = { ( ) = > onBatchRetry ( [ failure . publication_id as string ] ) } > 重 新 入 队 < / button > : null } < / li > ) } < / ul > : emptyLane ( '当前没有等待处理的死信记录。' ) }
< div className = "section-head sub" > < h3 > 死 信 ( 重 试 次 数 用 完 , 系 统 不 再 自 动 处 理 ) < / h3 > < span className = "tiny" > “ 源 头 取 件 ” = 从 钉 钉 / AList 把 原 始 文 件 拉 回 本 地 ; “ 上 传 解 析 ” = 把 文 件 送 进 知 识 库 做 解 析 。 死 信 只 是 失 败 任 务 的 登 记 表 , 不 会 改 动 原 始 记 录 ; 重 新 入 队 = 再 给 它 一 次 机 会 < / span > < / div >
{ failures . length ? < ul className = "dlq-list" > { failures . map ( ( failure ) = > < li key = { failure . id } > < span className = "monitor-status failed" > { failure . error_code } < / span > < b > { failure . job_type === 'test.upload' ? '上传解析' : failure . job_type === 'artifact.fetch' ? '源头取件' : failure . job_type } < / b > { failure . doc_name ? < b > 「 { failure . doc_name } 」 < / b > : failure . publication_id ? < code > { failure . publication_id } < / code > : null } < small > { failure . attempt } / { failure . max_attempts_at_failure } 次 · { new Date ( failure . created_at ) . toLocaleString ( 'zh-CN' , { hour12 : false } ) } < / small > < small > { failureHint ( failure ) } < / small > { failure . publication_id ? < button disabled = { retryingIDs . includes ( failure . publication_id ) } onClick = { ( ) = > onBatchRetry ( [ failure . publication_id as string ] ) } > 重 新 入 队 < / button > : null } < / li > ) } < / ul > : emptyLane ( '当前没有等待处理的死信记录。' ) }
< / section > : null }
{ lane === 'removal' ? < section className = "inbox-section" aria-label = "需下架" >
< div className = "section-head" > < h2 > 需 下 架 ( { laneCounts . removal } ) < / h2 > < span className = "tiny" > 来 源 目 录 里 被 改 为 “ 禁 止 导 入 ” 或 撤 销 标 注 、 但 仍 在 知 识 库 中 可 检 索 的 文 件 < / span > < / div >