> [!NOTE]
> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
> [English](./README.en.md) · [原始项目](https://github.com/simstudioai/sim) · [上游 README](https://github.com/simstudioai/sim/blob/HEAD/README.md)
> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。
用于构建、部署和管理 AI 智能体与工作流的工作空间。
## 快速开始
### 云端托管:[sim.ai](https://sim.ai)
### 自托管
```bash
npx simstudio
```
打开 [http://localhost:3000](http://localhost:3000)
必须安装并运行 Docker。使用 `-p, --port ` 在其他端口运行 Sim,或使用 `--no-pull` 跳过拉取最新 Docker 镜像。
## 功能特性
- 连接 1,000+ 集成与所有主流 LLM
- 接入 Slack、Notion、HubSpot、Salesforce、数据库等
- 通过可视化界面、对话或代码构建智能体
- 摄取文件、知识库和结构化表格数据
- 监控运行、日志、调度与工作流活动
## 一个工作空间,覆盖所有场景
聊天和工作流只是开始 — 表格、文件、知识库和定时任务都在同一工作空间中。
Tables — 内置数据库
|
Files — 团队与各智能体共享的统一存储
|
Knowledge — 智能体的记忆
|
Scheduled tasks — 按你的计划运行
|
## 自托管
### Docker Compose
```bash
git clone https://github.com/simstudioai/sim.git && cd sim
docker compose -f docker-compose.prod.yml up -d
```
打开 [http://localhost:3000](http://localhost:3000)
Sim 还支持通过 [Ollama](https://ollama.ai) 和 [vLLM](https://docs.vllm.ai/). 使用本地模型。详见 [Docker 自托管文档](https://docs.sim.ai/self-hosting/docker) 了解配置详情。
### 手动配置
**环境要求:** [Bun](https://bun.sh/), [Node.js](https://nodejs.org/) v20+、PostgreSQL 12+ 及 [pgvector](https://github.com/pgvector/pgvector)
1. 克隆并安装:
```bash
git clone https://github.com/simstudioai/sim.git
cd sim
bun install
bun run prepare # Set up pre-commit hooks
```
2. 配置带 pgvector 的 PostgreSQL:
```bash
docker run --name simstudio-db -e POSTGRES_PASSWORD=your_password -e POSTGRES_DB=simstudio -p 5432:5432 -d pgvector/pgvector:pg17
```
或通过 [pgvector 指南](https://github.com/pgvector/pgvector#installation). 手动安装
3. 配置环境:
```bash
cp apps/sim/.env.example apps/sim/.env
# Create your secrets
perl -i -pe "s/your_encryption_key/$(openssl rand -hex 32)/" apps/sim/.env
perl -i -pe "s/your_internal_api_secret/$(openssl rand -hex 32)/" apps/sim/.env
perl -i -pe "s/your_api_encryption_key/$(openssl rand -hex 32)/" apps/sim/.env
# DB configs for migration
cp packages/db/.env.example packages/db/.env
# Edit both .env files to set DATABASE_URL="postgresql://postgres:your_password@localhost:5432/simstudio"
```
4. 运行迁移:
```bash
cd packages/db && bun run db:migrate
```
5. 启动开发服务器:
```bash
bun run dev:full # Starts Next.js app and realtime socket server
```
或分别运行:`bun run dev`(Next.js)和 `cd apps/sim && bun run dev:sockets`(realtime)。
## Chat API 密钥
Chat 是 Sim 托管的服务。在自托管实例上使用 Chat:
- 前往 https://sim.ai → Settings → Chat keys,生成 Chat API 密钥
- 在自托管环境的 apps/sim/.env 文件中将 `COPILOT_API_KEY` 环境变量设置为该值
## 环境变量
完整列表见[环境变量参考](https://docs.sim.ai/self-hosting/environment-variables),默认值见 [`apps/sim/.env.example`](apps/sim/.env.example)。
## 技术栈
Next.js · Bun · PostgreSQL · Drizzle · Better Auth · Tailwind — 以及技术栈的其他部分
- **Framework(框架)**: [Next.js](https://nextjs.org/) (App Router)
- **Runtime(运行时)**: [Bun](https://bun.sh/)
- **Database(数据库)**: PostgreSQL with [Drizzle ORM](https://orm.drizzle.team)
- **Authentication(认证)**: [Better Auth](https://better-auth.com)
- **Schema Validation(模式验证)**: [Zod](https://zod.dev)
- **UI**: [Shadcn](https://ui.shadcn.com/), [Tailwind CSS](https://tailwindcss.com)
- **Streaming Markdown(流式 Markdown)**: [Streamdown](https://github.com/vercel/streamdown)
- **State Management(状态管理)**: [Zustand](https://zustand-demo.pmnd.rs/), [TanStack Query](https://tanstack.com/query)
- **Flow Editor(流程编辑器)**: [ReactFlow](https://reactflow.dev/)
- **Docs(文档)**: [Fumadocs](https://fumadocs.vercel.app/)
- **Monorepo(单体仓库)**: [Turborepo](https://turborepo.org/)
- **Realtime(实时通信)**: [Socket.io](https://socket.io/)
- **Background Jobs(后台任务)**: [Trigger.dev](https://trigger.dev/)
- **Remote Code Execution(远程代码执行)**: [E2B](https://www.e2b.dev/)
- **Isolated Code Execution(隔离代码执行)**: [isolated-vm](https://github.com/laverdet/isolated-vm)
## 贡献
我们欢迎贡献!详情请参阅我们的[贡献指南](.github/CONTRIBUTING.md)。
## 许可证
本项目采用 Apache License 2.0 许可证 — 详情请参阅 [LICENSE](LICENSE) 文件。