forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage.tsx
More file actions
59 lines (59 loc) · 1.52 KB
/
Copy pathpage.tsx
File metadata and controls
59 lines (59 loc) · 1.52 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
57
58
59
"use client";
import {
CopilotKit,
useCopilotAction,
useCopilotReadable,
} from "@copilotkit/react-core";
import { CopilotTextarea } from "@copilotkit/react-textarea";
import { CopilotSidebar } from "@copilotkit/react-ui";
import "@copilotkit/react-ui/styles.css";
import { useState } from "react";
import "@copilotkit/react-textarea/styles.css";
import "@copilotkit/react-ui/styles.css";
function InsideHome() {
const [message, setMessage] = useState("Hello World!");
const [text, setText] = useState("");
useCopilotReadable({
description: "This is the current message",
value: message,
});
useCopilotAction(
{
name: "displayMessage",
description: "Display a message.",
parameters: [
{
name: "message",
type: "string",
description: "The message to display.",
required: true,
},
],
handler: async ({ message }) => {
setMessage(message);
},
},
[],
);
return (
<div className="h-screen w-full flex items-center justify-center text-2xl">
{message}
</div>
);
}
export default function Home() {
return (
<CopilotKit url="http://127.0.0.1:5001/copilotkit-test-12345/us-central1/copilotKit">
<CopilotSidebar
defaultOpen={true}
labels={{
title: "Presentation Copilot",
initial: "Hi you! 👋 I can give you a presentation on any topic.",
}}
clickOutsideToClose={false}
>
<InsideHome />
</CopilotSidebar>
</CopilotKit>
);
}