diff --git a/app/page.tsx b/app/page.tsx index 7c5859a..16de2f9 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,16 +1,19 @@ +import { nanoid } from '@/lib/utils' import { Chat } from '@/components/chat' import { Header } from '@/components/header' // export const runtime = 'edge' export const preferredRegion = 'home' -export default async function IndexPage() { +export default function IndexPage() { + const id = nanoid() + return (
{/* @ts-ignore */}
- +
) diff --git a/components/chat-message-actions.tsx b/components/chat-message-actions.tsx index 0ed4564..732206a 100644 --- a/components/chat-message-actions.tsx +++ b/components/chat-message-actions.tsx @@ -20,7 +20,7 @@ export function ChatMessageActions({ return (
{ - append({ + onSubmit={async value => { + await append({ + id, content: value, role: 'user' }) diff --git a/components/chat.tsx b/components/chat.tsx index 0949dff..4e097c9 100644 --- a/components/chat.tsx +++ b/components/chat.tsx @@ -16,7 +16,10 @@ export function Chat({ id, initialMessages, className }: ChatProps) { const { messages, append, reload, stop, isLoading, input, setInput } = useChat({ initialMessages, - id + id, + body: { + id + } }) return (