mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 20:50:34 +00:00
refactor: improve config consistency and token limits
- Remove legacy childKey field from settingsSchema - Add contextWindowSize and maxOutputTokens to documentation - Refactor ContextUsageDisplay to accept contextWindowSize directly instead of Config object - Add useMemo optimization for contextWindowSize in Footer component - Fix logic gaps in contentGenerator for contextWindowSize and maxOutputTokens initialization - Increase DEFAULT_OUTPUT_TOKEN_LIMIT from 4K to 8K for better usability - Add fallback to default values when model is not available
This commit is contained in:
parent
25a1bbad45
commit
f9db8d5a73
5 changed files with 64 additions and 45 deletions
|
|
@ -6,26 +6,22 @@
|
|||
|
||||
import { Text } from 'ink';
|
||||
import { theme } from '../semantic-colors.js';
|
||||
import { DEFAULT_TOKEN_LIMIT, type Config } from '@qwen-code/qwen-code-core';
|
||||
import { DEFAULT_TOKEN_LIMIT } from '@qwen-code/qwen-code-core';
|
||||
|
||||
export const ContextUsageDisplay = ({
|
||||
promptTokenCount,
|
||||
model: _model,
|
||||
terminalWidth,
|
||||
config,
|
||||
contextWindowSize,
|
||||
}: {
|
||||
promptTokenCount: number;
|
||||
model: string;
|
||||
terminalWidth: number;
|
||||
config: Config;
|
||||
contextWindowSize?: number;
|
||||
}) => {
|
||||
if (promptTokenCount === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const contextLimit =
|
||||
config.getContentGeneratorConfig()?.contextWindowSize ??
|
||||
DEFAULT_TOKEN_LIMIT;
|
||||
const contextLimit = contextWindowSize ?? DEFAULT_TOKEN_LIMIT;
|
||||
const percentage = promptTokenCount / contextLimit;
|
||||
const percentageUsed = (percentage * 100).toFixed(1);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue