diff --git a/frontend/src/preferences/preferenceApi.ts b/frontend/src/preferences/preferenceApi.ts index c1ac97de..32cf8b17 100644 --- a/frontend/src/preferences/preferenceApi.ts +++ b/frontend/src/preferences/preferenceApi.ts @@ -9,7 +9,6 @@ export async function getDocs(): Promise { const data = await response.json(); const docs: Doc[] = []; - console.log(data); data.forEach((doc: object) => { docs.push(doc as Doc); }); @@ -31,17 +30,11 @@ export async function getDocsWithPagination( const query = `sort=${sort}&order=${order}&page=${pageNumber}&rows=${rowsPerPage}`; const response = await userService.getDocsWithPagination(query); const data = await response.json(); - const docs: Doc[] = []; - console.log(`data: ${data}`); Array.isArray(data.paginated) && data.paginated.forEach((doc: Doc) => { docs.push(doc as Doc); }); - console.log(`total: ${data.total}`); - console.log(`totalPages: ${data.totalPages}`); - console.log(`cursor: ${data.nextCursor}`); - console.log(`currentPage: ${data.currentPage}`); return { docs: docs, totalDocuments: data.total, diff --git a/frontend/src/preferences/preferenceSlice.ts b/frontend/src/preferences/preferenceSlice.ts index c566ba70..8b3064d5 100644 --- a/frontend/src/preferences/preferenceSlice.ts +++ b/frontend/src/preferences/preferenceSlice.ts @@ -20,6 +20,7 @@ export interface Preference { loading: boolean; }; modalState: ActiveState; + paginatedDocuments: Doc[] | null; } const initialState: Preference = { @@ -42,6 +43,7 @@ const initialState: Preference = { loading: false, }, modalState: 'INACTIVE', + paginatedDocuments: null, }; export const prefSlice = createSlice({ @@ -57,6 +59,9 @@ export const prefSlice = createSlice({ setSourceDocs: (state, action) => { state.sourceDocs = action.payload; }, + setPaginatedDocuments: (state, action) => { + state.paginatedDocuments = action.payload; + }, setConversations: (state, action) => { state.conversations = action.payload; }, @@ -84,6 +89,7 @@ export const { setChunks, setTokenLimit, setModalStateDeleteConv, + setPaginatedDocuments, } = prefSlice.actions; export default prefSlice.reducer; @@ -155,3 +161,5 @@ export const selectPrompt = (state: RootState) => state.preference.prompt; export const selectChunks = (state: RootState) => state.preference.chunks; export const selectTokenLimit = (state: RootState) => state.preference.token_limit; +export const selectPaginatedDocuments = (state: RootState) => + state.preference.paginatedDocuments;