+
diff --git a/gui/src/components/mainInput/Lump/LumpToolbar/StreamingToolbar.tsx b/gui/src/components/mainInput/Lump/LumpToolbar/StreamingToolbar.tsx
index 83ba508dc..7ce24d9cf 100644
--- a/gui/src/components/mainInput/Lump/LumpToolbar/StreamingToolbar.tsx
+++ b/gui/src/components/mainInput/Lump/LumpToolbar/StreamingToolbar.tsx
@@ -1,15 +1,25 @@
import { useAppDispatch } from "../../../../redux/hooks";
import { cancelStream } from "../../../../redux/thunks/cancelStream";
-import { CancelButton } from "./CancelButton";
+import { getAltKeyLabel, getMetaKeyLabel, isJetBrains } from "../../../../util";
import { GeneratingIndicator } from "./GeneratingIndicator";
export function StreamingToolbar() {
+ const jetbrains = isJetBrains();
const dispatch = useAppDispatch();
return (
-
void dispatch(cancelStream())} />
+ void dispatch(cancelStream())}
+ className="text-2xs cursor-pointer px-1.5 py-0.5 hover:brightness-125"
+ >
+ Pause
+ {/* JetBrains overrides cmd+backspace, so we have to use another shortcut */}
+
+ {jetbrains ? getAltKeyLabel() : getMetaKeyLabel()}⌫
+
+
);
}
diff --git a/gui/src/components/ui/Button.tsx b/gui/src/components/ui/Button.tsx
index 09ff269bf..608b8d774 100644
--- a/gui/src/components/ui/Button.tsx
+++ b/gui/src/components/ui/Button.tsx
@@ -15,9 +15,9 @@ const buttonVariants = {
secondary:
"border-none text-foreground bg-border hover:enabled:brightness-125",
outline:
- "border border-solid border-badge border-border text-foreground bg-transparent hover:enabled:bg-input",
+ "border border-solid border-badge border-border text-foreground bg-transparent hover:enabled:bg-input",
ghost:
- "border-none text-foreground bg-gray-500/40 hover:enabled:brightness-125",
+ "border-none text-foreground bg-inherit hover:enabled:brightness-125 hover:enabled:bg-input",
};
const buttonSizes = {
diff --git a/gui/src/pages/gui/ToolCallDiv/GroupedToolCallHeader.tsx b/gui/src/pages/gui/ToolCallDiv/GroupedToolCallHeader.tsx
new file mode 100644
index 000000000..e3e8ffdca
--- /dev/null
+++ b/gui/src/pages/gui/ToolCallDiv/GroupedToolCallHeader.tsx
@@ -0,0 +1,37 @@
+import { FolderIcon } from "@heroicons/react/24/outline";
+import { ToolCallState } from "core";
+import { ToggleWithIcon } from "./ToggleWithIcon";
+import { getGroupActionVerb } from "./utils";
+
+interface GroupedToolCallHeaderProps {
+ toolCallStates: ToolCallState[];
+ activeCalls: ToolCallState[];
+ open: boolean;
+ onToggle: () => void;
+}
+
+export function GroupedToolCallHeader({
+ toolCallStates,
+ activeCalls,
+ open,
+ onToggle,
+}: GroupedToolCallHeaderProps) {
+ return (
+
+
+
+ {getGroupActionVerb(toolCallStates)} {activeCalls.length}{" "}
+ {activeCalls.length === 1 ? "action" : "actions"}
+
+
+ );
+}
diff --git a/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx b/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx
index f35c43051..8ada08e53 100644
--- a/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx
+++ b/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx
@@ -1,4 +1,3 @@
-import { ChevronRightIcon } from "@heroicons/react/24/outline";
import { Tool, ToolCallState } from "core";
import { ComponentType, useContext, useMemo, useState } from "react";
import {
@@ -6,6 +5,7 @@ import {
openContextItem,
} from "../../../components/mainInput/belowMainInput/ContextItemsPeek";
import { IdeMessengerContext } from "../../../context/IdeMessenger";
+import { ToggleWithIcon } from "./ToggleWithIcon";
import { ArgsItems, ArgsToggleIcon } from "./ToolCallArgs";
import { ToolCallStatusMessage } from "./ToolCallStatusMessage";
import { ToolTruncateHistoryIcon } from "./ToolTruncateHistoryIcon";
@@ -31,7 +31,6 @@ export function SimpleToolCallUI({
}, [toolCallState]);
const [open, setOpen] = useState(false);
- const [isHovered, setIsHovered] = useState(false);
const [showingArgs, setShowingArgs] = useState(false);
const args: [string, any][] = useMemo(() => {
@@ -51,25 +50,16 @@ export function SimpleToolCallUI({
}
}
- function renderIcon() {
- if (!Icon && !isToggleable) {
- return null;
- }
-
+ function handleToggleClick() {
if (isToggleable) {
- const showChevron = isHovered || shouldShowContent;
- return showChevron ? (
-
- ) : (
- Icon &&
- );
+ setOpen((prev) => !prev);
}
+ }
- return Icon ?
: null;
+ function handleIconClick() {
+ if (isSingleItem) {
+ openContextItem(shownContextItems[0], ideMessenger);
+ }
}
return (
@@ -80,13 +70,15 @@ export function SimpleToolCallUI({
isClickable ? "cursor-pointer hover:brightness-125" : ""
}`}
onClick={isClickable ? handleClick : undefined}
- onMouseEnter={isToggleable ? () => setIsHovered(true) : undefined}
- onMouseLeave={isToggleable ? () => setIsHovered(false) : undefined}
data-testid="context-items-peek"
>
-
- {renderIcon()}
-
+
diff --git a/gui/src/pages/gui/ToolCallDiv/ToggleWithIcon.tsx b/gui/src/pages/gui/ToolCallDiv/ToggleWithIcon.tsx
new file mode 100644
index 000000000..27862065f
--- /dev/null
+++ b/gui/src/pages/gui/ToolCallDiv/ToggleWithIcon.tsx
@@ -0,0 +1,58 @@
+import { ChevronRightIcon } from "@heroicons/react/24/outline";
+import { ComponentType, useState } from "react";
+
+interface ToggleWithIconProps {
+ icon?: ComponentType
>;
+ isToggleable?: boolean;
+ open?: boolean;
+ onClick?: () => void;
+ className?: string;
+ isClickable?: boolean;
+}
+
+export function ToggleWithIcon({
+ icon: Icon,
+ isToggleable = false,
+ open = false,
+ onClick,
+ className = "",
+ isClickable = false,
+}: ToggleWithIconProps) {
+ const [isHovered, setIsHovered] = useState(false);
+ const showChevron = isToggleable && (isHovered || open);
+
+ function handleClick() {
+ if ((isToggleable || isClickable) && onClick) {
+ onClick();
+ }
+ }
+
+ function renderIcon() {
+ if (!Icon && !isToggleable) {
+ return null;
+ }
+
+ if (showChevron) {
+ return (
+
+ );
+ }
+
+ return Icon ? : null;
+ }
+
+ return (
+ setIsHovered(true) : undefined}
+ onMouseLeave={isToggleable ? () => setIsHovered(false) : undefined}
+ >
+ {renderIcon()}
+
+ );
+}
diff --git a/gui/src/pages/gui/ToolCallDiv/index.tsx b/gui/src/pages/gui/ToolCallDiv/index.tsx
index e9c725dbd..faa6bca1f 100644
--- a/gui/src/pages/gui/ToolCallDiv/index.tsx
+++ b/gui/src/pages/gui/ToolCallDiv/index.tsx
@@ -1,15 +1,12 @@
-import {
- ArrowRightIcon,
- ChevronRightIcon,
- FolderIcon,
-} from "@heroicons/react/24/outline";
+import { ArrowRightIcon } from "@heroicons/react/24/outline";
import { ToolCallState } from "core";
import { useState } from "react";
import { useAppSelector } from "../../../redux/hooks";
import FunctionSpecificToolCallDiv from "./FunctionSpecificToolCallDiv";
+import { GroupedToolCallHeader } from "./GroupedToolCallHeader";
import { SimpleToolCallUI } from "./SimpleToolCallUI";
import { ToolCallDisplay } from "./ToolCall";
-import { getGroupActionVerb, getStatusIcon, toolCallIcons } from "./utils";
+import { getStatusIcon, toolCallIcons } from "./utils";
interface ToolCallDivProps {
toolCallStates: ToolCallState[];
@@ -21,85 +18,70 @@ export function ToolCallDiv({
historyIndex,
}: ToolCallDivProps) {
const [open, setOpen] = useState(true);
- const [isHovered, setIsHovered] = useState(false);
const availableTools = useAppSelector((state) => state.config.config.tools);
- if (!toolCallStates || toolCallStates.length === 0) return null;
+ if (!toolCallStates?.length) return null;
- const validToolCalls = toolCallStates.map((state) => state.toolCall);
+ const isStreamingComplete = toolCallStates.every(
+ (toolCall) => toolCall.status !== "generating",
+ );
- if (validToolCalls.length > 1) {
- const showChevron = isHovered || open;
+ const shouldShowGroupedUI = toolCallStates.length > 1 && isStreamingComplete;
+ const activeCalls = toolCallStates.filter(
+ (call) => call.status !== "canceled",
+ );
+
+ const renderToolCall = (toolCallState: ToolCallState) => {
+ const tool = availableTools.find(
+ (tool) => toolCallState.toolCall.function?.name === tool.function.name,
+ );
+ const functionName = toolCallState.toolCall.function?.name;
+ const icon = functionName && toolCallIcons[functionName];
+
+ if (icon) {
+ return (
+
+ );
+ }
return (
-
-
setOpen((prev) => !prev)}
- onMouseEnter={() => setIsHovered(true)}
- onMouseLeave={() => setIsHovered(false)}
- >
-
- {showChevron ? (
-
- ) : (
-
- )}
-
- {getGroupActionVerb(toolCallStates)} {validToolCalls.length} actions
-
+
+
+
+ );
+ };
+
+ if (shouldShowGroupedUI) {
+ return (
+
+
setOpen(!open)}
+ />
{toolCallStates.map((toolCallState) => (
- {(() => {
- const tool = availableTools.find(
- (tool) =>
- toolCallState.toolCall.function?.name ===
- tool.function.name,
- );
- const icon =
- toolCallState.toolCall.function?.name &&
- toolCallIcons[toolCallState.toolCall.function.name];
-
- if (icon) {
- return (
-
- );
- }
-
- return (
-
-
-
- );
- })()}
+ {renderToolCall(toolCallState)}
))}
@@ -107,48 +89,14 @@ export function ToolCallDiv({
);
}
-
return (
-
+
{toolCallStates.map((toolCallState) => (
-
- {(() => {
- const tool = availableTools.find(
- (tool) =>
- toolCallState.toolCall.function?.name === tool.function.name,
- );
- const icon =
- toolCallState.toolCall.function?.name &&
- toolCallIcons[toolCallState.toolCall.function.name];
-
- if (icon) {
- return (
-
- );
- }
-
- return (
-
-
-
- );
- })()}
+
+ {renderToolCall(toolCallState)}
))}
diff --git a/gui/src/pages/gui/ToolCallDiv/utils.tsx b/gui/src/pages/gui/ToolCallDiv/utils.tsx
index 07a133bdb..c85d12d40 100644
--- a/gui/src/pages/gui/ToolCallDiv/utils.tsx
+++ b/gui/src/pages/gui/ToolCallDiv/utils.tsx
@@ -54,15 +54,13 @@ export function getGroupActionVerb(toolCallStates: ToolCallState[]): string {
// Get the most "active" status from all tool calls
const statuses = toolCallStates.map((state) => state.status);
- console.log({ statuses });
-
// Priority order: calling > generating > generated > done > errored/canceled
if (statuses.includes("calling")) {
return "Performing";
} else if (statuses.includes("generating")) {
return "Generating";
} else if (statuses.includes("generated")) {
- return "Will perform";
+ return "Pending";
} else if (statuses.some((s) => s === "done")) {
return "Performed";
} else if (statuses.some((s) => s === "errored" || s === "canceled")) {
@@ -84,9 +82,6 @@ export const toolCallIcons: Record
= {
[BuiltInToolNames.ViewRepoMap]: MapIcon,
[BuiltInToolNames.ViewSubdirectory]: FolderOpenIcon,
[BuiltInToolNames.CreateRuleBlock]: PencilIcon,
- // EditExistingFile
- // CreateNewFile
- // RunTerminalCommand
};
export function getStatusIcon(state: ToolStatus) {
@@ -97,10 +92,10 @@ export function getStatusIcon(state: ToolStatus) {
case "generated":
return ;
case "done":
- return ;
+ return ;
case "canceled":
case "errored":
- return ;
+ return ;
}
}
diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts
index 00c0e1ed6..31086d51f 100644
--- a/gui/src/redux/slices/sessionSlice.ts
+++ b/gui/src/redux/slices/sessionSlice.ts
@@ -414,7 +414,6 @@ export const sessionSlice = createSlice({
}
},
setInactive: (state) => {
- debugger;
const curMessage = state.history.at(-1);
if (curMessage) {