feat: edit and resubmit messages (#592)
This commit is contained in:
parent
2e479ccce7
commit
64d1aad2bb
12 changed files with 302 additions and 25 deletions
|
|
@ -3,7 +3,7 @@ import { UIBlock } from './block';
|
|||
import { PreviewMessage } from './message';
|
||||
import { useScrollToBottom } from './use-scroll-to-bottom';
|
||||
import { Vote } from '@/lib/db/schema';
|
||||
import { Message } from 'ai';
|
||||
import { ChatRequestOptions, Message } from 'ai';
|
||||
|
||||
interface BlockMessagesProps {
|
||||
chatId: string;
|
||||
|
|
@ -12,6 +12,12 @@ interface BlockMessagesProps {
|
|||
isLoading: boolean;
|
||||
votes: Array<Vote> | undefined;
|
||||
messages: Array<Message>;
|
||||
setMessages: (
|
||||
messages: Message[] | ((messages: Message[]) => Message[]),
|
||||
) => void;
|
||||
reload: (
|
||||
chatRequestOptions?: ChatRequestOptions,
|
||||
) => Promise<string | null | undefined>;
|
||||
}
|
||||
|
||||
function PureBlockMessages({
|
||||
|
|
@ -21,6 +27,8 @@ function PureBlockMessages({
|
|||
isLoading,
|
||||
votes,
|
||||
messages,
|
||||
setMessages,
|
||||
reload,
|
||||
}: BlockMessagesProps) {
|
||||
const [messagesContainerRef, messagesEndRef] =
|
||||
useScrollToBottom<HTMLDivElement>();
|
||||
|
|
@ -43,6 +51,8 @@ function PureBlockMessages({
|
|||
? votes.find((vote) => vote.messageId === message.id)
|
||||
: undefined
|
||||
}
|
||||
setMessages={setMessages}
|
||||
reload={reload}
|
||||
/>
|
||||
))}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue