MyGit

CopilotKit/CopilotKit

Fork: 856 Star: 8422 (更新于 2024-07-18 22:50:32)

license: MIT

Language: TypeScript .

A framework for building custom AI Copilots 🤖 in-app AI chatbots, in-app AI Agents, & AI-powered Textareas.

最后发布版本: @copilotkit/runtime-client-gql@1.0.9 ( 2024-07-18 16:21:09)

官方网址 GitHub网址

CopilotKit v1.0 release! Read about it here.

CopilotKit Logo

Discord GitHub CI NPM MIT

The Open-Source Copilot Framework

Build, deploy, and operate fully custom AI Copilots.

in-app AI chatbots, AI agents, and AI Textareas.

Join our Discord  ·  Read the Docs  ·  Try Copilot Cloud



"Hello World" Templates

PowerPoint + Copilot
https://github.com/CopilotKit/demo-presentation

Presentation
"Hello World" (A Todo App)
https://github.com/CopilotKit/demo-todo

Todo App
Spreadsheets + Copilot
https://github.com/CopilotKit/demo-spreadsheet

Presentation-Demo
PowerPoint + Copilot + Voice
https://github.com/CopilotKit/demo-presentation-voice

Presentation-Voice

Components

🌟 <CopilotChat />:
Build app-aware AI chatbots that can "see" the current app state + take action inside your app.
The AI chatbot can talk to your app frontend & backend, and to 3rd party services (Salesforce, Dropbox, etc.) via plugins.
Supports generative UI. Start in seconds:

🌟 <CopilotTextarea />:
Drop-in replacement for any <textarea />. AI-assisted text generation.
Autocompletions + AI editing + generate from scratch. Grounded on your users' data and Copilot application context.
Simply change textarea to CopilotTextarea.

🌟 In-App Agents (powered by LangChain):
Give agents access to realtime application context, and let agents take action inside applications.

🌟 Co-Agents (powered by LangChain. Coming soon.):
Allow end-users to observe and intervene in an in-app agent’s operations, with native application UX. End users can correct mistakes in intermediate steps if any were made, and restart agent operation from that point onwards.

How does it work

Define the following simple entry-points into your application, and the CopilotKit🪁 execution engine takes care of the rest!

  • Application state (frontend + backend + 3rd party)
  • Application interaction (via plain typescript code, frontend + backend)
  • Purpose-specific LLM chains
  • and more.

Installation

npm i @copilotkit/react-core @copilotkit/react-ui @copilotkit/react-textarea

Getting started

See quickstart in the docs

Demo

3-min showcase + 3-min implementation tutorial:

CopilotKit_Demo_Jan_zjgjk0.webm

Building blocks

A more comprehensive and up-to-date overview is available in the docs.
But roughly:

Copilot entrypoints

  • useCopilotReadable: give frontend state to the copilot
  • useMakeCopilotDocumentReadable: give document state to the copilot, especially useful with 3rd party state (e.g. Gong call transcript).
  • useCopilotAction: frontend application interaction
  • CopilotRuntime: server side runtime
  • 🚧 useCopilotChain: provide usecase-specific LLM chains

Built-in UI components

  • <CopilotSidebar>: Built in, hackable Copilot UI (optional - you can bring your own UI).
  • <CopilotPopup>: Built in popup UI.
  • <CopilotChat>: Standalone chat UI
  • <CopilotTextarea />: drop-in <textarea /> replacement with Copilot autocompletions.
  • useCopilotChat() for fully-custom UI component
  • 🚧 use custom UX elements inside the chat (coming soon)

Examples

<CopilotSidebar />

import "@copilotkit/react-ui/styles.css"; // add to the app-global css
import { CopilotKit } from "@copilotkit/react-core";
import { CopilotSidebar } from "@copilotkit/react-ui";

function MyAmazingContent() {
  const importantInfo = useImportantInfo();
  useCopilotReadable({
    description: "Very important information",
    value: importantInfo,
  });

  useCopilotAction(
    {
      name: `selectDestinations_${toCamelCase(heading)}`,
      description: `Set the given destinations as 'selected', on the ${heading} table`,
      parameters: [
        {
          name: "destinationNames",
          type: "string[]",
          description: "The names of the destinations to select",
          required: true,
        },
      ],
      handler: async ({ destinationNames }) => {
        setCheckedRows((prevState) => {
          const newState = { ...prevState };
          destinationNames.forEach((destinationName) => {
            newState[destinationName] = true;
          });
          return newState;
        });
      },
    },
    []
  );

  return <YourContent />;
}

export default function App() {
  return (
    <CopilotKit url="/api/copilotkit/chat">
      {" "}
      {/* Global state & copilot logic. Put this around the entire app */}
      <CopilotSidebar>
        {" "}
        {/* A built-in Copilot UI (or bring your own UI). Put around individual pages, or the entire app. */}
        <MyAmazingContent />
      </CopilotSidebar>
    </CopilotKit>
  );
}

<CopilotTextarea />

A drop-in <textarea /> replacement with autocompletions, AI insertions/edits, and generate-from-scratch.
Indexed on data provided to the Copilot.

import "@copilotkit/react-textarea/styles.css"; // add to the app-global css
import { CopilotTextarea } from "@copilotkit/react-textarea";
import { CopilotKit } from "@copilotkit/react-core";

// call ANYWHERE in your app to provide external context (make sure you wrap the app with a <CopilotKit >):
// See below for more features (parent/child hierarchy, categories, etc.)
useCopilotReadable({
  description: "The description of your data",
  value: relevantInformation,
});
useMakeCopilotDocumentReadable(document);

return (
  <CopilotKit url="/api/copilotkit/chat">
    {" "}
    {/* Global state & copilot logic. Put this around the entire app */}
    <CopilotTextarea
      className="p-4 w-1/2 aspect-square font-bold text-3xl bg-slate-800 text-white rounded-lg resize-none"
      placeholder="A CopilotTextarea!"
      autosuggestionsConfig={{
        purposePrompt:
          "A COOL & SMOOTH announcement post about CopilotTextarea. Be brief. Be clear. Be cool.",
        forwardedParams: {
          // additional arguments to customize autocompletions
          max_tokens: 25,
          stop: ["\n", ".", ","],
        },
      }}
    />
  </CopilotKit>
);

Near-Term Roadmap

📊 Please vote on features via the Issues tab!

Copilot-App Interaction

  • useCopilotReadable: give frontend state to the copilot
  • useMakeCopilotDocumentReadable: give document state to the copilot, especially useful with 3rd party state (e.g. Gong call transcript)
  • useCopilotAction: Let the copilot interact with the application
  • 🚧 useMakeCopilotAskable: let the copilot ask for additional information when needed (coming soon)
  • 🚧 useCopilotChain: provide usecase-specific chain
  • 🚧 useEditCopilotMessage: edit the (unsent) typed user message to the copilot (coming soon)
  • 🚧 copilot-assisted navigation: go to the best page to achieve some objective.
  • 🚧 Copilot Cloud: From hosting, chat history, analytics, and evals, to automatic Copilot personalization and self-improvement.

Integrations

  • ✅ Vercel AI SDK
  • ✅ OpenAI APIs
  • 🚧 Langchain
  • 🚧 Additional LLM providers

Frameworks

  • ✅ React
  • 🚧 Vue
  • 🚧 Svelte
  • 🚧 Swift (Mac + iOS)

Contribute

Contributions are welcome! 🎉

We have a dedicated Contributing section in our documentation with detailed guides on how to get started contributing to CopilotKit.

Join the Discord Discord

Contact

atai <at> copilotkit.ai

最近版本更新:(数据更新于 2024-07-21 01:39:27)

2024-07-18 16:21:09 @copilotkit/runtime-client-gql@1.0.9

2024-07-18 16:21:06 @copilotkit/shared@1.0.9

2024-07-18 16:21:03 @copilotkit/runtime@1.0.9

2024-07-18 16:21:00 @copilotkit/react-ui@1.0.9

2024-07-18 16:20:57 @copilotkit/react-textarea@1.0.9

2024-07-18 16:20:54 @copilotkit/react-core@1.0.9

2024-07-17 20:29:09 @copilotkit/shared@1.0.9-mme-modify-append-message.0

2024-07-17 20:29:06 @copilotkit/runtime-client-gql@1.0.9-mme-modify-append-message.0

2024-07-17 20:29:03 @copilotkit/runtime@1.0.9-mme-modify-append-message.0

2024-07-17 20:29:00 @copilotkit/react-ui@1.0.9-mme-modify-append-message.0

主题(topics):

ai, langchain, llm, nextjs, open-source, react, reactjs, ts, typescript

CopilotKit/CopilotKit同语言 TypeScript最近更新仓库

2024-07-20 20:28:47 AIsouler/GKD_subscription

2024-07-20 18:14:36 ZuodaoTech/everyone-can-use-english

2024-07-20 12:01:19 ItzCrazyKns/Perplexica

2024-07-20 05:39:45 continuedev/continue

2024-07-20 00:04:47 lobehub/lobe-chat

2024-07-19 23:09:34 the1812/Bilibili-Evolved