mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-03-10 18:12:35 +01:00
🏷️ refactor: EditPresetDialog UI and Remove chatGptLabel from Presets (#7543)
* fix: add necessary dep., remove unnecessary dep from useMentions memoization * fix: Migrate deprecated chatGptLabel to modelLabel in cleanupPreset and simplify getPresetTitle logic * fix: Enhance cleanupPreset to remove empty chatGptLabel and add comprehensive tests for label migration and preset handling * chore: Update endpointType prop in PopoverButtons to allow null values for better flexibility * refactor: Replace Dialog with OGDialog in EditPresetDialog for improved UI consistency and structure * style: Update EditPresetDialog layout and styling for improved responsiveness and consistency
This commit is contained in:
parent
fc8d24fa5b
commit
b45ff8e4ed
7 changed files with 717 additions and 122 deletions
|
|
@ -20,6 +20,21 @@ const cleanupPreset = ({ preset: _preset }: TCleanupPreset): TPreset => {
|
|||
const { presetOverride = {}, ...rest } = _preset ?? {};
|
||||
const preset = { ...rest, ...presetOverride };
|
||||
|
||||
// Handle deprecated chatGptLabel field
|
||||
// If both chatGptLabel and modelLabel exist, prioritize modelLabel and remove chatGptLabel
|
||||
// If only chatGptLabel exists, migrate it to modelLabel
|
||||
if (preset.chatGptLabel && preset.modelLabel) {
|
||||
// Both exist: prioritize modelLabel, remove chatGptLabel
|
||||
delete preset.chatGptLabel;
|
||||
} else if (preset.chatGptLabel && !preset.modelLabel) {
|
||||
// Only chatGptLabel exists: migrate to modelLabel
|
||||
preset.modelLabel = preset.chatGptLabel;
|
||||
delete preset.chatGptLabel;
|
||||
} else if ('chatGptLabel' in preset) {
|
||||
// chatGptLabel exists but is empty/falsy: remove it
|
||||
delete preset.chatGptLabel;
|
||||
}
|
||||
|
||||
/* @ts-ignore: endpoint can be a custom defined name */
|
||||
const parsedPreset = parseConvo({ endpoint, endpointType, conversation: preset });
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue