Ver código fonte

fix(gallery): 索引合并同 id 多版本到 versions[],修正 notes 中文乱码

- regen-index.ps1 原先每个 zip 生成一个 packages[] 条目,同 id 多版本会各占一条,
  平台按 id 只取一条展示 → 版本下拉永远只看到最新版、旧版选不到。
  现按 id 归并为单一条目,全部版本装进 versions[](与 SDK 的 AllVersions 契约一致),
  顶层字段对齐到最高版本。
- versions[].notes 优先取被发布物料 manifest.notes(本版特性),不再一律用兜底文案。
- 脚本补 UTF-8 BOM:无 BOM 时 Windows PowerShell 5.1 按 GBK 解析,中文字面量在内存里就已损坏,
  写出的 index.json 表现为乱码(如 '首次收录' → '棣栨鏀跺綍')。
王硕 1 semana atrás
pai
commit
378686c7de
2 arquivos alterados com 60 adições e 49 exclusões
  1. 19 46
      index.json
  2. 41 3
      regen-index.ps1

+ 19 - 46
index.json

@@ -1,6 +1,6 @@
 {
     "schemaVersion":  1,
-    "generatedAt":  "2026-09-25T05:30:51Z",
+    "generatedAt":  "2026-09-25T06:41:03Z",
     "packages":  [
                      {
                          "id":  "Plugins.Camera.Ahua",
@@ -10,7 +10,7 @@
                          "kind":  "extension",
                          "host":  "cameras",
                          "description":  "华睿(iRayple MVSDK_Net)相机驱动(kind=ahua):由相机扩展的驱动宿主(CameraPluginHost)加载,提供 ICameraDevice + IFrameSource。",
-                         "notes":  null,
+                         "notes":  "首次收录",
                          "downloadUrl":  "packages/cameras/Plugins.Camera.Ahua/Plugins.Camera.Ahua-1.0.0.zip",
                          "sha256":  "48cf712f02cbc7dd62536cc0b5a61138bb2d9c3ab99476d26b82b7bb4af12a4e",
                          "size":  27622,
@@ -45,7 +45,7 @@
                          "kind":  "extension",
                          "host":  "cameras",
                          "description":  "Basler Pylon 相机驱动(kind=basler):由相机扩展的驱动宿主(CameraPluginHost)加载,提供 ICameraDevice + IFrameSource。",
-                         "notes":  null,
+                         "notes":  "首次收录",
                          "downloadUrl":  "packages/cameras/Plugins.Camera.Basler/Plugins.Camera.Basler-1.0.0.zip",
                          "sha256":  "111a10b94bedc9cc554a392bbbf29ee979e4646d0273a566b3cef1e54c4d4418",
                          "size":  475597,
@@ -80,7 +80,7 @@
                          "kind":  "extension",
                          "host":  "cameras",
                          "description":  "海康机器人(Hikrobot MVS)相机驱动(kind=hikvision):由相机扩展的驱动宿主(CameraPluginHost)加载,提供 ICameraDevice + IFrameSource。",
-                         "notes":  null,
+                         "notes":  "首次收录",
                          "downloadUrl":  "packages/cameras/Plugins.Camera.Hikvision/Plugins.Camera.Hikvision-1.0.0.zip",
                          "sha256":  "ce7323c29e1c973cde8b0bdb33e82708f15dcc3d2e3913d364c90b79c99d8f0c",
                          "size":  92093,
@@ -115,7 +115,7 @@
                          "kind":  "extension",
                          "host":  "communication",
                          "description":  "三菱 MC 协议 PLC 通讯驱动(HslCommunication):通讯扩展子插件,直接导出 IPlcDriverProvider,按需安装。",
-                         "notes":  null,
+                         "notes":  "首次收录",
                          "downloadUrl":  "packages/communication/Plugins.Plc.Mitsubishi/Plugins.Plc.Mitsubishi-1.0.0.zip",
                          "sha256":  "9e3d511d96c8b1bdae5720375b39cca5f662f0f113b0a9008c0943bdb5168287",
                          "size":  2000905,
@@ -152,7 +152,7 @@
                          "kind":  "extension",
                          "host":  "communication",
                          "description":  "西门子 S7 协议 PLC 通讯驱动(HslCommunication):通讯扩展子插件,直接导出 IPlcDriverProvider,按需安装。",
-                         "notes":  null,
+                         "notes":  "首次收录",
                          "downloadUrl":  "packages/communication/Plugins.Plc.Siemens/Plugins.Plc.Siemens-1.0.0.zip",
                          "sha256":  "93d8ef4bc1d4b5f4b72c7cf5bd37bfc2a46944700e58804671a08b14569b188b",
                          "size":  2000141,
@@ -213,7 +213,7 @@
                                               "size":  703799,
                                               "releasedAt":  "2026-09-24",
                                               "status":  "stable",
-                                              "notes":  "首次收录"
+                                              "notes":  "• 流式对话与 Function Calling,内置默认模型开箱即用\n• 文件读写、命令执行、进程/窗口管理与鼠标键盘桌面控制\n• 联网搜索与平台命令桥接"
                                           }
                                       ]
                      },
@@ -249,7 +249,7 @@
                                               "size":  41928806,
                                               "releasedAt":  "2026-09-24",
                                               "status":  "stable",
-                                              "notes":  "首次收录"
+                                              "notes":  "• 设备管理、连接/采集、曝光增益调节与实时预览\n• 内置 USB(UVC) 相机与仿真相机\n• 其他品牌驱动以插件形式扩展接入"
                                           }
                                       ]
                      },
@@ -285,7 +285,7 @@
                                               "size":  11120,
                                               "releasedAt":  "2026-09-24",
                                               "status":  "stable",
-                                              "notes":  "首次收录"
+                                              "notes":  "• 七套配色:青灰 / 工业橙 / 深海蓝 / 松林绿 / 紫晶 / 暖砂 / 高对比\n• 仅需 6~7 个种子色,平台自动派生全部语义令牌\n• 浅色背景分层(窗口底 / 侧栏 / 内容面 / 分组块),告别一片白\n• 配色切换自动记忆,重启恢复"
                                           }
                                       ]
                      },
@@ -303,7 +303,8 @@
                          "size":  2233758,
                          "references":  [
                                             "TeamPLT.SDK",
-                                            "TeamPLT.Contracts"
+                                            "TeamPLT.Contracts",
+                                            "TeamAAS.Base.Contracts"
                                         ],
                          "targetFramework":  "net48",
                          "requiresHost":  "TeamPLT>=2.1.0",
@@ -311,7 +312,7 @@
                                       "x64"
                                   ],
                          "dependencies":  [
-
+                                              "TeamAAS.Base.Contracts"
                                           ],
                          "versions":  [
                                           {
@@ -321,36 +322,8 @@
                                               "size":  2233758,
                                               "releasedAt":  "2026-09-25",
                                               "status":  "stable",
-                                              "notes":  "棣栨鏀跺綍"
-                                          }
-                                      ]
-                     },
-                     {
-                         "id":  "Ext.Communication",
-                         "name":  "通讯",
-                         "version":  "1.0.0",
-                         "publisher":  "TeamAAS",
-                         "kind":  "extension",
-                         "host":  "platform",
-                         "description":  "通讯模块:TCP 客户端/服务器、UDP、串口透传与 Modbus TCP 设备管理、地址读写、状态监视(含仿真 PLC;其他品牌 PLC 由独立插件经 IPlcDriverRegistry 接入)。",
-                         "notes":  "• TCP 客户端/服务器、UDP、串口透传\n• Modbus TCP 设备管理、地址读写与状态监视\n• 内置仿真 PLC,其他品牌经 IPlcDriverRegistry 插件接入",
-                         "downloadUrl":  "packages/platform/Ext.Communication/Ext.Communication-1.0.0.zip",
-                         "sha256":  "db8b720afb104e400feea084e987723a08634e64aa02b810045a25e2cb41ded5",
-                         "size":  2225372,
-                         "references":  [
-                                            "TeamPLT.SDK",
-                                            "TeamPLT.Contracts",
-                                            "TeamAAS.Base.Contracts"
-                                        ],
-                         "targetFramework":  "net48",
-                         "requiresHost":  "TeamPLT>=2.1.0",
-                         "arch":  [
-                                      "x64"
-                                  ],
-                         "dependencies":  [
-                                              "TeamAAS.Base.Contracts"
-                                          ],
-                         "versions":  [
+                                              "notes":  "• TCP 客户端/服务器、UDP、串口透传\n• Modbus TCP 设备管理、地址读写与状态监视\n• 内置仿真 PLC,其他品牌经 IPlcDriverRegistry 插件接入"
+                                          },
                                           {
                                               "version":  "1.0.0",
                                               "downloadUrl":  "packages/platform/Ext.Communication/Ext.Communication-1.0.0.zip",
@@ -358,7 +331,7 @@
                                               "size":  2225372,
                                               "releasedAt":  "2026-09-24",
                                               "status":  "stable",
-                                              "notes":  "首次收录"
+                                              "notes":  "• TCP 客户端/服务器、UDP、串口透传\n• Modbus TCP 设备管理、地址读写与状态监视\n• 内置仿真 PLC,其他品牌经 IPlcDriverRegistry 插件接入"
                                           }
                                       ]
                      },
@@ -394,7 +367,7 @@
                                               "size":  43363852,
                                               "releasedAt":  "2026-09-24",
                                               "status":  "stable",
