mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 04:30:48 +00:00
- Fix contextWindowSize not updating when switching models via setModel() - Fix ACP agent to respect provider-configured contextWindowSize before auto-detection - Simplify getTruncateToolOutputThreshold to use static threshold - Add support for GLM-4.7, Kimi-2.5, and MiniMax-M2.1 models - Update context usage display to require explicit contextWindowSize Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
34 lines
702 B
TypeScript
34 lines
702 B
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import { Text } from 'ink';
|
|
import { theme } from '../semantic-colors.js';
|
|
|
|
export const ContextUsageDisplay = ({
|
|
promptTokenCount,
|
|
terminalWidth,
|
|
contextWindowSize,
|
|
}: {
|
|
promptTokenCount: number;
|
|
terminalWidth: number;
|
|
contextWindowSize: number;
|
|
}) => {
|
|
if (promptTokenCount === 0) {
|
|
return null;
|
|
}
|
|
|
|
const percentage = promptTokenCount / contextWindowSize;
|
|
const percentageUsed = (percentage * 100).toFixed(1);
|
|
|
|
const label = terminalWidth < 100 ? '% used' : '% context used';
|
|
|
|
return (
|
|
<Text color={theme.text.secondary}>
|
|
{percentageUsed}
|
|
{label}
|
|
</Text>
|
|
);
|
|
};
|