2025-04-18 17:44:24 -07:00
|
|
|
/**
|
|
|
|
|
* @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';
|
2025-05-15 00:36:08 -07:00
|
|
|
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;
|
2025-05-15 22:56:03 -07:00
|
|
|
isPending: boolean;
|
|
|
|
|
availableTerminalHeight: number;
|
2025-04-15 21:41:08 -07:00
|
|
|
}
|
|
|
|
|
|
2025-05-15 22:56:03 -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">
|
2025-05-15 22:56:03 -07:00
|
|
|
<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
|
|
|
};
|