mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 04:30:48 +00:00
fix(contextWindowSize): fix context window size update on model switch and ACP agent config priority
- 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>
This commit is contained in:
parent
1c5b74ebd9
commit
d67206819a
9 changed files with 47 additions and 77 deletions
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
import { Text } from 'ink';
|
||||
import { theme } from '../semantic-colors.js';
|
||||
import { DEFAULT_TOKEN_LIMIT } from '@qwen-code/qwen-code-core';
|
||||
|
||||
export const ContextUsageDisplay = ({
|
||||
promptTokenCount,
|
||||
|
|
@ -15,14 +14,13 @@ export const ContextUsageDisplay = ({
|
|||
}: {
|
||||
promptTokenCount: number;
|
||||
terminalWidth: number;
|
||||
contextWindowSize?: number;
|
||||
contextWindowSize: number;
|
||||
}) => {
|
||||
if (promptTokenCount === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const contextLimit = contextWindowSize ?? DEFAULT_TOKEN_LIMIT;
|
||||
const percentage = promptTokenCount / contextLimit;
|
||||
const percentage = promptTokenCount / contextWindowSize;
|
||||
const percentageUsed = (percentage * 100).toFixed(1);
|
||||
|
||||
const label = terminalWidth < 100 ? '% used' : '% context used';
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
|
||||
import type React from 'react';
|
||||
import { useMemo } from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
import { theme } from '../semantic-colors.js';
|
||||
import { ConsoleSummaryDisplay } from './ConsoleSummaryDisplay.js';
|
||||
|
|
@ -56,11 +55,8 @@ export const Footer: React.FC = () => {
|
|||
// Check if debug mode is enabled
|
||||
const debugMode = config.getDebugMode();
|
||||
|
||||
// Memoize contextWindowSize to avoid recalculating on every render
|
||||
const contextWindowSize = useMemo(
|
||||
() => config.getContentGeneratorConfig()?.contextWindowSize,
|
||||
[config],
|
||||
);
|
||||
const contextWindowSize =
|
||||
config.getContentGeneratorConfig()?.contextWindowSize;
|
||||
|
||||
// Left section should show exactly ONE thing at any time, in priority order.
|
||||
const leftContent = uiState.ctrlCPressedOnce ? (
|
||||
|
|
@ -93,7 +89,7 @@ export const Footer: React.FC = () => {
|
|||
node: <Text color={theme.status.warning}>Debug Mode</Text>,
|
||||
});
|
||||
}
|
||||
if (promptTokenCount > 0) {
|
||||
if (promptTokenCount > 0 && contextWindowSize) {
|
||||
rightItems.push({
|
||||
key: 'context',
|
||||
node: (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue