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

44 lines
1009 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-08-15 15:39:54 -07:00
import { theme } from '../../semantic-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;
terminalWidth: number;
2025-04-15 21:41:08 -07:00
}
export const GeminiMessage: React.FC<GeminiMessageProps> = ({
text,
isPending,
availableTerminalHeight,
terminalWidth,
}) => {
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}>
2025-08-15 15:39:54 -07:00
<Text color={theme.text.accent}>{prefix}</Text>
2025-04-22 07:48:12 -04:00
</Box>
2025-04-17 18:06:21 -04:00
<Box flexGrow={1} flexDirection="column">
<MarkdownDisplay
text={text}
isPending={isPending}
availableTerminalHeight={availableTerminalHeight}
terminalWidth={terminalWidth}
/>
2025-04-17 18:06:21 -04:00
</Box>
</Box>
);
2025-04-15 21:41:08 -07:00
};