mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 10:20:15 +01:00
feat: Implement Default Preset Selection for Conversations 📌 (#1275)
* fix: type issues with icons * refactor: use react query for presets, show toasts on preset crud, refactor mutations, remove presetsQuery from Root (breaking change) * refactor: change preset titling * refactor: update preset schemas and methods for necessary new properties `order` and `defaultPreset` * feat: add `defaultPreset` Recoil value * refactor(getPresetTitle): make logic cleaner and more concise * feat: complete UI portion of defaultPreset feature, with animations added to preset items * chore: remove console.logs() * feat: complete default preset handling * refactor: remove user sensitive values on logout * fix: allow endpoint selection without default preset overwriting
This commit is contained in:
parent
fdb65366d7
commit
ca64efec1b
32 changed files with 681 additions and 270 deletions
|
|
@ -7,6 +7,10 @@ import type {
|
|||
DeleteFilesResponse,
|
||||
DeleteFilesBody,
|
||||
DeleteMutationOptions,
|
||||
UpdatePresetOptions,
|
||||
DeletePresetOptions,
|
||||
PresetDeleteResponse,
|
||||
TPreset,
|
||||
} from 'librechat-data-provider';
|
||||
import { dataService, MutationKeys } from 'librechat-data-provider';
|
||||
|
||||
|
|
@ -37,3 +41,31 @@ export const useDeleteFilesMutation = (
|
|||
...(options || {}),
|
||||
});
|
||||
};
|
||||
|
||||
export const useUpdatePresetMutation = (
|
||||
options?: UpdatePresetOptions,
|
||||
): UseMutationResult<
|
||||
TPreset, // response data
|
||||
unknown,
|
||||
TPreset,
|
||||
unknown
|
||||
> => {
|
||||
return useMutation([MutationKeys.updatePreset], {
|
||||
mutationFn: (preset: TPreset) => dataService.updatePreset(preset),
|
||||
...(options || {}),
|
||||
});
|
||||
};
|
||||
|
||||
export const useDeletePresetMutation = (
|
||||
options?: DeletePresetOptions,
|
||||
): UseMutationResult<
|
||||
PresetDeleteResponse, // response data
|
||||
unknown,
|
||||
TPreset | undefined,
|
||||
unknown
|
||||
> => {
|
||||
return useMutation([MutationKeys.deletePreset], {
|
||||
mutationFn: (preset: TPreset | undefined) => dataService.deletePreset(preset),
|
||||
...(options || {}),
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue