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(context): Fix the incorrect display of the frontend context compression ratio.

yan_zj95731928bb2a
diff --git a/jiuwenclaw/web/src/components/ToolPanel/index.tsx b/jiuwenclaw/web/src/components/ToolPanel/index.tsx
index 3b00384b5e..bf6d049e0c 100644
--- a/jiuwenclaw/web/src/components/ToolPanel/index.tsx
+++ b/jiuwenclaw/web/src/components/ToolPanel/index.tsx
@@ -96,10 +96,10 @@ export function ToolPanel() {
const beforeK = ((contextCompressionBefore ?? 0) / 1000).toFixed(1);
const afterK = ((contextCompressionAfter ?? 0) / 1000).toFixed(1);
let compressionRateDisplay;
- if (contextCompressionBefore === 0) {
- compressionRateDisplay = '0.0';
+ if (contextCompressionBefore === 0 || contextCompressionBefore === null) {
+ compressionRateDisplay = '--';
} else if (contextCompressionAfter === contextCompressionBefore) {
- compressionRateDisplay = '100.0';
+ compressionRateDisplay = '0.0';
} else {
compressionRateDisplay = Number.isFinite(contextCompressionRate)
? contextCompressionRate.toFixed(1)