diff --git a/gui/src/components/StepContainer/StepContainer.tsx b/gui/src/components/StepContainer/StepContainer.tsx index a497a0b22..6fb460391 100644 --- a/gui/src/components/StepContainer/StepContainer.tsx +++ b/gui/src/components/StepContainer/StepContainer.tsx @@ -10,6 +10,7 @@ import ResponseActions from "./ResponseActions"; import { useAppSelector } from "../../redux/hooks"; import { selectUIConfig } from "../../redux/slices/configSlice"; import { deleteMessage } from "../../redux/slices/sessionSlice"; +import ThinkingIndicator from "./ThinkingIndicator"; interface StepContainerProps { item: ChatHistoryItem; @@ -95,8 +96,11 @@ export default function StepContainer(props: StepContainerProps) { itemIndex={props.index} /> )} + {props.isLast && ( + + )} - {/* We want to occupy space in the DOM regardless of whether the actions are visible to avoid jank on */} + {/* We want to occupy space in the DOM regardless of whether the actions are visible to avoid jank on stream complete */}
{!shouldHideActions && ( { + // Animation for thinking ellipses + const [animation, setAnimation] = useState(2); + useEffect(() => { + const interval = setInterval(() => { + setAnimation((prevState) => (prevState === 2 ? 0 : prevState + 1)); + }, 600); + return () => { + clearInterval(interval); + }; + }, []); + + const selectedModel = useAppSelector(selectDefaultModel); + const isStreaming = useAppSelector((state) => state.session.isStreaming); + + const hasContent = Array.isArray(messageContent) + ? !!messageContent.length + : !!messageContent; + const isO1 = selectedModel?.model.startsWith("o1"); + const isThinking = isStreaming && !hasContent; + if (!isThinking || !isO1) { + return null; + } + + return ( +
+ {`Thinking.${".".repeat(animation)}`} +
+ ); +}; + +export default ThinkingIndicator;