remove unused variables in load session
This commit is contained in:
parent
4932cb2ac4
commit
e78456c82d
3 changed files with 8 additions and 30 deletions
|
|
@ -43,14 +43,14 @@ import { streamResponseThunk } from "../../redux/thunks/streamResponse";
|
|||
import { isJetBrains, isMetaEquivalentKeyPressed } from "../../util";
|
||||
import { ToolCallDiv } from "./ToolCallDiv";
|
||||
|
||||
import { useStore } from "react-redux";
|
||||
import { FatalErrorIndicator } from "../../components/config/FatalErrorNotice";
|
||||
import InlineErrorMessage from "../../components/mainInput/InlineErrorMessage";
|
||||
import { RootState } from "../../redux/store";
|
||||
import { cancelStream } from "../../redux/thunks/cancelStream";
|
||||
import { EmptyChatBody } from "./EmptyChatBody";
|
||||
import { ExploreDialogWatcher } from "./ExploreDialogWatcher";
|
||||
import { useAutoScroll } from "./useAutoScroll";
|
||||
import { useStore } from "react-redux";
|
||||
import { RootState } from "../../redux/store";
|
||||
|
||||
// Helper function to find the index of the latest conversation summary
|
||||
function findLatestSummaryIndex(history: ChatHistoryItem[]): number {
|
||||
|
|
@ -431,11 +431,7 @@ export function Chat() {
|
|||
{history.length === 0 && lastSessionId && !isInEdit && (
|
||||
<NewSessionButton
|
||||
onClick={async () => {
|
||||
await dispatch(
|
||||
loadLastSession({
|
||||
saveCurrentSession: true,
|
||||
}),
|
||||
);
|
||||
await dispatch(loadLastSession());
|
||||
}}
|
||||
className="flex items-center gap-2"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -109,11 +109,7 @@ export const exitEdit = createAsyncThunk<
|
|||
if (openNewSession || state.editModeState.lastNonEditSessionWasEmpty) {
|
||||
dispatch(newSession());
|
||||
} else {
|
||||
await dispatch(
|
||||
loadLastSession({
|
||||
saveCurrentSession: false,
|
||||
}),
|
||||
);
|
||||
await dispatch(loadLastSession());
|
||||
}
|
||||
|
||||
dispatch(setMode(state.editModeState.returnToMode));
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { createAsyncThunk, unwrapResult } from "@reduxjs/toolkit";
|
||||
import { ChatMessage, Session, BaseSessionMetadata } from "core";
|
||||
import { BaseSessionMetadata, ChatMessage, Session } from "core";
|
||||
import { RemoteSessionMetadata } from "core/control-plane/client";
|
||||
import { NEW_SESSION_TITLE } from "core/util/constants";
|
||||
import { renderChatMessage } from "core/util/messageContent";
|
||||
|
|
@ -67,11 +67,7 @@ export const deleteSession = createAsyncThunk<void, string, ThunkApiType>(
|
|||
dispatch(deleteSessionMetadata(id)); // optimistic
|
||||
const state = getState();
|
||||
if (id === state.session.id) {
|
||||
await dispatch(
|
||||
loadLastSession({
|
||||
saveCurrentSession: false,
|
||||
}),
|
||||
);
|
||||
await dispatch(loadLastSession());
|
||||
}
|
||||
const result = await extra.ideMessenger.request("history/delete", { id });
|
||||
if (result.status === "error") {
|
||||
|
|
@ -146,19 +142,9 @@ export const loadRemoteSession = createAsyncThunk<
|
|||
},
|
||||
);
|
||||
|
||||
export const loadLastSession = createAsyncThunk<
|
||||
void,
|
||||
{
|
||||
saveCurrentSession: boolean;
|
||||
},
|
||||
ThunkApiType
|
||||
>(
|
||||
export const loadLastSession = createAsyncThunk<void, void, ThunkApiType>(
|
||||
"session/loadLast",
|
||||
async ({ saveCurrentSession }, { extra, dispatch, getState }) => {
|
||||
const state = getState();
|
||||
|
||||
if (state.session.id && saveCurrentSession) {
|
||||
}
|
||||
async (_, { extra, dispatch, getState }) => {
|
||||
const lastSessionId = getState().session.lastSessionId;
|
||||
|
||||
if (!lastSessionId) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue