Add thinking placeholder message (#496)

This commit is contained in:
Jeremy 2024-11-06 15:21:28 +03:00 committed by GitHub
parent 0001c24d09
commit b5c165714b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 67 additions and 13 deletions

View file

@ -8,7 +8,7 @@ import useSWR, { useSWRConfig } from 'swr';
import { useWindowSize } from 'usehooks-ts';
import { ChatHeader } from '@/components/custom/chat-header';
import { PreviewMessage } from '@/components/custom/message';
import { PreviewMessage, ThinkingMessage } from '@/components/custom/message';
import { useScrollToBottom } from '@/components/custom/use-scroll-to-bottom';
import { Vote } from '@/db/schema';
import { fetcher } from '@/lib/utils';
@ -100,6 +100,12 @@ export function Chat({
/>
))}
{isLoading &&
messages.length > 0 &&
messages[messages.length - 1].role === 'user' && (
<ThinkingMessage />
)}
<div
ref={messagesEndRef}
className="shrink-0 min-w-[24px] min-h-[24px]"