add new reducer to ensure conversations are renewed on model change

This commit is contained in:
Daniel Avila 2023-03-09 18:57:37 -05:00
parent 30936573ac
commit 0ba92c4c03
7 changed files with 53 additions and 24 deletions

View file

@ -2,6 +2,7 @@ import React, { useState, useRef } from 'react';
import TextareaAutosize from 'react-textarea-autosize';
import { useSelector, useDispatch } from 'react-redux';
import { setModel, setCustomGpt } from '~/store/submitSlice';
import { setNewConvo } from '~/store/convoSlice';
import manualSWR from '~/utils/fetchers';
import { Button } from '../ui/Button.tsx';
import { Input } from '../ui/Input.tsx';
@ -36,6 +37,16 @@ export default function ModelDialog({ mutate, setModelSave, handleSaveState }) {
dispatch(setCustomGpt({ chatGptLabel, promptPrefix }));
dispatch(setModel('chatgptCustom'));
handleSaveState(chatGptLabel.toLowerCase());
// Set new conversation
dispatch(setNewConvo());
// dispatch(
// setConversation({
// title: 'New Chat',
// error: false,
// conversationId: null,
// parentMessageId: null
// })
// );
// dispatch(setDisabled(false));
};