扫一扫分享
CopilotKit是一个开源框架,用于将强大的AI Copilots集成到任何应用程序中。轻松实现自定义AI聊天机器人、AI代理、AI文本区域等。
它基于 OpenAI 的 GPT 模型,提供了简单易用的 api 和组件,使开发者能够轻松构建智能对话系统、代码补全工具和其他 AI 驱动的功能。CopilotKit 的优势在于其高度模块化和灵活性,开发者可以根据自己的需求定制 AI 助手的行为和功能,同时它还支持多种编程语言和框架,适用于各种开发场景。
本地开发
从https://cloud.copilotkit.ai/中获取apikey,再在代码中设置copilotkit apikey
import "./globals.css";
import { ReactNode } from "react";
import { CopilotKit } from "@copilotkit/react-core";
export default function RootLayout({ children }: { children: ReactNode }) {
return (
<html lang="en">
<body>
{/* Use the public api key you got from Copilot Cloud */}
<CopilotKit publicApiKey="<your-copilot-cloud-public-api-key>">
{children}
</CopilotKit>
</body>
</html>
);
}最后配置前端,将默认样式导入root组件(通常是layout.tsx ):
import "@copilotkit/react-ui/styles.css";CopilotPopup是CopilotChat的便利包装,它与视图层次结构中的主要内容相同。它提供了一个可以打开和关闭的浮动聊天接口。
import { CopilotPopup } from "@copilotkit/react-ui";
export function YourApp() {
return (
<>
<YourMainContent />
<CopilotPopup
instructions={"You are assisting the user as best as you can. Answer in the best way possible given the data you have."}
labels={{
title: "Popup Assistant",
initial: "Need any help?",
}}
/>
</>
);
}
Docker
docker pull copilotkit/copilotkit
docker run -d -p 5000:5000 copilotkit/copilotkit仅供个人学习参考/导航指引使用,具体请以第三方网站说明为准,本站不提供任何专业建议。如果地址失效或描述有误,请联系站长反馈~感谢您的理解与支持!
手机预览