diff --git a/src/components/chat/chat-row.tsx b/src/components/chat/chat-row.tsx index cc9a0aa1..e2c5ea5e 100644 --- a/src/components/chat/chat-row.tsx +++ b/src/components/chat/chat-row.tsx @@ -1,12 +1,15 @@ import { ChatRole } from "@/features/chat/chat-services/models"; import { cn } from "@/lib/utils"; -import { FC } from "react"; +import { FC, useState } from "react"; import remarkGfm from "remark-gfm"; import remarkMath from "remark-math"; import Typography from "../typography"; import { Avatar, AvatarImage } from "../ui/avatar"; import { CodeBlock } from "./code-block"; import { MemoizedReactMarkdown } from "./memoized-react-markdown"; +import { CheckIcon, ClipboardIcon, ClipboardTypeIcon } from "lucide-react"; +import { Button } from "../ui/button"; +import { encode } from "gpt-tokenizer" interface ChatRowProps { name: string; profilePicture: string; @@ -14,8 +17,19 @@ interface ChatRowProps { type: ChatRole; } + const ChatRow: FC = (props) => { + const [isIconChecked, setIsIconChecked] = useState(false); + const toggleIcon = () => { + setIsIconChecked(prevState => !prevState); + }; + + const handleButtonClick = () => { + toggleIcon(); + navigator.clipboard.writeText(props.message); + }; return ( +
= (props) => { {props.name} - + + Tokens count: {encode(props.message).length} +
@@ -76,8 +100,8 @@ const ChatRow: FC = (props) => { }} > {props.message} - -
+ + ); diff --git a/src/package.json b/src/package.json index 2ae3ac3d..5b355684 100644 --- a/src/package.json +++ b/src/package.json @@ -28,6 +28,7 @@ "clsx": "^2.0.0", "eslint": "^8.46.0", "eslint-config-next": "^13.4.12", + "gpt-tokenizer": "^2.1.1", "langchain": "^0.0.123", "lucide-react": "^0.264.0", "nanoid": "^4.0.2",