1
This commit is contained in:
@@ -7,3 +7,7 @@ export function listEntities(params) {
|
||||
export function listRelations(params) {
|
||||
return request.get('/kg-relation/list', { params })
|
||||
}
|
||||
|
||||
export function listEntitySources(params) {
|
||||
return request.get('/kg-entity/sources', { params })
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@
|
||||
<el-collapse-item :title="`法律依据(${r.laws.length})`">
|
||||
<div v-for="(law, i) in r.laws" :key="i" class="risk-law">
|
||||
<span class="law-title">《{{ law.law_title }}》{{ law.law_item }}</span>
|
||||
<span v-if="law.source_file" class="law-src">来源:{{ law.source_file }}</span>
|
||||
<div class="law-content">{{ law.content }}</div>
|
||||
</div>
|
||||
</el-collapse-item>
|
||||
@@ -118,6 +119,7 @@
|
||||
<div class="summary-item-desc">{{ item.risks[0].desc }}</div>
|
||||
<div v-for="(law, j) in (item.risks[0].laws || [])" :key="j" class="summary-law">
|
||||
<span class="law-title">《{{ law.law_title }}》{{ law.law_item }}</span>
|
||||
<span v-if="law.source_file" class="law-src">来源:{{ law.source_file }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -401,6 +403,11 @@ const detailTitle = computed(() => detail.value ? detail.value.task.filename : '
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
.law-src {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
margin-left: 6px;
|
||||
}
|
||||
.law-content {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="openChunks(row)">分块</el-button>
|
||||
<el-button v-if="row.status === 5" link type="warning" @click="retry(row)">重试</el-button>
|
||||
<el-button link type="primary" @click="reembed(row)">重新向量化</el-button>
|
||||
<el-button link type="primary" :disabled="isBusy(row.status)" @click="reembed(row)">重新向量化</el-button>
|
||||
<el-button link type="danger" @click="remove(row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -135,6 +135,8 @@ const statusMap = {
|
||||
|
||||
function statusText(s) { return (statusMap[s] || {}).text || s }
|
||||
function statusType(s) { return (statusMap[s] || {}).type || 'info' }
|
||||
// 处理中(解析/向量化/图谱构建),期间禁止重新向量化
|
||||
function isBusy(s) { return s === 1 || s === 2 || s === 3 }
|
||||
|
||||
function formatSize(bytes) {
|
||||
if (!bytes) return '-'
|
||||
@@ -219,8 +221,10 @@ async function reembed(row) {
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
const d = await reembedDocument(row.id)
|
||||
ElMessage.success(`已重新向量化 ${d.count} 个分块`)
|
||||
await reembedDocument(row.id)
|
||||
ElMessage.success('已入队,正在重新向量化')
|
||||
await load()
|
||||
startPolling()
|
||||
}
|
||||
|
||||
async function openChunks(row) {
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
<el-table :data="entities" size="small" height="440" v-loading="loading">
|
||||
<el-table-column prop="name" label="实体" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="entity_type" label="类型" width="100" />
|
||||
<el-table-column prop="chunk_id" label="来源分块" width="90" />
|
||||
<el-table-column label="来源文件" min-width="150" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ srcText(row.name) }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination class="kg-page-bar" small layout="prev, pager, next" :total="entityTotal"
|
||||
:page-size="entityPageSize" v-model:current-page="entityPage" @current-change="loadEntities" />
|
||||
@@ -55,7 +57,7 @@ import { GraphChart } from 'echarts/charts'
|
||||
import { TooltipComponent, LegendComponent } from 'echarts/components'
|
||||
import { CanvasRenderer } from 'echarts/renderers'
|
||||
import { listDatasets } from '../api/dataset.js'
|
||||
import { listEntities, listRelations } from '../api/kg.js'
|
||||
import { listEntities, listRelations, listEntitySources } from '../api/kg.js'
|
||||
|
||||
echarts.use([GraphChart, TooltipComponent, LegendComponent, CanvasRenderer])
|
||||
|
||||
@@ -78,9 +80,15 @@ const relationPage = ref(1)
|
||||
const relationPageSize = 20
|
||||
|
||||
const sideTab = ref('entity')
|
||||
const srcMap = ref({}) // 实体名 → 来源文件列表(/kg-entity/sources)
|
||||
let chart = null
|
||||
let resizeObserver = null
|
||||
|
||||
function srcText(name) {
|
||||
const files = srcMap.value[name] || []
|
||||
return files.length ? files.join('、') : '-'
|
||||
}
|
||||
|
||||
const graphCountText = computed(() => `${truncated.value ? '≈' : ''}${graphNodes.value.length} 实体 / ${graphLinks.value.length} 关系`)
|
||||
const graphNodes = ref([])
|
||||
const graphLinks = ref([])
|
||||
@@ -104,10 +112,14 @@ async function load() {
|
||||
relationPage.value = 1
|
||||
loading.value = true
|
||||
try {
|
||||
const [allEntities, allRelations] = await Promise.all([
|
||||
const [allEntities, allRelations, allSources] = await Promise.all([
|
||||
listEntities({ dataset_id: datasetId.value, page: 1, page_size: 100000 }),
|
||||
listRelations({ dataset_id: datasetId.value, page: 1, page_size: 100000 }),
|
||||
listEntitySources({ dataset_id: datasetId.value }),
|
||||
])
|
||||
const map = {}
|
||||
for (const s of allSources?.list || []) map[s.name] = s.files || []
|
||||
srcMap.value = map
|
||||
buildGraph(allEntities?.list || [], allRelations?.list || [])
|
||||
await Promise.all([loadEntities(), loadRelations()])
|
||||
} finally {
|
||||
@@ -156,6 +168,7 @@ function buildGraph(entitiesList, relationsList) {
|
||||
name: n.name,
|
||||
category: n.entity_type || '未分类',
|
||||
symbolSize: sizeFor(degree.get(n.name) || 0),
|
||||
files: srcMap.value[n.name] || [],
|
||||
}))
|
||||
graphLinks.value = edges
|
||||
renderGraph()
|
||||
@@ -174,7 +187,9 @@ function renderGraph() {
|
||||
const e = graphLinks.value[p.dataIndex]
|
||||
return `${e.source} → ${e.target}<br/>关系:${e.relation}`
|
||||
}
|
||||
return `${p.name}<br/>类型:${p.data.category}`
|
||||
const files = p.data.files || []
|
||||
const src = files.length ? files.join('、') : '未知'
|
||||
return `${p.name}<br/>类型:${p.data.category}<br/>来源:${src}`
|
||||
},
|
||||
},
|
||||
series: [{
|
||||
|
||||
Reference in New Issue
Block a user