LibreChat/src/store/convoSlice.js

29 lines
665 B
JavaScript
Raw Normal View History

import { createSlice, current } from '@reduxjs/toolkit';
2023-02-06 21:17:46 -05:00
const initialState = {
error: false,
title: 'ChatGPT Clone',
2023-02-06 21:17:46 -05:00
conversationId: null,
parentMessageId: null,
// convos: [],
convosLoading: false,
2023-02-06 21:17:46 -05:00
};
const currentSlice = createSlice({
name: 'convo',
initialState,
reducers: {
setConversation: (state, action) => {
return { ...state, ...action.payload };
2023-02-06 21:17:46 -05:00
},
setError: (state, action) => {
state.error = action.payload;
},
// setConvos: (state, action) => state.convos = action.payload,
2023-02-06 21:17:46 -05:00
}
});
export const { setConversation, setConvos, setError } = currentSlice.actions;
2023-02-06 21:17:46 -05:00
export default currentSlice.reducer;