feat(compaction): cap auto-compaction at 225k tokens by default (#12790)
Co-authored-by: Jasper Hugo <jasper@jasperhugo.com>
This commit is contained in:
@@ -35,7 +35,6 @@ use crate::agents::AgentEvent;
|
||||
use crate::config::extensions::name_to_key;
|
||||
use crate::config::permission::PermissionManager;
|
||||
use crate::config::{Config, GooseMode};
|
||||
use crate::context_mgmt::DEFAULT_COMPACTION_THRESHOLD;
|
||||
use crate::conversation::message::{ActionRequiredData, Message, MessageContent};
|
||||
use crate::permission::permission_inspector::PermissionInspector;
|
||||
use crate::permission::{Permission, PermissionConfirmation};
|
||||
@@ -885,9 +884,7 @@ impl Agent {
|
||||
let stop_hook_block_cap = Config::global()
|
||||
.get_param::<u32>("GOOSE_STOP_HOOK_BLOCK_CAP")
|
||||
.unwrap_or(DEFAULT_STOP_HOOK_BLOCK_CAP);
|
||||
let compaction_threshold = Config::global()
|
||||
.get_param::<f64>("GOOSE_AUTO_COMPACT_THRESHOLD")
|
||||
.unwrap_or(DEFAULT_COMPACTION_THRESHOLD);
|
||||
let compaction_threshold = crate::context_mgmt::auto_compact_threshold(context_limit);
|
||||
let tool_call_cutoff = Config::global()
|
||||
.get_param::<usize>("GOOSE_TOOL_CALL_CUTOFF")
|
||||
.unwrap_or_else(|_| {
|
||||
|
||||
@@ -289,11 +289,11 @@ impl Operation<Session, GooseEffect> for CompactionOperation {
|
||||
conversation
|
||||
};
|
||||
|
||||
let threshold_percentage = (self.threshold * 100.0) as u32;
|
||||
let threshold_k_tokens = (self.context_limit as f64 * self.threshold / 1000.0) as usize;
|
||||
emit.message(Message::assistant().with_system_notification(
|
||||
SystemNotificationType::InlineMessage,
|
||||
format!(
|
||||
"Exceeded auto-compact threshold of {threshold_percentage}%. \
|
||||
"Exceeded auto-compact threshold of {threshold_k_tokens}k tokens. \
|
||||
Performing auto-compaction..."
|
||||
),
|
||||
))
|
||||
|
||||
@@ -22,8 +22,27 @@ use tracing::log::warn;
|
||||
|
||||
pub use goose_context_management::DEFAULT_COMPACTION_THRESHOLD;
|
||||
|
||||
/// Starts compaction with headroom below OpenAI's long-context price tier
|
||||
/// (above 272k input tokens). This is not a maximum request size.
|
||||
pub const DEFAULT_AUTO_COMPACT_TOKEN_LIMIT: usize = 225_000;
|
||||
|
||||
pub(crate) const TOOLCALL_SUMMARIZATION_BATCH_SIZE: usize = 10;
|
||||
|
||||
/// The configured threshold, lowered so compaction starts by the token limit.
|
||||
pub fn auto_compact_threshold(context_limit: usize) -> f64 {
|
||||
let config = Config::global();
|
||||
let threshold = config
|
||||
.get_param::<f64>("GOOSE_AUTO_COMPACT_THRESHOLD")
|
||||
.unwrap_or(DEFAULT_COMPACTION_THRESHOLD);
|
||||
if threshold <= 0.0 || threshold >= 1.0 || context_limit == 0 {
|
||||
return threshold;
|
||||
}
|
||||
let token_limit = config
|
||||
.get_param::<usize>("GOOSE_AUTO_COMPACT_TOKEN_LIMIT")
|
||||
.unwrap_or(DEFAULT_AUTO_COMPACT_TOKEN_LIMIT);
|
||||
threshold.min(token_limit as f64 / context_limit as f64)
|
||||
}
|
||||
|
||||
pub(crate) fn tool_pair_summarization_enabled() -> bool {
|
||||
Config::global()
|
||||
.get_param::<bool>("GOOSE_TOOL_PAIR_SUMMARIZATION")
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
use anyhow::Result;
|
||||
use async_trait::async_trait;
|
||||
use futures::StreamExt;
|
||||
use goose::agents::{Agent, SessionConfig};
|
||||
use goose::config::{Config, GooseMode};
|
||||
use goose::context_mgmt::auto_compact_threshold;
|
||||
use goose::conversation::message::Message;
|
||||
use goose::conversation::Conversation;
|
||||
use goose::providers::base::{stream_from_single_message, MessageStream, Provider};
|
||||
use goose::session::SessionType;
|
||||
use goose_providers::conversation::token_usage::{ProviderUsage, Usage};
|
||||
use goose_providers::errors::ProviderError;
|
||||
use goose_providers::model::ModelConfig;
|
||||
use rmcp::model::Tool;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::Arc;
|
||||
|
||||
#[derive(Default)]
|
||||
struct CompactionProvider {
|
||||
compacted: AtomicBool,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl Provider for CompactionProvider {
|
||||
fn get_name(&self) -> &str {
|
||||
"compaction-test"
|
||||
}
|
||||
|
||||
async fn get_context_limit(&self, model: &str, override_limit: Option<usize>) -> usize {
|
||||
override_limit.unwrap_or_else(|| model.parse().unwrap())
|
||||
}
|
||||
|
||||
async fn stream(
|
||||
&self,
|
||||
model_config: &ModelConfig,
|
||||
_system: &str,
|
||||
messages: &[Message],
|
||||
_tools: &[Tool],
|
||||
) -> Result<MessageStream, ProviderError> {
|
||||
let is_compaction = messages.iter().any(|message| {
|
||||
message
|
||||
.as_concat_text()
|
||||
.to_lowercase()
|
||||
.contains("summarize")
|
||||
});
|
||||
if is_compaction {
|
||||
self.compacted.store(true, Ordering::SeqCst);
|
||||
}
|
||||
Ok(stream_from_single_message(
|
||||
Message::assistant().with_text(if is_compaction {
|
||||
"summary"
|
||||
} else {
|
||||
"continued"
|
||||
}),
|
||||
ProviderUsage::new(
|
||||
model_config.model_name.clone(),
|
||||
Usage::new(Some(100), Some(10), Some(110)),
|
||||
),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn effective_trigger_and_agent_execution_follow_the_current_model() -> Result<()> {
|
||||
let temp_dir = tempfile::tempdir()?;
|
||||
let root = temp_dir.path().to_str().unwrap();
|
||||
let _env = env_lock::lock_env([
|
||||
("GOOSE_PATH_ROOT", Some(root)),
|
||||
("GOOSE_DISABLE_KEYRING", Some("1")),
|
||||
("GOOSE_AUTO_COMPACT_THRESHOLD", None),
|
||||
("GOOSE_AUTO_COMPACT_TOKEN_LIMIT", None),
|
||||
("GOOSE_CONTEXT_LIMIT", None),
|
||||
("GOOSE_TOOL_PAIR_SUMMARIZATION", Some("false")),
|
||||
("GOOSE_DISABLE_SESSION_NAMING", Some("true")),
|
||||
]);
|
||||
let config = Config::global();
|
||||
assert_eq!(auto_compact_threshold(1_000_000), 0.225);
|
||||
assert_eq!(auto_compact_threshold(200_000), 0.8);
|
||||
assert_eq!(auto_compact_threshold(0), 0.8);
|
||||
|
||||
let agent = Agent::new();
|
||||
let session = agent
|
||||
.config
|
||||
.session_manager
|
||||
.create_session(
|
||||
temp_dir.path().to_path_buf(),
|
||||
"compaction threshold".to_string(),
|
||||
SessionType::Hidden,
|
||||
GooseMode::default(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
for (percentage, cap, context, trigger) in [
|
||||
(0.8_f64, 225_000, 1_000_000, 225_000),
|
||||
(0.8, 225_000, 200_000, 160_000),
|
||||
(0.8, 225_000, 1_000_000, 225_000),
|
||||
(0.2, 225_000, 1_000_000, 200_000),
|
||||
(0.8, 900_000, 1_000_000, 800_000),
|
||||
] {
|
||||
config.set_param("GOOSE_AUTO_COMPACT_THRESHOLD", percentage)?;
|
||||
config.set_param("GOOSE_AUTO_COMPACT_TOKEN_LIMIT", cap)?;
|
||||
assert_eq!(
|
||||
auto_compact_threshold(context),
|
||||
percentage.min(cap as f64 / context as f64)
|
||||
);
|
||||
for (tokens, expected) in [(trigger - 1, false), (trigger, false), (trigger + 1, true)] {
|
||||
verify_reply(&agent, &session.id, context, tokens, expected).await?;
|
||||
}
|
||||
}
|
||||
|
||||
for disabled in [0.0, -0.1, 1.0] {
|
||||
config.set_param("GOOSE_AUTO_COMPACT_THRESHOLD", disabled)?;
|
||||
config.set_param("GOOSE_AUTO_COMPACT_TOKEN_LIMIT", 225_000)?;
|
||||
for context in [1_000_000, 200_000] {
|
||||
assert_eq!(auto_compact_threshold(context), disabled);
|
||||
verify_reply(&agent, &session.id, context, 900_000, false).await?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn verify_reply(
|
||||
agent: &Agent,
|
||||
session_id: &str,
|
||||
context: usize,
|
||||
tokens: i32,
|
||||
expected_compaction: bool,
|
||||
) -> Result<()> {
|
||||
let provider = Arc::new(CompactionProvider::default());
|
||||
agent
|
||||
.update_provider(
|
||||
provider.clone(),
|
||||
ModelConfig::new(context.to_string()),
|
||||
session_id,
|
||||
)
|
||||
.await?;
|
||||
agent
|
||||
.config
|
||||
.session_manager
|
||||
.replace_conversation(
|
||||
session_id,
|
||||
&Conversation::new_unvalidated([
|
||||
Message::user().with_text("previous work"),
|
||||
Message::assistant().with_text("previous response"),
|
||||
]),
|
||||
)
|
||||
.await?;
|
||||
agent
|
||||
.config
|
||||
.session_manager
|
||||
.update(session_id)
|
||||
.usage(Usage::new(Some(tokens), Some(0), Some(tokens)))
|
||||
.apply()
|
||||
.await?;
|
||||
let stream = agent
|
||||
.reply(
|
||||
Message::user().with_text("continue"),
|
||||
SessionConfig {
|
||||
id: session_id.to_string(),
|
||||
schedule_id: None,
|
||||
max_turns: Some(2),
|
||||
},
|
||||
None,
|
||||
)
|
||||
.await?;
|
||||
tokio::pin!(stream);
|
||||
while let Some(event) = stream.next().await {
|
||||
event?;
|
||||
}
|
||||
assert_eq!(
|
||||
provider.compacted.load(Ordering::SeqCst),
|
||||
expected_compaction,
|
||||
"context={context}, tokens={tokens}"
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
@@ -64,6 +64,7 @@ The following settings can be configured at the root level of your config.yaml f
|
||||
| `GOOSE_DOCS_ROOT` | Documentation root used by `goose-doc-guide` (e.g. for offline/air-gapped docs) | Local path or HTTP(S) URL containing `goose-docs-map.md` and `docs/` | `https://goose-docs.ai` | No |
|
||||
| `GOOSE_RECIPE_GITHUB_REPO` | GitHub repository for recipes | Format: "org/repo" | None | No |
|
||||
| `GOOSE_AUTO_COMPACT_THRESHOLD` | Set the percentage threshold at which goose [automatically compacts your session](/docs/guides/sessions/smart-context-management#automatic-compaction). | Float between 0.0 and 1.0 (disabled at 0.0)| 0.8 | No |
|
||||
| `GOOSE_AUTO_COMPACT_TOKEN_LIMIT` | Absolute auto-compaction trigger; the earlier of this and the percentage threshold applies while auto-compaction is enabled. Controls when compaction starts, not a guaranteed maximum request size. | Positive integer | 225000 | No |
|
||||
| `SECURITY_PROMPT_ENABLED` | Enable [prompt injection detection](/docs/guides/security/prompt-injection-detection) to identify potentially harmful commands | true/false | false | No |
|
||||
| `SECURITY_PROMPT_THRESHOLD` | Sensitivity threshold for prompt injection detection (higher = stricter) | Float between 0.01 and 1.0 | 0.8 | No |
|
||||
| `SECURITY_PROMPT_CLASSIFIER_ENABLED` | Enable ML-based prompt injection detection for advanced threat identification | true/false | false | No |
|
||||
|
||||
@@ -152,6 +152,7 @@ These variables control how goose manages conversation sessions and context.
|
||||
| `GOOSE_TRUNCATED_SHOW_LINES` | Number of lines shown before the "... (N more lines)" message when a code block is truncated | Positive integer | 20 |
|
||||
| `GOOSE_NO_CODE_TRUNCATION` | Disable code block truncation entirely — all code blocks are shown in full | "1", "true" (case-insensitive) to enable | false |
|
||||
| `GOOSE_AUTO_COMPACT_THRESHOLD` | Set the percentage threshold at which goose [automatically compacts your session](/docs/guides/sessions/smart-context-management#automatic-compaction). | Float between 0.0 and 1.0 (disabled at 0.0) | 0.8 |
|
||||
| `GOOSE_AUTO_COMPACT_TOKEN_LIMIT` | Absolute auto-compaction trigger; the earlier of this and the percentage threshold applies while auto-compaction is enabled. Controls when compaction starts, not a guaranteed maximum request size. | Positive integer | 225000 |
|
||||
| `GOOSE_TOOL_CALL_CUTOFF` | Number of tool calls to keep in full detail before summarizing older tool outputs to help maintain efficient context usage | Integer (e.g., 5, 10, 20) | Computed from the model context limit and auto-compaction threshold |
|
||||
| `GOOSE_MOIM_MESSAGE_TEXT` | Injects persistent text into goose's [working memory](/docs/guides/context-engineering/using-persistent-instructions) every turn. Useful for behavioral guardrails or persistent reminders. | Any text string | Not set |
|
||||
| `GOOSE_MOIM_MESSAGE_FILE` | Path to a file whose contents are injected into goose's [working memory](/docs/guides/context-engineering/using-persistent-instructions) every turn. Supports `~/`. Max 64 KB per file. | File path | Not set |
|
||||
|
||||
@@ -26,10 +26,13 @@ This layered approach lets goose handle token and context limits gracefully.
|
||||
|
||||
## Automatic Compaction
|
||||
goose automatically compacts older parts of your conversation into a summary when approaching token limits, allowing you to maintain long-running sessions without manual intervention.
|
||||
Auto-compaction is triggered by default when you reach 80% of the token limit in goose Desktop and the goose CLI.
|
||||
Auto-compaction is triggered by default when you reach 80% of the token limit or 225,000 tokens, whichever comes first, in goose Desktop and the goose CLI.
|
||||
The effective trigger is `min(GOOSE_AUTO_COMPACT_THRESHOLD × model context window, GOOSE_AUTO_COMPACT_TOKEN_LIMIT)`. It is recalculated for the current model's context window. Change the token cap with `GOOSE_AUTO_COMPACT_TOKEN_LIMIT`.
|
||||
|
||||
The default cap leaves headroom below OpenAI's long-context price tier (above 272,000 input tokens). It controls when compaction starts, not a guaranteed maximum request size: new messages, tool output, and the compaction request itself can exceed the trigger between checks.
|
||||
|
||||
Control the auto-compaction behavior with the `GOOSE_AUTO_COMPACT_THRESHOLD` [environment variable](/docs/guides/environment-variables.md#session-management).
|
||||
Disable this feature by setting the value to `0.0`.
|
||||
Disable this feature by setting the value to `0.0`; the token cap does not re-enable disabled auto-compaction.
|
||||
|
||||
```
|
||||
# Automatically compact sessions when 60% of available tokens are used
|
||||
|
||||
+25
-1
@@ -18,6 +18,7 @@ activities:
|
||||
- Test Z.AI Coding Plan streamed tool calls and interruption recovery
|
||||
- Validate ACP thinking-effort discovery, forwarding, and provider switching
|
||||
- Validate GDK observability hook lifecycle events and payload opt-in
|
||||
- Validate capped and uncapped auto-compaction thresholds and Desktop editing
|
||||
- Test error boundaries including nested delegation prevention
|
||||
- Generate comprehensive test report
|
||||
|
||||
@@ -26,7 +27,7 @@ parameters:
|
||||
input_type: string
|
||||
requirement: optional
|
||||
default: "all"
|
||||
description: "Which test phases to run: all, basic, extensions, delegation, reasoning, zai-coding-plan, acp-effort, advanced"
|
||||
description: "Which test phases to run: all, basic, extensions, delegation, reasoning, zai-coding-plan, acp-effort, compaction, advanced"
|
||||
|
||||
- key: test_depth
|
||||
input_type: string
|
||||
@@ -194,6 +195,29 @@ prompt: |
|
||||
Log results to: {{ workspace_dir }}/phase1_basic_tools.md
|
||||
{% endif %}
|
||||
|
||||
{% if test_phases == "all" or "compaction" in test_phases %}
|
||||
## Auto-Compaction Threshold Validation
|
||||
|
||||
**Prerequisites**: Run this phase from a goose source checkout with the Rust toolchain
|
||||
and installed Desktop dependencies. Record unavailable checks as SKIPPED.
|
||||
|
||||
1. Run `cargo test -p goose --test auto_compact_token_limit`.
|
||||
2. Verify the effective trigger is the minimum of the percentage budget and token cap:
|
||||
defaults produce 225,000 tokens for a 1M-token context and 160,000 for a 200,000-token
|
||||
context. Verify actual agent replies compact only after crossing the trigger.
|
||||
3. Verify changing model context size in the same session recalculates the trigger and
|
||||
that disabled auto-compaction remains disabled regardless of the cap.
|
||||
4. Run `cd ui/desktop && pnpm exec vitest run src/components/alerts/__tests__/AlertBox.test.tsx`.
|
||||
5. Verify the inline editor saves the displayed token cap in capped contexts and the
|
||||
percentage in uncapped contexts, including cancellation and model changes during editing.
|
||||
6. Confirm the smart context management guide describes when compaction starts, rather
|
||||
than promising a maximum request size. New messages, tool output, and compaction
|
||||
requests can exceed the trigger between checks.
|
||||
|
||||
Log command results and failures to: {{ workspace_dir }}/compaction.md
|
||||
Do not modify source files or configuration to make these checks pass.
|
||||
{% endif %}
|
||||
|
||||
{% if test_phases == "all" or "extensions" in test_phases %}
|
||||
## 🔧 PHASE 2: Extension System Testing
|
||||
|
||||
|
||||
@@ -24,6 +24,14 @@ const i18n = defineMessages({
|
||||
id: 'alertBox.autoCompactAt',
|
||||
defaultMessage: 'Auto compact at',
|
||||
},
|
||||
tokenLimitLabel: {
|
||||
id: 'settings.agentLoop.operations.tokenLimit.label',
|
||||
defaultMessage: 'Token limit',
|
||||
},
|
||||
thresholdLabel: {
|
||||
id: 'settings.agentLoop.operations.threshold.label',
|
||||
defaultMessage: 'Threshold %',
|
||||
},
|
||||
compactNow: {
|
||||
id: 'alertBox.compactNow',
|
||||
defaultMessage: 'Compact now',
|
||||
@@ -45,16 +53,23 @@ export const AlertBox = ({ alert, className }: AlertBoxProps) => {
|
||||
const { read, upsert } = useConfig();
|
||||
const [isEditingThreshold, setIsEditingThreshold] = useState(false);
|
||||
const [loadedThreshold, setLoadedThreshold] = useState<number>(0.8);
|
||||
const [thresholdValue, setThresholdValue] = useState(80);
|
||||
const [editValue, setEditValue] = useState(80);
|
||||
const [editingTokenLimit, setEditingTokenLimit] = useState(false);
|
||||
const [tokenLimit, setTokenLimit] = useState(225000);
|
||||
const [isSaving, setIsSaving] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const loadThreshold = async () => {
|
||||
try {
|
||||
const threshold = await read('GOOSE_AUTO_COMPACT_THRESHOLD', false);
|
||||
const [threshold, limit] = await Promise.all([
|
||||
read('GOOSE_AUTO_COMPACT_THRESHOLD', false),
|
||||
read('GOOSE_AUTO_COMPACT_TOKEN_LIMIT', false),
|
||||
]);
|
||||
if (threshold !== undefined && threshold !== null && typeof threshold === 'number') {
|
||||
setLoadedThreshold(threshold);
|
||||
setThresholdValue(Math.max(1, Math.min(99, Math.round(threshold * 100))));
|
||||
}
|
||||
if (typeof limit === 'number') {
|
||||
setTokenLimit(limit);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error fetching auto-compact threshold:', err);
|
||||
@@ -65,31 +80,39 @@ export const AlertBox = ({ alert, className }: AlertBoxProps) => {
|
||||
}, [read]);
|
||||
|
||||
const currentThreshold = loadedThreshold;
|
||||
const contextLimit = alert.progress?.total ?? 0;
|
||||
const tokenLimitApplies =
|
||||
currentThreshold > 0 && currentThreshold < 1 && tokenLimit < currentThreshold * contextLimit;
|
||||
|
||||
const editMaximum = editingTokenLimit ? Number.MAX_SAFE_INTEGER : 99;
|
||||
const editLabel = intl.formatMessage(
|
||||
editingTokenLimit ? i18n.tokenLimitLabel : i18n.thresholdLabel
|
||||
);
|
||||
|
||||
const handleSaveThreshold = async () => {
|
||||
if (isSaving) return; // Prevent double-clicks
|
||||
|
||||
let validThreshold = Math.max(1, Math.min(99, thresholdValue));
|
||||
if (validThreshold !== thresholdValue) {
|
||||
setThresholdValue(validThreshold);
|
||||
}
|
||||
|
||||
const validValue = Math.max(1, Math.min(editMaximum, editValue));
|
||||
setEditValue(validValue);
|
||||
setIsSaving(true);
|
||||
try {
|
||||
const newThreshold = validThreshold / 100; // Convert percentage to decimal
|
||||
|
||||
await upsert('GOOSE_AUTO_COMPACT_THRESHOLD', newThreshold, false);
|
||||
|
||||
setIsEditingThreshold(false);
|
||||
setLoadedThreshold(newThreshold);
|
||||
|
||||
// Notify parent component of the threshold change
|
||||
if (alert.onThresholdChange) {
|
||||
alert.onThresholdChange(newThreshold);
|
||||
if (editingTokenLimit) {
|
||||
await upsert('GOOSE_AUTO_COMPACT_TOKEN_LIMIT', validValue, false);
|
||||
setTokenLimit(validValue);
|
||||
} else {
|
||||
const newThreshold = validValue / 100;
|
||||
await upsert('GOOSE_AUTO_COMPACT_THRESHOLD', newThreshold, false);
|
||||
setLoadedThreshold(newThreshold);
|
||||
alert.onThresholdChange?.(newThreshold);
|
||||
}
|
||||
setIsEditingThreshold(false);
|
||||
} catch (error) {
|
||||
console.error('Error saving threshold:', error);
|
||||
window.alert(intl.formatMessage(i18n.failedToSaveThreshold, { error: errorMessage(error, 'Unknown error') }));
|
||||
window.alert(
|
||||
intl.formatMessage(i18n.failedToSaveThreshold, {
|
||||
error: errorMessage(error, 'Unknown error'),
|
||||
})
|
||||
);
|
||||
} finally {
|
||||
setIsSaving(false);
|
||||
}
|
||||
@@ -111,27 +134,28 @@ export const AlertBox = ({ alert, className }: AlertBoxProps) => {
|
||||
<div className="flex items-center justify-center gap-1 min-h-[20px]">
|
||||
{isEditingThreshold ? (
|
||||
<>
|
||||
<span className="text-[10px] opacity-70">{intl.formatMessage(i18n.autoCompactAt)}</span>
|
||||
<span className="text-[10px] opacity-70">{editLabel}</span>
|
||||
<input
|
||||
type="number"
|
||||
min="1"
|
||||
max="99"
|
||||
max={editMaximum}
|
||||
aria-label={editLabel}
|
||||
step="1"
|
||||
value={thresholdValue}
|
||||
value={editValue}
|
||||
onChange={(e) => {
|
||||
const val = parseInt(e.target.value, 10);
|
||||
if (e.target.value === '') {
|
||||
setThresholdValue(1);
|
||||
setEditValue(1);
|
||||
} else if (!isNaN(val)) {
|
||||
setThresholdValue(Math.max(1, Math.min(99, val)));
|
||||
setEditValue(Math.max(1, Math.min(editMaximum, val)));
|
||||
}
|
||||
}}
|
||||
onBlur={(e) => {
|
||||
const val = parseInt(e.target.value, 10);
|
||||
if (isNaN(val) || val < 1) {
|
||||
setThresholdValue(1);
|
||||
} else if (val > 99) {
|
||||
setThresholdValue(99);
|
||||
setEditValue(1);
|
||||
} else if (val > editMaximum) {
|
||||
setEditValue(editMaximum);
|
||||
}
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
@@ -139,8 +163,6 @@ export const AlertBox = ({ alert, className }: AlertBoxProps) => {
|
||||
handleSaveThreshold();
|
||||
} else if (e.key === 'Escape') {
|
||||
setIsEditingThreshold(false);
|
||||
const resetValue = Math.round(currentThreshold * 100);
|
||||
setThresholdValue(Math.max(1, Math.min(99, resetValue)));
|
||||
}
|
||||
}}
|
||||
onFocus={(e) => {
|
||||
@@ -149,11 +171,10 @@ export const AlertBox = ({ alert, className }: AlertBoxProps) => {
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
className="w-12 px-1 text-[10px] bg-white/10 border border-current/30 rounded outline-none text-center focus:bg-white/20 focus:border-current/50 transition-colors"
|
||||
className="w-20 px-1 text-[10px] bg-white/10 border border-current/30 rounded outline-none text-center focus:bg-white/20 focus:border-current/50 transition-colors"
|
||||
disabled={isSaving}
|
||||
autoFocus
|
||||
/>
|
||||
<span className="text-[10px] opacity-70">%</span>
|
||||
<button
|
||||
type="button"
|
||||
onMouseDown={(e) => {
|
||||
@@ -171,13 +192,22 @@ export const AlertBox = ({ alert, className }: AlertBoxProps) => {
|
||||
) : (
|
||||
<>
|
||||
<span className="text-[10px] opacity-70">
|
||||
{intl.formatMessage(i18n.autoCompactAt)} {Math.round(currentThreshold * 100)}%
|
||||
{intl.formatMessage(i18n.autoCompactAt)}{' '}
|
||||
{tokenLimitApplies
|
||||
? `${Math.round(tokenLimit / 1000)}k`
|
||||
: `${Math.round(currentThreshold * 100)}%`}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
setEditingTokenLimit(tokenLimitApplies);
|
||||
setEditValue(
|
||||
tokenLimitApplies
|
||||
? tokenLimit
|
||||
: Math.max(1, Math.min(99, Math.round(currentThreshold * 100)))
|
||||
);
|
||||
setIsEditingThreshold(true);
|
||||
}}
|
||||
className="p-1 hover:opacity-60 transition-opacity cursor-pointer relative z-10"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
import { render, type RenderOptions, screen, fireEvent } from '@testing-library/react';
|
||||
import { render, type RenderOptions, screen, fireEvent, waitFor } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { AlertBox } from '../AlertBox';
|
||||
import { Alert, AlertType } from '../types';
|
||||
@@ -8,11 +8,13 @@ import { IntlTestWrapper } from '../../../i18n/test-utils';
|
||||
const renderWithIntl = (ui: React.ReactElement, options?: RenderOptions) =>
|
||||
render(ui, { wrapper: IntlTestWrapper, ...options });
|
||||
|
||||
// Mock the ConfigContext
|
||||
const { mockRead, mockUpsert } = vi.hoisted(() => ({
|
||||
mockRead: vi.fn(),
|
||||
mockUpsert: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('../../ConfigContext', () => ({
|
||||
useConfig: () => ({
|
||||
read: vi.fn().mockResolvedValue(0.8),
|
||||
}),
|
||||
useConfig: () => ({ read: mockRead, upsert: mockUpsert }),
|
||||
}));
|
||||
|
||||
describe('AlertBox', () => {
|
||||
@@ -20,6 +22,10 @@ describe('AlertBox', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
mockRead.mockImplementation(async (key: string) =>
|
||||
key === 'GOOSE_AUTO_COMPACT_THRESHOLD' ? 0.8 : 225000
|
||||
);
|
||||
mockUpsert.mockResolvedValue(undefined);
|
||||
});
|
||||
|
||||
describe('Basic Rendering', () => {
|
||||
@@ -111,6 +117,114 @@ describe('AlertBox', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Effective compaction threshold', () => {
|
||||
const progressAlert = (total: number): Alert => ({
|
||||
type: AlertType.Info,
|
||||
message: 'Context window',
|
||||
progress: { current: 100000, total },
|
||||
});
|
||||
|
||||
it('edits the displayed token cap on a 1M-token model', async () => {
|
||||
renderWithIntl(<AlertBox alert={progressAlert(1000000)} />);
|
||||
expect(await screen.findByText('Auto compact at 225k')).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('button'));
|
||||
const input = screen.getByRole('spinbutton');
|
||||
expect(input).toHaveValue(225000);
|
||||
fireEvent.change(input, { target: { value: '250000' } });
|
||||
fireEvent.keyDown(input, { key: 'Enter' });
|
||||
expect(await screen.findByText('Auto compact at 250k')).toBeInTheDocument();
|
||||
expect(mockUpsert).toHaveBeenCalledExactlyOnceWith(
|
||||
'GOOSE_AUTO_COMPACT_TOKEN_LIMIT',
|
||||
250000,
|
||||
false
|
||||
);
|
||||
});
|
||||
|
||||
it('edits the percentage in an uncapped context', async () => {
|
||||
const onThresholdChange = vi.fn();
|
||||
renderWithIntl(<AlertBox alert={{ ...progressAlert(200000), onThresholdChange }} />);
|
||||
expect(await screen.findByText('Auto compact at 80%')).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('button'));
|
||||
const input = screen.getByRole('spinbutton');
|
||||
expect(input).toHaveValue(80);
|
||||
fireEvent.change(input, { target: { value: '70' } });
|
||||
fireEvent.keyDown(input, { key: 'Enter' });
|
||||
expect(await screen.findByText('Auto compact at 70%')).toBeInTheDocument();
|
||||
expect(mockUpsert).toHaveBeenCalledExactlyOnceWith(
|
||||
'GOOSE_AUTO_COMPACT_THRESHOLD',
|
||||
0.7,
|
||||
false
|
||||
);
|
||||
expect(onThresholdChange).toHaveBeenCalledWith(0.7);
|
||||
});
|
||||
|
||||
it('shows the percentage when an edited cap exceeds the percentage budget', async () => {
|
||||
renderWithIntl(<AlertBox alert={progressAlert(1000000)} />);
|
||||
await screen.findByText('Auto compact at 225k');
|
||||
fireEvent.click(screen.getByRole('button'));
|
||||
const input = screen.getByRole('spinbutton');
|
||||
fireEvent.change(input, { target: { value: '900000' } });
|
||||
fireEvent.keyDown(input, { key: 'Enter' });
|
||||
await waitFor(() =>
|
||||
expect(mockUpsert).toHaveBeenCalledWith('GOOSE_AUTO_COMPACT_TOKEN_LIMIT', 900000, false)
|
||||
);
|
||||
expect(screen.getByText('Auto compact at 80%')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('recalculates the displayed setting when the model context changes', async () => {
|
||||
const { rerender } = renderWithIntl(<AlertBox alert={progressAlert(1000000)} />);
|
||||
await screen.findByText('Auto compact at 225k');
|
||||
rerender(<AlertBox alert={progressAlert(200000)} />);
|
||||
expect(screen.getByText('Auto compact at 80%')).toBeInTheDocument();
|
||||
rerender(<AlertBox alert={progressAlert(1000000)} />);
|
||||
expect(screen.getByText('Auto compact at 225k')).toBeInTheDocument();
|
||||
expect(mockUpsert).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('keeps the edited setting stable if the model changes during editing', async () => {
|
||||
const { rerender } = renderWithIntl(<AlertBox alert={progressAlert(1000000)} />);
|
||||
await screen.findByText('Auto compact at 225k');
|
||||
fireEvent.click(screen.getByRole('button'));
|
||||
const input = screen.getByRole('spinbutton');
|
||||
fireEvent.change(input, { target: { value: '250000' } });
|
||||
rerender(<AlertBox alert={progressAlert(200000)} />);
|
||||
expect(input).toHaveValue(250000);
|
||||
fireEvent.keyDown(input, { key: 'Enter' });
|
||||
await waitFor(() =>
|
||||
expect(mockUpsert).toHaveBeenCalledExactlyOnceWith(
|
||||
'GOOSE_AUTO_COMPACT_TOKEN_LIMIT',
|
||||
250000,
|
||||
false
|
||||
)
|
||||
);
|
||||
expect(screen.getByText('Auto compact at 80%')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('discards a cancelled cap edit', async () => {
|
||||
renderWithIntl(<AlertBox alert={progressAlert(1000000)} />);
|
||||
await screen.findByText('Auto compact at 225k');
|
||||
fireEvent.click(screen.getByRole('button'));
|
||||
const input = screen.getByRole('spinbutton');
|
||||
fireEvent.change(input, { target: { value: '250000' } });
|
||||
fireEvent.keyDown(input, { key: 'Escape' });
|
||||
expect(screen.getByText('Auto compact at 225k')).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('button'));
|
||||
expect(screen.getByRole('spinbutton')).toHaveValue(225000);
|
||||
expect(mockUpsert).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('keeps disabled compaction disabled across context changes', async () => {
|
||||
mockRead.mockImplementation(async (key: string) =>
|
||||
key === 'GOOSE_AUTO_COMPACT_THRESHOLD' ? 0 : 225000
|
||||
);
|
||||
const { rerender } = renderWithIntl(<AlertBox alert={progressAlert(1000000)} />);
|
||||
await screen.findByText('Auto compact at 0%');
|
||||
rerender(<AlertBox alert={progressAlert(200000)} />);
|
||||
expect(screen.getByText('Auto compact at 0%')).toBeInTheDocument();
|
||||
expect(mockUpsert).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Compact Button', () => {
|
||||
it('should render compact button when showCompactButton is true', () => {
|
||||
const alert: Alert = {
|
||||
|
||||
@@ -74,6 +74,10 @@ const i18n = defineMessages({
|
||||
id: 'settings.agentLoop.operations.threshold.label',
|
||||
defaultMessage: 'Threshold %',
|
||||
},
|
||||
tokenLimitLabel: {
|
||||
id: 'settings.agentLoop.operations.tokenLimit.label',
|
||||
defaultMessage: 'Token limit',
|
||||
},
|
||||
cutoffLabel: {
|
||||
id: 'settings.agentLoop.operations.cutoff.label',
|
||||
defaultMessage: 'Cutoff',
|
||||
@@ -99,6 +103,7 @@ const i18n = defineMessages({
|
||||
type NumberSetting =
|
||||
| 'maxTurns'
|
||||
| 'compactionThreshold'
|
||||
| 'compactionTokenLimit'
|
||||
| 'toolCallCutoff'
|
||||
| 'retryTimeout'
|
||||
| 'failureTimeout'
|
||||
@@ -109,6 +114,7 @@ type NumberSettings = Record<NumberSetting, string>;
|
||||
const defaultNumberSettings: NumberSettings = {
|
||||
maxTurns: '1000',
|
||||
compactionThreshold: '80',
|
||||
compactionTokenLimit: '225000',
|
||||
toolCallCutoff: '',
|
||||
retryTimeout: '300',
|
||||
failureTimeout: '600',
|
||||
@@ -209,6 +215,7 @@ export default function AgentLoopSettings() {
|
||||
Promise.all([
|
||||
read('GOOSE_MAX_TURNS', false),
|
||||
read('GOOSE_AUTO_COMPACT_THRESHOLD', false),
|
||||
read('GOOSE_AUTO_COMPACT_TOKEN_LIMIT', false),
|
||||
read('GOOSE_SLASH_COMMANDS_ENABLED', false),
|
||||
read('GOOSE_TOOL_PAIR_SUMMARIZATION', false),
|
||||
read('GOOSE_TOOL_CALL_CUTOFF', false),
|
||||
@@ -219,6 +226,7 @@ export default function AgentLoopSettings() {
|
||||
([
|
||||
maxTurns,
|
||||
compactionThreshold,
|
||||
compactionTokenLimit,
|
||||
slashCommands,
|
||||
toolPairCompaction,
|
||||
toolCallCutoff,
|
||||
@@ -237,6 +245,7 @@ export default function AgentLoopSettings() {
|
||||
compactionThreshold: String(
|
||||
Number((readNumber(compactionThreshold, 0.8) * 100).toFixed(2))
|
||||
),
|
||||
compactionTokenLimit: String(readNumber(compactionTokenLimit, 225000)),
|
||||
toolCallCutoff:
|
||||
typeof toolCallCutoff === 'number' && Number.isFinite(toolCallCutoff)
|
||||
? String(toolCallCutoff)
|
||||
@@ -327,24 +336,42 @@ export default function AgentLoopSettings() {
|
||||
title={intl.formatMessage(i18n.contextCompactionTitle)}
|
||||
description={intl.formatMessage(i18n.contextCompactionDescription)}
|
||||
>
|
||||
<NumberInput
|
||||
label={intl.formatMessage(i18n.thresholdLabel)}
|
||||
value={numbers.compactionThreshold}
|
||||
min={1}
|
||||
max={99}
|
||||
step={0.1}
|
||||
onChange={(value) => setNumber('compactionThreshold', value)}
|
||||
onBlur={() =>
|
||||
saveNumber(
|
||||
'compactionThreshold',
|
||||
'GOOSE_AUTO_COMPACT_THRESHOLD',
|
||||
1,
|
||||
99,
|
||||
(value) => value / 100,
|
||||
false
|
||||
)
|
||||
}
|
||||
/>
|
||||
<div className="flex flex-wrap items-center gap-4">
|
||||
<NumberInput
|
||||
label={intl.formatMessage(i18n.thresholdLabel)}
|
||||
value={numbers.compactionThreshold}
|
||||
min={1}
|
||||
max={99}
|
||||
step={0.1}
|
||||
onChange={(value) => setNumber('compactionThreshold', value)}
|
||||
onBlur={() =>
|
||||
saveNumber(
|
||||
'compactionThreshold',
|
||||
'GOOSE_AUTO_COMPACT_THRESHOLD',
|
||||
1,
|
||||
99,
|
||||
(value) => value / 100,
|
||||
false
|
||||
)
|
||||
}
|
||||
/>
|
||||
<NumberInput
|
||||
label={intl.formatMessage(i18n.tokenLimitLabel)}
|
||||
value={numbers.compactionTokenLimit}
|
||||
min={1000}
|
||||
max={10000000}
|
||||
step={1000}
|
||||
onChange={(value) => setNumber('compactionTokenLimit', value)}
|
||||
onBlur={() =>
|
||||
saveNumber(
|
||||
'compactionTokenLimit',
|
||||
'GOOSE_AUTO_COMPACT_TOKEN_LIMIT',
|
||||
1000,
|
||||
10000000
|
||||
)
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</OperationRow>
|
||||
|
||||
<OperationRow
|
||||
|
||||
@@ -4730,6 +4730,9 @@
|
||||
"settings.agentLoop.operations.threshold.label": {
|
||||
"defaultMessage": "Schwellenwert %"
|
||||
},
|
||||
"settings.agentLoop.operations.tokenLimit.label": {
|
||||
"defaultMessage": "Token-Limit"
|
||||
},
|
||||
"settings.agentLoop.operations.toolPairCompaction.description": {
|
||||
"defaultMessage": "Fasst ältere Werkzeuganfragen und -antworten zusammen, um Kontext zu sparen. Ohne Eingabe wird der Grenzwert automatisch festgelegt."
|
||||
},
|
||||
|
||||
@@ -4031,6 +4031,9 @@
|
||||
"settings.agentLoop.operations.threshold.label": {
|
||||
"defaultMessage": "Threshold %"
|
||||
},
|
||||
"settings.agentLoop.operations.tokenLimit.label": {
|
||||
"defaultMessage": "Token limit"
|
||||
},
|
||||
"settings.agentLoop.operations.toolPairCompaction.description": {
|
||||
"defaultMessage": "Summarizes older tool requests and responses to save context. The cutoff is automatic when blank."
|
||||
},
|
||||
|
||||
@@ -4730,6 +4730,9 @@
|
||||
"settings.agentLoop.operations.threshold.label": {
|
||||
"defaultMessage": "Umbral %"
|
||||
},
|
||||
"settings.agentLoop.operations.tokenLimit.label": {
|
||||
"defaultMessage": "Límite de tokens"
|
||||
},
|
||||
"settings.agentLoop.operations.toolPairCompaction.description": {
|
||||
"defaultMessage": "Resume solicitudes y respuestas de herramientas antiguas para ahorrar contexto. El límite es automático si se deja vacío."
|
||||
},
|
||||
|
||||
@@ -4730,6 +4730,9 @@
|
||||
"settings.agentLoop.operations.threshold.label": {
|
||||
"defaultMessage": "Seuil %"
|
||||
},
|
||||
"settings.agentLoop.operations.tokenLimit.label": {
|
||||
"defaultMessage": "Limite de tokens"
|
||||
},
|
||||
"settings.agentLoop.operations.toolPairCompaction.description": {
|
||||
"defaultMessage": "Résume les anciennes requêtes et réponses d’outils pour économiser le contexte. Le seuil est automatique si le champ est vide."
|
||||
},
|
||||
|
||||
@@ -4730,6 +4730,9 @@
|
||||
"settings.agentLoop.operations.threshold.label": {
|
||||
"defaultMessage": "थ्रेशोल्ड %"
|
||||
},
|
||||
"settings.agentLoop.operations.tokenLimit.label": {
|
||||
"defaultMessage": "टोकन सीमा"
|
||||
},
|
||||
"settings.agentLoop.operations.toolPairCompaction.description": {
|
||||
"defaultMessage": "कॉन्टेक्स्ट बचाने के लिए पुराने टूल अनुरोधों और उत्तरों का सारांश बनाता है। खाली छोड़ने पर कटऑफ स्वचालित होता है।"
|
||||
},
|
||||
|
||||
@@ -4730,6 +4730,9 @@
|
||||
"settings.agentLoop.operations.threshold.label": {
|
||||
"defaultMessage": "Ambang %"
|
||||
},
|
||||
"settings.agentLoop.operations.tokenLimit.label": {
|
||||
"defaultMessage": "Batas token"
|
||||
},
|
||||
"settings.agentLoop.operations.toolPairCompaction.description": {
|
||||
"defaultMessage": "Meringkas permintaan dan respons alat lama untuk menghemat konteks. Batas ditentukan otomatis jika dikosongkan."
|
||||
},
|
||||
|
||||
@@ -4730,6 +4730,9 @@
|
||||
"settings.agentLoop.operations.threshold.label": {
|
||||
"defaultMessage": "Soglia %"
|
||||
},
|
||||
"settings.agentLoop.operations.tokenLimit.label": {
|
||||
"defaultMessage": "Limite di token"
|
||||
},
|
||||
"settings.agentLoop.operations.toolPairCompaction.description": {
|
||||
"defaultMessage": "Riassume le richieste e le risposte meno recenti degli strumenti per risparmiare contesto. La soglia è automatica se il campo è vuoto."
|
||||
},
|
||||
|
||||
@@ -4730,6 +4730,9 @@
|
||||
"settings.agentLoop.operations.threshold.label": {
|
||||
"defaultMessage": "しきい値 %"
|
||||
},
|
||||
"settings.agentLoop.operations.tokenLimit.label": {
|
||||
"defaultMessage": "トークン上限"
|
||||
},
|
||||
"settings.agentLoop.operations.toolPairCompaction.description": {
|
||||
"defaultMessage": "古いツールのリクエストとレスポンスを要約してコンテキストを節約します。空欄の場合、カットオフは自動です。"
|
||||
},
|
||||
|
||||
@@ -4730,6 +4730,9 @@
|
||||
"settings.agentLoop.operations.threshold.label": {
|
||||
"defaultMessage": "임계값 %"
|
||||
},
|
||||
"settings.agentLoop.operations.tokenLimit.label": {
|
||||
"defaultMessage": "토큰 한도"
|
||||
},
|
||||
"settings.agentLoop.operations.toolPairCompaction.description": {
|
||||
"defaultMessage": "이전 도구 요청과 응답을 요약하여 컨텍스트를 절약합니다. 비워 두면 컷오프가 자동으로 설정됩니다."
|
||||
},
|
||||
|
||||
@@ -4730,6 +4730,9 @@
|
||||
"settings.agentLoop.operations.threshold.label": {
|
||||
"defaultMessage": "Ambang %"
|
||||
},
|
||||
"settings.agentLoop.operations.tokenLimit.label": {
|
||||
"defaultMessage": "Had token"
|
||||
},
|
||||
"settings.agentLoop.operations.toolPairCompaction.description": {
|
||||
"defaultMessage": "Merumuskan permintaan dan respons alat lama untuk menjimatkan konteks. Had ditetapkan secara automatik jika dibiarkan kosong."
|
||||
},
|
||||
|
||||
@@ -4730,6 +4730,9 @@
|
||||
"settings.agentLoop.operations.threshold.label": {
|
||||
"defaultMessage": "Limite %"
|
||||
},
|
||||
"settings.agentLoop.operations.tokenLimit.label": {
|
||||
"defaultMessage": "Limite de tokens"
|
||||
},
|
||||
"settings.agentLoop.operations.toolPairCompaction.description": {
|
||||
"defaultMessage": "Resume solicitações e respostas antigas de ferramentas para economizar contexto. O limite é automático quando deixado em branco."
|
||||
},
|
||||
|
||||
@@ -4730,6 +4730,9 @@
|
||||
"settings.agentLoop.operations.threshold.label": {
|
||||
"defaultMessage": "Порог %"
|
||||
},
|
||||
"settings.agentLoop.operations.tokenLimit.label": {
|
||||
"defaultMessage": "Лимит токенов"
|
||||
},
|
||||
"settings.agentLoop.operations.toolPairCompaction.description": {
|
||||
"defaultMessage": "Сводит старые запросы и ответы инструментов для экономии контекста. Если поле пусто, порог выбирается автоматически."
|
||||
},
|
||||
|
||||
@@ -4730,6 +4730,9 @@
|
||||
"settings.agentLoop.operations.threshold.label": {
|
||||
"defaultMessage": "Eşik %"
|
||||
},
|
||||
"settings.agentLoop.operations.tokenLimit.label": {
|
||||
"defaultMessage": "Jeton sınırı"
|
||||
},
|
||||
"settings.agentLoop.operations.toolPairCompaction.description": {
|
||||
"defaultMessage": "Bağlamdan tasarruf etmek için eski araç isteklerini ve yanıtlarını özetler. Boş bırakıldığında kesme noktası otomatik belirlenir."
|
||||
},
|
||||
|
||||
@@ -4730,6 +4730,9 @@
|
||||
"settings.agentLoop.operations.threshold.label": {
|
||||
"defaultMessage": "Ngưỡng %"
|
||||
},
|
||||
"settings.agentLoop.operations.tokenLimit.label": {
|
||||
"defaultMessage": "Giới hạn token"
|
||||
},
|
||||
"settings.agentLoop.operations.toolPairCompaction.description": {
|
||||
"defaultMessage": "Tóm tắt các yêu cầu và phản hồi công cụ cũ để tiết kiệm ngữ cảnh. Ngưỡng cắt được đặt tự động khi để trống."
|
||||
},
|
||||
|
||||
@@ -4730,6 +4730,9 @@
|
||||
"settings.agentLoop.operations.threshold.label": {
|
||||
"defaultMessage": "阈值 %"
|
||||
},
|
||||
"settings.agentLoop.operations.tokenLimit.label": {
|
||||
"defaultMessage": "词元上限"
|
||||
},
|
||||
"settings.agentLoop.operations.toolPairCompaction.description": {
|
||||
"defaultMessage": "汇总较早的工具请求和响应以节省上下文。留空时自动设置截断值。"
|
||||
},
|
||||
|
||||
@@ -4730,6 +4730,9 @@
|
||||
"settings.agentLoop.operations.threshold.label": {
|
||||
"defaultMessage": "閾值 %"
|
||||
},
|
||||
"settings.agentLoop.operations.tokenLimit.label": {
|
||||
"defaultMessage": "詞元上限"
|
||||
},
|
||||
"settings.agentLoop.operations.toolPairCompaction.description": {
|
||||
"defaultMessage": "摘要較早的工具請求和回應以節省內容。留空時自動設定截斷值。"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user