-
+
+
+
+
)}
diff --git a/gui/src/pages/Edit/Edit.tsx b/gui/src/pages/Edit/Edit.tsx
index 93aae4c3b..8a1280a6b 100644
--- a/gui/src/pages/Edit/Edit.tsx
+++ b/gui/src/pages/Edit/Edit.tsx
@@ -58,7 +58,11 @@ export default function Edit() {
(store: RootState) => store.state.config.contextProviders,
);
- const state = useSelector((state: RootState) => state.state);
+ const history = useSelector((state: RootState) => state.state.history);
+
+ const applyStates = useSelector(
+ (state: RootState) => state.state.applyStates,
+ );
const applyState = useSelector(
(store: RootState) =>
@@ -83,11 +87,7 @@ export default function Edit() {
}
}, [applyState, editModeState.editStatus]);
- const applyStates = useSelector(
- (state: RootState) => state.state.applyStates,
- );
-
- const active = useSelector((state: RootState) => state.state.active);
+ // const active = useSelector((state: RootState) => state.state.active);
const pendingApplyStates = applyStates.filter(
(state) => state.status === "done",
@@ -98,8 +98,8 @@ export default function Edit() {
editModeState.editStatus === "accepting";
const toolbarOptions = {
- hideAddContext: true,
- hideImageUpload: true,
+ hideAddContext: false,
+ hideImageUpload: false,
hideUseCodebase: true,
hideSelectModel: false,
enterText: isStreaming ? "Retry" : "Edit",
@@ -124,6 +124,7 @@ export default function Edit() {
},
ideMessenger,
[],
+ dispatch,
);
const prompt = [
@@ -166,11 +167,11 @@ export default function Edit() {
const isLastUserInput = useCallback(
(index: number): boolean => {
- return !state.history
+ return !history
.slice(index + 1)
.some((entry) => entry.message.role === "user");
},
- [state.history],
+ [history],
);
return (
@@ -181,7 +182,7 @@ export default function Edit() {
- {!isSingleFileEdit && state.history.length > 1 && (
+ {!isSingleFileEdit && history.length > 1 && (
- {state.history.slice(1).map((item, index: number) => (
+ {history.slice(1).map((item, index: number) => (
{item.message.role === "user" ? (
)}
diff --git a/gui/src/redux/slices/editModeState.ts b/gui/src/redux/slices/editModeState.ts
index dc872f5c3..a4c5ac1fa 100644
--- a/gui/src/redux/slices/editModeState.ts
+++ b/gui/src/redux/slices/editModeState.ts
@@ -8,12 +8,14 @@ interface EditModeState {
previousInputs: MessageContent[];
fileAfterEdit?: string;
codeToEdit: RangeInFileWithContents[];
+ isInEditMode: boolean;
}
const initialState: EditModeState = {
editStatus: "not-started",
previousInputs: [],
codeToEdit: [],
+ isInEditMode: false,
};
export const editModeStateSlice = createSlice({
@@ -98,6 +100,9 @@ export const editModeStateSlice = createSlice({
state.editStatus = "done";
state.previousInputs = [];
},
+ setIsInEditMode: (state, { payload }: PayloadAction) => {
+ state.isInEditMode = payload;
+ },
},
});
@@ -110,5 +115,6 @@ export const {
removeEntryFromCodeToEdit,
focusEdit,
clearCodeToEdit,
+ setIsInEditMode,
} = editModeStateSlice.actions;
export default editModeStateSlice.reducer;
diff --git a/gui/src/redux/slices/stateSlice.ts b/gui/src/redux/slices/stateSlice.ts
index 770e9ce69..bc4f6ce63 100644
--- a/gui/src/redux/slices/stateSlice.ts
+++ b/gui/src/redux/slices/stateSlice.ts
@@ -46,7 +46,6 @@ type State = {
statuses: Record;
};
streamAborter: AbortController;
- isMultifileEdit: boolean;
};
const initialState: State = {
@@ -78,7 +77,6 @@ const initialState: State = {
defaultModelTitle: "GPT-4",
selectedProfileId: "local",
checkpoints: [],
- isMultifileEdit: false,
curCheckpointIndex: 0,
nextCodeBlockToApplyIndex: 0,
applyStates: [],
@@ -308,7 +306,6 @@ export const stateSlice = createSlice({
state.active = false;
state.context.isGathering = false;
- state.isMultifileEdit = false;
state.symbols = {};
if (payload) {
state.history = payload.history as any;
@@ -374,10 +371,6 @@ export const stateSlice = createSlice({
selectedProfileId: payload,
};
},
-
- setIsInMultifileEdit: (state, { payload }: PayloadAction) => {
- state.isMultifileEdit = payload;
- },
setCurCheckpointIndex: (state, { payload }: PayloadAction) => {
state.curCheckpointIndex = payload;
},
@@ -472,7 +465,6 @@ export const {
setSelectedProfileId,
deleteMessage,
setIsGatheringContext,
- setIsInMultifileEdit,
updateCurCheckpoint,
setCurCheckpointIndex,
resetNextCodeBlockToApplyIndex,
diff --git a/gui/src/redux/slices/uiStateSlice.ts b/gui/src/redux/slices/uiStateSlice.ts
index f4b531c39..9a13415d3 100644
--- a/gui/src/redux/slices/uiStateSlice.ts
+++ b/gui/src/redux/slices/uiStateSlice.ts
@@ -9,6 +9,7 @@ type UiState = {
dialogMessage: string | JSX.Element | undefined;
dialogEntryOn: boolean;
onboardingCard: OnboardingCardState;
+ shouldAddFileForEditing: boolean;
};
export const uiStateSlice = createSlice({
@@ -18,6 +19,7 @@ export const uiStateSlice = createSlice({
dialogMessage: "",
dialogEntryOn: false,
onboardingCard: defaultOnboardingCardState,
+ shouldAddFileForEditing: false,
} as UiState,
reducers: {
setOnboardingCard: (
@@ -41,6 +43,12 @@ export const uiStateSlice = createSlice({
setShowDialog: (state, action: PayloadAction) => {
state.showDialog = action.payload;
},
+ setShouldAddFileForEditing: (
+ state,
+ action: PayloadAction,
+ ) => {
+ state.shouldAddFileForEditing = action.payload;
+ },
},
});
@@ -49,6 +57,7 @@ export const {
setDialogMessage,
setDialogEntryOn,
setShowDialog,
+ setShouldAddFileForEditing,
} = uiStateSlice.actions;
export default uiStateSlice.reducer;