Files
aurak/docs/QUICK-REFERENCE.md
T
Developer 0a9588abb7 feat: implement QuestionBank CRUD with pagination and template query
- Add pagination support to findAll (page, limit query params)
- Add findByTemplateId method to service
- Add GET /by-template/:templateId endpoint to controller
- Service already includes CRUD for QuestionBank and QuestionBankItem
2026-04-23 17:19:11 +08:00

131 lines
3.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 飞书机器人快速参考
## 一、当前状态
### 飞书机器人知识库对接
- **现状**:使用默认知识库(用户所有文件)
- **原因**`selectedFiles``selectedGroups` 参数为 `undefined`
- **文件**`server/src/feishu/feishu.service.ts` (line 311-331)
### 人才测评模块
- **位置**`server/src/assessment/`
- **功能**:基于知识库生成问题、评估答案、生成报告
- **接口**REST API + SSE 流式更新
---
## 二、快速命令
### 飞书机器人命令
```
/assessment start [kbId|templateId] # 开始测评
/assessment answer [answer] # 提交答案
/assessment status # 查看状态
/assessment result # 获取结果
/assessment help # 帮助信息
```
### 直接回复(无需命令前缀)
```
# 直接回复答案,系统自动识别
```
---
## 三、配置示例
### 创建带知识库配置的机器人
```bash
POST /feishu/bots
{
"appId": "cli_xxx",
"appSecret": "xxx",
"botName": "测评机器人",
"knowledgeBaseId": "kb_xxx", # 特定知识库
"knowledgeGroupId": "group_xxx" # 或知识组
}
```
### 更新知识库配置
```bash
PATCH /feishu/bots/:id/knowledge
{
"knowledgeBaseId": "kb_xxx",
"knowledgeGroupId": null
}
```
---
## 四、文件位置
### 核心文件
```
server/src/feishu/
├── feishu.service.ts # 主服务
├── feishu.controller.ts # 控制器
├── feishu-ws.manager.ts # WebSocket 管理
├── entities/
│ ├── feishu-bot.entity.ts # 机器人实体
│ └── feishu-assessment-session.entity.ts # 测评会话实体
├── dto/
│ ├── create-bot.dto.ts # 创建机器人 DTO
│ └── assessment-command.dto.ts # 命令 DTO
└── services/
├── assessment-command.parser.ts # 命令解析器
└── feishu-assessment.service.ts # 测评服务
```
### 数据库迁移
```
server/src/migrations/
├── XXXXXX-AddFeishuBotKnowledgeFields.ts # 添加知识库字段
└── XXXXXX-CreateFeishuAssessmentSessionTable.ts # 创建测评会话表
```
---
## 五、实施检查清单
### 阶段 1:基础架构
- [ ] 创建数据库迁移脚本
- [ ] 更新 FeishuBot 实体
- [ ] 更新 CreateFeishuBotDto
- [ ] 修改 FeishuService.processChatMessage()
### 阶段 2:测评集成
- [ ] 创建 FeishuAssessmentSession 实体
- [ ] 实现命令解析器
- [ ] 实现 FeishuAssessmentService
- [ ] 集成到 FeishuService
- [ ] 设计飞书卡片模板
### 阶段 3:测试
- [ ] 单元测试
- [ ] 集成测试
- [ ] 文档更新
---
## 六、常见问题
### Q1: 如何让飞书机器人只搜索特定知识库?
**A**: 在创建机器人时设置 `knowledgeBaseId` 字段
### Q2: 如何切换知识库?
**A**: 使用 PATCH `/feishu/bots/:id/knowledge` 接口更新配置
### Q3: 测评命令不生效怎么办?
**A**: 检查命令格式是否正确,确保以 `/assessment``/测评` 开头
### Q4: 如何查看测评进度?
**A**: 发送 `/assessment status``/assessment result`
---
## 七、参考文档
- 完整设计文档: `feishu-assessment-integration-design.md`
- 设计摘要: `feishu-assessment-integration-summary.md`
- 飞书开放平台: https://open.feishu.cn/document