Unified Solution for Object Creation Functionality
Objective
Ensure consistent creation behavior across 4 entry points (business object list, dialog, digital employee, mini-program), all going through the verified core useCapabilityCreate.create().
Object lists do not require intent recognition (itemType is known). The other 3 entry points require intent recognition to determine the type. If the type does not exist, create the type first, then create the object.
Architecture
基础核心(已验证):
useCapabilityCreate.create(itemType, description)
→ Schema → LLM → 双库查重 → Sequence → 预创建 → buildAML → SubmitSCSAI → 关系创建 → 后置规则
意图识别层(新加):
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)
不受影响,不变。
Dialog (Minor modification to AiCapabilityBar.vue)
Current: executeCapability within AiCapabilityBar directly calls useCapabilityCreate.create(props.itemType, desc).
Modified: Add props.itemType="auto" mode → first call the identify-and-create API.
Digital Employee (Major modification to capability-pipeline.js)
Current: executePipeline → detectItemType keyword matching → createObject (simplified version, lacking Sequence/Retry/Deduplication).
Modified: executePipeline → identifyIntent (includes type creation) → same identify-and-create flow.
Mini-program (Modify backend API calls)
Current: SCSAI-create.vue → POST /api/unified/create → handleCreate() (simplified version).
After modification: Same as the identify-and-create process (server-side follows the same logic)
Execution steps
Step 1: Establish basic core tests (Completed)
- [x] Verify the complete flow of useCapabilityCreate.create() (line 2045)
- [x] Verify the backend /SCSAI-api/ApplyItem proxy is working correctly
- [x] Verify SCSAI connection is normal (ai-inspector/itemtypes returns real data)
- [x] Verify Schema API, type template API, and dual-database duplicate check API are normal
- [x] Test creation: Customer ✅ Vendor ✅ Part ✅ Product ✅ Document ✅ Project ⚠️ Model ✅ Part BOM ✅
Step 2: Implement backend identity-and-create pipeline (Coded)
- [x] Add SCSAI ItemType creation to object-modeler.applyDefinition
- [x] Add ObjectModelerModule, ensureItemTypeExists to capability-pipeline.js
- [x] Modify identifyIntent in capability-pipeline.js to create type when it does not exist
- [x] capability-pipeline.js adds POST /api/capability/pipeline/identify-and-create endpoint
Step 3: Frontend adaptation (coded)
- [x] AiCapabilityBar.vue adds auto-detect mode (itemType="auto")
Step 4: Verification (pending)
- [ ] Restart server, load new code
- [ ] Test POST /api/capability/pipeline/identify-intent return type and _typeCreated
- [ ] Test POST /api/capability/pipeline/identify-and-create full chain
Step 5: Digital employee integration (pending)
- [ ] Modify executePipeline Step 1 to use identifyIntent (existing type creation logic)
- [ ] Modify executePipeline Step 6 to use useCapabilityCreate.create() peer logic (not createObject)
Step 6: Mini-program integration (pending)
- [ ] Modify SCSAI-create.vue to support natural language description detection for type on submission
- [ ] Call /api/capability/pipeline/identify-and-create instead of /api/unified/create
Files not to be modified
- src/composables/useCapabilityCreate.js — core foundation, do not touch
- src/composables/useCreate.js — alternative, do not touch
- src/utils/AmlBuilder.js — AML construction, do not touch
- src/utils/PromptBuilder.js — Prompt construction, do not touch
- server/routes/unified-create.js — simplified backend version, do not modify
Modified files
- server/core/object-modeler.js — added SCSAI ItemType creation in applyDefinition (coded)
- server/routes/capability-pipeline.js — ObjectModelerModule, ensureItemTypeExists, identifyIntent, identify-and-create endpoint (coded)
- src/components/ai/AiCapabilityBar.vue — auto-detect mode (coded)
BossAgents