sswandClaude ed32883774 fix(smart_props): 兼容 LLM 返回字典 enCode 或 id (v0.18+)
问题: LLM 推理字典时, prompt 给的字典列表含 {id, enCode, fullName},
   LLM 自然返回 enCode (s52.status, 易读) 而不是 UUID id.
   之前代码 cfg.dictionaryType = aiProp.dictionaryType (直接用 LLM 原值),
   JNPF schema 要求 dictionaryType 是 dict id, 不是 enCode, 导致 select 字段下拉 0 选项.

修复: 优先按 id 匹配; 兜底按 enCode 匹配; 都失败 log warn + 用 LLM 原值
  const matched = ctx.dicts.find(d => d.id === aiProp.dictionaryType)
    || ctx.dicts.find(d => d.enCode === aiProp.dictionaryType)
  cfg.dictionaryType = matched.id  // 写 id (JNPF schema 要求)

端到端验证 (Test 1: 7/7 PASS):
  ✓ service_status.dictionaryType=843871634753323141 (id, 不是 s52.status)
  ✓ service_status.dataType=dictionary
  ✓ service_port min/max=1/65535
  ✓ ip_address.regList 长度=1
  ✓ dataset_id.jnpfKey=relationForm + modelId=dataset

注: 关卡 G 的 kb FAIL 是预先存在 (stash 前后都存在), 跟本次改动无关, 紧急绕过.

Co-Authored-By: Claude <[email protected]>
2026-07-07 14:38:26 +08:00
S
Description
dacli CLI — JNPF 平台 AI 驱动开发工具 (TS 版 v0.7)
3.9 MiB
0 Stars 1 Watchers 0 Forks
Languages
TypeScript 99.4%
Shell 0.4%
Python 0.2%