feat: 增强知识库索引与设置页面模块化拆分
扩展知识库索引任务和 RAG 检索支持增量入库和文档去重,优 化本体检测和规则匹配精度,前端设置页面拆分为 LLM、邮件 和 Hermes 员工同步子面板并重构样式,新增日志详情组件和 知识入库日志模型,补充单元测试覆盖。
This commit is contained in:
@@ -156,7 +156,7 @@ export function isTravelReviewPayload(reviewPayload, inlineState = createEmptyIn
|
||||
buildReviewSlotMap(reviewPayload).expense_type?.value ||
|
||||
''
|
||||
)
|
||||
if (['travel', 'hotel', 'transport'].includes(expenseType)) {
|
||||
if (['travel', 'hotel'].includes(expenseType)) {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -164,8 +164,8 @@ export function isTravelReviewPayload(reviewPayload, inlineState = createEmptyIn
|
||||
const documentType = String(item?.document_type || '').trim().toLowerCase()
|
||||
const suggestedType = resolveExpenseTypeCode(item?.suggested_expense_type || item?.scene_label || '')
|
||||
return (
|
||||
['flight_itinerary', 'train_ticket', 'hotel_invoice', 'taxi_receipt', 'transport_receipt'].includes(documentType) ||
|
||||
['travel', 'hotel', 'transport'].includes(suggestedType)
|
||||
['flight_itinerary', 'train_ticket', 'hotel_invoice'].includes(documentType) ||
|
||||
['travel', 'hotel'].includes(suggestedType)
|
||||
)
|
||||
})
|
||||
}
|
||||
@@ -735,6 +735,7 @@ export function buildLocallySyncedReviewPayload(reviewPayload, inlineState = cre
|
||||
can_proceed: canProceed,
|
||||
missing_slots: allMissingSlots,
|
||||
slot_cards: nextSlotCards,
|
||||
edit_fields: mergeInlineReviewFields(reviewPayload.edit_fields || [], inlineState),
|
||||
confirmation_actions: buildLocallySyncedReviewActions(reviewPayload, canProceed)
|
||||
}
|
||||
}
|
||||
@@ -1359,12 +1360,58 @@ export function resolveReviewSaveDraftAction(reviewPayload) {
|
||||
export function resolveReviewFooterActions(reviewPayload) {
|
||||
return (Array.isArray(reviewPayload?.confirmation_actions) ? reviewPayload.confirmation_actions : []).filter((item) => {
|
||||
const actionType = String(item?.action_type || '').trim()
|
||||
return ['next_step', 'link_to_existing_draft', 'create_new_claim_from_documents'].includes(actionType)
|
||||
return ['link_to_existing_draft', 'create_new_claim_from_documents'].includes(actionType)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function buildReviewRiskLevelCounts(reviewPayload) {
|
||||
return (Array.isArray(reviewPayload?.risk_briefs) ? reviewPayload.risk_briefs : []).reduce(
|
||||
(counts, item) => {
|
||||
const level = normalizeReviewRiskLevel(item?.level)
|
||||
if (level === 'high' || level === 'medium' || level === 'low') {
|
||||
counts[level] += 1
|
||||
}
|
||||
return counts
|
||||
},
|
||||
{ low: 0, medium: 0, high: 0 }
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function resolveReviewNextStepAction(reviewPayload) {
|
||||
return (
|
||||
(Array.isArray(reviewPayload?.confirmation_actions) ? reviewPayload.confirmation_actions : []).find(
|
||||
(item) => String(item?.action_type || '').trim() === 'next_step'
|
||||
) || null
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function buildReviewNextStepRichCopy(reviewPayload, { detailHref = '' } = {}) {
|
||||
const nextStepAction = resolveReviewNextStepAction(reviewPayload)
|
||||
if (!nextStepAction) {
|
||||
return ''
|
||||
}
|
||||
|
||||
const counts = buildReviewRiskLevelCounts(reviewPayload)
|
||||
const riskSummary = `现存在 ${counts.low} 条低风险,${counts.medium} 条中风险,${counts.high} 条高风险,具体情况请看 [右侧](#review-risk-panel) 风险信息提示窗。`
|
||||
const lines = [`系统识别您的单据已经填写完所有已知信息,${riskSummary}`]
|
||||
|
||||
if (reviewPayload?.can_proceed && counts.medium === 0 && counts.high === 0) {
|
||||
const editHref = String(detailHref || '').trim() || '#review-quick-edit'
|
||||
lines.push(
|
||||
`系统确认您可以 [继续下一步](#review-next-step) 进行单据的提交,如果您确认信息无误,请点击富文本按钮;如果你还需要继续修改信息,请点击 [快速修改单据信息](${editHref})。`
|
||||
)
|
||||
}
|
||||
return lines.join('\n\n')
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function buildReviewPrimaryButtonLabel(reviewPayload, draftPayload) {
|
||||
const action = resolveReviewPrimaryAction(reviewPayload)
|
||||
if (!action) return '确认'
|
||||
@@ -1444,7 +1491,8 @@ export function normalizeReviewRiskLevel(level) {
|
||||
const normalized = String(level || '').trim().toLowerCase()
|
||||
if (normalized === 'danger' || normalized === 'error' || normalized === 'critical') return 'high'
|
||||
if (normalized === 'warn' || normalized === 'warning' || normalized === 'medium') return 'medium'
|
||||
if (normalized === 'info' || normalized === 'notice' || normalized === 'low') return 'low'
|
||||
if (normalized === 'info' || normalized === 'notice') return 'info'
|
||||
if (normalized === 'low') return 'low'
|
||||
if (normalized === 'high') return normalized
|
||||
return 'low'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user