Rename callCurrentTool to callToolById for clarity
- Renamed function from callCurrentTool to callToolById to better reflect its purpose - Updated function signature to accept toolCallId parameter for parallel tool execution - Renamed file from callCurrentTool.ts to callToolById.ts - Updated all import paths and call sites across codebase - Verified TypeScript compilation passes - All utility function tests still pass (21/21) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
082a73e277
commit
7cb78fe209
4 changed files with 23 additions and 12 deletions
|
|
@ -4,7 +4,7 @@ import { IdeMessengerContext } from "../../../../context/IdeMessenger";
|
|||
import { useAppDispatch, useAppSelector } from "../../../../redux/hooks";
|
||||
import { selectCurrentToolCall } from "../../../../redux/selectors/selectCurrentToolCall";
|
||||
import { cancelToolCall } from "../../../../redux/slices/sessionSlice";
|
||||
import { callCurrentTool } from "../../../../redux/thunks/callCurrentTool";
|
||||
import { callToolById } from "../../../../redux/thunks/callToolById";
|
||||
import { logToolUsage } from "../../../../redux/util";
|
||||
import { isJetBrains } from "../../../../util";
|
||||
import { BlockSettingsTopToolbar } from "./BlockSettingsTopToolbar";
|
||||
|
|
@ -48,7 +48,9 @@ export function LumpToolbar() {
|
|||
if (metaKey && event.key === "Enter") {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
void dispatch(callCurrentTool());
|
||||
void dispatch(
|
||||
callToolById({ toolCallId: toolCallState.toolCallId })
|
||||
);
|
||||
} else if ((jetbrains ? altKey : metaKey) && event.key === "Backspace") {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import styled from "styled-components";
|
|||
import { useAppDispatch, useAppSelector } from "../../../../redux/hooks";
|
||||
import { selectCurrentToolCall } from "../../../../redux/selectors/selectCurrentToolCall";
|
||||
import { cancelToolCall } from "../../../../redux/slices/sessionSlice";
|
||||
import { callCurrentTool } from "../../../../redux/thunks/callCurrentTool";
|
||||
import { callToolById } from "../../../../redux/thunks/callToolById";
|
||||
import {
|
||||
getAltKeyLabel,
|
||||
getFontSize,
|
||||
|
|
@ -58,7 +58,11 @@ export function PendingToolCallToolbar() {
|
|||
<EnterButton
|
||||
isPrimary={true}
|
||||
className="text-description"
|
||||
onClick={() => dispatch(callCurrentTool())}
|
||||
onClick={() =>
|
||||
currentToolCall && dispatch(
|
||||
callToolById({ toolCallId: currentToolCall.toolCallId })
|
||||
)
|
||||
}
|
||||
data-testid="accept-tool-call-button"
|
||||
>
|
||||
{getMetaKeyLabel()} ⏎ Continue
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { ContextItem } from "core";
|
|||
import { CLIENT_TOOLS_IMPLS } from "core/tools/builtIn";
|
||||
import posthog from "posthog-js";
|
||||
import { callClientTool } from "../../util/clientTools/callClientTool";
|
||||
import { selectCurrentToolCall } from "../selectors/selectCurrentToolCall";
|
||||
import { findToolCall } from "../util";
|
||||
import { selectSelectedChatModel } from "../slices/configSlice";
|
||||
import {
|
||||
acceptToolCall,
|
||||
|
|
@ -15,12 +15,17 @@ import { ThunkApiType } from "../store";
|
|||
import { logToolUsage } from "../util";
|
||||
import { streamResponseAfterToolCall } from "./streamResponseAfterToolCall";
|
||||
|
||||
export const callCurrentTool = createAsyncThunk<void, undefined, ThunkApiType>(
|
||||
export const callToolById = createAsyncThunk<
|
||||
void,
|
||||
{ toolCallId: string },
|
||||
ThunkApiType
|
||||
>(
|
||||
"chat/callTool",
|
||||
async (_, { dispatch, extra, getState }) => {
|
||||
async ({ toolCallId }, { dispatch, extra, getState }) => {
|
||||
const state = getState();
|
||||
const toolCallState = selectCurrentToolCall(state);
|
||||
const toolCallState = findToolCall(state.session.history, toolCallId);
|
||||
if (!toolCallState) {
|
||||
console.warn(`Tool call with ID ${toolCallId} not found`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -34,8 +39,6 @@ export const callCurrentTool = createAsyncThunk<void, undefined, ThunkApiType>(
|
|||
throw new Error("No model selected");
|
||||
}
|
||||
|
||||
const { toolCallId } = toolCallState;
|
||||
|
||||
dispatch(
|
||||
setToolCallCalling({
|
||||
toolCallId,
|
||||
|
|
@ -19,7 +19,7 @@ import {
|
|||
constructMessages,
|
||||
getBaseSystemMessage,
|
||||
} from "../util/constructMessages";
|
||||
import { callCurrentTool } from "./callCurrentTool";
|
||||
import { callToolById } from "./callToolById";
|
||||
|
||||
export const streamNormalInput = createAsyncThunk<
|
||||
void,
|
||||
|
|
@ -160,7 +160,9 @@ export const streamNormalInput = createAsyncThunk<
|
|||
toolSettings[toolCallState.toolCall.function.name] ===
|
||||
"allowedWithoutPermission"
|
||||
) {
|
||||
const response = await dispatch(callCurrentTool());
|
||||
const response = await dispatch(
|
||||
callToolById({ toolCallId: toolCallState.toolCallId })
|
||||
);
|
||||
unwrapResult(response);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue