Reduce context token usage#28
Merged
RachelForster merged 4 commits intoMay 24, 2026
Merged
Conversation
Owner
|
我在本地测试了下,效果非常好,可以清晰观测到token消耗,设置token压缩比例,感谢贡献,有点小建议,
|
Contributor
Author
|
好的,已提交改动 |
Owner
|
感谢贡献,已merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
compact_target_ratio <= compact_threshold - 0.05,避免压缩后马上再次触发。tool_calls、tool_call_id、name等;每轮调用前记录 system/history/tools/total,并在桌面聊天窗口用不显眼的小状态文本展示。tool_calls/tool results 会保留,只清理损坏的 orphan tool 链。original_chars、omitted_chars、head、tail,避免只剩开头 preview 丢掉尾部错误或结论。default,需要时仍可临时启用其他工具组。--run-ui下先window.show()/qtbot.waitExposed(window),再断言 token 标签状态和文本。Tests
.\.venv\Scripts\python.exe -m pytest -q,结果445 passed, 5 skipped, 1 warning.\.venv\Scripts\python.exe -m pytest test/e2e/test_chat_flow.py::TestUISignalFlow::test_ui_update_manager_signals_to_window --run-ui -q,结果1 passed, 1 warninggit diff --check,只有 Windows 换行提示,没有 whitespace errorAddresses #25.