feat: add reasoning tests (#856)
This commit is contained in:
parent
39729644df
commit
9628c54755
11 changed files with 420 additions and 155 deletions
|
|
@ -44,6 +44,7 @@ export function MessageReasoning({
|
|||
<div className="flex flex-row gap-2 items-center">
|
||||
<div className="font-medium">Reasoned for a few seconds</div>
|
||||
<button
|
||||
data-testid="message-reasoning-toggle"
|
||||
type="button"
|
||||
className="cursor-pointer"
|
||||
onClick={() => {
|
||||
|
|
@ -58,6 +59,7 @@ export function MessageReasoning({
|
|||
<AnimatePresence initial={false}>
|
||||
{isExpanded && (
|
||||
<motion.div
|
||||
data-testid="message-reasoning"
|
||||
key="content"
|
||||
initial="collapsed"
|
||||
animate="expanded"
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ const PurePreviewMessage = ({
|
|||
return (
|
||||
<AnimatePresence>
|
||||
<motion.div
|
||||
data-testid={`message-${message.role}-${index}`}
|
||||
data-testid={`message-${message.role}`}
|
||||
className="w-full mx-auto max-w-3xl px-4 group/message"
|
||||
initial={{ y: 5, opacity: 0 }}
|
||||
animate={{ y: 0, opacity: 1 }}
|
||||
|
|
@ -73,7 +73,7 @@ const PurePreviewMessage = ({
|
|||
<div className="flex flex-col gap-4 w-full">
|
||||
{message.experimental_attachments && (
|
||||
<div
|
||||
data-testid={`message-attachments-${index}`}
|
||||
data-testid={`message-attachments`}
|
||||
className="flex flex-row justify-end gap-2"
|
||||
>
|
||||
{message.experimental_attachments.map((attachment) => (
|
||||
|
|
@ -93,12 +93,15 @@ const PurePreviewMessage = ({
|
|||
)}
|
||||
|
||||
{(message.content || message.reasoning) && mode === 'view' && (
|
||||
<div className="flex flex-row gap-2 items-start">
|
||||
<div
|
||||
data-testid="message-content"
|
||||
className="flex flex-row gap-2 items-start"
|
||||
>
|
||||
{message.role === 'user' && !isReadonly && (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
data-testid={`edit-${message.role}-${index}`}
|
||||
data-testid={`message-edit`}
|
||||
variant="ghost"
|
||||
className="px-2 h-fit rounded-full text-muted-foreground opacity-0 group-hover/message:opacity-100"
|
||||
onClick={() => {
|
||||
|
|
@ -243,6 +246,7 @@ export const ThinkingMessage = () => {
|
|||
|
||||
return (
|
||||
<motion.div
|
||||
data-testid="message-assistant-loading"
|
||||
className="w-full mx-auto max-w-3xl px-4 group/message "
|
||||
initial={{ y: 5, opacity: 0 }}
|
||||
animate={{ y: 0, opacity: 1, transition: { delay: 1 } }}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,11 @@ export function ModelSelector({
|
|||
className,
|
||||
)}
|
||||
>
|
||||
<Button variant="outline" className="md:px-2 md:h-[34px]">
|
||||
<Button
|
||||
data-testid="model-selector"
|
||||
variant="outline"
|
||||
className="md:px-2 md:h-[34px]"
|
||||
>
|
||||
{selectedChatModel?.name}
|
||||
<ChevronDownIcon />
|
||||
</Button>
|
||||
|
|
@ -50,6 +54,7 @@ export function ModelSelector({
|
|||
|
||||
return (
|
||||
<DropdownMenuItem
|
||||
data-testid={`model-selector-item-${id}`}
|
||||
key={id}
|
||||
onSelect={() => {
|
||||
setOpen(false);
|
||||
|
|
@ -59,19 +64,24 @@ export function ModelSelector({
|
|||
saveChatModelAsCookie(id);
|
||||
});
|
||||
}}
|
||||
className="gap-4 group/item flex flex-row justify-between items-center"
|
||||
data-active={id === optimisticModelId}
|
||||
asChild
|
||||
>
|
||||
<div className="flex flex-col gap-1 items-start">
|
||||
<div>{chatModel.name}</div>
|
||||
<div className="text-xs text-muted-foreground">
|
||||
{chatModel.description}
|
||||
<button
|
||||
type="button"
|
||||
className="gap-4 group/item flex flex-row justify-between items-center w-full"
|
||||
>
|
||||
<div className="flex flex-col gap-1 items-start">
|
||||
<div>{chatModel.name}</div>
|
||||
<div className="text-xs text-muted-foreground">
|
||||
{chatModel.description}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="text-foreground dark:text-foreground opacity-0 group-data-[active=true]/item:opacity-100">
|
||||
<CheckCircleFillIcon />
|
||||
</div>
|
||||
<div className="text-foreground dark:text-foreground opacity-0 group-data-[active=true]/item:opacity-100">
|
||||
<CheckCircleFillIcon />
|
||||
</div>
|
||||
</button>
|
||||
</DropdownMenuItem>
|
||||
);
|
||||
})}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue