Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

fix: update round level compressor config

l_x_d7f7171512fd3
diff --git a/docs/en/Configuration.md b/docs/en/Configuration.md
index 349353892f..2a08648a2b 100644
--- a/docs/en/Configuration.md
+++ b/docs/en/Configuration.md
@@ -423,7 +423,7 @@ These are **conceptual** paths in the main configuration for cross-reference wit
| `models.*.model_config_obj.temperature` | Temperature | `0.95` |
| `heartbeat.every` | Heartbeat interval (seconds) | `3600` |
| `react.context_engine_config.dialogue_compressor_config.tokens_threshold` | Dialogue compression token threshold | `100000` |
-| `react.context_engine_config.round_level_compressor_config.tokens_threshold` | Round-level compression token threshold | `230000` |
+| `react.context_engine_config.round_level_compressor_config.trigger_context_ratio` | Round-level compression trigger ratio of the effective context budget | `0.9` |
<a id="dotenv-configuration"></a>
diff --git "a/docs/zh/\351\205\215\347\275\256\344\277\241\346\201\257.md" "b/docs/zh/\351\205\215\347\275\256\344\277\241\346\201\257.md"
index ee07a1ac8c..2a84ab0b1b 100644
--- "a/docs/zh/\351\205\215\347\275\256\344\277\241\346\201\257.md"
+++ "b/docs/zh/\351\205\215\347\275\256\344\277\241\346\201\257.md"
@@ -425,7 +425,7 @@ permissions:
| `models.*.model_config_obj.temperature` | 温度 | `0.95` |
| `heartbeat.every` | 心跳间隔(秒) | `3600` |
| `react.context_engine_config.dialogue_compressor_config.tokens_threshold` | 历史对话压缩 Token 阈值 | `100000` |
-| `react.context_engine_config.round_level_compressor_config.tokens_threshold` | 轮次级压缩 Token 阈值 | `230000` |
+| `react.context_engine_config.round_level_compressor_config.trigger_context_ratio` | 轮次级压缩触发比例(相对有效上下文预算) | `0.9` |
<a id="dotenv-configuration"></a>
diff --git a/jiuwenswarm/resources/config.team.distributed.leader.yaml b/jiuwenswarm/resources/config.team.distributed.leader.yaml
index 618c595460..ece9dc07d5 100644
--- a/jiuwenswarm/resources/config.team.distributed.leader.yaml
+++ b/jiuwenswarm/resources/config.team.distributed.leader.yaml
@@ -240,8 +240,7 @@ react:
offload_writeback_enabled: false
round_level_compressor_config:
rounds_threshold: 2
- tokens_threshold: 230000
- trigger_total_tokens: 230000
+ trigger_context_ratio: 0.9
target_total_tokens: 160000
compression_call_max_tokens: 250000
keep_last_round: true
diff --git a/jiuwenswarm/resources/config.team.distributed.teammate.yaml b/jiuwenswarm/resources/config.team.distributed.teammate.yaml
index 10d5586a1f..5b6d222865 100644
--- a/jiuwenswarm/resources/config.team.distributed.teammate.yaml
+++ b/jiuwenswarm/resources/config.team.distributed.teammate.yaml
@@ -240,8 +240,7 @@ react:
offload_writeback_enabled: false
round_level_compressor_config:
rounds_threshold: 2
- tokens_threshold: 230000
- trigger_total_tokens: 230000
+ trigger_context_ratio: 0.9
target_total_tokens: 160000
compression_call_max_tokens: 250000
keep_last_round: true
diff --git a/jiuwenswarm/resources/config.yaml b/jiuwenswarm/resources/config.yaml
index fc09eff70a..31c3456397 100644
--- a/jiuwenswarm/resources/config.yaml
+++ b/jiuwenswarm/resources/config.yaml
@@ -406,8 +406,7 @@ react:
offload_writeback_enabled: false
round_level_compressor_config:
rounds_threshold: 2
- tokens_threshold: 230000
- trigger_total_tokens: 230000
+ trigger_context_ratio: 0.9
target_total_tokens: 160000
compression_call_max_tokens: 250000
keep_last_round: true
diff --git a/tests/unit_tests/test_resource_config.py b/tests/unit_tests/test_resource_config.py
new file mode 100644
index 0000000000..fa09759474
--- /dev/null
+++ b/tests/unit_tests/test_resource_config.py
@@ -0,0 +1,20 @@
+from pathlib import Path
+
+import yaml
+
+
+def test_default_round_level_compressor_config_uses_context_ratio():
+ repo_root = Path(__file__).resolve().parents[2]
+ config_files = [
+ repo_root / "jiuwenswarm" / "resources" / "config.yaml",
+ repo_root / "jiuwenswarm" / "resources" / "config.team.distributed.leader.yaml",
+ repo_root / "jiuwenswarm" / "resources" / "config.team.distributed.teammate.yaml",
+ ]
+
+ for config_file in config_files:
+ data = yaml.safe_load(config_file.read_text(encoding="utf-8"))
+ round_level_config = data["react"]["context_engine_config"]["round_level_compressor_config"]
+
+ assert round_level_config["trigger_context_ratio"] == 0.9
+ assert "trigger_total_tokens" not in round_level_config
+ assert "tokens_threshold" not in round_level_config