From 06e1d3cb09a7fb3e6e82c65d2256f3766c972344 Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Wed, 3 Sep 2025 03:09:39 +0800 Subject: [PATCH] =?UTF-8?q?perf(GraphView):=20=E4=BC=98=E5=8C=96=E5=8A=9B?= =?UTF-8?q?=E5=AF=BC=E5=90=91=E5=9B=BE=E5=B8=83=E5=B1=80=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E4=BB=A5=E6=8F=90=E5=8D=87=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 调整 alphaDecay、velocityDecay 和 charge.strength 参数,加快布局收敛速度并减少节点震荡 --- docs/changelog/update.md | 3 +++ web/src/views/GraphView.vue | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/changelog/update.md b/docs/changelog/update.md index d5aaa93e..8275628f 100644 --- a/docs/changelog/update.md +++ b/docs/changelog/update.md @@ -6,6 +6,9 @@ - [ ] 使用更好的知识图谱检索方法 - [ ] 使用其他的聊天记录管理方法,解决两个问题,一个是上下文长度过长,一个是上下文的类型变得更加丰富,比如多模态等等。(现在是基于 LangGraph 的 Memory 实现的,v0.2.3 版本实现),暂定使用 [mem0](github.com/mem0ai/mem0) 来实现。但是目前了解下来,还不是我想要的那种方案。可能会基于这个实现一个 ThreadConvManager 这个类。 - [ ] 添加对于上传文件的支持:这里的复杂的地方就在于如何和历史记录结合在一起(v0.2.3 版本实现,放在记忆管理后面) +- [ ] 将现在的GraphContainer相关的代码分离到一个单独的组件中,然后 actions 和 footer 都是作为 slot top/bottom 提供的 +- [ ] 移除现有的 GraphContainer 然后应用到 AgentView 中。 +- [ ] 知识图谱的上传和可视化,支持属性,标签的展示 🐛**BUGs** - [x] LlightRAG 知识库中,点击边,没有显示,但是在全屏的时候却又能够显示出来。 diff --git a/web/src/views/GraphView.vue b/web/src/views/GraphView.vue index 7da59ee4..b1834ba2 100644 --- a/web/src/views/GraphView.vue +++ b/web/src/views/GraphView.vue @@ -328,9 +328,9 @@ const initGraph = () => { type: 'd3-force', preventOverlap: true, // 优化布局性能参数 - alphaDecay: 0.08, // 增加衰减率,加快收敛速度 + alphaDecay: 0.1, // 增加衰减率,加快收敛速度 alphaMin: 0.01, // 提高最小alpha值,更早停止模拟 - velocityDecay: 0.8, // 增加速度衰减,减少震荡 + velocityDecay: 0.7, // 增加速度衰减,减少震荡 iterations: 100, // 限制最大迭代次数 // 力的配置 force: { @@ -342,7 +342,7 @@ const initGraph = () => { }, // 排斥力 - 节点间相互排斥 charge: { - strength: -300, // 负值表示排斥力 + strength: -400, // 负值表示排斥力 distanceMax: 400 // 限制力的作用距离 }, // 链接力 - 连接的节点相互吸引