fix(GraphCanvas): 修复节点大小计算缩进并优化图谱渲染流程(避免缩成一团)
This commit is contained in:
parent
28e02b8d0e
commit
558d26853f
@ -18,6 +18,7 @@
|
|||||||
- 目前的知识库的图片存在公开访问风险
|
- 目前的知识库的图片存在公开访问风险
|
||||||
- 工具传递给模型的时候,使用英文,显示的时候,使用中文(尽量保持一致)
|
- 工具传递给模型的时候,使用英文,显示的时候,使用中文(尽量保持一致)
|
||||||
- 首页加载的问题
|
- 首页加载的问题
|
||||||
|
- lightrag 类型的图谱的节点数量统计有问题
|
||||||
|
|
||||||
### 新增
|
### 新增
|
||||||
- 新增对于上传附件的智能体中间件,详见[文档](https://xerrors.github.io/Yuxi-Know/latest/advanced/agents-config.html#%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0%E4%B8%AD%E9%97%B4%E4%BB%B6)
|
- 新增对于上传附件的智能体中间件,详见[文档](https://xerrors.github.io/Yuxi-Know/latest/advanced/agents-config.html#%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0%E4%B8%AD%E9%97%B4%E4%BB%B6)
|
||||||
|
|||||||
@ -142,7 +142,7 @@ function initGraph() {
|
|||||||
labelFill: getCSSVariable('--gray-700'),
|
labelFill: getCSSVariable('--gray-700'),
|
||||||
labelWordWrap: true, // enable label ellipsis
|
labelWordWrap: true, // enable label ellipsis
|
||||||
labelMaxWidth: '300%',
|
labelMaxWidth: '300%',
|
||||||
size: (d) => {
|
size: (d) => {
|
||||||
if (!props.sizeByDegree) return 24
|
if (!props.sizeByDegree) return 24
|
||||||
const deg = d.data.degree || 0
|
const deg = d.data.degree || 0
|
||||||
return Math.min(15 + deg * 5, 50)
|
return Math.min(15 + deg * 5, 50)
|
||||||
@ -228,14 +228,33 @@ function setGraphData() {
|
|||||||
if (!graphInstance) initGraph()
|
if (!graphInstance) initGraph()
|
||||||
if (!graphInstance) return
|
if (!graphInstance) return
|
||||||
const data = formatData()
|
const data = formatData()
|
||||||
|
|
||||||
|
console.log('开始设置图谱数据:', {
|
||||||
|
nodes: data.nodes.length,
|
||||||
|
edges: data.edges.length
|
||||||
|
})
|
||||||
|
|
||||||
graphInstance.setData(data)
|
graphInstance.setData(data)
|
||||||
graphInstance.render()
|
graphInstance.render()
|
||||||
|
|
||||||
// 应用关键词高亮
|
// 手动触发布局重新计算,确保节点分布
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
applyHighlightKeywords()
|
try {
|
||||||
emit('data-rendered')
|
if (graphInstance && graphInstance.layout) {
|
||||||
}, 100)
|
graphInstance.layout()
|
||||||
|
console.log('触发布局重新计算')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('布局重新计算失败:', error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 等待力导向布局稳定后再应用高亮
|
||||||
|
setTimeout(() => {
|
||||||
|
applyHighlightKeywords()
|
||||||
|
emit('data-rendered')
|
||||||
|
console.log('图谱渲染完成,布局已稳定')
|
||||||
|
}, 1500)
|
||||||
|
}, 10) // 等待 1ms 确保布局完成
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关键词高亮功能
|
// 关键词高亮功能
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user