NocoBase AI Employee Management
You are guiding the user to create and manage AI employees (chatbot assistants) in NocoBase.
Key Concepts
AI Employee
An AI employee is a chatbot assistant configured with:
- - username (PK): Unique identifier, e.g. INLINECODE0
- nickname: Display name shown to users
- about: System prompt defining role, data scope, and behavior
- skills: Tool bindings (query, count, form fill, workflow call)
- modelSettings: LLM configuration (service, model, temperature)
Page Integration
AI employees appear on pages in two ways:
- 1. Floating Avatar (
AIEmployeeShortcutListModel + AIEmployeeShortcutModel): Circular avatar buttons in page top-right corner - Action Bar Button (
AIEmployeeButtonModel): AI button in table/form action bars
Workflow
Phase 1: Create AI Employees
CODEBLOCK0
Phase 2: Add Page Shortcuts (Floating Avatars)
CODEBLOCK1
Phase 3: Add Block Buttons
CODEBLOCK2
Available Skills (Tool Bindings)
| Tool Name | Description | autoCall |
|---|
| INLINECODE4 | Discover table names | true |
| INLINECODE5 |
Get field definitions | true |
|
dataSource-dataSourceQuery | Query database | true |
|
dataSource-dataSourceCounting | Count records | true |
|
frontend-formFiller | Auto-fill forms | true |
|
workflowCaller-<key> | Custom workflow tool | false |
Avatar IDs
Common avatar IDs: nocobase-001-male through nocobase-060-male,
nocobase-001-female through nocobase-060-female.
Model Settings
Default LLM configuration:
CODEBLOCK3
Common adjustments:
- -
temperature: 0.3 — more deterministic, better for data queries - INLINECODE15 — more creative, better for writing/suggestions
- INLINECODE16 — longer timeout for complex multi-step queries
- INLINECODE17 — for formatted output
Page Integration — Complete Example
Floating Avatar (Shortcut)
Place AI employee avatars on a page for quick access:
CODEBLOCK4
Multiple employees on the same page:
CODEBLOCK5
Block Button
Add AI action button to a table's action bar:
CODEBLOCK6
Best Practices
- 1. Role-focused: Each AI employee covers one business domain
- Progressive: Start with basic query tools, add workflow tools later
- Chinese-first: Use
{{$nLang}} in system prompts for language awareness - Data scope: Explicitly list accessible tables in the system prompt
- Preset tasks: Add 1-2 quick-start tasks to shortcuts and buttons
- System prompt structure: Role → Data scope (table names) → Behavior rules → Output format
- Skill selection: Start with
dataSource-dataSourceQuery + dataModeling-getCollectionMetadata for data-oriented employees
NocoBase AI员工管理
您正在指导用户在NocoBase中创建和管理AI员工(聊天机器人助手)。
关键概念
AI员工
AI员工是一个配置了以下内容的聊天机器人助手:
- - 用户名(主键):唯一标识符,例如 am-asset-keeper
- 昵称:向用户显示的展示名称
- 关于:定义角色、数据范围和行为规则的系统提示词
- 技能:工具绑定(查询、计数、表单填写、工作流调用)
- 模型设置:LLM配置(服务商、模型、温度)
页面集成
AI员工以两种方式出现在页面上:
- 1. 浮动头像(AIEmployeeShortcutListModel + AIEmployeeShortcutModel):页面右上角的圆形头像按钮
- 操作栏按钮(AIEmployeeButtonModel):表格/表单操作栏中的AI按钮
工作流程
第一阶段:创建AI员工
nbcreateai_employee(my-helper, 助手, 通用助手,
nocobase-015-male, 一行描述,
包含角色、数据范围、行为规则的完整系统提示词...,
欢迎消息...,
[{name:dataSource-dataSourceQuery,autoCall:true}])
第二阶段:添加页面快捷方式(浮动头像)
nbaishortcut(tab_uid, [
{username: my-helper, tasks: [
{title: 快速查询, message: {user: 帮我查询数据}, autoSend: false}
]}
])
第三阶段:添加区块按钮
nbaibutton(table_uid, my-helper, [
{title: 分析数据, message: {user: 分析当前数据}, autoSend: false}
])
可用技能(工具绑定)
| 工具名称 | 描述 | 自动调用 |
|---|
| dataModeling-getCollectionNames | 发现表名 | true |
| dataModeling-getCollectionMetadata |
获取字段定义 | true |
| dataSource-dataSourceQuery | 查询数据库 | true |
| dataSource-dataSourceCounting | 计数记录 | true |
| frontend-formFiller | 自动填写表单 | true |
| workflowCaller-
| 自定义工作流工具 | false |
头像ID
常用头像ID:nocobase-001-male 至 nocobase-060-male,
nocobase-001-female 至 nocobase-060-female。
模型设置
默认LLM配置:
json
{
llmService: gemini,
model: models/gemini-2.5-flash,
temperature: 0.7,
topP: 1,
timeout: 60000,
maxRetries: 1,
responseFormat: text
}
常见调整:
- - temperature: 0.3 — 更确定性,适合数据查询
- temperature: 0.9 — 更具创造性,适合写作/建议
- timeout: 120000 — 复杂多步骤查询的更长超时时间
- responseFormat: markdown — 用于格式化输出
页面集成 — 完整示例
浮动头像(快捷方式)
在页面上放置AI员工头像以便快速访问:
nbaishortcut(tab_uid, [
{username: my-helper, tasks: [
{title: 快速查询, message: {user: 帮我查一下最新数据}, autoSend: false},
{title: 生成报告, message: {user: 生成本月汇总报表}, autoSend: false}
]}
])
同一页面上的多个员工:
nbaishortcut(tab_uid, [
{username: data-analyst, tasks: [...]},
{username: form-helper, tasks: [...]}
])
区块按钮
在表格的操作栏中添加AI操作按钮:
nbaibutton(table_uid, my-helper, [
{title: 分析选中项, message: {user: 分析当前选中的记录}, autoSend: false}
])
最佳实践
- 1. 角色聚焦:每个AI员工覆盖一个业务领域
- 渐进式:从基础查询工具开始,后续添加工作流工具
- 中文优先:在系统提示词中使用{{$nLang}}实现语言感知
- 数据范围:在系统提示词中明确列出可访问的表
- 预设任务:为快捷方式和按钮添加1-2个快速启动任务
- 系统提示词结构:角色 → 数据范围(表名) → 行为规则 → 输出格式
- 技能选择:对于数据导向的员工,从dataSource-dataSourceQuery + dataModeling-getCollectionMetadata开始