diff --git a/src/message.tsx b/src/message.tsx index 1e95ac8..3ed507e 100644 --- a/src/message.tsx +++ b/src/message.tsx @@ -12,6 +12,15 @@ import { MessageToolCall } from "@/messageToolCall"; import { MessageToolResp } from "@/messageToolResp"; import { EditMessage } from "@/editMessage"; import logprobToColor from "@/logprob"; +import { + ChatBubble, + ChatBubbleAvatar, + ChatBubbleMessage, + ChatBubbleAction, + ChatBubbleActionWrapper, +} from "@/components/ui/chat/chat-bubble"; +import { useToast } from "@/hooks/use-toast"; +import { ClipboardIcon, PencilIcon, TrashIcon } from "lucide-react"; export const isVailedJSON = (str: string): boolean => { try { @@ -74,10 +83,13 @@ export default function Message(props: Props) { ); + const { toast } = useToast(); const copyToClipboard = (text: string) => { navigator.clipboard.writeText(text); - setShowCopiedHint(true); - setTimeout(() => setShowCopiedHint(false), 1000); + // TODO: Remove show copied hint + toast({ + description: Tr("Message copied to clipboard!"), + }); }; const CopyIcon = ({ textToCopy }: { textToCopy: string }) => { @@ -108,154 +120,154 @@ export default function Message(props: Props) { )} -
- Tokens: {chatStore.totalTokens}/{chatStore.maxTokens} -
-- Cut(s): {chatStore.postBeginIndex}/ - {chatStore.history.filter(({ hide }) => !hide).length} -
-- Cost: ${chatStore.cost.toFixed(4)} / $ - {getTotalCost().toFixed(2)} -
-+ Tokens: {chatStore.totalTokens}/{chatStore.maxTokens} +
++ Cut(s): {chatStore.postBeginIndex}/ + {chatStore.history.filter(({ hide }) => !hide).length} +
++ Cost: ${chatStore.cost.toFixed(4)} / $ + {getTotalCost().toFixed(2)} +
+
+ {Tr("No chat history here")}
+
⚙{Tr("Model")}: {chatStore.model}
+
⬆{Tr("Click above to change the settings of this chat")}
+
↖{Tr("Click the conor to create a new chat")}
+
⚠
+ {Tr(
+ "All chat history and settings are stored in the local browser"
+ )}
+
+
+ {generatingMessage || Tr("Generating...")} + ... +
+ )} +
+ {chatStore.history.length > 0 && (
+
+ )}
+ {chatStore.develop_mode && chatStore.history.length > 0 && (
+
- {generatingMessage || Tr("Generating...")} - ... +
+ {chatStore.postBeginIndex !== 0 && (
+ <>
+
+ {Tr("Info: chat history is too long, forget messages")}:{" "}
+ {chatStore.postBeginIndex}
+ >
+ )}
- {chatStore.history.length > 0 && (
-
+
- {chatStore.postBeginIndex !== 0 && (
- <>
-
- {Tr("Info: chat history is too long, forget messages")}:{" "}
- {chatStore.postBeginIndex}
- >
- )}
-
-