Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x | // Libs
import { InputProps } from '@copilotkit/react-ui';
import { useCopilotMessagesContext } from '@copilotkit/react-core';
import { MessageRole } from '@copilotkit/runtime-client-gql';
// Components
import StopGenerate from './StopGenerate';
import { CustomInput } from './CustomInput';
import { CopilotSuggestions } from './CopilotSuggestions';
export const InputContainer = (props: InputProps) => {
const { inProgress } = props;
const { messages } = useCopilotMessagesContext();
const hasUserMessage = messages.some(
(msg) => msg.isTextMessage() && msg.role === MessageRole.User,
);
const shouldShowSuggestions = !inProgress && !hasUserMessage;
return (
<div className="flex flex-col gap-3 dark:bg-gray-800">
{shouldShowSuggestions && <CopilotSuggestions />}
{/* Stop generating button */}
{inProgress && <StopGenerate />}
<CustomInput {...props} />
</div>
);
};
|