Object Creation Function Analysis Document

Object Creation Function Analysis Document

I. Overall Architecture

用户输入 "Create..."
    │
    ├── 业务对象列表(硬编码 itemType)
    │   └── AiCapabilityBar → useCapabilityCreate.create(itemType, description)
    │       ├── GET /api/aml/unified/schema/:itemType    (获取字段定义)
    │       ├── GET /api/sciot/type-template/:itemType    (获取模板)
    │       ├── POST /api/llm/chat                        (调用LLM生成数据)
    │       ├── POST /api/private-library/objects         (双库查重)
    │       ├── POST /SCSAI-api/ApplyItem                  (创建主对象)
    │       ├── POST /SCSAI-api/ApplyItem                  (创建关系)
    │       └── POST /api/rule-engine/execute-create-post (后置规则)
    │
    ├── 对话框(硬编码 itemType)
    │   └── 同上
    │
    ├── 小程序(用户手选类型)
    │   └── POST /api/unified/create → handleCreate()
    │
    └── Digital Staff(关键词匹配)
        └── executePipeline() → createObject()

二、已验证的基础核心:useCapabilityCreate.create()

位置: src/composables/useCapabilityCreate.js L448-2045

Verified: Business objects such as Product, BOM, Part, Project, Supplier, including relationships, Item attributes, List attributes, and Sequence numbering.

Complete Process (17 Steps)

StepAPI CallDescription
1. Get SchemaGET /api/aml/unified/schema/:itemTypeGet field types, list values, validation rules
2. Get TemplateGET /api/sciot/type-template/:itemTypeGet extended field metadata, relationship definitions, generation rules
3. Get Subtype SchemasGET /api/sciot/type-template/:relatedType × NFetch field definitions for related target types in parallel
4. Get Item Attribute SchemasGET /api/sciot/type-template/:targetType × NGet field definitions for item/foreign attribute target types
5. Get System TemplatesGET /api/sciot/system-templatesRetrieve system object templates such as Permissions/Identities
6. Build Prompt(Local) Call PromptBuilder.buildCreationPrompt()Assemble LLM creation instruction
7. Call LLMPOST /api/llm/chatGenerate object attributes + relationships + sub-objects
8. Parse JSON(Local) Compatible with 3 formatsStandard / Legacy main / Flattened
9. Dual-DB DeduplicationPOST /SCSAI-api/ApplyItem (First query SCSAI exact → fuzzy → query standard DB)Exact match → suggest → copy → create
10. Sequence NumberingPOST /SCSAI-api/ApplyItem (getNextValue / get+edit)Obtain SCSAI native Sequence or manually increment
11. Pre-create item propertiesPOST /SCSAI-api/ApplyItem × NCreate child objects first then reference (e.g., Method for scheduling_method)
12. Pre-create relationship objectsPOST /SCSAI-api/ApplyItem × NRecursively pre-create all nested child objects
13. Build AML(Local) Call AmlBuilder.buildAML()Assemble the complete AML XML
14. Create main objectPOST /SCSAI-api/ApplyItem (with full Relationships)Submit to SCSAI
15. Duplicate name retryPOST /SCSAI-api/ApplyItemIf PropertiesAreNotUnique, auto-retry with suffix
16. AI error correction retryPOST /api/llm/chat → RecreateMax 3 attempts, LLM analyzes errors and makes corrections
17. Create relationships + post-processingPOST /SCSAI-api/ApplyItem × N + create_post rulesCreate relationships stepwise, execute post-processing rules

Key Dependencies

  • Frontend: AmlBuilder.js (AML build), PromptBuilder.js (Prompt build)
  • Backend: /api/aml/unified/schema/, /api/sciot/type-template/, /api/llm/chat, /SCSAI-api/ApplyItem
  • SCSAI Proxy: /SCSAI-api/ApplyItem → Node.js constructs SOAP → SCSAI InnovatorServer.aspx

3. Four Entry Points and Current Status Verification

Entry PointCall ChainitemType SourceVerified?
Business Object ListAiCapabilityBar → useCapabilityCreate.create()Hardcoded in Page✅ Verified
Dialog BoxSame as AboveHardcoded in Page❌ Pending Test
Mini ProgramPOST /api/unified/create → handleCreate()User Manual Selection❌ Pending Test
Digital EmployeeexecutePipeline() → createObject()detectItemType❌ Pending Test

Current Test Verification

Test ItemResult
Server Running (port 3006)✅ PID 23324
SCSAI Connection (ai-inspector/itemtypes)✅ Returns Real ItemType Data
Schema API (/api/aml/unified/schema/Product)✅ Returns Field Definitions
Type Template (/api/sciot/type-template/Product)✅ Returns Property + Relationship Definitions
Dual Library Duplicate Check (/api/private-library/objects)✅ Returns Private Library Data
Frontend SCSAI-api Proxy (/SCSAI-api/ApplyItem)✅ Returns Real SCSAI Part Data ("Clamp")
Sequence API (/api/sciot/apply-item)❌ Route Does Not Exist (tocConfigRouter Not Registered)

4. Existing Issues

P0 — "Type Does Not Exist → Create Type" Logic Completely Missing

detectItemType() (capability-pipeline.js L114-138) defaults to returning Part when type is not found, with no logic for "Create ItemType First".

object-modeler.defineObject (L44-89) exists and can define new object classes via LLM, but:

  • There is no creation entry point that calls it.
  • applyDefinition (L95-168) only writes to the local sciot_import.db and does not create an SCSAI ItemType.
  • The intent recognition chain does not have a branch for "itemType does not exist → defineObject → applyDefinition → create ItemType → then create object".

P0 — Four entry points, three sets of execution logic.

ImplementationRelationship HandlingSequenceAI RetryDual-DB DeduplicationLines
useCapabilityCreate.create()Pre-create → Reference✅ getNextValue+fallback✅ Up to 3 times✅ Exact+Fuzzy+Standard Library2045 lines
unified-create.handleCreate()Pre-create → Reference⚠️ resolveSequences simplified version❌❌250 lines
capability-pipeline.createObject()Simple sendAML❌❌❌110 lines

P1 — Backend createObject lacks multiple capabilities.

createObject (capability-pipeline.js L490-600) vs. useCapabilityCreate.create():

  • No AI error correction and retry (LLM analyzes errors and corrects).
  • No dual-database deduplication.
  • No automatic Sequence numbering.
  • Simple relationship handling (only calls sendAML, does not pre-create child objects).

P2 — Intent recognition keyword mapping is too shallow.

TYPE_CHINESE_MAP has only 12 mappings; defaults to Part if not found.

V. Fix Plan

Target Architecture

用户输入 → 意图识别 → 类型存在?→ 是 → useCapabilityCreate.create()
                          → 否 → ObjectModeler.defineObject → applyDefinition → CreateSCSAI ItemType → useCapabilityCreate.create()

最小改动(不改 useCapabilityCreate.create())

  1. capability-pipeline.identifyIntent — 检测到类型不存在时调用 ObjectModeler
  2. object-modeler.applyDefinition — 加 SCSAI ItemType Create
  3. AiCapabilityBar — 支持 itemType="auto" 先意图识别再创建
  4. 小程序和Digital Staff — 最终都走 useCapabilityCreate.create() 基核

六、测试结论

useCapabilityCreate.create() 依赖的 5 个后端 API 中 4 个已验证正常。前端 SCSAI-api 代理工作正常,SCSAI 连接正常。但无法直接在命令行测试前端 composable——需要浏览器环境。后端 capability-pipeline.createObject() 需要补全多项能力才能对标前端基核。

← 返回案例列表

Try 左帮右臂 Industrial Agent — your digital workforce

Available as a WeChat mini program, web app (ylxt.chat) and desktop client. Start from whichever fits your workflow.

🌐 Web App 💻 Desktop Download 📞 Call 189-8606-6876
WeChat mini program QR
Scan for the WeChat mini program
Share:
🤖 Try Now →
🤖
🎁