@ copilotkit/ 频道
@copilotkit/channels 是包含电池的 CopilotKit Channels 软件包。 一个安装
提供引擎,JSX词汇,UI原始,测试API,以及每个被支持的适配器.
频道通过频道跑道运行. 副驾驶Kit情报部门提供
管理下跑者,可在自由计划中使用: CopilotRuntime 开始和拥有
每个频道的生命周期,一旦配置智能。 你也可以建造和
在SDK原始版下层操作自己的频道跑取器,没有
情报依赖——一个支持路径,你的团队拥有状态,
持久性、货币性、锁定性、再试和种族条件处理.
安装
pnpm add @copilotkit/channels
配置 TypeScript 用于频道 JSX 运行时间 :
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "@copilotkit/channels"
}
}
import { createChannel, Message, Section } from "@copilotkit/channels";
import { slack } from "@copilotkit/channels/slack";
import { CopilotRuntime, CopilotKitIntelligence } from "@copilotkit/runtime/v2";
import { createCopilotNodeListener } from "@copilotkit/runtime/v2/node";
const channel = createChannel({
name: "support-bot", // project-unique Intelligence Channel name
identifyUser: "platform",
adapters: [
slack({
botToken: process.env.SLACK_BOT_TOKEN!,
appToken: process.env.SLACK_APP_TOKEN!,
}),
],
});
channel.onMessage(({ thread, message }) =>
thread.post(
<Message>
<Section>Echo: {message.text}</Section>
</Message>,
),
);
// The runtime owns the Channel's lifecycle — there is no `channel.start()`.
const runtime = new CopilotRuntime({
intelligence: new CopilotKitIntelligence({
// apiUrl and wsUrl default to cloud-hosted CopilotKit Intelligence — override
// both together only for a self-hosted deployment.
apiKey: process.env.CPK_INTELLIGENCE_API_KEY!, // free tier available
}),
channels: [channel],
});
// Creating the listener starts the Channel's connection.
const listener = createCopilotNodeListener({ runtime });
// Optional: await that activation so a broken config fails startup loudly.
await listener.channels.ready(); // listener.channels.stop() tears it down
适应器切入点
@copilotkit/channels/slack(单位:千美元)/slack/codec财务报告和审定财务报表/slack/render(中文(简体) )@copilotkit/channels/teams(单位:千美元)/teams/render(中文(简体) )@copilotkit/channels/discord@copilotkit/channels/whatsapp
一个软件包版本给你一个测试过的核心引擎快照 JSX/UI词汇, 测试辅助器,以及上面列出的所有适配器.
@copilotkit/channels/teams 需要微软365代理SDK,这是一个
可选同伴依赖 而不为您安装
pnpm add @microsoft/agents-hosting @microsoft/agents-activity
只有自办的团队适配器需要它. @copilotkit/channels/teams/render
没有,这就是为什么SDK 远离从未运行过团队的安装
内入. express 也是可选的对等器, 懒散地装入, 只需要由
内置 createTeamsServer 听着.
对于适配器作者或选择性依赖性图表,安装
@copilotkit/channels-core 加您需要的直接适配软件包,例如:
pnpm add @copilotkit/channels-core @copilotkit/channels-slack