Skip to content
Open
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

# next.js
/.next/
/.next-dev/
.next-dev/
/out/

# production
Expand Down
23 changes: 22 additions & 1 deletion components/ChatWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { countToolCallBlocks, getAssistantErrorMessage, getDisplayableAssistantB
import { MessageView } from "./MessageView";
import { ChatInput, type ChatInputHandle } from "./ChatInput";
import { ChatMinimap, useMessageRefs } from "./ChatMinimap";
import { ScrollToolbar } from "./ScrollToolbar";
import { ExtensionStatusBar } from "./ExtensionStatusBar";
import { useI18n } from "@/hooks/useI18n";
import { useAgentSession, type AgentPhase, type NoticeItem } from "@/hooks/useAgentSession";
Expand Down Expand Up @@ -196,6 +197,9 @@ export function ChatWindow({ session, newSessionCwd, onAgentEnd, onSessionCreate
chatInputRef?.current?.insertIfEmpty(content);
}, [chatInputRef]);

// Follow-streaming toggle (long-press on the 'latest' scroll button).
const followStreamingRef = useRef<boolean>(false);

const {
loading, error, messages, entryIds, streamState,
agentRunning, bashRunning, pendingBash, modelNames, modelList, modelError, modelScopeWarnings, modelThinkingLevels, modelThinkingLevelMaps, toolPreset, thinkingLevel,
Expand All @@ -216,6 +220,7 @@ export function ChatWindow({ session, newSessionCwd, onAgentEnd, onSessionCreate
} = useAgentSession({
session, newSessionCwd, onAgentEnd: wrappedOnAgentEnd, onSessionCreated, onSessionForked,
modelsRefreshKey, chatInputRef, onBranchDataChange, onSystemPromptChange, onSessionStatsPanelOpen,
followStreamingRef,
});
const sessionBusy = agentRunning || bashRunning;

Expand Down Expand Up @@ -720,13 +725,29 @@ export function ChatWindow({ session, newSessionCwd, onAgentEnd, onSessionCreate
)}

{agentRunning && (
<div style={{ height: scrollContainerRef.current ? scrollContainerRef.current.clientHeight : "80vh" }} />
/* Room below the last message while the agent runs so the
follow-step can land the last message at the top 1/4 of the
viewport with 3/4 of blank space below for the output to
grow. (Was a full viewport, then 96px — both broke the step's
landing.) */
<div style={{ height: scrollContainerRef.current ? scrollContainerRef.current.clientHeight * 0.75 : "60vh" }} />
)}

<div ref={messagesEndRef} />
</div>
</div>
</div>
<ScrollToolbar
scrollContainerRef={scrollContainerRef}
messagesEndRef={messagesEndRef}
messageRefs={messageRefs}
visibleMessages={visibleMessages}
messagesLength={messages.length}
agentRunning={agentRunning}
isMobile={isMobile}
setVisibleCount={setVisibleCount}
followStreamingRef={followStreamingRef}
/>
{isMobile ? null : (
<ChatMinimap
messages={messages}
Expand Down
Loading