mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-23 11:50:14 +01:00
* feat: working started for feedback implementation. TODO: - needs some refactoring. - needs some UI animations. * feat: working rate functionality * feat: works now as well to reader the already rated responses from the server. * feat: added the option to give feedback in text (optional) * feat: added Dismiss option `x` to the `FeedbackTagOptions` * ✨ feat: Add rating and ratingContent fields to message schema * 🔧 chore: Bump version to 0.0.3 in package.json * ✨ feat: Enhance feedback localization and update UI elements * 🚀 feat: Implement feedback tagging system with thumbs up/down options * 🚀 feat: Add data-provider package to unused i18n keys detection * 🎨 style: update HoverButtons' style * 🎨 style: Update HoverButtons and Fork components for improved styling and visibility * 🔧 feat: Implement feedback system with rating and content options * 🔧 feat: Enhance feedback handling with improved rating toggle and tag options * 🔧 feat: Integrate toast notifications for feedback submission and clean up unused state * 🔧 feat: Remove unused feedback tag options from translation file * ✨ refactor: clean up Feedback component and improve HoverButtons structure * ✨ refactor: remove unused settings switches for auto scroll, hide side panel, and user message markdown * refactor: reorganize import order * ✨ refactor: enhance HoverButtons and Fork components with improved styles and animations * ✨ refactor: update feedback response phrases for improved user engagement * ✨ refactor: add CheckboxOption component and streamline fork options rendering * Refactor feedback components and logic - Consolidated feedback handling into a single Feedback component, removing FeedbackButtons and FeedbackTagOptions. - Introduced new feedback tagging system with detailed tags for both thumbs up and thumbs down ratings. - Updated feedback schema to include new tags and improved type definitions. - Enhanced user interface for feedback collection, including a dialog for additional comments. - Removed obsolete files and adjusted imports accordingly. - Updated translations for new feedback tags and placeholders. * ✨ refactor: update feedback handling by replacing rating fields with feedback in message updates * fix: add missing validateMessageReq middleware to feedback route and refactor feedback system * 🗑️ chore: Remove redundant fork option explanations from translation file * 🔧 refactor: Remove unused dependency from feedback callback * 🔧 refactor: Simplify message update response structure and improve error logging * Chore: removed unused tests. --------- Co-authored-by: Marco Beretta <81851188+berry-13@users.noreply.github.com>
64 lines
2 KiB
TypeScript
64 lines
2 KiB
TypeScript
import React from 'react';
|
|
import { motion } from 'framer-motion';
|
|
import { MessageCircleDashed } from 'lucide-react';
|
|
import { useRecoilState, useRecoilCallback } from 'recoil';
|
|
import { TooltipAnchor } from '~/components/ui';
|
|
import { useChatContext } from '~/Providers';
|
|
import { useLocalize } from '~/hooks';
|
|
import { cn } from '~/utils';
|
|
import store from '~/store';
|
|
|
|
export function TemporaryChat() {
|
|
const localize = useLocalize();
|
|
const [isTemporary, setIsTemporary] = useRecoilState(store.isTemporary);
|
|
const { conversation, isSubmitting } = useChatContext();
|
|
|
|
const temporaryBadge = {
|
|
id: 'temporary',
|
|
icon: MessageCircleDashed,
|
|
label: 'com_ui_temporary' as const,
|
|
atom: store.isTemporary,
|
|
isAvailable: true,
|
|
};
|
|
|
|
const handleBadgeToggle = useRecoilCallback(
|
|
() => () => {
|
|
setIsTemporary(!isTemporary);
|
|
},
|
|
[isTemporary],
|
|
);
|
|
|
|
if (
|
|
(Array.isArray(conversation?.messages) && conversation.messages.length >= 1) ||
|
|
isSubmitting
|
|
) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<div className="relative flex flex-wrap items-center gap-2">
|
|
<TooltipAnchor
|
|
description={localize(temporaryBadge.label)}
|
|
render={
|
|
<button
|
|
onClick={handleBadgeToggle}
|
|
aria-label={localize(temporaryBadge.label)}
|
|
className={cn(
|
|
'inline-flex size-10 flex-shrink-0 items-center justify-center rounded-xl border border-border-light text-text-primary transition-all ease-in-out hover:bg-surface-tertiary',
|
|
isTemporary
|
|
? 'bg-surface-active shadow-md'
|
|
: 'bg-transparent shadow-sm hover:bg-surface-hover hover:shadow-md',
|
|
'active:shadow-inner',
|
|
)}
|
|
>
|
|
{temporaryBadge.icon && (
|
|
<temporaryBadge.icon
|
|
className={cn('relative h-5 w-5 md:h-4 md:w-4', !temporaryBadge.label && 'mx-auto')}
|
|
/>
|
|
)}
|
|
</button>
|
|
}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|