+ {shouldShowAcceptRejectButtons &&
}
+
(null);
const wasGeneratingRef = useRef(props.isGeneratingCodeBlock);
const isMultifileEdit = useSelector(
- (state: RootState) => state.uiState.isInMultifileEdit,
+ (state: RootState) => state.state.isInMultifileEdit,
);
const [isExpanded, setIsExpanded] = useState(isMultifileEdit ? false : true);
const [codeBlockContent, setCodeBlockContent] = useState("");
diff --git a/gui/src/components/markdown/utils/useApplyCodeBlock.ts b/gui/src/components/markdown/utils/useApplyCodeBlock.ts
index 9cbe2309a..cb016e1d8 100644
--- a/gui/src/components/markdown/utils/useApplyCodeBlock.ts
+++ b/gui/src/components/markdown/utils/useApplyCodeBlock.ts
@@ -26,6 +26,7 @@ export function useApplyCodeBlock({
dispatch(
updateApplyState({
streamId,
+ filepath,
status: "streaming",
}),
);
diff --git a/gui/src/hooks/useChatHandler.ts b/gui/src/hooks/useChatHandler.ts
index db41686a2..0c9eb056e 100644
--- a/gui/src/hooks/useChatHandler.ts
+++ b/gui/src/hooks/useChatHandler.ts
@@ -30,13 +30,11 @@ import {
resubmitAtIndex,
setInactive,
setIsGatheringContext,
+ setIsInMultifileEdit,
setMessageAtIndex,
streamUpdate,
} from "../redux/slices/stateSlice";
-import {
- resetNextCodeBlockToApplyIndex,
- setIsInMultifileEdit,
-} from "../redux/slices/uiStateSlice";
+import { resetNextCodeBlockToApplyIndex } from "../redux/slices/uiStateSlice";
import { RootState } from "../redux/store";
import useHistory from "./useHistory";
diff --git a/gui/src/hooks/useHistory.tsx b/gui/src/hooks/useHistory.tsx
index 725e59726..8ebcd4581 100644
--- a/gui/src/hooks/useHistory.tsx
+++ b/gui/src/hooks/useHistory.tsx
@@ -10,7 +10,6 @@ import { newSession } from "../redux/slices/stateSlice";
import { RootState } from "../redux/store";
import { getLocalStorage, setLocalStorage } from "../util/localStorage";
import { useLastSessionContext } from "../context/LastSessionContext";
-import { setIsInMultifileEdit } from "../redux/slices/uiStateSlice";
const MAX_TITLE_LENGTH = 100;
@@ -100,8 +99,6 @@ function useHistory(dispatch: Dispatch) {
workspaceDirectory: window.workspacePaths?.[0] || "",
};
- dispatch(setIsInMultifileEdit(false));
-
return await ideMessenger.request("history/save", sessionInfo);
}
diff --git a/gui/src/redux/slices/stateSlice.ts b/gui/src/redux/slices/stateSlice.ts
index c22d4bb1b..d7ccf422d 100644
--- a/gui/src/redux/slices/stateSlice.ts
+++ b/gui/src/redux/slices/stateSlice.ts
@@ -1,7 +1,6 @@
import { PayloadAction, createSlice } from "@reduxjs/toolkit";
import { JSONContent } from "@tiptap/react";
import {
- ChatHistory,
ChatHistoryItem,
ChatMessage,
ContextItemId,
@@ -46,6 +45,7 @@ type State = {
mainEditorContent?: JSONContent;
selectedProfileId: string;
configError: ConfigValidationError[] | undefined;
+ isInMultifileEdit: boolean;
};
const initialState: State = {
@@ -81,6 +81,7 @@ const initialState: State = {
sessionId: v4(),
defaultModelTitle: "GPT-4",
selectedProfileId: "local",
+ isInMultifileEdit: false,
};
export const stateSlice = createSlice({
@@ -301,6 +302,7 @@ export const stateSlice = createSlice({
state.active = false;
state.title = "New Session";
state.sessionId = v4();
+ state.isInMultifileEdit = false;
}
},
deleteContextWithIds: (
@@ -442,6 +444,9 @@ export const stateSlice = createSlice({
selectedProfileId: payload,
};
},
+ setIsInMultifileEdit: (state, action: PayloadAction) => {
+ state.isInMultifileEdit = action.payload;
+ },
},
});
@@ -470,6 +475,7 @@ export const {
setSelectedProfileId,
deleteMessage,
setIsGatheringContext,
+ setIsInMultifileEdit,
} = stateSlice.actions;
export default stateSlice.reducer;
diff --git a/gui/src/redux/slices/uiStateSlice.ts b/gui/src/redux/slices/uiStateSlice.ts
index aaf225980..34fd29eb4 100644
--- a/gui/src/redux/slices/uiStateSlice.ts
+++ b/gui/src/redux/slices/uiStateSlice.ts
@@ -16,8 +16,6 @@ type UiState = {
* Syncs the sidebar with the accepted/rejected blocks in the editor. Reused for Edit as well.
*/
applyStates: ApplyState[];
-
- isInMultifileEdit: boolean;
};
export const uiStateSlice = createSlice({
@@ -29,7 +27,6 @@ export const uiStateSlice = createSlice({
nextCodeBlockToApplyIndex: 0,
onboardingCard: defaultOnboardingCardState,
applyStates: [],
- isInMultifileEdit: false,
} as UiState,
reducers: {
setOnboardingCard: (
@@ -77,11 +74,9 @@ export const uiStateSlice = createSlice({
} else {
curApplyState.status = payload.status ?? curApplyState.status;
curApplyState.numDiffs = payload.numDiffs ?? curApplyState.numDiffs;
+ curApplyState.filepath = payload.filepath ?? curApplyState.filepath;
}
},
- setIsInMultifileEdit: (state, action: PayloadAction) => {
- state.isInMultifileEdit = action.payload;
- },
},
});
@@ -93,7 +88,6 @@ export const {
resetNextCodeBlockToApplyIndex,
incrementNextCodeBlockToApplyIndex,
updateApplyState,
- setIsInMultifileEdit,
} = uiStateSlice.actions;
export default uiStateSlice.reducer;