-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Only show for the last assistant message Mobile UI ![image](https://github.com/LAION-AI/Open-Assistant/assets/33456881/ca2d534d-b6ad-4ff3-bd1b-93769c7b6327) Desktop UI ![image](https://github.com/LAION-AI/Open-Assistant/assets/33456881/612435fc-0dd3-4d23-b2fa-ff0f4d1990fe) --------- Co-authored-by: Andreas Koepf <[email protected]>
- Loading branch information
1 parent
9739bc2
commit 895b662
Showing
5 changed files
with
154 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,66 @@ | ||
import { Badge } from "@chakra-ui/react"; | ||
import { Box, Button, ButtonProps, Card, Flex } from "@chakra-ui/react"; | ||
import { ThumbsDown, ThumbsUp, X } from "lucide-react"; | ||
import { useTranslation } from "next-i18next"; | ||
// kept brief so that it doesnt distract/interfere with user experience | ||
export const EncourageMessage = () => { | ||
|
||
import { messageEntryContainerProps } from "./ChatMessageEntry"; | ||
|
||
export const EncourageMessage = ({ | ||
onClose, | ||
onThumbsDown, | ||
onThumbsUp, | ||
}: { | ||
onThumbsUp: () => void; | ||
onThumbsDown: () => void; | ||
onClose: () => void; | ||
}) => { | ||
const { t } = useTranslation("chat"); | ||
|
||
return ( | ||
<Badge fontWeight="normal" background="gray.300" color="black"> | ||
{t("feedback_message")} | ||
</Badge> | ||
<Box {...messageEntryContainerProps}> | ||
<Card | ||
fontWeight="normal" | ||
p="4" | ||
flexDirection="row" | ||
gap="2" | ||
alignItems="center" | ||
justifyContent={{ base: "center", lg: "space-between" }} | ||
flexWrap="wrap" | ||
textAlign="center" | ||
w="fit-content" | ||
ms={{ | ||
md: "38px", | ||
}} | ||
borderRadius="2xl" | ||
> | ||
{t("feedback_message")} | ||
<Flex> | ||
<FeedBackButton | ||
leftIcon={<ThumbsUp size="20px" />} | ||
onClick={() => { | ||
onThumbsUp(); | ||
onClose(); | ||
}} | ||
> | ||
{t("feedback_action_great")} | ||
</FeedBackButton> | ||
<FeedBackButton | ||
leftIcon={<ThumbsDown size="20px" />} | ||
onClick={() => { | ||
onThumbsDown(); | ||
onClose(); | ||
}} | ||
> | ||
{t("feedback_action_poor")} | ||
</FeedBackButton> | ||
<FeedBackButton p="2" onClick={onClose}> | ||
<X size="20px" /> | ||
</FeedBackButton> | ||
</Flex> | ||
</Card> | ||
</Box> | ||
); | ||
}; | ||
|
||
const FeedBackButton = (props: ButtonProps) => { | ||
return <Button variant="ghost" py="2" px="3" borderRadius="xl" {...props}></Button>; | ||
}; |