@@ -5,13 +5,12 @@ import {
5
5
ExclamationTriangleIcon ,
6
6
} from "@heroicons/react/24/outline" ;
7
7
import { Editor , JSONContent } from "@tiptap/react" ;
8
- import { InputModifiers , RangeInFileWithContents , ToolCallState } from "core" ;
8
+ import { InputModifiers , RangeInFileWithContents } from "core" ;
9
9
import { streamResponse } from "core/llm/stream" ;
10
10
import { renderChatMessage , stripImages } from "core/util/messageContent" ;
11
11
import { usePostHog } from "posthog-js/react" ;
12
12
import { useCallback , useContext , useEffect , useRef , useState } from "react" ;
13
13
import { ErrorBoundary } from "react-error-boundary" ;
14
- import { useSelector } from "react-redux" ;
15
14
import styled from "styled-components" ;
16
15
import { Button , lightGray , vscBackground } from "../../components" ;
17
16
import CodeToEditCard from "../../components/CodeToEditCard" ;
@@ -45,7 +44,6 @@ import {
45
44
setDialogMessage ,
46
45
setShowDialog ,
47
46
} from "../../redux/slices/uiSlice" ;
48
- import { RootState } from "../../redux/store" ;
49
47
import { cancelStream } from "../../redux/thunks/cancelStream" ;
50
48
import { exitEditMode } from "../../redux/thunks/exitEditMode" ;
51
49
import { loadLastSession } from "../../redux/thunks/session" ;
@@ -116,9 +114,7 @@ export function Chat() {
116
114
( state ) => state . config . config . ui ?. showChatScrollbar ,
117
115
) ;
118
116
const codeToEdit = useAppSelector ( ( state ) => state . session . codeToEdit ) ;
119
- const toolCallState = useSelector < RootState , ToolCallState | undefined > (
120
- selectCurrentToolCall ,
121
- ) ;
117
+ const toolCallState = useAppSelector ( selectCurrentToolCall ) ;
122
118
const applyStates = useAppSelector (
123
119
( state ) => state . session . codeBlockApplyStates . states ,
124
120
) ;
@@ -163,6 +159,11 @@ export function Chat() {
163
159
index ?: number ,
164
160
editorToClearOnSend ?: Editor ,
165
161
) => {
162
+ if ( toolCallState ?. status === "generated" ) {
163
+ return console . error (
164
+ "Cannot submit message while awaiting tool confirmation" ,
165
+ ) ;
166
+ }
166
167
if ( defaultModel ?. provider === "free-trial" ) {
167
168
const newCount = incrementFreeTrialCount ( ) ;
168
169
@@ -226,6 +227,7 @@ export function Chat() {
226
227
streamResponse ,
227
228
isSingleRangeEditOrInsertion ,
228
229
codeToEdit ,
230
+ toolCallState ,
229
231
] ,
230
232
) ;
231
233
0 commit comments