forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
56 lines (51 loc) · 1.62 KB
/
Copy pathApp.tsx
File metadata and controls
56 lines (51 loc) · 1.62 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { useState } from "react";
import { CopilotKitProvider } from "@copilotkit/react-core/v2";
import { CopilotChat } from "@copilotkit/react-core/v2";
import { ExampleLayout } from "@/components/example-layout";
import { ExampleCanvas } from "@/components/example-canvas";
import { ThreadsDrawer } from "@/components/threads-drawer";
import { ThemeProvider } from "@/hooks/use-theme";
import { useExampleSuggestions, useGenerativeUIExamples } from "@/hooks";
import { demonstrationCatalog } from "@/declarative-generative-ui/renderers";
import styles from "@/components/threads-drawer/threads-drawer.module.css";
const runtimeUrl = "/api/copilotkit";
function HomePage() {
useGenerativeUIExamples();
useExampleSuggestions();
const [threadId, setThreadId] = useState<string | undefined>(undefined);
return (
<div className={styles.layout}>
<ThreadsDrawer
agentId="default"
threadId={threadId}
onThreadChange={setThreadId}
/>
<div className={styles.mainPanel}>
<ExampleLayout
chatContent={
<CopilotChat
agentId="default"
threadId={threadId}
input={{ disclaimer: () => null, className: "pb-6" }}
/>
}
appContent={<ExampleCanvas />}
/>
</div>
</div>
);
}
export default function App() {
return (
<ThemeProvider>
<CopilotKitProvider
runtimeUrl={runtimeUrl}
a2ui={{ catalog: demonstrationCatalog }}
openGenerativeUI={{}}
useSingleEndpoint={false}
>
<HomePage />
</CopilotKitProvider>
</ThemeProvider>
);
}