2023-02-07 16:22:35 -05:00
|
|
|
import { createSlice } from '@reduxjs/toolkit';
|
|
|
|
|
|
|
|
|
|
const initialState = {
|
|
|
|
|
isSubmitting: false,
|
2023-03-03 15:52:06 -05:00
|
|
|
disabled: false,
|
|
|
|
|
model: 'chatgpt',
|
|
|
|
|
promptPrefix: '',
|
|
|
|
|
chatGptLabel: '',
|
2023-02-07 16:22:35 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const currentSlice = createSlice({
|
|
|
|
|
name: 'submit',
|
|
|
|
|
initialState,
|
|
|
|
|
reducers: {
|
|
|
|
|
setSubmitState: (state, action) => {
|
|
|
|
|
state.isSubmitting = action.payload;
|
|
|
|
|
},
|
2023-03-03 15:52:06 -05:00
|
|
|
setDisabled: (state, action) => {
|
|
|
|
|
state.disabled = action.payload;
|
|
|
|
|
},
|
2023-02-13 21:15:28 -05:00
|
|
|
setModel: (state, action) => {
|
|
|
|
|
state.model = action.payload;
|
|
|
|
|
},
|
2023-03-03 15:52:06 -05:00
|
|
|
setCustomGpt: (state, action) => {
|
|
|
|
|
state.promptPrefix = action.payload.promptPrefix;
|
|
|
|
|
state.chatGptLabel = action.payload.chatGptLabel;
|
|
|
|
|
},
|
2023-02-07 16:22:35 -05:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2023-03-03 15:52:06 -05:00
|
|
|
export const { setSubmitState, setDisabled, setModel, setCustomGpt } = currentSlice.actions;
|
2023-02-07 16:22:35 -05:00
|
|
|
|
|
|
|
|
export default currentSlice.reducer;
|