From a8eaf2452a0e37a1517b60711a46bdac48051be0 Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Tue, 7 Mar 2023 14:43:55 -0500 Subject: [PATCH] update readme, setup files, and clear convo bug --- README.md | 6 +++++ client/src/components/Nav/ClearConvos.jsx | 28 +++++++++++++---------- client/src/store/convoSlice.js | 5 +++- client/src/store/modelSlice.js | 1 - client/src/store/submitSlice.js | 1 - docker-compose.yml | 4 ++-- 6 files changed, 28 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index d9a088d75..0ca0977d5 100644 --- a/README.md +++ b/README.md @@ -151,8 +151,14 @@ Here are my recently completed and planned features:
ChatGPT Free Instructions +**This has been disabled as is no longer working as of 3-07-23** + + + To get your Access token For ChatGPT 'Free Version', login to chat.openai.com, then visit https://chat.openai.com/api/auth/session. + + **Warning:** There may be a high chance of your account being banned with this method. Continue doing so at your own risk.
diff --git a/client/src/components/Nav/ClearConvos.jsx b/client/src/components/Nav/ClearConvos.jsx index 0d4b6eaf3..25762aa2f 100644 --- a/client/src/components/Nav/ClearConvos.jsx +++ b/client/src/components/Nav/ClearConvos.jsx @@ -1,27 +1,31 @@ import React from 'react'; import TrashIcon from '../svg/TrashIcon'; -import { useSWRConfig } from "swr" +import { useSWRConfig } from 'swr'; import manualSWR from '~/utils/fetchers'; import { useDispatch } from 'react-redux'; -import { setConversation } from '~/store/convoSlice'; +import { setConversation, removeAll } from '~/store/convoSlice'; import { setMessages } from '~/store/messageSlice'; export default function ClearConvos() { const dispatch = useDispatch(); - const { mutate } = useSWRConfig() + const { mutate } = useSWRConfig(); - const { trigger } = manualSWR( - `http://localhost:3080/api/convos/clear`, - 'post', - () => { - dispatch(setMessages([])); - dispatch(setConversation({ error: false, title: 'New chat', conversationId: null, parentMessageId: null })); - mutate(`http://localhost:3080/api/convos`); - } - ); + const { trigger } = manualSWR(`http://localhost:3080/api/convos/clear`, 'post', () => { + dispatch(setMessages([])); + dispatch( + setConversation({ + error: false, + title: 'New chat', + conversationId: null, + parentMessageId: null + }) + ); + mutate(`http://localhost:3080/api/convos`); + }); const clickHandler = () => { console.log('Clearing conversations...'); + dispatch(removeAll()); trigger({}); }; diff --git a/client/src/store/convoSlice.js b/client/src/store/convoSlice.js index 98a8c09c7..d2294e5bb 100644 --- a/client/src/store/convoSlice.js +++ b/client/src/store/convoSlice.js @@ -38,11 +38,14 @@ const currentSlice = createSlice({ }, removeConvo: (state, action) => { state.convos = state.convos.filter((convo) => convo.conversationId !== action.payload); + }, + removeAll: (state) => { + state.convos = []; } } }); -export const { setConversation, setConvos, setError, incrementPage, removeConvo } = +export const { setConversation, setConvos, setError, incrementPage, removeConvo, removeAll } = currentSlice.actions; export default currentSlice.reducer; diff --git a/client/src/store/modelSlice.js b/client/src/store/modelSlice.js index c18d85716..801f0955d 100644 --- a/client/src/store/modelSlice.js +++ b/client/src/store/modelSlice.js @@ -33,7 +33,6 @@ const currentSlice = createSlice({ initialState, reducers: { setModels: (state, action) => { - console.log('setModels', action.payload); const models = [...initialState.models, ...action.payload]; state.models = models; const modelMap = {}; diff --git a/client/src/store/submitSlice.js b/client/src/store/submitSlice.js index f55b4df0d..b659ddcc7 100644 --- a/client/src/store/submitSlice.js +++ b/client/src/store/submitSlice.js @@ -27,7 +27,6 @@ const currentSlice = createSlice({ state.chatGptLabel = action.payload.chatGptLabel; }, setCustomModel: (state, action) => { - console.log('setCustomModel', action.payload); state.customModel = action.payload; } } diff --git a/docker-compose.yml b/docker-compose.yml index 1475e80c4..83fa98fd2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: image: react-client restart: always ports: - - "3050:80" + - "3080:80" volumes: - ./client:/client - /client/node_modules @@ -23,7 +23,7 @@ services: - CHATGPT_TOKEN="" - BING_TOKEN="" ports: - - "3080:3080" + - "9000:3080" volumes: - ./api:/api - /api/node_modules