mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-29 12:11:09 +00:00
When a plan is rejected, preserve and display the plan content so users can still see what was proposed. The rejection message is now shown in yellow (AccentYellow) instead of green to visually indicate the rejected state. Changes: - Add 'rejected' flag to PlanResultDisplay interface - Update PlanSummaryDisplay to conditionally color message based on rejection - Preserve plan content in coreToolScheduler when plan is cancelled - Add tests for both rejected and approved plan rendering Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
42 lines
1 KiB
TypeScript
42 lines
1 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Qwen
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import type React from 'react';
|
|
import { Box, Text } from 'ink';
|
|
import { MarkdownDisplay } from '../utils/MarkdownDisplay.js';
|
|
import { Colors } from '../colors.js';
|
|
import type { PlanResultDisplay } from '@qwen-code/qwen-code-core';
|
|
|
|
interface PlanSummaryDisplayProps {
|
|
data: PlanResultDisplay;
|
|
availableHeight?: number;
|
|
childWidth: number;
|
|
}
|
|
|
|
export const PlanSummaryDisplay: React.FC<PlanSummaryDisplayProps> = ({
|
|
data,
|
|
availableHeight,
|
|
childWidth,
|
|
}) => {
|
|
const { message, plan, rejected } = data;
|
|
const messageColor = rejected ? Colors.AccentYellow : Colors.AccentGreen;
|
|
|
|
return (
|
|
<Box flexDirection="column">
|
|
<Box marginBottom={1}>
|
|
<Text color={messageColor} wrap="wrap">
|
|
{message}
|
|
</Text>
|
|
</Box>
|
|
<MarkdownDisplay
|
|
text={plan}
|
|
isPending={false}
|
|
availableTerminalHeight={availableHeight}
|
|
contentWidth={childWidth}
|
|
/>
|
|
</Box>
|
|
);
|
|
};
|