Spaces:
Build error
Build error
Add Query Function Page
Browse files
frontend/app/components/query-section.tsx
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client";
|
| 2 |
+
|
| 3 |
+
import { useChat } from "ai/react";
|
| 4 |
+
import { ChatInput, ChatMessages } from "./ui/chat";
|
| 5 |
+
|
| 6 |
+
export default function QuerySection() {
|
| 7 |
+
const {
|
| 8 |
+
messages,
|
| 9 |
+
input,
|
| 10 |
+
isLoading,
|
| 11 |
+
handleSubmit,
|
| 12 |
+
handleInputChange,
|
| 13 |
+
reload,
|
| 14 |
+
stop,
|
| 15 |
+
} = useChat({ api: process.env.NEXT_PUBLIC_QUERY_API });
|
| 16 |
+
|
| 17 |
+
return (
|
| 18 |
+
<div className="space-y-4 max-w-5xl w-full">
|
| 19 |
+
<ChatMessages
|
| 20 |
+
messages={messages}
|
| 21 |
+
isLoading={isLoading}
|
| 22 |
+
reload={reload}
|
| 23 |
+
stop={stop}
|
| 24 |
+
/>
|
| 25 |
+
<ChatInput
|
| 26 |
+
input={input}
|
| 27 |
+
handleSubmit={handleSubmit}
|
| 28 |
+
handleInputChange={handleInputChange}
|
| 29 |
+
isLoading={isLoading}
|
| 30 |
+
/>
|
| 31 |
+
</div>
|
| 32 |
+
);
|
| 33 |
+
}
|
frontend/app/query/page.tsx
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use client";
|
| 2 |
+
|
| 3 |
+
import Header from "@/app/components/header";
|
| 4 |
+
import Main from "@/app/components/ui/main-container";
|
| 5 |
+
import QuerySection from "@/app/components/query-section";
|
| 6 |
+
|
| 7 |
+
export default function Query() {
|
| 8 |
+
|
| 9 |
+
return (
|
| 10 |
+
<Main>
|
| 11 |
+
<Header />
|
| 12 |
+
<QuerySection />
|
| 13 |
+
</Main>
|
| 14 |
+
);
|
| 15 |
+
}
|