diff --git a/gui/src/components/markdown/CodeBlockToolbar.tsx b/gui/src/components/markdown/CodeBlockToolbar.tsx index a01dd78d2..ac4c03bb2 100644 --- a/gui/src/components/markdown/CodeBlockToolbar.tsx +++ b/gui/src/components/markdown/CodeBlockToolbar.tsx @@ -131,7 +131,6 @@ function CodeBlockToolBar(props: CodeBlockToolBarProps) { const defaultModel = useSelector(defaultModelSelector); const isTerminal = isTerminalCodeBlock(props.language, props.text); const [isCopied, setIsCopied] = useState(false); - const [isApplying, setIsApplying] = useState(false); const streamIdRef = useRef(null); if (streamIdRef.current === null) { @@ -149,10 +148,11 @@ function CodeBlockToolBar(props: CodeBlockToolBarProps) { useWebviewListener( "applyCodeFromChat", async () => { - await ideMessenger.request("applyToCurrentFile", { + await ideMessenger.request("applyToFile", { curSelectedModelTitle: defaultModel.title, text: props.text, streamId: streamIdRef.current, + filepath: props.filepath, }); dispatch(incrementNextCodeBlockToApplyIndex({})); }, @@ -172,8 +172,6 @@ function CodeBlockToolBar(props: CodeBlockToolBarProps) { } async function onClickApply() { - if (isApplying) return; - if (isTerminal) { await ideMessenger.ide.runCommand(getTerminalCommand(props.text)); return; @@ -232,7 +230,6 @@ function CodeBlockToolBar(props: CodeBlockToolBarProps) { {!isJetBrains() && isTerminal && ( @@ -240,15 +237,11 @@ function CodeBlockToolBar(props: CodeBlockToolBarProps) { )} - {isApplying ? ( - - ) : ( - - )} +