mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-11 03:54:23 +01:00
🗣 fix: Add Various State Change Announcements (#11495)
* fix: Agent Builder Reset button announcements * fix: special variables announcements * fix: model select announcements * fix: prompt deletion announcement * refactor: encapsulate model display name logic * chore: address comments * chore: re-order i18n strings
This commit is contained in:
parent
fcb363403a
commit
46624798b6
5 changed files with 39 additions and 2 deletions
|
|
@ -14,6 +14,7 @@ import {
|
|||
import { useDeletePromptGroup, useUpdatePromptGroup } from '~/data-provider';
|
||||
import CategoryIcon from '~/components/Prompts/Groups/CategoryIcon';
|
||||
import { useLocalize, useResourcePermissions } from '~/hooks';
|
||||
import { useLiveAnnouncer } from '~/Providers';
|
||||
import { cn } from '~/utils';
|
||||
|
||||
interface DashGroupItemProps {
|
||||
|
|
@ -25,6 +26,7 @@ function DashGroupItemComponent({ group, instanceProjectId }: DashGroupItemProps
|
|||
const params = useParams();
|
||||
const navigate = useNavigate();
|
||||
const localize = useLocalize();
|
||||
const { announcePolite } = useLiveAnnouncer();
|
||||
|
||||
const blurTimeoutRef = useRef<NodeJS.Timeout | null>(null);
|
||||
const [nameInputValue, setNameInputValue] = useState(group.name);
|
||||
|
|
@ -49,6 +51,8 @@ function DashGroupItemComponent({ group, instanceProjectId }: DashGroupItemProps
|
|||
const deleteGroup = useDeletePromptGroup({
|
||||
onSuccess: (_response, variables) => {
|
||||
if (variables.id === group._id) {
|
||||
const announcement = localize('com_ui_prompt_deleted', { 0: group.name });
|
||||
announcePolite({ message: announcement, isStatus: true });
|
||||
navigate('/d/prompts');
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { useFormContext } from 'react-hook-form';
|
|||
import { DropdownPopup } from '@librechat/client';
|
||||
import { specialVariables } from 'librechat-data-provider';
|
||||
import type { TSpecialVarLabel } from 'librechat-data-provider';
|
||||
import { useLiveAnnouncer } from '~/Providers';
|
||||
import { useLocalize } from '~/hooks';
|
||||
|
||||
interface VariableOption {
|
||||
|
|
@ -30,6 +31,7 @@ export default function VariablesDropdown({
|
|||
const localize = useLocalize();
|
||||
const methods = useFormContext();
|
||||
const { setValue, getValues } = methods;
|
||||
const { announcePolite } = useLiveAnnouncer();
|
||||
|
||||
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
||||
|
||||
|
|
@ -39,6 +41,8 @@ export default function VariablesDropdown({
|
|||
const prefix = localize(label);
|
||||
setValue(fieldName, currentText + spacer + prefix + ': ' + value);
|
||||
setIsMenuOpen(false);
|
||||
const announcement = localize('com_ui_special_variable_added', { 0: prefix });
|
||||
announcePolite({ message: announcement, isStatus: true });
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue