File size: 1,173 Bytes
caae15f
 
 
fb3baa1
7d9d30d
caae15f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7d9d30d
 
 
 
 
 
 
caae15f
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"use client";

import { useChat } from "ai/react";
import { ChatInput, ChatMessages } from "@/app/components/ui/chat";
import AutofillQuestion from "@/app/components/ui/autofill-prompt/autofill-prompt-dialog";

export default function QuerySection() {
    const {
        messages,
        input,
        isLoading,
        handleSubmit,
        handleInputChange,
        reload,
        stop,
    } = useChat({ api: process.env.NEXT_PUBLIC_QUERY_API });

    return (
        <div className="space-y-4 max-w-5xl w-full">
            <ChatMessages
                messages={messages}
                isLoading={isLoading}
                reload={reload}
                stop={stop}
            />
            <AutofillQuestion
                messages={messages}
                isLoading={isLoading}
                handleSubmit={handleSubmit}
                handleInputChange={handleInputChange}
                input={input}
            />
            <ChatInput
                input={input}
                handleSubmit={handleSubmit}
                handleInputChange={handleInputChange}
                isLoading={isLoading}
            />
        </div>
    );
}