feat: 新增风险规则生成引擎与知识图谱可视化

后端新增风险规则自动生成和模板执行服务,支持从规则资产
批量生成并持久化风险规则文件;知识库入库日志增强图谱
查询和本地 RAG 回退,前端审计页面增加风险规则模型和流
程图组件,知识入库面板拆分为图谱可视化子组件,报销创
建页面增加引导式流程模型,更新知识库索引数据。
This commit is contained in:
caoxiaozhu
2026-05-23 19:54:42 +08:00
parent 5b388d08c0
commit 575f093c74
63 changed files with 35497 additions and 1517 deletions

View File

@@ -26,8 +26,26 @@ function buildRun() {
chunk_count: 5,
entity_count: 3,
relation_count: 2,
entities: ['远光软件', '支出管理'],
relations: [{ source: '远光软件', target: '支出管理', type: '关联' }]
entities: [
{
name: '远光软件',
type: 'ORGANIZATION',
description: '远光软件是支出管理制度的公司主体。',
descriptions: ['远光软件是支出管理制度的公司主体。'],
properties: { created_at: '2026-05-23' }
},
'支出管理'
],
relations: [
{
source: '远光软件',
target: '支出管理',
type: '约束',
description: '通过制度约束支出审批。',
keywords: ['制度', '审批'],
weight: 2.5
}
]
},
documents: [
{
@@ -40,7 +58,8 @@ function buildRun() {
chunk_count: 3,
entity_count: 2,
relation_count: 1,
chunks: [{ id: 'chunk-1', order: 0, tokens: 21, summary: '支出管理范围' }],
chunks: [{ id: 'chunk-1', order: 0, tokens: 21, summary: '支出管理范围', excerpt: '支出管理范围正文' }],
entity_chunks: [{ entity: '支出管理', chunk_ids: ['chunk-1'] }],
sections: [{ title: '第一章 总则', excerpt: '适用于公司支出。' }],
events: [{ at: '2026-05-22T08:00:00Z', level: 'info', message: '完成' }]
},
@@ -75,8 +94,18 @@ function testBuildsInteractiveModel() {
assert.equal(model.documents.length, 2)
assert.equal(model.documents[0].statusLabel, '已完成')
assert.equal(model.documents[0].chunks[0].summary, '支出管理范围')
assert.equal(model.documents[0].chunks[0].excerpt, '支出管理范围正文')
assert.deepEqual(model.documents[0].entityChunks, [{ entity: '支出管理', chunkIds: ['chunk-1'] }])
assert.deepEqual(model.documents[1].chunks, [])
assert.deepEqual(model.documents[1].sections, [])
assert.deepEqual(model.documents[1].events, [])
assert.equal(model.graph.entityCount, 3)
assert.equal(model.graph.entities[0].name, '远光软件')
assert.equal(model.graph.entities[0].type, 'ORGANIZATION')
assert.equal(model.graph.entities[0].descriptions[0], '远光软件是支出管理制度的公司主体。')
assert.equal(model.graph.relations[0].source, '远光软件')
assert.equal(model.graph.relations[0].description, '通过制度约束支出审批。')
assert.deepEqual(model.graph.relations[0].keywords, ['制度', '审批'])
assert.equal(model.metrics[1].value, '5')
}