mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 04:41:25 +00:00
Add Chinese context overflow patterns to isContextOverflowError (#22855)
Proxy providers returning Chinese error messages (e.g. Chinese LLM gateways) use patterns like '上下文过长' or '上下文超出' that are not matched by the existing English-only patterns in isContextOverflowError. This prevents auto-compaction from triggering, leaving the session stuck. Add the most common Chinese proxy patterns: - 上下文过长 (context too long) - 上下文超出 (context exceeded) - 上下文长度超 (context length exceeds) - 超出最大上下文 (exceeds maximum context) - 请压缩上下文 (please compress context) Chinese characters are unaffected by toLowerCase() so check the original message directly. Closes #22849
This commit is contained in:
@@ -81,7 +81,13 @@ export function isContextOverflowError(errorMessage?: string): boolean {
|
||||
lower.includes("exceeds the model's maximum context") ||
|
||||
(lower.includes("max_tokens") && lower.includes("exceed") && lower.includes("context")) ||
|
||||
(lower.includes("input length") && lower.includes("exceed") && lower.includes("context")) ||
|
||||
(lower.includes("413") && lower.includes("too large"))
|
||||
(lower.includes("413") && lower.includes("too large")) ||
|
||||
// Chinese proxy error messages for context overflow
|
||||
errorMessage.includes("上下文过长") ||
|
||||
errorMessage.includes("上下文超出") ||
|
||||
errorMessage.includes("上下文长度超") ||
|
||||
errorMessage.includes("超出最大上下文") ||
|
||||
errorMessage.includes("请压缩上下文")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user