mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
fix: don't reset new convo if model not change
fix: change model will clear all messages.
This commit is contained in:
parent
4e91437049
commit
54aa9debb4
1 changed files with 10 additions and 7 deletions
|
|
@ -12,6 +12,8 @@ import ModelDialog from './ModelDialog';
|
||||||
import MenuItems from './MenuItems';
|
import MenuItems from './MenuItems';
|
||||||
import { swr } from '~/utils/fetchers';
|
import { swr } from '~/utils/fetchers';
|
||||||
import { setModels } from '~/store/modelSlice';
|
import { setModels } from '~/store/modelSlice';
|
||||||
|
import { setMessages } from '~/store/messageSlice';
|
||||||
|
import { setText } from '~/store/textSlice';
|
||||||
import GPTIcon from '../svg/GPTIcon';
|
import GPTIcon from '../svg/GPTIcon';
|
||||||
import BingIcon from '../svg/BingIcon';
|
import BingIcon from '../svg/BingIcon';
|
||||||
import { Button } from '../ui/Button.tsx';
|
import { Button } from '../ui/Button.tsx';
|
||||||
|
|
@ -64,16 +66,13 @@ export default function ModelMenu() {
|
||||||
}, [model]);
|
}, [model]);
|
||||||
|
|
||||||
const onChange = (value, custom = false) => {
|
const onChange = (value, custom = false) => {
|
||||||
// Set new conversation
|
|
||||||
dispatch(setNewConvo());
|
|
||||||
dispatch(setSubmission({}));
|
|
||||||
// if (custom) {
|
|
||||||
// mutate();
|
|
||||||
// }
|
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return;
|
return;
|
||||||
|
} else if (value === model) {
|
||||||
|
return;
|
||||||
} else if (value === 'chatgptCustom') {
|
} else if (value === 'chatgptCustom') {
|
||||||
// dispatch(setMessages([]));
|
// dispatch(setMessages([]));
|
||||||
|
return;
|
||||||
} else if (initial[value]) {
|
} else if (initial[value]) {
|
||||||
dispatch(setModel(value));
|
dispatch(setModel(value));
|
||||||
dispatch(setDisabled(false));
|
dispatch(setDisabled(false));
|
||||||
|
|
@ -92,7 +91,11 @@ export default function ModelMenu() {
|
||||||
dispatch(setCustomModel(null));
|
dispatch(setCustomModel(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set new conversation
|
||||||
|
dispatch(setText(''));
|
||||||
|
dispatch(setMessages([]));
|
||||||
|
dispatch(setNewConvo());
|
||||||
|
dispatch(setSubmission({}));
|
||||||
};
|
};
|
||||||
|
|
||||||
const onOpenChange = (open) => {
|
const onOpenChange = (open) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue