对象创建功能统一方案
目标
4个入口(业务对象列表、对话框、数字员工、小程序)创建行为一致,都经过 useCapabilityCreate.create() 这个已验证的基核。
对象列表不需要意图识别(itemType 已知),其余3个入口需要意图识别确定类型,类型不存在时先创建类型再创建对象。
架构
基础核心(已验证):
useCapabilityCreate.create(itemType, description)
→ Schema → LLM → 双库查重 → Sequence → 预创建 → buildAML → 提交SCSAI → 关系创建 → 后置规则
意图识别层(新加):
identifyIntent(description)
→ 类型已知?→ 直接用
→ 类型未知?→ detectItemType → 存在?→ 用;不存在?→ ObjectModeler创建类型 → 用
统一入口:
POST /api/capability/pipeline/identify-and-create
→ identifyIntent → useCapabilityCreate.create(itemType, description)
4个入口的统一方式
业务对象列表(不改)
ProductList.vue → AiCapabilityBar item-type="Product" → useCapabilityCreate.create("Product", desc)
不受影响,不变。
对话框(小改 AiCapabilityBar.vue)
当前:AiCapabilityBar 内 executeCapability 直接调 useCapabilityCreate.create(props.itemType, desc)
改后:增加 props.itemType="auto" 模式 → 先调 identify-and-create API
数字员工(大改 capability-pipeline.js)
当前:executePipeline → detectItemType 关键词匹配 → createObject(简易版,缺Sequence/重试/查重)
改后:executePipeline → identifyIntent(含类型创建)→ 同 identify-and-create 流程
小程序(改 后端 API 调用)
当前:aras-create.vue → POST /api/unified/create → handleCreate()(简化版)
改后:同 identify-and-create 流程(服务端走同一套逻辑)
执行步骤
Step 1: 建立基础核心测试(已完成)
- [x] 确认
useCapabilityCreate.create()的完整流程(2045行) - [x] 确认后端
/aras-api/ApplyItem代理工作正常 - [x] 确认 SCSAI 连接正常(ai-inspector/itemtypes 返回真实数据)
- [x] 确认 Schema API、类型模板 API、双库查重 API 正常
- [x] 测试创建:Customer ✅ Vendor ✅ Part ✅ Product ✅ Document ✅ Project ⚠️ Model ✅ Part BOM ✅
Step 2: 实现后端 identity-and-create 管线(已编码)
- [x]
object-modeler.applyDefinition增加 SCSAI ItemType 创建 - [x]
capability-pipeline.js添加ObjectModelerModule、ensureItemTypeExists - [x]
capability-pipeline.js修改identifyIntent类型不存在时创建 - [x]
capability-pipeline.js添加POST /api/capability/pipeline/identify-and-create端点
Step 3: 前端适配(已编码)
- [x]
AiCapabilityBar.vue增加 auto-detect mode(itemType="auto")
Step 4: 验证(待执行)
- [ ] 重启服务器,加载新代码
- [ ] 测试 POST /api/capability/pipeline/identify-intent 返回类型和 _typeCreated
- [ ] 测试 POST /api/capability/pipeline/identify-and-create 完整链路
Step 5: 数字员工接入(待执行)
- [ ] 修改
executePipelineStep 1 使用identifyIntent(已有类型创建逻辑) - [ ] 修改
executePipelineStep 6 使用useCapabilityCreate.create()同级逻辑(不是createObject)
Step 6: 小程序接入(待执行)
- [ ] 修改
aras-create.vue在提交时支持自然语言描述检测类型 - [ ] 调用
/api/capability/pipeline/identify-and-create代替/api/unified/create
不改的文件
src/composables/useCapabilityCreate.js— 基础核心,不碰src/composables/useCreate.js— 备选,不碰src/utils/AmlBuilder.js— AML构建,不碰src/utils/PromptBuilder.js— Prompt构建,不碰server/routes/unified-create.js— 后端简化版,不动
改动的文件
server/core/object-modeler.js—applyDefinition加 SCSAI ItemType创建(已编码)server/routes/capability-pipeline.js—ObjectModelerModule、ensureItemTypeExists、identifyIntent、identify-and-create端点(已编码)src/components/ai/AiCapabilityBar.vue— auto-detect mode(已编码)
BossAgents