In my message container code, do you have any idea wehre the message box with a border…
- User
In my message container code, do you have any idea wehre the message box with a border is specified? import { Transition } from '@headlessui/react'; import { usePrevious, useTimeoutEffect } from '@react-hookz/web'; import React, { ReactNode, forwardRef, memo, useEffect, useMemo, useState } from 'react'; import ScrollToBottom, { useScrollToBottom, useSticky } from 'react-scroll-to-bottom';
import { CitationPanel } from '@/components/Citations/CitationPanel'; import MessageRow from '@/components/MessageRow'; import { Button } from '@/components/Shared'; import { PromptOption, StartModes } from '@/components/StartModes'; import { ReservedClasses } from '@/constants'; import { MESSAGE_LIST_CONTAINER_ID, useCalculateCitationStyles } from '@/hooks/citations'; import { useFixCopyBug } from '@/hooks/fixCopyBug'; import { useCitationsStore } from '@/stores'; import { ChatMessage, MessageType, StreamingMessage, isFulfilledMessage } from '@/types/message'; import { cn } from '@/utils';
type Props = { isStreaming: boolean; startOptionsEnabled: boolean; messages: ChatMessage[]; streamingMessage: StreamingMessage | null; onRetry: VoidFunction; composer: ReactNode; conversationId?: string; scrollViewClassName?: string; onPromptSelected?: (option: PromptOption) => void; };
/**
- This component is in charge of rendering anything in the main scrollable view.
- This includes all of the message, the RAG citations, and the composer (which is sticky at the bottom).
*/
const MessagingContainer: React.FC = (props) => {
const { scrollViewClassName = '', ...rest } = props;
return (
<ScrollToBottom
initialScrollBehavior="auto"
className={cn(ReservedClasses.MESSAGES, 'relative flex h-0 flex-grow flex-col')}
scrollViewClassName={cn(
'md:!h-full !h-fit',
'flex relative mt-auto overflow-x-hidden',
scrollViewClassName
)}
followButtonClassName="hidden"
debounce={100}
<Content {...rest} /> ); }; export default memo(MessagingContainer);
/**
- This component lays out the messages, citations, and composer.
- In order to access the state hooks for the scroll to bottom component, we need to wrap the content in a component. */ const Content: React.FC = (props) => { const { isStreaming, messages, composer, streamingMessage, onPromptSelected } = props; const scrollToBottom = useScrollToBottom(); const { citations: { hasCitations }, } = useCitationsStore();
useFixCopyBug(); const [isAtBottom] = useSticky(); const prevIsStreaming = usePrevious(isStreaming);
// Wait some time before being able to fetch previous messages // This is to prevent loading a bunch of messages on first load const [isReadyToFetchPreviousMessages, setIsReadyToFetchPreviousMessages] = useState(false); useTimeoutEffect(() => { setIsReadyToFetchPreviousMessages(true); }, 1000);
// Show the
New Messagebutton if the user has scrolled up // and the last message is a bot message. // This reruns when isAtBottom or isStreaming changes only since // these are the only times users may miss the newest message. const showNewMessageButton = useMemo(() => { // Whether the user is at the bottom of the messages container if (isAtBottom) return false; // When isStreaming changes this means that the bot has sent a new message // or is in the process of sending a new message if (prevIsStreaming === isStreaming) return false; if (!streamingMessage) return false; return true; }, [isAtBottom, isStreaming]); - Assistant
- User
I thought so too but that is incorrect.
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.