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:
xwj02155382 2026-01-26 10:26:44 +08:00
parent 25a1bbad45
commit f9db8d5a73
5 changed files with 64 additions and 45 deletions

View file

@ -5,6 +5,7 @@
*/
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';
@ -57,6 +58,12 @@ 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]
);
// Left section should show exactly ONE thing at any time, in priority order.
const leftContent = uiState.ctrlCPressedOnce ? (
<Text color={theme.status.warning}>{t('Press Ctrl+C again to exit.')}</Text>
@ -95,9 +102,8 @@ export const Footer: React.FC = () => {
<Text color={theme.text.accent}>
<ContextUsageDisplay
promptTokenCount={promptTokenCount}
model={model}
terminalWidth={terminalWidth}
config={config}
contextWindowSize={contextWindowSize}
/>
</Text>
),