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>
<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.
**Warning:** There may be a high chance of your account being banned with this method. Continue doing so at your own risk.
</details>

View file

@ -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',
() => {
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`);
}
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({});
};

View file

@ -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;

View file

@ -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 = {};

View file

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

View file

@ -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