mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-18 00:15:30 +01:00
reorganize components and add root import plugin
This commit is contained in:
parent
faf8800e67
commit
9d41ed4615
27 changed files with 76 additions and 27 deletions
24
src/store/convoSlice.js
Normal file
24
src/store/convoSlice.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { createSlice } from '@reduxjs/toolkit';
|
||||
|
||||
const initialState = {
|
||||
active: false,
|
||||
conversationId: null,
|
||||
parentMessageId: null,
|
||||
};
|
||||
|
||||
const currentSlice = createSlice({
|
||||
name: 'convo',
|
||||
initialState,
|
||||
reducers: {
|
||||
setConversation: (state, action) => {
|
||||
const { conversationId, parentMessageId } = action.payload;
|
||||
state.conversationId = conversationId;
|
||||
state.parentMessageId = parentMessageId;
|
||||
},
|
||||
}
|
||||
});
|
||||
//
|
||||
|
||||
export const { setConversation } = currentSlice.actions;
|
||||
|
||||
export default currentSlice.reducer;
|
||||
11
src/store/index.js
Normal file
11
src/store/index.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { configureStore } from '@reduxjs/toolkit';
|
||||
|
||||
import convoReducer from './convoSlice.js';
|
||||
import messageReducer from './messageSlice.js'
|
||||
|
||||
export const store = configureStore({
|
||||
reducer: {
|
||||
convo: convoReducer,
|
||||
messages: messageReducer,
|
||||
},
|
||||
});
|
||||
18
src/store/messageSlice.js
Normal file
18
src/store/messageSlice.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { createSlice } from '@reduxjs/toolkit';
|
||||
|
||||
const initialState = [];
|
||||
|
||||
const currentSlice = createSlice({
|
||||
name: 'messages',
|
||||
initialState,
|
||||
reducers: {
|
||||
setMessages: (state, action) => {
|
||||
const { payload } = action;
|
||||
return [...payload];
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
export const { setMessages } = currentSlice.actions;
|
||||
|
||||
export default currentSlice.reducer;
|
||||
Loading…
Add table
Add a link
Reference in a new issue