Merge pull request #3240 from continuedev/nate/quick-edit-e6e1
cancelStream
This commit is contained in:
commit
f3387b755a
2 changed files with 17 additions and 1 deletions
|
|
@ -57,6 +57,7 @@ import {
|
|||
setShowDialog,
|
||||
} from "../../redux/slices/uiSlice";
|
||||
import { RootState } from "../../redux/store";
|
||||
import { cancelStream } from "../../redux/thunks/cancelStream";
|
||||
import { exitEditMode } from "../../redux/thunks/exitEditMode";
|
||||
import { streamResponseThunk } from "../../redux/thunks/streamResponse";
|
||||
import {
|
||||
|
|
@ -203,7 +204,7 @@ export function Chat() {
|
|||
isMetaEquivalentKeyPressed(e) &&
|
||||
!e.shiftKey
|
||||
) {
|
||||
// dispatch(cancelGeneration()); TODO!!!
|
||||
dispatch(cancelStream());
|
||||
}
|
||||
};
|
||||
window.addEventListener("keydown", listener);
|
||||
|
|
|
|||
15
gui/src/redux/thunks/cancelStream.ts
Normal file
15
gui/src/redux/thunks/cancelStream.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||
import { abortStream, setInactive } from "../slices/sessionSlice";
|
||||
import { ThunkApiType } from "../store";
|
||||
|
||||
export const cancelStream = createAsyncThunk<void, undefined, ThunkApiType>(
|
||||
"chat/cancelStream",
|
||||
async (messages, { dispatch, extra, getState }) => {
|
||||
dispatch(setInactive());
|
||||
dispatch(abortStream());
|
||||
|
||||
// If the assistant message is empty, then remove it and the user message, placing the user input in the main text box
|
||||
// TODO: Waiting until next release
|
||||
// dispatch(clearLastEmptyResponse());
|
||||
},
|
||||
);
|
||||
Loading…
Add table
Reference in a new issue