update readme, setup files, and clear convo bug

This commit is contained in:
Danny Avila 2023-03-07 14:43:55 -05:00
parent 5ad32e211f
commit a8eaf2452a
6 changed files with 28 additions and 17 deletions

View file

@ -151,8 +151,14 @@ Here are my recently completed and planned features:
<details> <details>
<summary><strong>ChatGPT Free Instructions</strong></summary> <summary><strong>ChatGPT Free Instructions</strong></summary>
**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. 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. **Warning:** There may be a high chance of your account being banned with this method. Continue doing so at your own risk.
</details> </details>

View file

@ -1,27 +1,31 @@
import React from 'react'; import React from 'react';
import TrashIcon from '../svg/TrashIcon'; import TrashIcon from '../svg/TrashIcon';
import { useSWRConfig } from "swr" import { useSWRConfig } from 'swr';
import manualSWR from '~/utils/fetchers'; import manualSWR from '~/utils/fetchers';
import { useDispatch } from 'react-redux'; import { useDispatch } from 'react-redux';
import { setConversation } from '~/store/convoSlice'; import { setConversation, removeAll } from '~/store/convoSlice';
import { setMessages } from '~/store/messageSlice'; import { setMessages } from '~/store/messageSlice';
export default function ClearConvos() { export default function ClearConvos() {
const dispatch = useDispatch(); const dispatch = useDispatch();
const { mutate } = useSWRConfig() const { mutate } = useSWRConfig();
const { trigger } = manualSWR( const { trigger } = manualSWR(`http://localhost:3080/api/convos/clear`, 'post', () => {
`http://localhost:3080/api/convos/clear`, dispatch(setMessages([]));
'post', dispatch(
() => { setConversation({
dispatch(setMessages([])); error: false,
dispatch(setConversation({ error: false, title: 'New chat', conversationId: null, parentMessageId: null })); title: 'New chat',
mutate(`http://localhost:3080/api/convos`); conversationId: null,
} parentMessageId: null
); })
);
mutate(`http://localhost:3080/api/convos`);
});
const clickHandler = () => { const clickHandler = () => {
console.log('Clearing conversations...'); console.log('Clearing conversations...');
dispatch(removeAll());
trigger({}); trigger({});
}; };

View file

@ -38,11 +38,14 @@ const currentSlice = createSlice({
}, },
removeConvo: (state, action) => { removeConvo: (state, action) => {
state.convos = state.convos.filter((convo) => convo.conversationId !== action.payload); 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; currentSlice.actions;
export default currentSlice.reducer; export default currentSlice.reducer;

View file

@ -33,7 +33,6 @@ const currentSlice = createSlice({
initialState, initialState,
reducers: { reducers: {
setModels: (state, action) => { setModels: (state, action) => {
console.log('setModels', action.payload);
const models = [...initialState.models, ...action.payload]; const models = [...initialState.models, ...action.payload];
state.models = models; state.models = models;
const modelMap = {}; const modelMap = {};

View file

@ -27,7 +27,6 @@ const currentSlice = createSlice({
state.chatGptLabel = action.payload.chatGptLabel; state.chatGptLabel = action.payload.chatGptLabel;
}, },
setCustomModel: (state, action) => { setCustomModel: (state, action) => {
console.log('setCustomModel', action.payload);
state.customModel = action.payload; state.customModel = action.payload;
} }
} }

View file

@ -5,7 +5,7 @@ services:
image: react-client image: react-client
restart: always restart: always
ports: ports:
- "3050:80" - "3080:80"
volumes: volumes:
- ./client:/client - ./client:/client
- /client/node_modules - /client/node_modules
@ -23,7 +23,7 @@ services:
- CHATGPT_TOKEN="" - CHATGPT_TOKEN=""
- BING_TOKEN="" - BING_TOKEN=""
ports: ports:
- "3080:3080" - "9000:3080"
volumes: volumes:
- ./api:/api - ./api:/api
- /api/node_modules - /api/node_modules