Files
gemini-cli/packages/cli/src/ui/components/messages/GeminiMessage.tsx
T

41 lines
920 B
TypeScript
Raw Normal View History

/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
2025-04-15 21:41:08 -07:00
import React from 'react';
import { Text, Box } from 'ink';
import { MarkdownDisplay } from '../../utils/MarkdownDisplay.js';
2025-04-19 12:38:09 -04:00
import { Colors } from '../../colors.js';
2025-04-15 21:41:08 -07:00
interface GeminiMessageProps {
2025-04-17 18:06:21 -04:00
text: string;
isPending: boolean;
availableTerminalHeight: number;
2025-04-15 21:41:08 -07:00
}
export const GeminiMessage: React.FC<GeminiMessageProps> = ({
text,
isPending,
availableTerminalHeight,
}) => {
2025-04-17 18:06:21 -04:00
const prefix = '✦ ';
const prefixWidth = prefix.length;
return (
<Box flexDirection="row">
2025-04-22 07:48:12 -04:00
<Box width={prefixWidth}>
<Text color={Colors.AccentPurple}>{prefix}</Text>
</Box>
2025-04-17 18:06:21 -04:00
<Box flexGrow={1} flexDirection="column">
<MarkdownDisplay
text={text}
isPending={isPending}
availableTerminalHeight={availableTerminalHeight}
/>
2025-04-17 18:06:21 -04:00
</Box>
</Box>
);
2025-04-15 21:41:08 -07:00
};