mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 01:40:15 +01:00
improve custom model selection ux
This commit is contained in:
parent
d93282640c
commit
6d757ff91f
6 changed files with 49 additions and 20 deletions
|
|
@ -16,10 +16,11 @@ import {
|
|||
DialogTitle
|
||||
} from '../ui/Dialog.tsx';
|
||||
|
||||
export default function ModelDialog({ mutate, modelMap }) {
|
||||
export default function ModelDialog({ mutate, modelMap, setModelSave, handleSaveState }) {
|
||||
const dispatch = useDispatch();
|
||||
const [chatGptLabel, setChatGptLabel] = useState('');
|
||||
const [promptPrefix, setPromptPrefix] = useState('');
|
||||
|
||||
const [saveText, setSaveText] = useState('Save');
|
||||
const [required, setRequired] = useState(false);
|
||||
const inputRef = useRef(null);
|
||||
|
|
@ -34,11 +35,13 @@ export default function ModelDialog({ mutate, modelMap }) {
|
|||
}
|
||||
dispatch(setCustomGpt({ chatGptLabel, promptPrefix }));
|
||||
dispatch(setModel('chatgptCustom'));
|
||||
handleSaveState(chatGptLabel.toLowerCase());
|
||||
// dispatch(setDisabled(false));
|
||||
};
|
||||
|
||||
const saveHandler = (e) => {
|
||||
e.preventDefault();
|
||||
setModelSave(true);
|
||||
const value = chatGptLabel.toLowerCase();
|
||||
|
||||
if (chatGptLabel.length === 0) {
|
||||
|
|
@ -60,7 +63,11 @@ export default function ModelDialog({ mutate, modelMap }) {
|
|||
// dispatch(setDisabled(false));
|
||||
};
|
||||
|
||||
if (modelMap[chatGptLabel.toLowerCase()] && saveText === 'Save') {
|
||||
if (
|
||||
chatGptLabel !== 'chatgptCustom' &&
|
||||
modelMap[chatGptLabel.toLowerCase()] &&
|
||||
saveText === 'Save'
|
||||
) {
|
||||
setSaveText('Update');
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue