Skip to content

Latest commit

 

History

History
84 lines (70 loc) · 2.26 KB

File metadata and controls

84 lines (70 loc) · 2.26 KB
title Step 2: Setup CopilotKit

Now that we have our todo list app running, we're ready to integrate CopilotKit. For this tutorial, we will install the following dependencies:

  • @copilotkit/react-core: The core library for CopilotKit, which contains the CopilotKit provider and useful hooks.
  • @copilotkit/react-textarea: The textarea component for CopilotKit, which enables you to get instant context-aware autocompletions in your app.

Install Dependencies

To install the CopilotKit dependencies, run the following:

npm install @copilotkit/react-core @copilotkit/react-textarea

Setup CopilotKit

} > In order to use CopilotKit, we'll need to configure the CopilotKit provider. } > ### Set up Copilot Runtime Endpoint ### Configure the CopilotKit Provider
"use client";

export default function Home() {
  return (
    <CopilotKit runtimeUrl="/api/copilotkit">
      {" "}
      // [!code highlight]
      <EmailsProvider>
        <EmailThread />
      </EmailsProvider>
      {/* [!code highlight:1] */}
    </CopilotKit>
  );
}

Let's break this down:

  • First, we imported the CopilotKit provider from @copilotkit/react-core/v2.
  • Then, we wrapped the page with the <CopilotKit> provider.
  • We imported the built-in styles from @copilotkit/react-textarea.