mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-07-24 12:50:50 +08:00
* website: Support new widget types for labelling Adds proper support for yes/no spam style questions as well as a simple interface for flag style labels. Also cleaned up the Task component to fix some rerender issues. * website: Fix some UI text, adjust yes/no button alignment * website: Remove left over console.log Co-authored-by: notmd <33456881+notmd@users.noreply.github.com> --------- Co-authored-by: notmd <33456881+notmd@users.noreply.github.com>
24 lines
726 B
TypeScript
24 lines
726 B
TypeScript
import { Box, forwardRef, useColorMode } from "@chakra-ui/react";
|
|
import { useMemo } from "react";
|
|
import { Message } from "src/types/Conversation";
|
|
|
|
export const MessageView = forwardRef<Partial<Message>, "div">((message: Partial<Message>, ref) => {
|
|
const { colorMode } = useColorMode();
|
|
|
|
const bgColor = useMemo(() => {
|
|
if (colorMode === "light") {
|
|
return message.is_assistant ? "gray.800" : "blue.600";
|
|
} else {
|
|
return message.is_assistant ? "black" : "blue.600";
|
|
}
|
|
}, [colorMode, message.is_assistant]);
|
|
|
|
return (
|
|
<Box bg={bgColor} ref={ref} className={`p-4 rounded-md text-white whitespace-pre-wrap`}>
|
|
{message.text}
|
|
</Box>
|
|
);
|
|
});
|
|
|
|
MessageView.displayName = "MessageView";
|