mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 01:10:14 +01:00
feat: dynamic custom model saving/updating in dialog
This commit is contained in:
parent
15986c078b
commit
8d60cbdc7a
2 changed files with 7 additions and 3 deletions
|
|
@ -16,7 +16,7 @@ import {
|
||||||
DialogTitle
|
DialogTitle
|
||||||
} from '../ui/Dialog.tsx';
|
} from '../ui/Dialog.tsx';
|
||||||
|
|
||||||
export default function ModelDialog({ mutate }) {
|
export default function ModelDialog({ mutate, modelMap }) {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const [chatGptLabel, setChatGptLabel] = useState('');
|
const [chatGptLabel, setChatGptLabel] = useState('');
|
||||||
const [promptPrefix, setPromptPrefix] = useState('');
|
const [promptPrefix, setPromptPrefix] = useState('');
|
||||||
|
|
@ -50,7 +50,7 @@ export default function ModelDialog({ mutate }) {
|
||||||
updateCustomGpt.trigger({ value, chatGptLabel, promptPrefix });
|
updateCustomGpt.trigger({ value, chatGptLabel, promptPrefix });
|
||||||
|
|
||||||
mutate();
|
mutate();
|
||||||
setSaveText('Saved!');
|
setSaveText((prev) => prev + 'd!');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setSaveText('Save');
|
setSaveText('Save');
|
||||||
}, 2500);
|
}, 2500);
|
||||||
|
|
@ -60,6 +60,10 @@ export default function ModelDialog({ mutate }) {
|
||||||
// dispatch(setDisabled(false));
|
// dispatch(setDisabled(false));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (modelMap[chatGptLabel.toLowerCase()] && saveText === 'Save') {
|
||||||
|
setSaveText('Update');
|
||||||
|
}
|
||||||
|
|
||||||
const requiredProp = required ? { required: true } : {};
|
const requiredProp = required ? { required: true } : {};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ export default function ModelMenu() {
|
||||||
</DropdownMenuRadioGroup>
|
</DropdownMenuRadioGroup>
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
<ModelDialog mutate={trigger} />
|
<ModelDialog mutate={trigger} modelMap={modelMap}/>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue