We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi! Excellent work on this library. I'm not sure what I am doing wrong, there are no errors but the scroll area and markdown are not working.
The below code is based on this example.
I followed the docks to add scroll area and markdown, but it appears to do nothing. Thank you for the help!
'use client'; import { ComposerPrimitive, MessagePrimitive, ThreadPrimitive, } from '@assistant-ui/react'; import type { FC } from 'react'; import { Avatar, AvatarFallback } from '../avatar'; import { Bot, SendHorizontalIcon } from 'lucide-react'; import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area'; import { ScrollBar } from '@upcaret/ui'; import { MarkdownText } from './markdown-text'; export const CostcoBotThread: FC = () => { return ( <ScrollAreaPrimitive.Root asChild> <ThreadPrimitive.Root className="flex h-full flex-col items-center pb-3"> <ScrollAreaPrimitive.Viewport className="thread-viewport" asChild> <ThreadPrimitive.Viewport className="flex w-full flex-grow flex-col items-center overflow-y-scroll scroll-smooth px-4 pt-12"> <ThreadPrimitive.Empty> <ThreadEmpty /> </ThreadPrimitive.Empty> <ThreadPrimitive.Messages components={{ UserMessage, AssistantMessage, }} /> </ThreadPrimitive.Viewport> </ScrollAreaPrimitive.Viewport> <ScrollBar /> <Composer /> </ThreadPrimitive.Root> </ScrollAreaPrimitive.Root> ); }; const ThreadEmpty: FC = () => { return ( <div className="flex flex-grow flex-col items-center justify-center"> <Avatar> <AvatarFallback> <Bot /> </AvatarFallback> </Avatar> <p className="mt-4 text-xl">How can I help you today?</p> </div> ); }; const Composer: FC = () => { return ( <ComposerPrimitive.Root className="flex w-[calc(100%-32px)] max-w-[42rem] items-end rounded-lg border p-0.5 transition-shadow focus-within:shadow-sm"> <ComposerPrimitive.Input placeholder="Write a message..." className="placeholder:text-foreground/50 h-12 max-h-40 flex-grow resize-none bg-transparent p-3.5 text-sm outline-none" /> <ThreadPrimitive.If running={false}> <ComposerPrimitive.Send className="bg-primary m-2 flex h-8 w-8 items-center justify-center rounded-md text-2xl font-bold shadow transition-opacity disabled:opacity-45"> <SendHorizontalIcon className="text-background size-4" /> </ComposerPrimitive.Send> </ThreadPrimitive.If> <ThreadPrimitive.If running> <ComposerPrimitive.Cancel className="border-primary m-3.5 flex size-5 items-center justify-center rounded-full border-2"> <div className="bg-primary size-2 rounded-[1px]" /> </ComposerPrimitive.Cancel> </ThreadPrimitive.If> </ComposerPrimitive.Root> ); }; const UserMessage: FC = () => { return ( <MessagePrimitive.Root className="relative mb-6 flex w-full max-w-2xl flex-col items-end gap-2 pl-24"> <div className="relative mr-1 flex items-start gap-3"> <div className="bg-foreground/5 text-foreground max-w-xl break-words rounded-3xl px-5 py-2.5"> <MessagePrimitive.Content components={{ Text: MarkdownText }} /> </div> </div> </MessagePrimitive.Root> ); }; const AssistantMessage: FC = () => { return ( <MessagePrimitive.Root className="relative mb-6 flex w-full max-w-2xl gap-3"> <Avatar> <AvatarFallback>A</AvatarFallback> </Avatar> <div className="mt-2 flex-grow"> <div className="text-foreground max-w-x break-words"> <MessagePrimitive.Content /> </div> </div> </MessagePrimitive.Root> ); };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi! Excellent work on this library. I'm not sure what I am doing wrong, there are no errors but the scroll area and markdown are not working.
The below code is based on this example.
I followed the docks to add scroll area and markdown, but it appears to do nothing. Thank you for the help!
The text was updated successfully, but these errors were encountered: