mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-05 15:31:27 +00:00
Merge branch 'main' into feat/token_display
This commit is contained in:
commit
b66b390d55
195 changed files with 23765 additions and 2508 deletions
|
|
@ -103,7 +103,7 @@ const RenderInlineInternal: React.FC<RenderInlineProps> = ({
|
|||
const codeMatch = fullMatch.match(/^(`+)(.+?)\1$/s);
|
||||
if (codeMatch && codeMatch[2]) {
|
||||
renderedNode = (
|
||||
<Text key={key} color={theme.text.accent}>
|
||||
<Text key={key} color={theme.text.code}>
|
||||
{codeMatch[2]}
|
||||
</Text>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,34 @@
|
|||
*/
|
||||
|
||||
import { theme } from '../semantic-colors.js';
|
||||
import { AgentStatus } from '@qwen-code/qwen-code-core';
|
||||
|
||||
// --- Status Labels ---
|
||||
|
||||
export interface StatusLabel {
|
||||
icon: string;
|
||||
text: string;
|
||||
color: string;
|
||||
}
|
||||
|
||||
export function getArenaStatusLabel(status: AgentStatus): StatusLabel {
|
||||
switch (status) {
|
||||
case AgentStatus.IDLE:
|
||||
return { icon: '✓', text: 'Idle', color: theme.status.success };
|
||||
case AgentStatus.COMPLETED:
|
||||
return { icon: '✓', text: 'Done', color: theme.status.success };
|
||||
case AgentStatus.CANCELLED:
|
||||
return { icon: '⊘', text: 'Cancelled', color: theme.status.warning };
|
||||
case AgentStatus.FAILED:
|
||||
return { icon: '✗', text: 'Failed', color: theme.status.error };
|
||||
case AgentStatus.RUNNING:
|
||||
return { icon: '○', text: 'Running', color: theme.text.secondary };
|
||||
case AgentStatus.INITIALIZING:
|
||||
return { icon: '○', text: 'Initializing', color: theme.text.secondary };
|
||||
default:
|
||||
return { icon: '○', text: status, color: theme.text.secondary };
|
||||
}
|
||||
}
|
||||
|
||||
// --- Thresholds ---
|
||||
export const TOOL_SUCCESS_RATE_HIGH = 95;
|
||||
|
|
|
|||
40
packages/cli/src/ui/utils/layoutUtils.ts
Normal file
40
packages/cli/src/ui/utils/layoutUtils.ts
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2025 Qwen Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Shared layout calculation utilities for the terminal UI.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Calculate the widths for the input prompt area based on terminal width.
|
||||
*
|
||||
* Returns the content width (for the text buffer), the total container width
|
||||
* (including border + padding + prefix), the suggestions dropdown width,
|
||||
* and the frame overhead constant.
|
||||
*/
|
||||
export const calculatePromptWidths = (terminalWidth: number) => {
|
||||
const widthFraction = 0.9;
|
||||
const FRAME_PADDING_AND_BORDER = 4; // Border (2) + padding (2)
|
||||
const PROMPT_PREFIX_WIDTH = 2; // '> ' or '! '
|
||||
const MIN_CONTENT_WIDTH = 2;
|
||||
|
||||
const innerContentWidth =
|
||||
Math.floor(terminalWidth * widthFraction) -
|
||||
FRAME_PADDING_AND_BORDER -
|
||||
PROMPT_PREFIX_WIDTH;
|
||||
|
||||
const inputWidth = Math.max(MIN_CONTENT_WIDTH, innerContentWidth);
|
||||
const FRAME_OVERHEAD = FRAME_PADDING_AND_BORDER + PROMPT_PREFIX_WIDTH;
|
||||
const containerWidth = inputWidth + FRAME_OVERHEAD;
|
||||
const suggestionsWidth = Math.max(20, Math.floor(terminalWidth * 1.0));
|
||||
|
||||
return {
|
||||
inputWidth,
|
||||
containerWidth,
|
||||
suggestionsWidth,
|
||||
frameOverhead: FRAME_OVERHEAD,
|
||||
} as const;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue