# ReplyPier

> ReplyPier 是一个开源的 AI 客服系统：AI 先依据知识库答疑，转人工后在同一个会话里接着处理，
> 服务结束邀请访客评价。仓库包含后端、客服工作台、嵌入 Widget、帮助中心与端到端测试。

## 仓库

- 源码：http://149.71.241.228:10489/WangShen007/replypier
- 分支：`main`

## 本机运行

需要 PostgreSQL 16 + pgvector、Redis、Python 3.12 与 Node：

```bash
./deploy/local/local.sh setup   # 首次运行：安装依赖并构建前端
./deploy/local/local.sh up      # 启动数据库、后端与前端
./deploy/local/local.sh status  # 查看各服务状态
```

- 客服工作台：http://127.0.0.1:3018/
- 悬浮客服演示页：http://127.0.0.1:3018/local-demo.html
- 部署、账号与恢复说明：`LOCAL_DEPLOY.md`

## 网站接入

在后台创建一个 Widget 拿到 id，然后在页面里引入加载器：

```html
<script>window.replypierId = "YOUR_WIDGET_ID";</script>
<script src="https://<你的域名>/webclient/replypier.min.js" async></script>
```

自建实例的域名即后端或前端对外地址；加载器默认读取 `window.replypierBaseUrl`，
未设置时用构建时写入的 API 地址。站点已登录用户可用
`window.ReplyPier.identify(token)` 把访客身份绑定到自己的账号。

## 代码结构

- `backend/app/`：FastAPI 应用、Agent、知识处理、工单与后台任务
- `backend/tests/`：后端测试
- `frontend/src/`：管理后台、客服工作台与嵌入 Widget
- `frontend/src/webclient/replypier.js`：网站加载器源码，构建到 `frontend/public/webclient/replypier.min.js`
- `e2e/`：Playwright 端到端测试，约定见 `e2e/AUTHORING.md`
- `deploy/local/`：本机环境与启停脚本

## 技术栈

Python、FastAPI、SQLAlchemy、Alembic、PostgreSQL/pgvector、Redis、Agno；
Vue 3、TypeScript、Vite、Socket.IO。

## 许可

Apache License 2.0，见 `LICENSE` 与 `NOTICE`。
