From 93989459e3806f1ba6d647036dc9db064bf30e38 Mon Sep 17 00:00:00 2001 From: Test Date: Wed, 4 Dec 2024 09:51:59 -0800 Subject: [PATCH] fix: use index when sending chat input --- gui/src/pages/gui/Chat.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 000a06f12..258a92013 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -228,7 +228,12 @@ export function Chat() { const { widget, highlights } = useFindWidget(stepsDivRef); const sendInput = useCallback( - (editorState: JSONContent, modifiers: InputModifiers, editor: Editor) => { + ( + editorState: JSONContent, + modifiers: InputModifiers, + editor: Editor, + index?: number, + ) => { if (defaultModel?.provider === "free-trial") { const u = getLocalStorage("ftc"); if (u) { @@ -259,7 +264,9 @@ export function Chat() { ? getMultifileEditPrompt(codeToEdit) : undefined; - dispatch(streamResponseThunk({ editorState, modifiers, promptPreamble })); + dispatch( + streamResponseThunk({ editorState, modifiers, promptPreamble, index }), + ); // Increment localstorage counter for popup const currentCount = getLocalStorage("mainTextEntryCounter"); @@ -355,7 +362,9 @@ export function Chat() { <> {isInEditMode && index === 0 && } + sendInput(editorState, modifiers, editor, index) + } isLastUserInput={isLastUserInput(index)} isMainInput={false} editorState={item.editorState}