diff --git a/ui/app/share/client-page.js b/ui/app/share/client-page.js index 0a17a1ffd..49a59f71c 100644 --- a/ui/app/share/client-page.js +++ b/ui/app/share/client-page.js @@ -12,6 +12,8 @@ import { InputGroup, InputRightElement, Link, + ListItem, + OrderedList, Stack, Text, Tag, @@ -19,6 +21,7 @@ import { Avatar, useToast, Divider, + UnorderedList, } from "@chakra-ui/react"; import NextLink from "next/link"; import React, { useState } from "react"; @@ -27,23 +30,30 @@ import { useSession } from "next-auth/react"; import { useForm } from "react-hook-form"; import remarkGfm from "remark-gfm"; import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; -import { dracula } from "react-syntax-highlighter/dist/esm/styles/prism"; +import { coldarkDark } from "react-syntax-highlighter/dist/esm/styles/prism"; import { BeatLoader } from "react-spinners"; import { SUPERAGENT_VERSION } from "@/lib/constants"; import { ReactMarkdown } from "react-markdown/lib/react-markdown"; -function LoadingMessage() { +function LoadingMessage({ name = "Bot" }) { return ( - - - Thinking... + + + + + {name} + {" "} + is typing... + ); } function Message({ agent, message, type }) { + const toast = useToast(); + return ( ) : ( @@ -65,15 +75,30 @@ function Message({ agent, message, type }) { {type === "human" ? ( {message} ) : ( - + {children}; + }, + ul({ children }) { + return {children}; + }, + p({ children }) { + return {children}; + }, code({ node, inline, className, children, ...props }) { const value = String(children).replace(/\n$/, ""); const match = /language-(\w+)/.exec(className || ""); const handleCopyCode = () => { navigator.clipboard.writeText(value); + + toast({ + description: "Copied to clipboard", + position: "top", + colorScheme: "gray", + }); }; return !inline ? ( @@ -87,13 +112,14 @@ function Message({ agent, message, type }) { /> {value} @@ -257,7 +283,6 @@ export default function ShareClientPage({ agent, token }) { {messages.map(({ type, message }, index) => ( ))} - {isSubmitting && } - - - - - + {isSubmitting && } + + } + {...register("input", { required: true })} /> - - + + } + /> + + + ); }