-                                              "notes":  "首次收录"
+                                              "notes":  "• 数据库底层:MySQL / SQLite\n• 通讯底层:Serial / TCP / UDP / OPC / Web / 光源\n• 流程引擎与画布、产品管理(IProductService / ICommunicationService / IDatabaseManager)"
                                           }
                                       ]
                      },
@@ -430,7 +403,7 @@
                                               "size":  1680054,
                                               "releasedAt":  "2026-09-24",
                                               "status":  "stable",
-                                              "notes":  "首次收录"
+                                              "notes":  "• 多通道亮度控制与全开全关\n• 内置仿真光源,支持 KCS 串口真机\n• 流程节点:光源控制"
                                           }
                                       ]
                      },
@@ -466,7 +439,7 @@
                                               "size":  812178,
                                               "releasedAt":  "2026-09-24",
                                               "status":  "stable",
-                                              "notes":  "首次收录"
+                                              "notes":  "• 活动栏替换为 2.x 顶部横条形态(图标上文字下、选中高亮跟随)\n• barHeight / iconSize / showText 参数即时生效\n• 禁用并重启即回退默认活动栏,无残留"
                                           }
                                       ]
                      },
@@ -505,7 +478,7 @@
                                               "size":  825810,
                                               "releasedAt":  "2026-09-24",
                                               "status":  "stable",
-                                              "notes":  "首次收录"
+                                              "notes":  "• 产品栏 / 画面区 / 生产统计卡 + 运行日志面板(实时 ILogStream)\n• 关于命令与帮助菜单"
                                           }
                                       ]
                      }

+ 41 - 3
regen-index.ps1

@@ -1,4 +1,4 @@
-# Regenerate index.json for THIS gallery repository (PLT\Gallery).
+# Regenerate index.json for THIS gallery repository (PLT\Gallery).
 #
 # 为什么自带一份:
 #   主仓库 build\regen-gallery-index.ps1 写死了 "<脚本父目录的父目录>\gallery",
@@ -102,7 +102,9 @@ foreach ($zipFile in (Get-ChildItem -Path $packagesDir -Recurse -Filter '*.zip'
             size        = $size
             releasedAt  = if ($prev) { $prev.releasedAt } else { $today }
             status      = if ($prev) { $prev.status } else { 'stable' }
-            notes       = if ($prev -and $prev.notes) { $prev.notes } else { '首次收录' }
+            # 本版特性优先取被发布物料自己的 manifest.notes(每个版本各自的说明),
+            # 其次继承旧 index 里的同版本记录,最后才是兜底文案。
+            notes       = if ($j.notes) { [string]$j.notes } elseif ($prev -and $prev.notes) { $prev.notes } else { '首次收录' }
         }
 
         $entry = [ordered]@{
@@ -133,8 +135,44 @@ foreach ($zipFile in (Get-ChildItem -Path $packagesDir -Recurse -Filter '*.zip'
 }
 $sha.Dispose()
 
+# ---------------------------------------------------------------------------
+# 合并同 id 的多条为单一条目:
+#   index.json 的契约是 packages[] 每个 id 只出现一次,多版本装在 versions[] 里
+#   (SDK 侧 GalleryPackage.AllVersions 就按这个读)。
+#   若同 id 各版本各占一条,平台按 id 取一条展示 —— 表现为"版本下拉只有最新一版",
+#   旧版本永远选不到。这里按 id 归并,并把顶层字段对齐到最高版本。
+# ---------------------------------------------------------------------------
+$byId = [ordered]@{}
+foreach ($e in $entries) {
+    $id = [string]$e.id
+    if ($byId.Contains($id)) {
+        $byId[$id].versions = @($byId[$id].versions) + @($e.versions)
+        if (-not $byId[$id].notes -and $e.notes) { $byId[$id].notes = $e.notes }
+    } else {
+        $byId[$id] = $e
+    }
+}
+
+$merged = New-Object System.Collections.Generic.List[object]
+foreach ($id in $byId.Keys) {
+    $p = $byId[$id]
+    $versions = @($p.versions | Sort-Object -Property @{ Expression = {
+        $v = $null
+        if ([version]::TryParse([string]$_.version, [ref]$v)) { $v } else { [version]'0.0' }
+    } } -Descending)
+    if ($versions.Count -eq 0) { continue }
+    $top = $versions[0]
+    $p.versions    = $versions
+    $p.version     = [string]$top.version
+    $p.downloadUrl = $top.downloadUrl
+    $p.sha256      = $top.sha256
+    $p.size        = $top.size
+    $p.notes       = if ($p.notes) { $p.notes } else { $top.notes }
+    $merged.Add([PSCustomObject]$p)
+}
+
 # Stable order: host (platform first), then id.
-$sorted = @($entries | Sort-Object @{ Expression = { $_.host } }, @{ Expression = { $_.id } })
+$sorted = @($merged | Sort-Object @{ Expression = { $_.host } }, @{ Expression = { $_.id } })
 
 $index = [ordered]@{
     schemaVersion = 1