import * as React from 'react'; import { AIStateProvider, useInProgress } from '@redhat-cloud-services/ai-react-state'; import { AIChatFooter } from '~/components/AIChat/components/AIChatFooter'; import { AIChatHeader } from '~/components/AIChat/components/AIChatHeader'; import { AIChatMessageList } from '~/components/AIChat/components/AIChatMessageList'; import { AIChatPanel } from '~/components/AIChat/components/AIChatPanel'; import { AIChatToggle } from '~/components/AIChat/components/AIChatToggle'; import { useAIChatInit } from '~/components/AIChat/hooks/useAIChatInit'; import { useAIChatSend } from '~/components/AIChat/hooks/useAIChatSend'; import { getLightspeedClient } from '~/lightspeed/lightspeedClient'; import { useToggle } from '~/shared/hooks/useToggle'; import '@patternfly/chatbot/dist/css/main.css'; import './AIChat.scss'; const AIChatDockContent: React.FC = () => { const [isVisible, toggle] = useToggle(); const { initError, isInitializing, retryInit } = useAIChatInit(); const { sendError, clearSendError, sendMessage } = useAIChatSend(); const isInProgress = useInProgress(); const handleToggle = React.useCallback(() => { if (!isVisible) { clearSendError(); if (initError) { retryInit(); } } toggle(); }, [clearSendError, initError, isVisible, retryInit, toggle]); const chatError = sendError ?? initError; const isSendDisabled = isInProgress || !!initError || isInitializing; return (
{ void sendMessage(message); }} />
); }; /** PatternFly chatbot dock backed by the Red Hat AI state provider. */ const AIChatDock: React.FC = () => ( ); export default AIChatDock;