Skip to content

Commit 1ddfa9b

Browse files
committed
add imports, slightly simplify
1 parent b827f44 commit 1ddfa9b

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pnpm install @copilotkit/react-core @copilotkit/react-ui
1515
## Examples
1616

1717

18-
### Integrate copilot with 2 lines of code
18+
### Integrate copilot (2 lines of code)
1919

2020
```typescript
2121
import { CopilotProvider } from "@copilotkit/react-core";
@@ -35,7 +35,9 @@ export default function App(): JSX.Element {
3535
### Let the copilot read the current state of your app
3636

3737
```typescript
38-
function DepartmentComponent(props: DepartmentComponentProps): JSX.Element {
38+
import { useMakeCopilotReadable } from "@copilotkit/react-core";
39+
40+
function Department(props: DepartmentProps): JSX.Element {
3941
const { departmentData, employees } = props;
4042

4143
// Give the copilot information about this department. Keep the pointer, to easily associate employees w departments.
@@ -48,7 +50,7 @@ function DepartmentComponent(props: DepartmentComponentProps): JSX.Element {
4850
<h2>Employees:</h2>
4951

5052
{employees.map((employeeData) => (
51-
<EmployeeComponent
53+
<Employee
5254
employeeData={employeeData}
5355
departmentCopilotPointer={departmentCopilotPointer} // pass the copilot pointer
5456
/>
@@ -57,7 +59,7 @@ function DepartmentComponent(props: DepartmentComponentProps): JSX.Element {
5759
);
5860
}
5961

60-
function EmployeeComponent(props: EmployeeComponentProps): JSX.Element {
62+
function Employee(props: EmployeeProps): JSX.Element {
6163
const { employeeData, departmentCopilotPointer } = props;
6264

6365
// Give the copilot information about this employee.
@@ -72,6 +74,8 @@ function EmployeeComponent(props: EmployeeComponentProps): JSX.Element {
7274
### Let the copilot interact with your app
7375

7476
```typescript
77+
import { useMakeCopilotActionable } from "@copilotkit/react-core";
78+
7579
function DepartmentComponent(props: DepartmentComponentProps): JSX.Element {
7680
// Give the copilot an entrypoint to take action on behalf of the user.
7781
useMakeCopilotActionable(

0 commit comments

Comments
 (0)