diff --git a/src/Chat.tsx b/src/Chat.tsx index 952de3b..d392a38 100644 --- a/src/Chat.tsx +++ b/src/Chat.tsx @@ -11,7 +11,7 @@ import { useHotkeys } from 'reakeys'; import { cn, useComponentTheme } from 'reablocks'; import { Session } from './types'; import { ChatTheme, chatTheme } from './theme'; -import { ChatContext } from './ChatContext'; +import { ChatContext, ChatViewType } from './ChatContext'; import { PluggableList } from 'react-markdown/lib'; import { AnimatePresence } from 'framer-motion'; import { useDimensions } from './utils/useDimensions'; @@ -28,11 +28,13 @@ export interface ChatProps extends PropsWithChildren { className?: string; /** - * The type of prompt to display. Companion prompts are smaller and are - * meant to be displayed alongside other content. Full prompts are larger - * and are meant to be displayed on their own. + * The type of prompt to display. + * + * - Companion: Smaller prompt screen with session lists. + * - Console: Full screen experience. + * - Chat: Only chat, no sessions. */ - viewType?: 'companion' | 'console'; + viewType?: ChatViewType; /** * The list of sessions to display. @@ -172,6 +174,7 @@ export const Chat: FC = ({ disabled, isLoading, isCompact, + viewType, activeSessionId: internalActiveSessionID, selectSession: handleSelectSession, deleteSession: handleDeleteSession, @@ -183,6 +186,7 @@ export const Chat: FC = ({ [ isLoading, isCompact, + viewType, disabled, theme, remarkPlugins, diff --git a/src/ChatContext.ts b/src/ChatContext.ts index d66bffd..aadca37 100644 --- a/src/ChatContext.ts +++ b/src/ChatContext.ts @@ -3,6 +3,8 @@ import { Session } from './types'; import { ChatTheme } from './theme'; import { PluggableList } from 'react-markdown/lib'; +export type ChatViewType = 'chat' | 'companion' | 'console'; + export interface ChatContextProps { sessions: Session[]; disabled?: boolean; @@ -10,6 +12,7 @@ export interface ChatContextProps { theme?: ChatTheme; isLoading?: boolean; isCompact?: boolean; + viewType?: ChatViewType; activeSession?: Session | null; remarkPlugins?: PluggableList[]; selectSession?: (sessionId: string) => void; diff --git a/src/SessionMessages/SessionMessagePanel.tsx b/src/SessionMessages/SessionMessagePanel.tsx index 28c7f18..742d282 100644 --- a/src/SessionMessages/SessionMessagePanel.tsx +++ b/src/SessionMessages/SessionMessagePanel.tsx @@ -5,12 +5,12 @@ import { motion } from 'framer-motion'; import BackIcon from '@/assets/back.svg?react'; export const SessionMessagePanel: FC = ({ children }) => { - const { activeSessionId, theme, isCompact, selectSession } = + const { activeSessionId, theme, isCompact, selectSession, viewType } = useContext(ChatContext); - const isVisible = isCompact && activeSessionId; + const isVisible = (isCompact && activeSessionId) || viewType === 'chat' || !isCompact; return ( - (!isCompact || isVisible) && ( + isVisible && ( = ({ children }) => { })} >
- {isCompact && ( + {(isCompact && viewType !== 'chat') && (
+ ); +};