1- " use client" ;
1+ ' use client' ;
22
3- import type { Attachment , Message } from "ai" ;
4- import { useChat } from "ai/react" ;
5- import { useState } from "react" ;
6- import useSWR , { useSWRConfig } from "swr" ;
3+ import type { Attachment , Message } from 'ai' ;
4+ import { useChat } from 'ai/react' ;
5+ import { useState } from 'react' ;
6+ import { toast } from 'sonner' ;
7+ import useSWR , { useSWRConfig } from 'swr' ;
78
8- import { ChatHeader } from "@/components/chat-header" ;
9- import type { Vote } from "@/lib/db/schema" ;
10- import { fetcher , generateUUID } from "@/lib/utils" ;
9+ import { ChatHeader } from '@/components/chat-header' ;
10+ import { useArtifactSelector } from '@/hooks/use-artifact' ;
11+ import type { Vote } from '@/lib/db/schema' ;
12+ import { fetcher , generateUUID } from '@/lib/utils' ;
1113
12- import { Artifact } from "./artifact" ;
13- import { MultimodalInput } from "./multimodal-input" ;
14- import { Messages } from "./messages" ;
15- import { VisibilityType } from "./visibility-selector" ;
16- import { useArtifactSelector } from "@/hooks/use-artifact" ;
17- import { toast } from "sonner" ;
14+ import { Artifact } from './artifact' ;
15+ import { Messages } from './messages' ;
16+ import { MultimodalInput } from './multimodal-input' ;
17+ import type { VisibilityType } from './visibility-selector' ;
1818
1919export function Chat ( {
2020 id,
2121 initialMessages,
22- selectedChatModel,
2322 isReadonly,
2423} : {
2524 id : string ;
2625 initialMessages : Array < Message > ;
27- selectedChatModel : string ;
2826 selectedVisibilityType : VisibilityType ;
2927 isReadonly : boolean ;
3028} ) {
@@ -42,22 +40,22 @@ export function Chat({
4240 reload,
4341 } = useChat ( {
4442 id,
45- body : { id, selectedChatModel : selectedChatModel } ,
43+ body : { id } ,
4644 initialMessages,
4745 experimental_throttle : 100 ,
4846 sendExtraMessageFields : true ,
4947 generateId : generateUUID ,
5048 onFinish : ( ) => {
51- mutate ( " /api/history" ) ;
49+ mutate ( ' /api/history' ) ;
5250 } ,
5351 onError : ( error ) => {
54- toast . error ( " An error occured, please try again!" ) ;
52+ toast . error ( ' An error occured, please try again!' ) ;
5553 } ,
5654 } ) ;
5755
5856 const { data : votes } = useSWR < Array < Vote > > (
5957 `/api/vote?chatId=${ id } ` ,
60- fetcher
58+ fetcher ,
6159 ) ;
6260
6361 const [ attachments , setAttachments ] = useState < Array < Attachment > > ( [ ] ) ;
0 commit comments