feat: 增强知识库索引与设置页面模块化拆分
扩展知识库索引任务和 RAG 检索支持增量入库和文档去重,优 化本体检测和规则匹配精度,前端设置页面拆分为 LLM、邮件 和 Hermes 员工同步子面板并重构样式,新增日志详情组件和 知识入库日志模型,补充单元测试覆盖。
This commit is contained in:
@@ -12,8 +12,32 @@ const defaultParagraphOpen = markdown.renderer.rules.paragraph_open
|
||||
const defaultLinkOpen = markdown.renderer.rules.link_open
|
||||
const defaultBlockquoteOpen = markdown.renderer.rules.blockquote_open
|
||||
|
||||
const RISK_TEXT_CLASS_BY_LABEL = {
|
||||
低风险: 'markdown-risk-text-low',
|
||||
中风险: 'markdown-risk-text-medium',
|
||||
高风险: 'markdown-risk-text-high'
|
||||
}
|
||||
|
||||
const ACTION_LINK_CLASS_BY_HREF = {
|
||||
'#confirm-attachment-association': 'markdown-action-link-confirm'
|
||||
'#confirm-attachment-association': 'markdown-action-link-confirm',
|
||||
'#review-next-step': 'markdown-action-link-next',
|
||||
'#review-quick-edit': 'markdown-action-link-edit',
|
||||
'#review-risk-panel': 'markdown-action-link-risk'
|
||||
}
|
||||
|
||||
function escapeHtml(text) {
|
||||
return String(text || '')
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
}
|
||||
|
||||
function renderRiskText(text) {
|
||||
return escapeHtml(text).replace(/低风险|中风险|高风险/g, (label) => {
|
||||
const className = RISK_TEXT_CLASS_BY_LABEL[label]
|
||||
return className ? `<span class="${className}">${label}</span>` : label
|
||||
})
|
||||
}
|
||||
|
||||
function resolveActionLinkClass(href) {
|
||||
@@ -70,6 +94,8 @@ markdown.renderer.rules.link_open = (tokens, idx, options, env, self) => {
|
||||
: self.renderToken(tokens, idx, options)
|
||||
}
|
||||
|
||||
markdown.renderer.rules.text = (tokens, idx) => renderRiskText(tokens[idx]?.content)
|
||||
|
||||
markdown.renderer.rules.blockquote_open = (tokens, idx, options, env, self) => {
|
||||
if (blockquoteHasAttachmentHeading(tokens, idx)) {
|
||||
tokens[idx].attrJoin('class', 'markdown-attachment-card')
|
||||
|
||||
Reference in New Issue
Block a user