Elffuss BraidHub

kikocis/continue public

451a09bc4725 · 655 BRawPermalink
1import { createAsyncThunk } from "@reduxjs/toolkit";
2import {
3 abortStream,
4 clearLastEmptyResponse,
5 setInactive,
6} from "../slices/sessionSlice";
7import { ThunkApiType } from "../store";
8
9export const cancelStream = createAsyncThunk<void, undefined, ThunkApiType>(
10 "chat/cancelStream",
11 async (messages, { dispatch, extra, getState }) => {
12 dispatch(setInactive());
13 dispatch(abortStream());
14
15 // In the case tool calls were being generated,
16 // Replace them with
17 // If the assistant message is empty, then remove it and the user message, placing the user input in the main text box
18 dispatch(clearLastEmptyResponse());
19 },
20);