低效压缩,每次只压缩一轮对话 #5279
liuyangedu
started this conversation in
General
低效压缩,每次只压缩一轮对话
#5279
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
我用univse做ppt。做到一半模型开始频繁压缩,一步一压缩,而且越压缩上下文越多。

下面是我的dsh-context插件的截图
我用AI自动分析了一下:
分析完成!问题找到了。
根因分析
问题出在
selectCompactableRange函数(dsh-compaction-basic/lib/index.js第379-401行):问题原因
toolPairingBalancedBefore会检查某个位置是否是"balanced cut"(没有未完成的tool-call跨越这个cut)在我们的对话中,频繁的工具调用(
univer_execute、univer_compile_svg、univer_screenshot等)产生了大量的 tool-call/result 对如果某个位置有未完成的tool-call(即一个tool_call后面还没有对应的tool_result),这个位置就不能作为压缩边界
结果:系统找不到合适的压缩边界,
keepFromIdx被迫向前移动很多,导致每次只能压缩很少的内容解决方案
这是设计上的权衡:
可能的改进方向:
retainRatio(默认0.16),让更多内容被保留这是DSH的设计选择,不是bug。在tool调用密集的场景下(如本对话),确实会导致压缩效率低下。
不知道这个可以解决吗?
All reactions