本页内容
Sommatic 文档
打开控制台

SDK

React SDK(@sommatic/react-sdk)把 Sommatic AI 带入你的 Web 应用:API 服务、实时事件流、指挥中心、工作流画布以及任务组件。

以 Markdown 查看
在以下应用中打开

Sommatic AI 控制台本身就是用 @sommatic/react-sdk 构建的。借助它,你的 React 应用可以通过 API 读取和修改工作流、 知识与任务,实时跟踪运行过程和任务分派,嵌入指挥中心,并把任务展示给需要处理它们的人。

包内包含什么

部分你能得到什么
配置configureSommatic:一次调用,把所有服务和事件流指向你的后端。
服务每个 API 资源对应一个类(WorkflowOrchestrationFlowDefinitionService、WorkManagementTaskService 等),均基于 BaseApi;另有用于 Server-Sent Events 的事件流类。
组件指挥中心面板、工作流画布及其实时控制台、任务视图、通知和知识编辑器。
HooksuseCommandCenter、useSommatic* 注册类 Hooks、useTaskInbox、useEventStream、useSseConsole 等。

安装

安装包及其对等依赖

Shell
npm install @sommatic/react-sdk @link-loom/react-sdk @veripass/react-sdk luxon @mui/x-date-pickers

SDK 支持 React 17、18、19 以及 React Router 5、6、7。身份能力来自 @veripass/react-sdk,通用界面组件来自 @link-loom/react-sdk。

指向你的后端

JavaScript
import { configureSommatic } from '@sommatic/react-sdk';

configureSommatic({ baseUrl: 'https://api.sommatic.ai' });

在首次渲染前调用一次即可,详见配置。

使用服务

JavaScript
import { WorkflowOrchestrationFlowDefinitionService } from '@sommatic/react-sdk';

const service = new WorkflowOrchestrationFlowDefinitionService({ apiKey: token });
const response = await service.getByParameters({ queryselector: 'id', search: 'wf-flow-definition-…' });

if (response?.success) {
  const [definition] = response.result.items;
}

该包以 @sommatic/react-sdk 发布在 npm 上,采用 Apache-2.0 许可证,使用 JavaScript 编写,提供 CommonJS 和 ES 模块两种构建。

下一步

安装智能体工具

为你的编程智能体接入 Sommatic AI 官方文档:技能包、文档 MCP 服务器与 Markdown 页面,无需再抓取网页。

仅安装技能包,不会自动更新;需要时重新运行即可。

npx skills add https://docs.sommatic.ai
智能体如何读取本文档