# Office Copilot

> 从支持协作、原生编辑器和自带模型 Key 的 Web 应用出发，构建自己的 Office Copilot。

- Human documentation: [https://docs.univer.ai/zh-CN/overview/examples/copilot](https://docs.univer.ai/zh-CN/overview/examples/copilot)

- Agent Markdown: [https://docs.univer.ai/zh-CN/overview/examples/copilot.md](https://docs.univer.ai/zh-CN/overview/examples/copilot.md)

- Requested language: `zh-CN`

- Content language: `zh-CN`

- Documentation version: `1.4.0`

- Source: [examples/copilot.zh-CN.mdx](https://github.com/dream-num/documentation/blob/dev/content/docs/examples/copilot.zh-CN.mdx)

---

**Univer Office Copilot** 是基于 **[Univer Office SDK](https://docs.univer.ai/zh-CN/overview.md)**、LangChain、React 和 TypeScript 构建的开源参考 Web 应用。表格、文档、幻灯片、多维表格和画板与对话助手并排显示，可以直接编辑。你可以运行这个代码样例，再改造成自己的办公 Copilot。

[本地运行](#quick-start) · [可编辑案例](https://github.com/dream-num/univer-office-copilot#included-examples) · [源码仓库](https://github.com/dream-num/univer-office-copilot)

![财务工作簿与 Copilot 对话并排显示，工作空间中包含六个案例文件](https://raw.githubusercontent.com/dream-num/documentation/dev/public/assets/examples/office-copilot/overview.webp)

## 可以构建什么

| 产品 | 可构建的应用 |
| --- | --- |
| Sheets | 财务模型、情景分析、公式与图表。 |
| Docs | 使用现代文档或分页文档编写研究报告与备忘录。 |
| Slides | 可编辑的投资者演示与项目汇报。 |
| Base | 关联记录、业务跟踪与实时仪表盘。 |
| Board | 决策地图、工作流程与连线图。 |

## 在本地运行参考应用

使用 **Node.js 24+** 和 **pnpm 10.33.4**：

```bash
git clone https://github.com/dream-num/univer-office-copilot.git
cd univer-office-copilot
pnpm install --frozen-lockfile
pnpm dev
```

打开 [http://127.0.0.1:5173](http://127.0.0.1:5173)。新的本地演示账户会获得六个私有、可编辑的案例，覆盖五类产品和两种文档模式。浏览和手动编辑不需要模型 Key、Docker 或外部数据库。

使用 Copilot 时，在聊天窗口的模型菜单中选择 **Add model** 或 **Manage models**，配置提供商、模型 ID 和 API Key。应用支持 OpenAI、Anthropic、Google Gemini、DeepSeek、OpenRouter 和自定义 OpenAI 兼容 HTTPS 接口。选择 **Ask** 查看文件，或选择 **Edit** 直接修改当前文件。

AI 文本测量和渲染检查需要本地安装 Chrome、Chromium 或 Edge。模型配置、附件、导入导出与浏览器设置见[本地开发指南](https://github.com/dream-num/univer-office-copilot/blob/main/docs/local-development.md)。

> [!INFO]
> 应用源码使用 Apache-2.0 协议。内嵌 Univer Pro 功能遵循独立的 SDK 授权条款，应用开源不代表授予 Pro 授权。详见 [SDK 授权说明](https://github.com/dream-num/univer-office-copilot/blob/main/docs/local-development.md#univer-licensing)。

## Office SDK 如何支撑这个应用

React 工作空间提供编辑器和聊天界面；Node 后端通过 LangChain 工具循环、产品 Skills 和受限编辑脚本操作无界面的 Univer 客户端。已确认的修改沿着与真人相同的协同通道同步到浏览器，原生内容回读与渲染检查为验证提供反馈。

现代文档使用 Markdown，分页文档使用 Typst，幻灯片通过 SVG 编译成可编辑元素。应用还包含单文件多会话、附件上下文、每轮修改查看、原生文件历史、所有者恢复版本，以及文件与对话分别分享。

可以从[架构说明](https://github.com/dream-num/univer-office-copilot/blob/main/docs/architecture.md)和[扩展指南](https://github.com/dream-num/univer-office-copilot/blob/main/docs/extending.md)继续开发，也可以了解底层的[内容操作](https://docs.univer.ai/zh-CN/ai/content-operations.md)、[协作](https://docs.univer.ai/zh-CN/overview/features/shared/collaboration.md)与[历史版本](https://docs.univer.ai/zh-CN/overview/features/shared/history.md)能力。

[全部示例](https://docs.univer.ai/zh-CN/overview/examples.md)
