Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import type { ChatContext } from '@/stores/panel'
interface MothershipChatProps {
messages: ChatMessage[]
isSending: boolean
isReconnecting?: boolean
onSubmit: (
text: string,
fileAttachments?: FileAttachmentForApi[],
Expand Down Expand Up @@ -71,6 +72,7 @@ const LAYOUT_STYLES = {
export function MothershipChat({
messages,
isSending,
isReconnecting = false,
onSubmit,
onStopGeneration,
messageQueue,
Expand All @@ -88,7 +90,8 @@ export function MothershipChat({
className,
}: MothershipChatProps) {
const styles = LAYOUT_STYLES[layout]
const { ref: scrollContainerRef, scrollToBottom } = useAutoScroll(isSending)
const isStreamActive = isSending || isReconnecting
const { ref: scrollContainerRef, scrollToBottom } = useAutoScroll(isStreamActive)
const hasMessages = messages.length > 0
const initialScrollDoneRef = useRef(false)

Expand Down Expand Up @@ -131,7 +134,7 @@ export function MothershipChat({
msg.content ?? ''
)
const isLastAssistant = index === messages.length - 1
const isThisStreaming = isSending && isLastAssistant
const isThisStreaming = isStreamActive && isLastAssistant

if (!hasAnyBlocks && !msg.content?.trim() && isThisStreaming) {
return <PendingTagIndicator key={msg.id} />
Expand Down Expand Up @@ -175,7 +178,7 @@ export function MothershipChat({
/>
<UserInput
onSubmit={onSubmit}
isSending={isSending}
isSending={isStreamActive}
onStopGeneration={onStopGeneration}
isInitialView={false}
userId={userId}
Expand Down
2 changes: 2 additions & 0 deletions apps/sim/app/workspace/[workspaceId]/home/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export function Home({ chatId }: HomeProps = {}) {
const {
messages,
isSending,
isReconnecting,
sendMessage,
stopGeneration,
resolvedChatId,
Expand Down Expand Up @@ -335,6 +336,7 @@ export function Home({ chatId }: HomeProps = {}) {
<MothershipChat
messages={messages}
isSending={isSending}
isReconnecting={isReconnecting}
onSubmit={handleSubmit}
onStopGeneration={stopGeneration}
messageQueue={messageQueue}
Expand Down
Loading
Loading