Skip to content

API 概览

本文档提供 AI 小鲸 v2.0 所有包的 API 总览,帮助你快速了解各模块的职责与导出内容。

包一览

包名用途关键导出
@blueking/ai-blueking业务组件层AIBluekingChatBot、Managers
@blueking/ai-blueking/standalone非 Vue 宿主(v2.1.4-beta.8+)mountAIBluekingmountChatBot、内联 Vue 3
@blueking/chat-x纯 UI 组件ChatInputMessageContainerMessageRender
@blueking/chat-helper业务 SDKuseChatHelperAGUIProtocol

我该用哪个包?

根据你的场景,按照以下决策树选择合适的包:

包选择决策树

场景对比

场景推荐方案说明
SaaS 平台快速接入AIBlueking开箱即用,含弹窗、拖拽、会话管理等完整功能
嵌入已有页面的聊天窗口ChatBot轻量级,仅包含核心聊天功能
宿主无 Vue(React、纯 HTML 等)@blueking/ai-blueking/standalonemountAIBlueking / mountChatBot,见 Standalone 指南
自定义聊天界面chat-x + chat-helper最大灵活性,自由组合 UI 组件与业务逻辑

导入参考

typescript
// ========================
// @blueking/ai-blueking
// ========================

// 主组件(Vue 3 宿主)
import { AIBlueking, ChatBot } from '@blueking/ai-blueking';

// 样式引入(按 Vue 版本选择)
import '@blueking/ai-blueking/dist/vue3/style.css';  // Vue 3
// import '@blueking/ai-blueking/dist/vue2/style.css';  // Vue 2

// 非 Vue 宿主(v2.1.4-beta.8+)
// import { mountAIBlueking } from '@blueking/ai-blueking/standalone';
// import '@blueking/ai-blueking/dist/standalone/style.css';

// Composables
import { useChatBootstrap } from '@blueking/ai-blueking';

// Managers(业务管理器)
import {
  ComponentManager,
  ChatBusinessManager,
  SessionBusinessManager,
  ShortcutManager,
  UIStateManager,
} from '@blueking/ai-blueking';

// ========================
// @blueking/chat-x
// ========================

// UI 组件
import {
  ChatInput,
  MessageContainer,
  MessageRender,
  ShortcutRender,
  AiSelection,
} from '@blueking/chat-x';

// ========================
// @blueking/chat-helper
// ========================

// SDK
import { useChatHelper, AGUIProtocol } from '@blueking/chat-helper';

包依赖关系

包依赖关系

  • ai-blueking 是最上层的业务组件包,内部依赖 chat-xchat-helper
  • chat-x 是纯 UI 层,不包含任何业务逻辑,可独立使用。
  • chat-helper 是纯业务 SDK 层,负责与后端通信、状态管理,不包含任何 UI。

快速链接

All Rights Reserved. 腾讯蓝鲸 版权所有