mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-05 18:18:51 +01:00
add new reducer to ensure conversations are renewed on model change
This commit is contained in:
parent
30936573ac
commit
0ba92c4c03
7 changed files with 53 additions and 24 deletions
|
|
@ -3,7 +3,7 @@ import TrashIcon from '../svg/TrashIcon';
|
|||
import { useSWRConfig } from 'swr';
|
||||
import manualSWR from '~/utils/fetchers';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { setConversation, removeAll } from '~/store/convoSlice';
|
||||
import { setNewConvo, removeAll } from '~/store/convoSlice';
|
||||
import { setMessages } from '~/store/messageSlice';
|
||||
|
||||
export default function ClearConvos() {
|
||||
|
|
@ -12,14 +12,15 @@ export default function ClearConvos() {
|
|||
|
||||
const { trigger } = manualSWR(`http://localhost:3080/api/convos/clear`, 'post', () => {
|
||||
dispatch(setMessages([]));
|
||||
dispatch(
|
||||
setConversation({
|
||||
error: false,
|
||||
title: 'New chat',
|
||||
conversationId: null,
|
||||
parentMessageId: null
|
||||
})
|
||||
);
|
||||
dispatch(setNewConvo());
|
||||
// dispatch(
|
||||
// setConversation({
|
||||
// error: false,
|
||||
// title: 'New chat',
|
||||
// conversationId: null,
|
||||
// parentMessageId: null
|
||||
// })
|
||||
// );
|
||||
mutate(`http://localhost:3080/api/convos`);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import React from 'react';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { setConversation } from '~/store/convoSlice';
|
||||
import { setNewConvo } from '~/store/convoSlice';
|
||||
import { setMessages } from '~/store/messageSlice';
|
||||
import { setText } from '~/store/textSlice';
|
||||
|
||||
|
|
@ -10,7 +10,8 @@ export default function NewChat() {
|
|||
const clickHandler = () => {
|
||||
dispatch(setText(''));
|
||||
dispatch(setMessages([]));
|
||||
dispatch(setConversation({ title: 'New Chat', error: false, conversationId: null, parentMessageId: null }));
|
||||
dispatch(setNewConvo());
|
||||
// dispatch(setConversation({ title: 'New Chat', error: false, conversationId: null, parentMessageId: null }));
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue