@yuku123/z-cognition-component 2.0.2 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/dist-lib/BaseInput-rxw05EpT.js +1096 -0
  2. package/dist-lib/ClockCircleOutlined-DqK04lTb.js +12 -0
  3. package/dist-lib/Collapse-D9XOithE.js +523 -0
  4. package/dist-lib/{ConceptsPage-BOeKdDKI.js → ConceptsPage-DOf_CJlz.js} +13 -16
  5. package/dist-lib/DeleteOutlined-DnGmqa7C.js +12 -0
  6. package/dist-lib/{DocsPage-BZOBFp3c.js → DocsPage-CiC7TU96.js} +4 -4
  7. package/dist-lib/EllipsisOutlined-VzQrhleP.js +1109 -0
  8. package/dist-lib/EvidenceFormList-CrE2FzHk.js +90 -0
  9. package/dist-lib/{EyeOutlined-DGSrX-0M.js → EyeOutlined-CIFgRd6d.js} +4 -4
  10. package/dist-lib/ImpactPage-CYiuqy0S.js +68 -0
  11. package/dist-lib/{LeftOutlined-Cgo6Izj-.js → LeftOutlined-Be44-JWT.js} +1 -1
  12. package/dist-lib/{OntologyDetailPage-B8DyU8WW.js → OntologyDetailPage-mgK_NQxP.js} +99 -93
  13. package/dist-lib/{OntologyInferPage-CvcjxpBB.js → OntologyInferPage-NUaoaQpN.js} +38 -40
  14. package/dist-lib/{OntologyListPage-Cb0XfpWE.js → OntologyListPage-C9wH01y0.js} +47 -49
  15. package/dist-lib/OntologyMaterializePage-D_fDqYHY.js +134 -0
  16. package/dist-lib/OntologyNodesPage-5kH7RHwE.js +2844 -0
  17. package/dist-lib/{OntologyValidatePage-abQVJwzV.js → OntologyValidatePage-DtkYK_l4.js} +49 -52
  18. package/dist-lib/Pagination-BuFXTevS.js +1112 -0
  19. package/dist-lib/PlusOutlined-BSTPGLOH.js +21 -0
  20. package/dist-lib/{ReloadOutlined-CS-e-TmN.js → ReloadOutlined-B26pDoyV.js} +19 -10
  21. package/dist-lib/{ResolvePage-rbQ-8nNZ.js → ResolvePage-Cz9HORZ3.js} +31 -33
  22. package/dist-lib/{RotateRightOutlined-q7zp2e47.js → RotateRightOutlined-CYlCNRvD.js} +1 -1
  23. package/dist-lib/Skeleton-CxFsInYI.js +671 -0
  24. package/dist-lib/Table-Civ838nE.js +20514 -0
  25. package/dist-lib/{Table-CDagah-g.js → Table-D1RvQXGM.js} +414 -414
  26. package/dist-lib/TermDetailPage-BtkOpbPT.js +263 -0
  27. package/dist-lib/{TermsPage-CuufAyuL.js → TermsPage-BuzCMYov.js} +28 -31
  28. package/dist-lib/_commonjsHelpers-DaMA6jEr.js +8 -0
  29. package/dist-lib/accessAk-DlxcvD0O.js +64 -0
  30. package/dist-lib/{agents-CvgRLQw2.js → agents-CabJdV6W.js} +46 -46
  31. package/dist-lib/{ai-DYDhijtn.js → ai-DZ6fqUyK.js} +32 -32
  32. package/dist-lib/{ai-chat-share-DJnybJtS.js → ai-chat-share-CYSU7UlK.js} +13 -14
  33. package/dist-lib/ak-manage-MTp2UyyK.js +805 -0
  34. package/dist-lib/{approval-3IbhY8Lp.js → approval-F9OYS1Ov.js} +25 -26
  35. package/dist-lib/{approvals-Cd6CVzz4.js → approvals-DDEl02-L.js} +42 -43
  36. package/dist-lib/{assistant-cIXgilaE.js → assistant-CcC1rvys.js} +48 -49
  37. package/dist-lib/{assistant-history-BQzH4ChB.js → assistant-history-fmy8IsJL.js} +5 -5
  38. package/dist-lib/{assistant-summary-LKTj_HKM.js → assistant-summary-kuK5-mku.js} +1 -1
  39. package/dist-lib/{audit-CxuJ5unU.js → audit-C0GYByqU.js} +1 -1
  40. package/dist-lib/{bios-BplnCOF4.js → bios-_axkM_DR.js} +128 -130
  41. package/dist-lib/callSuper-CuPJalb0.js +7 -0
  42. package/dist-lib/callSuper-CwIeyYoc.js +7 -0
  43. package/dist-lib/category-BPLw60Ia.js +76 -0
  44. package/dist-lib/causal-CcWolsb5.js +789 -0
  45. package/dist-lib/{changelog-BoGqt_81.js → changelog-BQdmpq5H.js} +2 -2
  46. package/dist-lib/changelog-DC6nlUDh.js +103 -0
  47. package/dist-lib/chat-panel-CgpP4Xf5.js +1543 -0
  48. package/dist-lib/chunk-6KYCQHYJ-DcgZQlO5.js +1627 -0
  49. package/dist-lib/code-space-CZ3CzVcA.js +1070 -0
  50. package/dist-lib/{colors-sdAcAcU3.js → colors-BsFEfaVs.js} +1 -1
  51. package/dist-lib/community-D9mD_Tq1.js +217 -0
  52. package/dist-lib/community-ESJc4qtl.js +70 -0
  53. package/dist-lib/community-material-page-Ct5uMwhv.js +747 -0
  54. package/dist-lib/connections-DrxmCfe3.js +1065 -0
  55. package/dist-lib/context-T27uno74.js +54 -0
  56. package/dist-lib/{createForOfIteratorHelper-DEx_aTey.js → createForOfIteratorHelper-3K1vcDqi.js} +1 -1
  57. package/dist-lib/{dayjs.min-BauDENhn.js → dayjs.min-DoEf5yCX.js} +1 -1
  58. package/dist-lib/{detail-Cx5c4KJH.js → detail-DXOJf57e.js} +39 -40
  59. package/dist-lib/detail-kPAVlzm3.js +84 -0
  60. package/dist-lib/{detail-BaX7WiWV.js → detail-lGslEB8s.js} +5847 -7224
  61. package/dist-lib/development-aLXXcLcF.js +167 -0
  62. package/dist-lib/{docx-preview-B5nQuTwk.js → docx-preview-D4v2g8Yg.js} +1 -1
  63. package/dist-lib/{downloads-C3Oz04OW.js → downloads-DFOEFvX6.js} +3 -4
  64. package/dist-lib/{edit-Cbn2eJaJ.js → edit-BbtVK23D.js} +200 -204
  65. package/dist-lib/{editor-mtaJBQXz.js → editor-DbLQFOUf.js} +25 -26
  66. package/dist-lib/editor-page-B_H0fRAI.js +1169 -0
  67. package/dist-lib/embed-BUaR8PAn.js +51816 -0
  68. package/dist-lib/embed.css +2 -2
  69. package/dist-lib/{evaluation-BoHiY8yT.js → evaluation-8Tx-3UQh.js} +14 -15
  70. package/dist-lib/execution-Dz5dBEFl.js +159 -0
  71. package/dist-lib/focus-set-lt52maBX.js +38 -0
  72. package/dist-lib/{format-UGmYKemG.js → format-CWI99NCN.js} +1 -1
  73. package/dist-lib/graph-BllA9bmL.js +44 -0
  74. package/dist-lib/graph-DacHEbKr.js +640 -0
  75. package/dist-lib/index-4tbtbcAt.js +550 -0
  76. package/dist-lib/index-B6G8CZ1v.js +915 -0
  77. package/dist-lib/index-BDWjubAD.js +390 -0
  78. package/dist-lib/{index-BEjXaDfk.js → index-BI-rknta.js} +53 -54
  79. package/dist-lib/index-BLGPH51v.js +251 -0
  80. package/dist-lib/index-BMv3kGDG.js +236 -0
  81. package/dist-lib/{index-CHBNrCMy.js → index-BOB3j3H_.js} +29 -29
  82. package/dist-lib/index-BU2GXuww.js +413 -0
  83. package/dist-lib/index-BVgdmf6r.js +2487 -0
  84. package/dist-lib/index-BWmgE7bB.js +2075 -0
  85. package/dist-lib/{index-B57Fj7Y0.js → index-Be_iqVpx.js} +50 -52
  86. package/dist-lib/{index-y7jVGGI0.js → index-Bf8IQq4A.js} +21 -23
  87. package/dist-lib/{index-DsuUGhTA.js → index-Bi7O9pQv.js} +177 -179
  88. package/dist-lib/index-Bs4MevzC.js +16075 -0
  89. package/dist-lib/{index-DBlG9uXV.js → index-Bt9F-2Fl.js} +520 -597
  90. package/dist-lib/{index-Cj4DDWyj.js → index-BtW_nQBU.js} +10 -11
  91. package/dist-lib/{index-CyKWCYMK.js → index-BuGHtvxH.js} +81 -84
  92. package/dist-lib/{index-Bc-Vin3j.js → index-CDxeB8C4.js} +47 -49
  93. package/dist-lib/index-CNBwau86.js +1166 -0
  94. package/dist-lib/{index-9aQ4BzIK.js → index-CS6H40rM.js} +24 -25
  95. package/dist-lib/index-CSnvcFg-.js +543 -0
  96. package/dist-lib/{index-o65vKUwa.js → index-CSoMwNHq.js} +82 -83
  97. package/dist-lib/{index-C3AMwzIi.js → index-CZipVp1G.js} +1 -1
  98. package/dist-lib/index-CdNxm2We.js +1987 -0
  99. package/dist-lib/{index-DMTPsTna.js → index-CjFA5T3K.js} +3 -4
  100. package/dist-lib/{index-Bm1sK-VN.js → index-D23tZfhi.js} +10 -10
  101. package/dist-lib/index-D35Ry0PG.js +1162 -0
  102. package/dist-lib/index-D7nLwQye.js +5012 -0
  103. package/dist-lib/index-DQ16Zb7x.js +546 -0
  104. package/dist-lib/{index-BwVZgt5s.js → index-DR9LGJpi.js} +46 -48
  105. package/dist-lib/index-DRcTwC17.js +418 -0
  106. package/dist-lib/index-DTgboCiF.js +566 -0
  107. package/dist-lib/index-Dd9pPAT3.js +2192 -0
  108. package/dist-lib/{index-Vu6sPBci.js → index-Ddx6XQu5.js} +285 -280
  109. package/dist-lib/index-Di2bQwQn.js +242 -0
  110. package/dist-lib/{index-Cy9i4Kx7.js → index-DlqhOJnd.js} +101 -105
  111. package/dist-lib/index-DxzorPvG.js +13960 -0
  112. package/dist-lib/{index-CLTfICbf.js → index-GQGXGr9M.js} +6 -6
  113. package/dist-lib/{index-nQSVLWfW.js → index-IB3GOib9.js} +81 -83
  114. package/dist-lib/index-If4xc1-H.js +559 -0
  115. package/dist-lib/index-Pcxp_AYe.js +1719 -0
  116. package/dist-lib/{index-ounfql2z.js → index-QkktEus5.js} +25 -27
  117. package/dist-lib/{index-B22_2Dzh.js → index-fVCVIu8I.js} +2 -2
  118. package/dist-lib/{index-D3GHtSlM.js → index-jHh-ITBK.js} +28 -29
  119. package/dist-lib/index-keRQ37lH.js +853 -0
  120. package/dist-lib/index-mUlorJxp.js +3279 -0
  121. package/dist-lib/{index-BSlCGnzo.js → index-n6hK1r_G.js} +12 -12
  122. package/dist-lib/index-qYfXuLnZ.js +34 -0
  123. package/dist-lib/index-yPMzsLHL.js +77 -0
  124. package/dist-lib/index.js +3 -4
  125. package/dist-lib/json-field-Bu-gFb6c.js +196 -0
  126. package/dist-lib/{jszip.min-DcEHhn-b.js → jszip.min-dcaDnWUw.js} +1 -1
  127. package/dist-lib/{kb-form-modal-B0rM1ZvV.js → kb-form-modal-DsXpXfNT.js} +64 -63
  128. package/dist-lib/{kbTeam-Bh_FQH28.js → kbTeam-D8hsAHI5.js} +3 -3
  129. package/dist-lib/{knowledge-base-Cl1Ka1e6.js → knowledge-base-D2XMD7iI.js} +111 -111
  130. package/dist-lib/{knowledge-hub-CPuzdRiq.js → knowledge-hub-BoBR8-j-.js} +52 -53
  131. package/dist-lib/login-B4C374Y_.js +36 -0
  132. package/dist-lib/{markdown-lite-Cu62Fl7J.js → markdown-lite-ROKlyMXg.js} +156 -160
  133. package/dist-lib/material-CqtPqoZj.js +204 -0
  134. package/dist-lib/material-draft-markdown-BKlKt3pc.js +443 -0
  135. package/dist-lib/material-original-preview-pzANkVK5.js +214 -0
  136. package/dist-lib/{material-preview-docx-CH-09KeC.js → material-preview-docx-lp_xPipj.js} +1 -1
  137. package/dist-lib/{material-preview-pptx-D8XGDF-u.js → material-preview-pptx-6Byitp0J.js} +1 -1
  138. package/dist-lib/material-workspace-model-BUpogooV.js +328 -0
  139. package/dist-lib/{member-DKDx77PD.js → member-CCTFfLDC.js} +1 -1
  140. package/dist-lib/memory-reorganization-CBTDCRhV.js +8 -0
  141. package/dist-lib/memory-spaces-CZGIBlz2.js +2340 -0
  142. package/dist-lib/{message-BrooQ3Q7.js → message-Chq3cAdy.js} +24 -25
  143. package/dist-lib/{message-Dievi8Jw.js → message-Rz7LvGMk.js} +1 -1
  144. package/dist-lib/{messages-xTNmTS9g.js → messages-DciGawgR.js} +15 -16
  145. package/dist-lib/meta-BWgVxZgd.js +708 -0
  146. package/dist-lib/{metrics-DiHYqBKB.js → metrics-iWreq4IL.js} +2 -2
  147. package/dist-lib/mobile-CNrK04Ak.js +2413 -0
  148. package/dist-lib/{monitor-BBCu3zRe.js → monitor-BpUJZCht.js} +8 -8
  149. package/dist-lib/{monitor-BXsdMJSV.js → monitor-CaTKbDI1.js} +4 -4
  150. package/dist-lib/{my-access-CEGErUgv.js → my-access-ZH5CWVGF.js} +120 -132
  151. package/dist-lib/{my-permissions-wSr5zv7g.js → my-permissions-edhi0lav.js} +22 -23
  152. package/dist-lib/navigation-2WdPUP2T.js +102 -0
  153. package/dist-lib/{new-BevAuTe5.js → new-Dq6mvU2w.js} +14 -15
  154. package/dist-lib/{ontology-DXGSJC-y.js → ontology-BX6X1X2J.js} +50 -52
  155. package/dist-lib/ontology-dataprep-BjMnFRBG.js +322 -0
  156. package/dist-lib/{ontology-domains-jTG7CZm8.js → ontology-domains-B7AuwW8S.js} +100 -103
  157. package/dist-lib/ontology-extract-FpJ6K8z6.js +295 -0
  158. package/dist-lib/ontology-extract-wbvBwGZO.js +3199 -0
  159. package/dist-lib/ontology-flow-CJsIvS35.js +456 -0
  160. package/dist-lib/ontology-flow-Cgi8Fk-i.js +154 -0
  161. package/dist-lib/ontology-modeling-C_6GvHBT.js +15136 -0
  162. package/dist-lib/ontology-modeling-CeDS1-FE.js +510 -0
  163. package/dist-lib/ontology-scenarios-4Ar7Y8Kt.js +675 -0
  164. package/dist-lib/{ontology-scenarios-J5kw6xgi.js → ontology-scenarios-BaYN82pv.js} +1289 -1305
  165. package/dist-lib/ontology-task-config-CDt7NdIq.js +122 -0
  166. package/dist-lib/ontology-terms-CnFarWZX.js +66 -0
  167. package/dist-lib/ontology-terms-CxTp2Dcq.js +1195 -0
  168. package/dist-lib/pages-CticGC6S.js +512 -0
  169. package/dist-lib/pages.js +3 -3
  170. package/dist-lib/{permission-BUXo69Ne.js → permission-CNqwhyF3.js} +41 -41
  171. package/dist-lib/pipeline-layout-CJlOMXJF.js +70 -0
  172. package/dist-lib/{pptx-preview.es-AUrdYKu3.js → pptx-preview.es-D4ODiBv2.js} +2 -2
  173. package/dist-lib/preset-Bp_mvsJm.js +56827 -0
  174. package/dist-lib/{preset-gh5SGoYT.js → preset-CfByvcqu.js} +8 -8
  175. package/dist-lib/progress-ImhDvynO.js +778 -0
  176. package/dist-lib/{quota-D31cXjul.js → quota-B38BWyPo.js} +4 -3
  177. package/dist-lib/row-DeVE0t_N.js +154 -0
  178. package/dist-lib/runs-ILSUwEOv.js +565 -0
  179. package/dist-lib/{save-blob-CiWNK-cX.js → save-blob-C5BbV45B.js} +2 -2
  180. package/dist-lib/{scenario-mapping-preview-DQ_OBV4Z.js → scenario-mapping-preview-7v1SRE7V.js} +43 -45
  181. package/dist-lib/scenario-simple-form-mFm6f2ho.js +989 -0
  182. package/dist-lib/{schedule-BktxwX3S.js → schedule-DzB9rZrm.js} +8 -8
  183. package/dist-lib/script-CKdVDsYh.js +2709 -0
  184. package/dist-lib/{settings-dsB3H65I.js → settings-CaihqQtz.js} +121 -121
  185. package/dist-lib/{shared-CTCzvhyE.js → shared-B51Q5536.js} +1 -1
  186. package/dist-lib/{shared-utils-BstybhBG.js → shared-utils-Ck5sql2m.js} +2 -2
  187. package/dist-lib/{skills-CHPlMsgO.js → skills-By3A0Dc1.js} +39 -40
  188. package/dist-lib/{source-selection-tXqc855k.js → source-selection-sIKyG7xR.js} +16 -16
  189. package/dist-lib/sources-DvIMColY.js +279 -0
  190. package/dist-lib/style-BHQZmWlH.js +191 -0
  191. package/dist-lib/{task-config-BiTOiZj0.js → task-config-CoPFj_FN.js} +4 -4
  192. package/dist-lib/{tech-BKlGPkV0.js → tech-BJgEEFrT.js} +3 -4
  193. package/dist-lib/templates-CODaf2QI.js +58 -0
  194. package/dist-lib/tenant-login-DmN4qfah.js +338 -0
  195. package/dist-lib/{tools-CouQ4FWk.js → tools-CyRz1Ofg.js} +14 -14
  196. package/dist-lib/use-current-tenant-otPCQ3X8.js +22 -0
  197. package/dist-lib/{use-domain-access-BPlNfoiP.js → use-domain-access-BuD99GTw.js} +15 -15
  198. package/dist-lib/{use-g6-graph-WLX0PweO.js → use-g6-graph-C5h9frJM.js} +1 -1
  199. package/dist-lib/{use-graph-layers-ja-ZIC_R.js → use-graph-layers-Cbd3Jggb.js} +48 -50
  200. package/dist-lib/use-resizable-columns-BpMCRKif.js +59 -0
  201. package/dist-lib/useBreakpoint-B8dF3ifo.js +87 -0
  202. package/dist-lib/{useForm-Byp1LopG.js → useForm-BZkiMeaN.js} +9 -9
  203. package/dist-lib/{version-control-panel-CkBm36Yk.js → version-control-panel-HdMlbpbO.js} +26 -27
  204. package/dist-lib/{version-management-B4kIbdVc.js → version-management-BYoxw4GV.js} +6 -7
  205. package/dist-lib/{welcome-F5iZoFB1.js → welcome-CMNXQf8J.js} +3 -4
  206. package/package.json +1 -1
  207. package/dist-lib/ApartmentOutlined-M6qSurnE.js +0 -12
  208. package/dist-lib/ArrowLeftOutlined-DowsrSUj.js +0 -12
  209. package/dist-lib/EvidenceFormList-DXqqSpPV.js +0 -91
  210. package/dist-lib/ImpactPage-DyhUR6fT.js +0 -71
  211. package/dist-lib/OntologyMaterializePage-B0f9TnJa.js +0 -136
  212. package/dist-lib/OntologyNodesPage-D4MWlm6q.js +0 -1268
  213. package/dist-lib/Pagination-Dxslodkq.js +0 -1344
  214. package/dist-lib/PlusOutlined-B_dXo_97.js +0 -12
  215. package/dist-lib/SearchOutlined-puH6bCY6.js +0 -979
  216. package/dist-lib/Skeleton-DXcERb5r.js +0 -557
  217. package/dist-lib/TagsOutlined-B4_qkn6-.js +0 -20
  218. package/dist-lib/TermDetailPage-CP0D6OvA.js +0 -242
  219. package/dist-lib/TextArea-DTpTS5HL.js +0 -1897
  220. package/dist-lib/ThunderboltOutlined-Bf54AaFE.js +0 -20
  221. package/dist-lib/callSuper-DZEfdkXG.js +0 -7
  222. package/dist-lib/changelog-Cn81Dvgk.js +0 -69
  223. package/dist-lib/chunk-YDNE64FV-DGyyfCo0.js +0 -2004
  224. package/dist-lib/context-Buz0ggsK.js +0 -710
  225. package/dist-lib/context-DpmyNOn3.js +0 -21
  226. package/dist-lib/embed-CR8XVkMy.js +0 -31148
  227. package/dist-lib/focus-set-h0YtOUB2.js +0 -427
  228. package/dist-lib/index-CaXylbQR.js +0 -3419
  229. package/dist-lib/index-Cfu1W1H6.js +0 -535
  230. package/dist-lib/index-CrMcNEAZ.js +0 -9656
  231. package/dist-lib/index-DBtGE89a.js +0 -168
  232. package/dist-lib/index-DjFPRXl5.js +0 -1484
  233. package/dist-lib/index-DvWHYX81.js +0 -450
  234. package/dist-lib/index-PBT9GksC.js +0 -340
  235. package/dist-lib/index-bOY1cBol.js +0 -4890
  236. package/dist-lib/meta-BD_qYTZu.js +0 -540
  237. package/dist-lib/ontology-modeling-CjRsa-DR.js +0 -1039
  238. package/dist-lib/ontology-modeling-DOj68TuI.js +0 -38946
  239. package/dist-lib/ontology-scenarios-CcAagMiP.js +0 -660
  240. package/dist-lib/pages-CsexFuEz.js +0 -73
  241. package/dist-lib/row-B5MnGm9M.js +0 -156
  242. package/dist-lib/scenario-simple-form-DESMvU7A.js +0 -2396
  243. package/dist-lib/useClosable-BY7FgWKy.js +0 -59
@@ -0,0 +1,3199 @@
1
+ import { jsx as t, jsxs as l, Fragment as H } from "react/jsx-runtime";
2
+ import { useState as x, useCallback as z, useRef as _, useEffect as B, useMemo as Q } from "react";
3
+ import { A as re, B as O, S as pe, dd as it, h as te, I as J, d8 as ve, q as ct, aa as ke, de as dt } from "./embed-BUaR8PAn.js";
4
+ import { u as ut } from "./use-domain-access-BuD99GTw.js";
5
+ import { g as mt, a as ht, u as Re, r as $e, q as ft, i as pt, p as Nt, b as Fe, s as yt, c as xt, w as gt, e as Ne, d as be, f as ee, h as Le, j as Ct, k as wt, l as Me, B as vt, m as bt, n as Tt, o as kt, t as St } from "./ontology-extract-FpJ6K8z6.js";
6
+ import { r as Et, e as It, d as zt, p as At, a as Dt, g as Rt, c as $t, b as Ft, f as Lt, u as Mt, h as Ot } from "./ontology-dataprep-BjMnFRBG.js";
7
+ import { u as oe } from "./use-resizable-columns-BpMCRKif.js";
8
+ import { T as j } from "./index-CDxeB8C4.js";
9
+ import { M as ce } from "./index-yPMzsLHL.js";
10
+ import { D as Oe } from "./index-CS6H40rM.js";
11
+ import { F as le, R as Pt } from "./Table-D1RvQXGM.js";
12
+ import { P as ye } from "./Pagination-BuFXTevS.js";
13
+ import { d as Bt } from "./dayjs.min-DoEf5yCX.js";
14
+ import { F as X } from "./index-Bt9F-2Fl.js";
15
+ import { I as ne } from "./index-CNBwau86.js";
16
+ import { S as qt } from "./index-BDWjubAD.js";
17
+ import { A as ae } from "./index-QkktEus5.js";
18
+ import { D as Gt } from "./index-D7nLwQye.js";
19
+ import { d as Kt } from "./ontology-task-config-CDt7NdIq.js";
20
+ import { T as fe } from "./index-DR9LGJpi.js";
21
+ import { u as _t, C as Ut } from "./chat-panel-CgpP4Xf5.js";
22
+ import { g as Jt } from "./ontology-modeling-CeDS1-FE.js";
23
+ import { b as ie } from "./format-CWI99NCN.js";
24
+ import { U as Vt } from "./index-Pcxp_AYe.js";
25
+ import { P as Xt } from "./progress-ImhDvynO.js";
26
+ import { e as jt } from "./material-CqtPqoZj.js";
27
+ import { a as Wt } from "./index-BMv3kGDG.js";
28
+ function Yt(e) {
29
+ const { message: r, modal: n } = re.useApp(), [d, m] = x(), [o, s] = x(), a = z(async (p) => {
30
+ m(p.code);
31
+ try {
32
+ if (!await Et(p.code)) return;
33
+ r.success("已发起一次同步,可在运行记录中查看进度"), e();
34
+ } finally {
35
+ m(void 0);
36
+ }
37
+ }, [r, e]), i = z((p) => {
38
+ const C = p.enabled !== 1;
39
+ n.confirm({
40
+ title: `${C ? "启用" : "停用"}采集任务「${p.name}」?`,
41
+ content: C ? "启用后按调度持续同步数据集到实例;直写实例、不产草案。" : "停用后不再按调度发起同步;已写入的实例保留。",
42
+ okText: C ? "启用" : "停用",
43
+ cancelText: "取消",
44
+ onOk: async () => {
45
+ s(p.code);
46
+ try {
47
+ await It(p.code, C), r.success(C ? "任务已启用" : "任务已停用"), e();
48
+ } finally {
49
+ s(void 0);
50
+ }
51
+ }
52
+ });
53
+ }, [n, r, e]), u = z((p) => {
54
+ n.confirm({
55
+ title: `删除采集任务「${p.name}」?`,
56
+ content: "删除后不再调度同步;已写入的实例与历史运行记录保留。",
57
+ okText: "删除",
58
+ okButtonProps: { danger: !0 },
59
+ cancelText: "取消",
60
+ onOk: async () => {
61
+ await zt(p.code), r.success("任务已删除"), e();
62
+ }
63
+ });
64
+ }, [n, r, e]);
65
+ return { run: a, toggle: i, remove: u, runningCode: d, togglingCode: o };
66
+ }
67
+ function Qt(e = 0) {
68
+ const [r, n] = x({}), [d, m] = x({ current: 1, size: 20 }), [o, s] = x([]), [a, i] = x(0), [u, p] = x(!1), [C, A] = x(0), h = _(0);
69
+ B(() => {
70
+ const N = ++h.current;
71
+ return p(!0), (async () => {
72
+ try {
73
+ const f = await At({
74
+ ...r,
75
+ current: d.current,
76
+ size: d.size
77
+ });
78
+ if (N !== h.current)
79
+ return;
80
+ s((f == null ? void 0 : f.records) ?? []), i((f == null ? void 0 : f.total) ?? 0);
81
+ } finally {
82
+ N === h.current && p(!1);
83
+ }
84
+ })(), () => {
85
+ h.current += 1;
86
+ };
87
+ }, [r, d, e, C]);
88
+ const c = z((N) => {
89
+ n(N), m((f) => ({ ...f, current: 1 }));
90
+ }, []), T = z((N, f) => {
91
+ m({ current: N, size: f });
92
+ }, []), v = z(() => {
93
+ A((N) => N + 1);
94
+ }, []);
95
+ return {
96
+ filters: r,
97
+ pagination: d,
98
+ records: o,
99
+ total: a,
100
+ loading: u,
101
+ updateFilters: c,
102
+ updatePagination: T,
103
+ reload: v
104
+ };
105
+ }
106
+ function Pe(e) {
107
+ const [r, n] = x(), [d, m] = x(!0), [o, s] = x(0), a = _(0);
108
+ B(() => {
109
+ const u = ++a.current;
110
+ return m(!0), mt({ silent: !0 }).then((p) => {
111
+ u === a.current && (n(p), m(!1));
112
+ }), () => {
113
+ a.current += 1;
114
+ };
115
+ }, [e, o]);
116
+ const i = z(() => s((u) => u + 1), []);
117
+ return { stats: r, loading: d, reload: i };
118
+ }
119
+ const Be = {
120
+ 0: { label: "待执行", color: "default" },
121
+ 1: { label: "运行中", color: "processing" },
122
+ 2: { label: "已完成", color: "success" },
123
+ 3: { label: "部分成功", color: "warning" },
124
+ 4: { label: "失败", color: "error" },
125
+ 5: { label: "已取消", color: "default" }
126
+ };
127
+ function Ce(e) {
128
+ var r;
129
+ return e === void 0 ? "未运行" : ((r = Be[e]) == null ? void 0 : r.label) ?? `状态${e}`;
130
+ }
131
+ function we(e) {
132
+ var r;
133
+ return e === void 0 ? "default" : ((r = Be[e]) == null ? void 0 : r.color) ?? "default";
134
+ }
135
+ function Se(e) {
136
+ return e === 0 || e === 1;
137
+ }
138
+ function Ee(e) {
139
+ return { 1: "全量重放", 2: "增量同步", 3: "手动执行" }[e ?? 3] ?? "手动执行";
140
+ }
141
+ function qe(e) {
142
+ return e === 2 ? "关系" : "对象";
143
+ }
144
+ function he(e) {
145
+ if (!e)
146
+ return [];
147
+ try {
148
+ const r = JSON.parse(e);
149
+ return Array.isArray(r) ? r.flatMap((n) => {
150
+ if (typeof n != "object" || n === null)
151
+ return [];
152
+ const d = n, m = typeof d.sourceColumn == "string" ? d.sourceColumn : "", o = typeof d.propertyName == "string" ? d.propertyName : "";
153
+ return m || o ? [{ sourceColumn: m, propertyName: o }] : [];
154
+ }) : [];
155
+ } catch {
156
+ return [];
157
+ }
158
+ }
159
+ function Zt(e) {
160
+ const r = e.filter((n) => n.sourceColumn.trim() && n.propertyName.trim());
161
+ return r.length ? JSON.stringify(r) : void 0;
162
+ }
163
+ function Ht({ failures: e }) {
164
+ const r = Q(
165
+ () => [
166
+ {
167
+ title: "批次",
168
+ dataIndex: "batchNo",
169
+ key: "batchNo",
170
+ width: 60,
171
+ sorter: (o, s) => (o.batchNo ?? 0) - (s.batchNo ?? 0),
172
+ render: (o) => o ?? "—"
173
+ },
174
+ {
175
+ title: "行号",
176
+ dataIndex: "rowNo",
177
+ key: "rowNo",
178
+ width: 70,
179
+ sorter: (o, s) => (o.rowNo ?? 0) - (s.rowNo ?? 0),
180
+ render: (o) => o ?? "—"
181
+ },
182
+ {
183
+ title: "目标",
184
+ key: "target",
185
+ width: 180,
186
+ ellipsis: !0,
187
+ render: (o, s) => /* @__PURE__ */ t("span", { title: s.targetVid, children: s.targetName || s.targetVid || "—" })
188
+ },
189
+ {
190
+ title: "两端 VID",
191
+ key: "endpoints",
192
+ width: 180,
193
+ ellipsis: !0,
194
+ render: (o, s) => s.srcVid || s.dstVid ? `${s.srcVid ?? "—"} → ${s.dstVid ?? "—"}` : "—"
195
+ },
196
+ {
197
+ title: "错误码",
198
+ dataIndex: "errorCode",
199
+ key: "errorCode",
200
+ width: 90,
201
+ render: (o) => o || "—"
202
+ },
203
+ {
204
+ title: "失败原因",
205
+ dataIndex: "errorMsg",
206
+ key: "errorMsg",
207
+ width: 260,
208
+ ellipsis: !0,
209
+ render: (o) => /* @__PURE__ */ t("span", { className: "ox-fail-text", title: o, children: o || "—" })
210
+ }
211
+ ],
212
+ []
213
+ ), { columns: n, components: d } = oe(r), m = r.reduce((o, s) => o + Number(s.width || 0), 0);
214
+ return /* @__PURE__ */ t(
215
+ le,
216
+ {
217
+ rowKey: (o) => `${o.batchNo ?? 0}-${o.rowNo ?? 0}-${o.targetVid ?? ""}`,
218
+ size: "small",
219
+ columns: n,
220
+ components: d,
221
+ dataSource: e,
222
+ pagination: { pageSize: 10, size: "small", showTotal: (o) => `共 ${o} 行` },
223
+ scroll: { x: m }
224
+ }
225
+ );
226
+ }
227
+ function en({
228
+ task: e,
229
+ onClose: r,
230
+ onLaunchSync: n,
231
+ syncRunning: d
232
+ }) {
233
+ var Z;
234
+ const { message: m, modal: o } = re.useApp(), s = !!e, [a, i] = x([]), [u, p] = x(0), [C, A] = x(!1), [h, c] = x({ current: 1, size: 10 }), [T, v] = x(0), [N, f] = x(), [g, S] = x(), [$, k] = x(!1), [P, V] = x(), q = _(0), U = _(0), y = z(() => {
235
+ v((E) => E + 1);
236
+ }, []);
237
+ B(() => {
238
+ f(void 0), S(void 0), c({ current: 1, size: 10 });
239
+ }, [e == null ? void 0 : e.code]), B(() => {
240
+ if (!(e != null && e.code))
241
+ return;
242
+ const E = ++q.current;
243
+ return A(!0), Dt({
244
+ taskCode: e.code,
245
+ current: h.current,
246
+ size: h.size
247
+ }).then((F) => {
248
+ E === q.current && (i((F == null ? void 0 : F.records) ?? []), p((F == null ? void 0 : F.total) ?? 0), A(!1));
249
+ }), () => {
250
+ q.current += 1;
251
+ };
252
+ }, [e == null ? void 0 : e.code, h, T]);
253
+ const b = a.some((E) => Se(E.status));
254
+ B(() => {
255
+ if (!s || !b)
256
+ return;
257
+ const E = window.setInterval(() => {
258
+ v((F) => F + 1);
259
+ }, 5e3);
260
+ return () => {
261
+ window.clearInterval(E);
262
+ };
263
+ }, [s, b]), B(() => {
264
+ if (!N)
265
+ return;
266
+ const E = ++U.current;
267
+ return k(!0), Rt(N).then((F) => {
268
+ E === U.current && (S(F), k(!1));
269
+ }), () => {
270
+ U.current += 1;
271
+ };
272
+ }, [N, T]);
273
+ const W = z(
274
+ (E) => {
275
+ o.confirm({
276
+ title: "取消本次同步运行?",
277
+ content: "运行中与排队中的批次都会停止;已写入的实例保留。",
278
+ okText: "取消运行",
279
+ okButtonProps: { danger: !0 },
280
+ cancelText: "再想想",
281
+ onOk: async () => {
282
+ V(E.code);
283
+ try {
284
+ await $t(E.code), m.success("已下发取消"), y();
285
+ } finally {
286
+ V(void 0);
287
+ }
288
+ }
289
+ });
290
+ },
291
+ [o, m, y]
292
+ ), w = z(async () => {
293
+ e && (await n(e), y());
294
+ }, [e, n, y]), M = Q(
295
+ () => [
296
+ {
297
+ title: "运行编码",
298
+ dataIndex: "code",
299
+ key: "code",
300
+ width: 180,
301
+ ellipsis: !0,
302
+ sorter: (E, F) => E.code.localeCompare(F.code),
303
+ render: (E) => /* @__PURE__ */ t("button", { type: "button", className: "ox-task-name mono", onClick: () => f(E), children: E })
304
+ },
305
+ {
306
+ title: "类型",
307
+ dataIndex: "runType",
308
+ key: "runType",
309
+ width: 100,
310
+ sorter: (E, F) => (E.runType ?? 0) - (F.runType ?? 0),
311
+ render: (E) => Ee(E)
312
+ },
313
+ {
314
+ title: "状态",
315
+ dataIndex: "status",
316
+ key: "status",
317
+ width: 100,
318
+ sorter: (E, F) => (E.status ?? -1) - (F.status ?? -1),
319
+ render: (E, F) => /* @__PURE__ */ t(j, { color: we(E), title: F.statusMessage, children: Ce(E) })
320
+ },
321
+ {
322
+ title: "行数(共/成/败)",
323
+ key: "rows",
324
+ width: 140,
325
+ sorter: (E, F) => (E.totalRows ?? 0) - (F.totalRows ?? 0),
326
+ render: (E, F) => /* @__PURE__ */ l("span", { children: [
327
+ F.totalRows ?? 0,
328
+ " / ",
329
+ F.succeededRows ?? 0,
330
+ " /",
331
+ " ",
332
+ F.failedRows ? /* @__PURE__ */ t("em", { className: "ox-fail-count", children: F.failedRows }) : 0
333
+ ] })
334
+ },
335
+ {
336
+ title: "水位",
337
+ key: "watermark",
338
+ width: 200,
339
+ ellipsis: !0,
340
+ render: (E, F) => F.watermarkBefore || F.watermarkAfter ? `${F.watermarkBefore ?? "—"} → ${F.watermarkAfter ?? "—"}` : "—"
341
+ },
342
+ {
343
+ title: "开始时间",
344
+ dataIndex: "startedAt",
345
+ key: "startedAt",
346
+ width: 150,
347
+ sorter: (E, F) => (E.startedAt ?? "").localeCompare(F.startedAt ?? ""),
348
+ render: (E) => E || "—"
349
+ },
350
+ {
351
+ title: "结束时间",
352
+ dataIndex: "finishedAt",
353
+ key: "finishedAt",
354
+ width: 150,
355
+ sorter: (E, F) => (E.finishedAt ?? "").localeCompare(F.finishedAt ?? ""),
356
+ render: (E) => E || "—"
357
+ },
358
+ {
359
+ title: "操作",
360
+ key: "action",
361
+ width: 120,
362
+ render: (E, F) => /* @__PURE__ */ l("span", { className: "ox-row-actions", children: [
363
+ /* @__PURE__ */ t(O, { size: "small", type: "link", onClick: () => f(F.code), children: "详情" }),
364
+ Se(F.status) ? /* @__PURE__ */ t(
365
+ O,
366
+ {
367
+ size: "small",
368
+ type: "link",
369
+ danger: !0,
370
+ loading: P === F.code,
371
+ onClick: () => W(F),
372
+ children: "取消"
373
+ }
374
+ ) : null
375
+ ] })
376
+ }
377
+ ],
378
+ [P, W]
379
+ ), { columns: R, components: D } = oe(M, { excludeKeys: ["action"] }), G = M.reduce((E, F) => E + Number(F.width || 0), 0), I = g == null ? void 0 : g.run;
380
+ return /* @__PURE__ */ l(
381
+ ce,
382
+ {
383
+ title: `运行记录 · ${(e == null ? void 0 : e.name) ?? ""}`,
384
+ open: s,
385
+ width: 960,
386
+ onCancel: r,
387
+ maskClosable: !1,
388
+ className: "ox-collection-runs-modal",
389
+ footer: /* @__PURE__ */ l("span", { className: "ox-detail-footer", children: [
390
+ /* @__PURE__ */ t("span", { className: "hint", children: "同步直写实例、不产草案;运行记录按轮次留痕" }),
391
+ /* @__PURE__ */ t(O, { loading: d, onClick: () => void w(), children: "立即同步" }),
392
+ /* @__PURE__ */ t(O, { type: "primary", onClick: r, children: "关 闭" })
393
+ ] }),
394
+ children: [
395
+ /* @__PURE__ */ t("p", { className: "ox-modal-sub", children: "长期任务:按调度持续同步数据集到实例;失败行在运行记录中查看。数据集与字段在「数据准备」维护。" }),
396
+ N ? /* @__PURE__ */ t(pe, { spinning: $ && !g, children: /* @__PURE__ */ l("div", { className: "ox-run-detail", children: [
397
+ /* @__PURE__ */ t(O, { size: "small", onClick: () => f(void 0), children: "返回运行列表" }),
398
+ g ? /* @__PURE__ */ l(H, { children: [
399
+ /* @__PURE__ */ t(
400
+ Oe,
401
+ {
402
+ size: "small",
403
+ column: 3,
404
+ items: [
405
+ { key: "code", label: "运行编码", children: (I == null ? void 0 : I.code) || N },
406
+ {
407
+ key: "status",
408
+ label: "状态",
409
+ children: /* @__PURE__ */ t(j, { color: we(I == null ? void 0 : I.status), children: Ce(I == null ? void 0 : I.status) })
410
+ },
411
+ {
412
+ key: "type",
413
+ label: "类型",
414
+ children: Ee(I == null ? void 0 : I.runType)
415
+ },
416
+ {
417
+ key: "target",
418
+ label: "目标",
419
+ children: `${qe(g.targetType)} · ${g.targetCode || "—"}`
420
+ },
421
+ { key: "dataset", label: "数据集", children: g.datasetCode || "—" },
422
+ {
423
+ key: "rows",
424
+ label: "行数(共/成/败)",
425
+ children: `${(I == null ? void 0 : I.totalRows) ?? 0} / ${(I == null ? void 0 : I.succeededRows) ?? 0} / ${(I == null ? void 0 : I.failedRows) ?? 0}`
426
+ },
427
+ {
428
+ key: "watermark",
429
+ label: "水位",
430
+ children: I != null && I.watermarkBefore || I != null && I.watermarkAfter ? `${(I == null ? void 0 : I.watermarkBefore) ?? "—"} → ${(I == null ? void 0 : I.watermarkAfter) ?? "—"}` : "—",
431
+ span: 2
432
+ },
433
+ {
434
+ key: "message",
435
+ label: "状态说明",
436
+ children: (I == null ? void 0 : I.statusMessage) || "—"
437
+ }
438
+ ]
439
+ }
440
+ ),
441
+ g.querySql ? /* @__PURE__ */ l("section", { className: "ox-detail-section", children: [
442
+ /* @__PURE__ */ t("header", { children: /* @__PURE__ */ t("b", { children: "执行 SQL" }) }),
443
+ /* @__PURE__ */ t("pre", { className: "ox-run-sql", children: g.querySql })
444
+ ] }) : null,
445
+ /* @__PURE__ */ l("section", { className: "ox-detail-section", children: [
446
+ /* @__PURE__ */ l("header", { children: [
447
+ /* @__PURE__ */ t("b", { children: "失败行" }),
448
+ /* @__PURE__ */ t("span", { className: "hint", children: "失败行只留痕,不回滚已写入实例" })
449
+ ] }),
450
+ (Z = g.failures) != null && Z.length ? /* @__PURE__ */ t(Ht, { failures: g.failures }) : /* @__PURE__ */ t("p", { className: "ox-run-nofail", children: "本次运行没有失败行" })
451
+ ] })
452
+ ] }) : /* @__PURE__ */ t("div", { className: "ox-detail-placeholder", children: $ ? "" : "运行明细加载失败" })
453
+ ] }) }) : /* @__PURE__ */ l(H, { children: [
454
+ /* @__PURE__ */ t(
455
+ le,
456
+ {
457
+ rowKey: "code",
458
+ size: "small",
459
+ loading: C,
460
+ columns: R,
461
+ components: D,
462
+ dataSource: a,
463
+ pagination: !1,
464
+ scroll: { x: G },
465
+ locale: { emptyText: "暂无运行记录,可点击「立即同步」发起一次" }
466
+ }
467
+ ),
468
+ /* @__PURE__ */ t("div", { className: "ox-pagination", children: /* @__PURE__ */ t(
469
+ ye,
470
+ {
471
+ size: "small",
472
+ current: h.current,
473
+ pageSize: h.size,
474
+ total: u,
475
+ showSizeChanger: !0,
476
+ showTotal: (E) => `共 ${E} 条`,
477
+ onChange: (E, F) => c({ current: E, size: F })
478
+ }
479
+ ) })
480
+ ] })
481
+ ]
482
+ }
483
+ );
484
+ }
485
+ const Ge = {
486
+ name: "",
487
+ datasetCode: "",
488
+ targetType: 1,
489
+ targetCode: "",
490
+ fieldMapping: [],
491
+ enabled: !0
492
+ };
493
+ function tn(e) {
494
+ return e ? {
495
+ name: e.name || "",
496
+ datasetCode: e.datasetCode || "",
497
+ targetType: e.targetType === 2 ? 2 : 1,
498
+ targetCode: e.targetCode || "",
499
+ fieldMapping: he(e.fieldMapping),
500
+ instanceField: e.instanceField,
501
+ sourceField: e.sourceField,
502
+ targetField: e.targetField,
503
+ updateTimeField: e.updateTimeField,
504
+ cronExpr: e.cronExpr,
505
+ baseTime: e.baseTime ? Bt(e.baseTime) : null,
506
+ enabled: e.enabled !== 0
507
+ } : Ge;
508
+ }
509
+ function nn(e, r) {
510
+ var n, d, m;
511
+ return {
512
+ ...r ? { code: r } : {},
513
+ name: e.name.trim(),
514
+ datasetCode: e.datasetCode,
515
+ targetType: e.targetType,
516
+ targetCode: e.targetCode,
517
+ fieldMapping: Zt(e.fieldMapping || []),
518
+ instanceField: ((n = e.instanceField) == null ? void 0 : n.trim()) || void 0,
519
+ sourceField: e.targetType === 2 ? e.sourceField : void 0,
520
+ targetField: e.targetType === 2 ? e.targetField : void 0,
521
+ updateTimeField: ((d = e.updateTimeField) == null ? void 0 : d.trim()) || void 0,
522
+ cronExpr: ((m = e.cronExpr) == null ? void 0 : m.trim()) || void 0,
523
+ baseTime: e.baseTime ? e.baseTime.format("YYYY-MM-DD HH:mm:ss") : void 0,
524
+ enabled: e.enabled ? 1 : 0
525
+ };
526
+ }
527
+ function rn({ open: e, record: r, onClose: n, onSaved: d }) {
528
+ const { message: m } = re.useApp(), [o] = X.useForm(), [s, a] = x(!1), [i, u] = x(null), [p, C] = x(!1), [A, h] = x([]), [c, T] = x(
529
+ null
530
+ ), v = _(0), N = _(0), f = !!(r != null && r.code), g = X.useWatch("targetType", o) ?? 1, S = X.useWatch("targetCode", o), $ = X.useWatch("datasetCode", o);
531
+ B(() => {
532
+ if (!e)
533
+ return;
534
+ o.setFieldsValue(tn(r));
535
+ const w = ++v.current;
536
+ return C(!1), Ft({ current: 1, size: 200, enabled: 1 }).then((M) => {
537
+ w !== v.current || !M || h(
538
+ (M.records || []).map((R) => ({ value: R.code, label: R.name }))
539
+ );
540
+ }), it().then((M) => {
541
+ w === v.current && u(M);
542
+ }).catch(() => {
543
+ w === v.current && C(!0);
544
+ }), () => {
545
+ v.current += 1;
546
+ };
547
+ }, [e, r, o]), B(() => {
548
+ const w = ++N.current;
549
+ if ($)
550
+ return Lt($).then((M) => {
551
+ w === N.current && T({ code: $, columns: (M == null ? void 0 : M.columns) ?? [] });
552
+ }), () => {
553
+ N.current += 1;
554
+ };
555
+ }, [$]);
556
+ const k = !!$ && (c == null ? void 0 : c.code) === $, P = Q(() => k ? ((c == null ? void 0 : c.columns) ?? []).map((w) => ({
557
+ value: w.columnName,
558
+ label: w.comment ? `${w.columnName} · ${w.comment}` : w.columnName
559
+ })) : [], [c, k]), V = $ ? k ? P.length ? `已读取 ${P.length} 列,列名均可下拉选择` : "列读取失败(数据源不可达或无权限),可直接输入列名" : "正在读取数据集列…" : void 0, q = Q(() => i ? g === 2 ? i.edges.map((w) => ({
560
+ value: w.edgeName,
561
+ label: w.displayName ? `${w.displayName}(${w.edgeName})` : w.edgeName
562
+ })) : i.tags.map((w) => ({
563
+ value: w.tagName,
564
+ label: w.displayName ? `${w.displayName}(${w.tagName})` : w.tagName
565
+ })) : [], [i, g]), U = Q(() => {
566
+ var M, R;
567
+ return !i || !S ? [] : ((g === 2 ? (M = i.edges.find((D) => D.edgeName === S)) == null ? void 0 : M.properties : (R = i.tags.find((D) => D.tagName === S)) == null ? void 0 : R.properties) || []).map((D) => ({
568
+ value: D.propertyName,
569
+ label: D.displayName && D.displayName !== D.propertyName ? `${D.propertyName} · ${D.displayName}` : D.propertyName
570
+ }));
571
+ }, [i, S, g]), y = Q(() => {
572
+ var D;
573
+ if (g !== 2 || !S || !i)
574
+ return null;
575
+ const w = ((D = i.edges.find((G) => G.edgeName === S)) == null ? void 0 : D.endpoints) ?? [];
576
+ if (!w.length)
577
+ return null;
578
+ const M = Array.from(new Set(w.map((G) => G.srcTag))), R = Array.from(new Set(w.map((G) => G.dstTag)));
579
+ return M.length !== 1 || R.length !== 1 ? { multiple: !0, srcTag: "", dstTag: "" } : { multiple: !1, srcTag: M[0], dstTag: R[0] };
580
+ }, [i, S, g]), b = (w, M) => y != null && y.multiple ? "该关系类型声明了多组端点,采集暂不支持;请改用唯一端点约束的关系类型" : y ? `列值按「${w}:列值」匹配${M}实例,未命中再按展示名回查` : `列值优先按主键匹配${M}实例,未命中再按展示名回查`;
581
+ B(() => {
582
+ if (!e || !k || !U.length)
583
+ return;
584
+ const w = o.getFieldValue("fieldMapping");
585
+ if (w && w.length)
586
+ return;
587
+ const M = new Map(U.map((D) => [D.value.toLowerCase(), D.value])), R = ((c == null ? void 0 : c.columns) ?? []).map((D) => {
588
+ const G = M.get(D.columnName.toLowerCase());
589
+ return G ? { sourceColumn: D.columnName, propertyName: G } : null;
590
+ }).filter((D) => D !== null);
591
+ R.length && o.setFieldValue("fieldMapping", R);
592
+ }, [e, k, c, U, o]);
593
+ const W = async () => {
594
+ const w = await o.validateFields();
595
+ a(!0);
596
+ try {
597
+ const M = nn(w, r == null ? void 0 : r.code);
598
+ if (!(f ? await Mt(M) : await Ot(M)))
599
+ return;
600
+ m.success(f ? "采集任务已更新" : "采集任务已创建"), d(), n();
601
+ } finally {
602
+ a(!1);
603
+ }
604
+ };
605
+ return /* @__PURE__ */ l(
606
+ ce,
607
+ {
608
+ title: f ? "编辑采集任务" : "新建采集任务",
609
+ open: e,
610
+ width: 720,
611
+ okText: "保存任务",
612
+ cancelText: "取消",
613
+ confirmLoading: s,
614
+ onOk: () => void W(),
615
+ onCancel: n,
616
+ destroyOnHidden: !0,
617
+ maskClosable: !1,
618
+ className: "ox-collection-modal",
619
+ children: [
620
+ /* @__PURE__ */ t("p", { className: "ox-modal-sub", children: "采集任务是长期任务:按调度持续同步数据集,每批按映射直接写入对象/关系实例(走写入网关,不进草案池)。 数据集与字段在「数据准备」维护。" }),
621
+ /* @__PURE__ */ l(X, { form: o, layout: "vertical", initialValues: Ge, className: "ox-collection-form", children: [
622
+ /* @__PURE__ */ t("div", { className: "ox-form-section", children: "基本配置" }),
623
+ /* @__PURE__ */ l("div", { className: "ox-form-row", children: [
624
+ /* @__PURE__ */ t(
625
+ X.Item,
626
+ {
627
+ name: "name",
628
+ label: "名称",
629
+ className: "ox-form-row-main",
630
+ rules: [{ required: !0, whitespace: !0, message: "请输入任务名称" }],
631
+ children: /* @__PURE__ */ t(ne, { maxLength: 64, placeholder: "如 患者主索引同步" })
632
+ }
633
+ ),
634
+ /* @__PURE__ */ t(X.Item, { name: "enabled", label: "启用", className: "ox-form-row-side", valuePropName: "checked", children: /* @__PURE__ */ t(qt, {}) })
635
+ ] }),
636
+ /* @__PURE__ */ t(
637
+ X.Item,
638
+ {
639
+ name: "datasetCode",
640
+ label: "数据集",
641
+ rules: [{ required: !0, message: "请选择数据集" }],
642
+ extra: V ?? "先选数据集;同步列名与该数据集的列探测结果一致",
643
+ children: /* @__PURE__ */ t(
644
+ te,
645
+ {
646
+ showSearch: !0,
647
+ optionFilterProp: "label",
648
+ options: A,
649
+ placeholder: "选择启用的数据集",
650
+ notFoundContent: "暂无启用数据集,请先在数据准备页启用"
651
+ }
652
+ )
653
+ }
654
+ ),
655
+ /* @__PURE__ */ t("div", { className: "ox-form-section", children: "采集目标" }),
656
+ /* @__PURE__ */ t(X.Item, { name: "targetType", label: "目标类型", children: /* @__PURE__ */ t(
657
+ Pt.Group,
658
+ {
659
+ optionType: "button",
660
+ options: [
661
+ { value: 1, label: "对象" },
662
+ { value: 2, label: "关系" }
663
+ ],
664
+ onChange: () => o.setFieldValue("targetCode", void 0)
665
+ }
666
+ ) }),
667
+ /* @__PURE__ */ t(
668
+ X.Item,
669
+ {
670
+ name: "targetCode",
671
+ label: "目标编码",
672
+ rules: [{ required: !0, message: "请选择目标类型编码" }],
673
+ extra: p ? "本体结构加载失败,请稍后重试" : q.length ? void 0 : "当前本体还没有可选类型,请先在建模工作台创建对象/关系类型",
674
+ children: /* @__PURE__ */ t(
675
+ te,
676
+ {
677
+ showSearch: !0,
678
+ optionFilterProp: "label",
679
+ options: q,
680
+ placeholder: g === 2 ? "选择关系类型" : "选择对象类型",
681
+ disabled: !q.length
682
+ }
683
+ )
684
+ }
685
+ ),
686
+ g === 2 ? /* @__PURE__ */ l("div", { className: "ox-form-row", children: [
687
+ /* @__PURE__ */ t(
688
+ X.Item,
689
+ {
690
+ name: "sourceField",
691
+ label: "起点主键列",
692
+ className: "ox-form-row-main",
693
+ rules: [{ required: !0, message: "起点主键列必填" }],
694
+ extra: b((y == null ? void 0 : y.srcTag) ?? "", "起点"),
695
+ children: /* @__PURE__ */ t(ae, { options: P, placeholder: "选择数据集列", allowClear: !0 })
696
+ }
697
+ ),
698
+ /* @__PURE__ */ t(
699
+ X.Item,
700
+ {
701
+ name: "targetField",
702
+ label: "终点主键列",
703
+ className: "ox-form-row-side",
704
+ rules: [{ required: !0, message: "终点主键列必填" }],
705
+ extra: b((y == null ? void 0 : y.dstTag) ?? "", "终点"),
706
+ children: /* @__PURE__ */ t(ae, { options: P, placeholder: "选择数据集列", allowClear: !0 })
707
+ }
708
+ )
709
+ ] }) : /* @__PURE__ */ t(
710
+ X.Item,
711
+ {
712
+ name: "instanceField",
713
+ label: "实例主键列",
714
+ extra: "列值作为实例主键(类型名:列值),同列值聚合为同一条实例;实例展示名默认取该值",
715
+ children: /* @__PURE__ */ t(ae, { options: P, placeholder: "选择数据集列,如 patient_id", allowClear: !0 })
716
+ }
717
+ ),
718
+ /* @__PURE__ */ t("div", { className: "ox-form-section", children: "属性映射" }),
719
+ /* @__PURE__ */ t("div", { className: "ox-mapping-caption", children: "数据集源列 → 本体属性名,按行一一对应;同名列已自动预填,可增删调整;留空则不写业务属性(关系类型只建边时常用)" }),
720
+ /* @__PURE__ */ t(X.List, { name: "fieldMapping", children: (w, { add: M, remove: R }) => /* @__PURE__ */ l("div", { className: "ox-mapping", children: [
721
+ w.map((D) => /* @__PURE__ */ l("div", { className: "ox-mapping-row", children: [
722
+ /* @__PURE__ */ t(
723
+ X.Item,
724
+ {
725
+ name: [D.name, "sourceColumn"],
726
+ rules: [{ required: !0, message: "源列必填" }],
727
+ className: "ox-mapping-source",
728
+ children: /* @__PURE__ */ t(ae, { options: P, placeholder: "数据集源列" })
729
+ }
730
+ ),
731
+ /* @__PURE__ */ t(J, { name: "arrow-right", size: 12 }),
732
+ /* @__PURE__ */ t(
733
+ X.Item,
734
+ {
735
+ name: [D.name, "propertyName"],
736
+ rules: [{ required: !0, message: "属性必填" }],
737
+ className: "ox-mapping-target",
738
+ children: /* @__PURE__ */ t(ae, { options: U, placeholder: "本体属性", filterOption: !0 })
739
+ }
740
+ ),
741
+ /* @__PURE__ */ t(
742
+ O,
743
+ {
744
+ size: "small",
745
+ type: "text",
746
+ "aria-label": "删除映射行",
747
+ onClick: () => R(D.name),
748
+ children: /* @__PURE__ */ t(J, { name: "x-circle", size: 13 })
749
+ }
750
+ )
751
+ ] }, D.key)),
752
+ /* @__PURE__ */ t(O, { size: "small", type: "dashed", block: !0, onClick: () => M(), children: "添加映射" })
753
+ ] }) }),
754
+ /* @__PURE__ */ t("div", { className: "ox-form-section", children: "调度与更新规则" }),
755
+ /* @__PURE__ */ t(
756
+ X.Item,
757
+ {
758
+ name: "updateTimeField",
759
+ label: "更新时间列",
760
+ extra: "选列后按该列时间水位扫描:首轮从起始水位(未设则从头)扫,之后每轮只扫上轮水位以后的新数据;不选则每轮全量扫描",
761
+ children: /* @__PURE__ */ t(ae, { options: P, placeholder: "选择数据集时间列,可留空", allowClear: !0 })
762
+ }
763
+ ),
764
+ /* @__PURE__ */ l("div", { className: "ox-form-row", children: [
765
+ /* @__PURE__ */ t(
766
+ X.Item,
767
+ {
768
+ name: "cronExpr",
769
+ label: "调度频次(cron)",
770
+ className: "ox-form-row-main",
771
+ extra: "留空仅手动执行",
772
+ children: /* @__PURE__ */ t(ne, { placeholder: "0 0 2 * * ?" })
773
+ }
774
+ ),
775
+ /* @__PURE__ */ t(
776
+ X.Item,
777
+ {
778
+ name: "baseTime",
779
+ label: "起始水位",
780
+ className: "ox-form-row-side",
781
+ extra: "选了时间列时首轮从该时间起算",
782
+ children: /* @__PURE__ */ t(Gt, { showTime: !0, style: { width: "100%" } })
783
+ }
784
+ )
785
+ ] })
786
+ ] }),
787
+ /* @__PURE__ */ t("p", { className: "ox-modal-footnote", children: "写入域固定为当前域 · 产出直达实例,不进草案池" })
788
+ ]
789
+ }
790
+ );
791
+ }
792
+ function an({
793
+ records: e,
794
+ loading: r,
795
+ onEdit: n,
796
+ onRuns: d,
797
+ onRun: m,
798
+ onToggle: o,
799
+ onDelete: s,
800
+ runningCode: a,
801
+ togglingCode: i
802
+ }) {
803
+ const u = Q(
804
+ () => [
805
+ {
806
+ title: "任务 / 数据集",
807
+ dataIndex: "name",
808
+ key: "name",
809
+ width: 220,
810
+ ellipsis: !0,
811
+ sorter: (h, c) => h.name.localeCompare(c.name),
812
+ render: (h, c) => /* @__PURE__ */ l("span", { className: "ox-collection-name", children: [
813
+ /* @__PURE__ */ t("button", { type: "button", className: "ox-task-name", onClick: () => d(c), children: h }),
814
+ /* @__PURE__ */ t("em", { children: c.datasetName || c.datasetCode || "—" })
815
+ ] })
816
+ },
817
+ {
818
+ title: "目标",
819
+ key: "target",
820
+ width: 160,
821
+ ellipsis: !0,
822
+ sorter: (h, c) => (h.targetCode ?? "").localeCompare(c.targetCode ?? ""),
823
+ render: (h, c) => /* @__PURE__ */ l("span", { children: [
824
+ /* @__PURE__ */ t(j, { children: qe(c.targetType) }),
825
+ c.targetCode || "—"
826
+ ] })
827
+ },
828
+ {
829
+ title: "映射 / 更新",
830
+ key: "mapping",
831
+ width: 150,
832
+ sorter: (h, c) => he(h.fieldMapping).length - he(c.fieldMapping).length,
833
+ render: (h, c) => /* @__PURE__ */ l("span", { className: "ox-collection-mapping", children: [
834
+ "映射 ",
835
+ he(c.fieldMapping).length,
836
+ " 列",
837
+ /* @__PURE__ */ t("em", { children: c.updateTimeField ? `按 ${c.updateTimeField} 时间` : "全量扫描" })
838
+ ] })
839
+ },
840
+ {
841
+ title: "频次",
842
+ dataIndex: "cronExpr",
843
+ key: "cronExpr",
844
+ width: 140,
845
+ ellipsis: !0,
846
+ sorter: (h, c) => (h.cronExpr ?? "").localeCompare(c.cronExpr ?? ""),
847
+ render: (h) => h || "手动"
848
+ },
849
+ {
850
+ title: "最近同步",
851
+ key: "lastRun",
852
+ width: 190,
853
+ sorter: (h, c) => (h.lastRunTime ?? "").localeCompare(c.lastRunTime ?? ""),
854
+ render: (h, c) => /* @__PURE__ */ l("span", { className: "ox-collection-lastrun", children: [
855
+ /* @__PURE__ */ t(j, { color: we(c.lastRunStatus), children: Ce(c.lastRunStatus) }),
856
+ /* @__PURE__ */ t("em", { title: c.lastRunMessage, children: c.lastRunTime || "—" })
857
+ ] })
858
+ },
859
+ {
860
+ title: "状态",
861
+ dataIndex: "enabled",
862
+ key: "enabled",
863
+ width: 90,
864
+ sorter: (h, c) => (h.enabled ?? 0) - (c.enabled ?? 0),
865
+ render: (h, c) => c.runState === 1 ? /* @__PURE__ */ t(j, { color: "processing", children: "同步中" }) : h === 1 ? /* @__PURE__ */ t(j, { color: "success", children: "已启用" }) : /* @__PURE__ */ t(j, { children: "已停用" })
866
+ },
867
+ {
868
+ title: "操作",
869
+ key: "action",
870
+ width: 250,
871
+ render: (h, c) => /* @__PURE__ */ l("span", { className: "ox-row-actions", children: [
872
+ /* @__PURE__ */ t(O, { size: "small", type: "link", onClick: () => d(c), children: "运行记录" }),
873
+ /* @__PURE__ */ t(
874
+ O,
875
+ {
876
+ size: "small",
877
+ type: "link",
878
+ loading: a === c.code,
879
+ onClick: () => m(c),
880
+ children: "立即同步"
881
+ }
882
+ ),
883
+ /* @__PURE__ */ t(O, { size: "small", type: "link", onClick: () => n(c), children: "编辑" }),
884
+ /* @__PURE__ */ t(
885
+ O,
886
+ {
887
+ size: "small",
888
+ type: "link",
889
+ loading: i === c.code,
890
+ onClick: () => o(c),
891
+ children: c.enabled === 1 ? "停用" : "启用"
892
+ }
893
+ ),
894
+ /* @__PURE__ */ t(O, { size: "small", type: "link", danger: !0, onClick: () => s(c), children: "删除" })
895
+ ] })
896
+ }
897
+ ],
898
+ [n, d, m, o, s, a, i]
899
+ ), { columns: p, components: C } = oe(u, { excludeKeys: ["action"] }), A = u.reduce((h, c) => h + Number(c.width || 0), 0);
900
+ return /* @__PURE__ */ t(
901
+ le,
902
+ {
903
+ rowKey: "code",
904
+ size: "small",
905
+ loading: r,
906
+ columns: p,
907
+ components: C,
908
+ dataSource: e,
909
+ pagination: !1,
910
+ scroll: { x: A },
911
+ locale: {
912
+ emptyText: /* @__PURE__ */ l("div", { className: "ox-table-empty", children: [
913
+ /* @__PURE__ */ t(J, { name: "inbox", size: 22 }),
914
+ /* @__PURE__ */ t("b", { children: "暂无采集任务" }),
915
+ /* @__PURE__ */ t("p", { children: "点击「新建采集任务」,按调度持续同步数据集到实例;直写实例、不产草案。" })
916
+ ] })
917
+ }
918
+ }
919
+ );
920
+ }
921
+ const sn = [
922
+ {
923
+ source: "数据集",
924
+ form: "长期定时任务",
925
+ intake: "按调度持续同步数据集,每批按属性映射直接写入对象/关系实例(走写入网关)",
926
+ pick: "数据集 + 目标类型 + 属性映射 + 调度与更新规则(增量需更新时间列)",
927
+ output: "实例直写,不进草案池",
928
+ evidence: "运行记录按轮次留痕,失败行在运行明细查看"
929
+ }
930
+ ], on = [
931
+ {
932
+ source: "会话",
933
+ form: "结构化提取任务",
934
+ intake: "在会话里用对话说明要抽取的对象与关系,发送即在后台运行",
935
+ pick: "任务名称 + 对话说明(可不挂资料)",
936
+ output: "实例草案,待确认后生效",
937
+ evidence: "会话轮次留痕,草案组按轮次归档"
938
+ },
939
+ {
940
+ source: "知识库",
941
+ form: "结构化提取任务",
942
+ intake: "勾选知识库资料作为来源,随首条消息发送;服务端解析并分片提取",
943
+ pick: "任务名称 + 知识库资料清单 + 抽取要求",
944
+ output: "实例草案,待确认后生效",
945
+ evidence: "草案行可回溯到来源资料;同一会话可追加轮次续跑同一任务"
946
+ },
947
+ {
948
+ source: "附件",
949
+ form: "结构化提取任务",
950
+ intake: "上传本地附件(先解析并准备,再分片提取);历史附件追加时默认复用,不重复上传",
951
+ pick: "任务名称 + 本地附件 + 抽取要求",
952
+ output: "实例草案,待确认后生效",
953
+ evidence: "任务详情可下载附件原件;草案组按轮次归档"
954
+ }
955
+ ];
956
+ function Ie({ caption: e, rows: r }) {
957
+ return /* @__PURE__ */ l("section", { className: "ox-source-help-group", children: [
958
+ /* @__PURE__ */ t("b", { children: e }),
959
+ /* @__PURE__ */ l("table", { className: "ox-source-help-table", children: [
960
+ /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ l("tr", { children: [
961
+ /* @__PURE__ */ t("th", { children: "来源" }),
962
+ /* @__PURE__ */ t("th", { children: "任务形态" }),
963
+ /* @__PURE__ */ t("th", { children: "内容怎么进来" }),
964
+ /* @__PURE__ */ t("th", { children: "新建时要选什么" }),
965
+ /* @__PURE__ */ t("th", { children: "产出" }),
966
+ /* @__PURE__ */ t("th", { children: "证据定位" })
967
+ ] }) }),
968
+ /* @__PURE__ */ t("tbody", { children: r.map((n) => /* @__PURE__ */ l("tr", { children: [
969
+ /* @__PURE__ */ t("td", { children: n.source }),
970
+ /* @__PURE__ */ t("td", { children: n.form }),
971
+ /* @__PURE__ */ t("td", { children: n.intake }),
972
+ /* @__PURE__ */ t("td", { children: n.pick }),
973
+ /* @__PURE__ */ t("td", { children: n.output }),
974
+ /* @__PURE__ */ t("td", { children: n.evidence })
975
+ ] }, n.source)) })
976
+ ] })
977
+ ] });
978
+ }
979
+ function Ke({ open: e, onClose: r }) {
980
+ return /* @__PURE__ */ l(
981
+ ce,
982
+ {
983
+ title: "来源说明",
984
+ open: e,
985
+ width: 920,
986
+ onCancel: r,
987
+ footer: null,
988
+ className: "ox-source-help-modal",
989
+ children: [
990
+ /* @__PURE__ */ t("p", { className: "ox-modal-sub", children: "提取分两类:采集任务是长期定时任务,按调度持续同步、直写实例; 结构化提取在会话里完成,产出草案待确认。" }),
991
+ /* @__PURE__ */ l("div", { className: "ox-source-help", children: [
992
+ /* @__PURE__ */ t(Ie, { caption: "长期任务 · 采集任务维护", rows: sn }),
993
+ /* @__PURE__ */ t(Ie, { caption: "结构化提取任务 · 产出草案待确认", rows: on })
994
+ ] }),
995
+ /* @__PURE__ */ t("p", { className: "ox-modal-footnote", children: "结构化提取任务产出的草案在「查看待提交草案」里逐行核对、修正与提交 · 写入域固定为当前域" })
996
+ ]
997
+ }
998
+ );
999
+ }
1000
+ function ln({
1001
+ startCreate: e,
1002
+ onStartCreateHandled: r,
1003
+ openTaskCode: n,
1004
+ onOpenTaskHandled: d
1005
+ }) {
1006
+ const m = ve(), o = Qt(m.version), s = Pe(m.version), a = Yt(o.reload), [i, u] = x(""), [p, C] = x(!1), [A, h] = x(!1), [c, T] = x(), [v, N] = x();
1007
+ B(() => {
1008
+ e && (T(void 0), h(!0), r == null || r());
1009
+ }, [e, r]), B(() => {
1010
+ n && (N({ code: n, name: n }), d == null || d());
1011
+ }, [n, d]);
1012
+ const { filters: f, updateFilters: g } = o, S = z((k) => {
1013
+ g({ ...f, ...k });
1014
+ }, [f, g]), $ = v ? o.records.find((k) => k.code === v.code) ?? v : void 0;
1015
+ return /* @__PURE__ */ l("div", { className: "view ontology-extract", children: [
1016
+ /* @__PURE__ */ l("header", { className: "ox-head", children: [
1017
+ /* @__PURE__ */ t("h2", { children: "数据集采集" }),
1018
+ /* @__PURE__ */ l("span", { className: "sub", children: [
1019
+ "按调度持续同步数据集,依映射直写实例,不产草案。",
1020
+ /* @__PURE__ */ t("button", { type: "button", className: "ox-help-link", onClick: () => C(!0), children: "来源说明" })
1021
+ ] }),
1022
+ /* @__PURE__ */ t("div", { className: "ox-head-actions", children: /* @__PURE__ */ t(
1023
+ O,
1024
+ {
1025
+ size: "small",
1026
+ icon: /* @__PURE__ */ t(J, { name: "refresh", size: 13 }),
1027
+ onClick: () => {
1028
+ o.reload(), s.reload();
1029
+ },
1030
+ children: "刷新"
1031
+ }
1032
+ ) })
1033
+ ] }),
1034
+ /* @__PURE__ */ t("section", { className: "ox-kpis", "aria-label": "采集概览", "aria-busy": s.loading || void 0, children: /* @__PURE__ */ l("div", { className: "ox-kpi", children: [
1035
+ /* @__PURE__ */ t("span", { className: "k-label", children: "运行中的采集任务" }),
1036
+ /* @__PURE__ */ t("span", { className: "k-value tnum", children: s.stats ? s.stats.runningCollectionTaskCount : "—" }),
1037
+ /* @__PURE__ */ t("span", { className: "k-foot", children: "长期任务,每批直接写入实例 · 域内合计" })
1038
+ ] }) }),
1039
+ /* @__PURE__ */ l("div", { className: "ox-toolbar", children: [
1040
+ /* @__PURE__ */ t(
1041
+ ne.Search,
1042
+ {
1043
+ size: "small",
1044
+ placeholder: "搜索任务名称",
1045
+ allowClear: !0,
1046
+ value: i,
1047
+ onChange: (k) => u(k.target.value),
1048
+ onSearch: (k) => S({ keyword: k.trim() || void 0 }),
1049
+ style: { width: 220 }
1050
+ }
1051
+ ),
1052
+ /* @__PURE__ */ t(
1053
+ te,
1054
+ {
1055
+ size: "small",
1056
+ placeholder: "启停",
1057
+ allowClear: !0,
1058
+ value: f.enabled,
1059
+ onChange: (k) => S({ enabled: k }),
1060
+ options: [{ value: 1, label: "已启用" }, { value: 0, label: "已停用" }],
1061
+ style: { width: 110 }
1062
+ }
1063
+ ),
1064
+ /* @__PURE__ */ l("span", { className: "ox-total", children: [
1065
+ "共 ",
1066
+ o.total,
1067
+ " 个任务 · 按调度持续同步,直写实例"
1068
+ ] })
1069
+ ] }),
1070
+ /* @__PURE__ */ t("div", { className: "ox-table-wrap", children: /* @__PURE__ */ t(
1071
+ an,
1072
+ {
1073
+ records: o.records,
1074
+ loading: o.loading,
1075
+ onEdit: (k) => {
1076
+ T(k), h(!0);
1077
+ },
1078
+ onRuns: N,
1079
+ onRun: (k) => void a.run(k),
1080
+ onToggle: a.toggle,
1081
+ onDelete: a.remove,
1082
+ runningCode: a.runningCode,
1083
+ togglingCode: a.togglingCode
1084
+ }
1085
+ ) }),
1086
+ /* @__PURE__ */ t("div", { className: "ox-pagination", children: /* @__PURE__ */ t(
1087
+ ye,
1088
+ {
1089
+ size: "small",
1090
+ current: o.pagination.current,
1091
+ pageSize: o.pagination.size,
1092
+ total: o.total,
1093
+ showSizeChanger: !0,
1094
+ showTotal: (k) => `共 ${k} 条`,
1095
+ onChange: (k, P) => o.updatePagination(k, P)
1096
+ }
1097
+ ) }),
1098
+ /* @__PURE__ */ t(
1099
+ rn,
1100
+ {
1101
+ open: A,
1102
+ record: c,
1103
+ onClose: () => {
1104
+ h(!1), T(void 0);
1105
+ },
1106
+ onSaved: o.reload
1107
+ }
1108
+ ),
1109
+ /* @__PURE__ */ t(
1110
+ en,
1111
+ {
1112
+ task: $,
1113
+ onClose: () => N(void 0),
1114
+ onLaunchSync: a.run,
1115
+ syncRunning: !!(v && a.runningCode === v.code)
1116
+ }
1117
+ ),
1118
+ /* @__PURE__ */ t(Ke, { open: p, onClose: () => C(!1) })
1119
+ ] });
1120
+ }
1121
+ function cn(e, r) {
1122
+ const [n, d] = x(), [m, o] = x(!1), [s, a] = x(!1), [i, u] = x(), [p, C] = x(!1), A = _(0), h = e == null ? void 0 : e.taskCode, c = e == null ? void 0 : e.roundNo, T = e == null ? void 0 : e.draftGroup, v = z(async () => {
1123
+ if (!h || c === void 0) {
1124
+ d(void 0), a(!1);
1125
+ return;
1126
+ }
1127
+ const $ = ++A.current;
1128
+ o(!0);
1129
+ let k = !1;
1130
+ const P = await ht(
1131
+ { taskCode: h, roundNo: c, draftGroup: T },
1132
+ {
1133
+ onError: (V) => pt(V) ? (k = !0, $ === A.current && (d(void 0), a(!0), o(!1)), !0) : !1
1134
+ }
1135
+ );
1136
+ $ !== A.current || k || (d(P), a(!1), o(!1));
1137
+ }, [h, c, T]);
1138
+ B(() => (v(), () => {
1139
+ A.current += 1;
1140
+ }), [v, r]);
1141
+ const N = z(() => {
1142
+ v();
1143
+ }, [v]), f = z(
1144
+ async ($) => {
1145
+ u($.itemId);
1146
+ try {
1147
+ const k = await Re($);
1148
+ return k && await v(), !!k;
1149
+ } finally {
1150
+ u(void 0);
1151
+ }
1152
+ },
1153
+ [v]
1154
+ ), g = z(
1155
+ async ($) => {
1156
+ if (!h)
1157
+ return !1;
1158
+ u($);
1159
+ try {
1160
+ const k = await $e({ taskCode: h, itemId: $ });
1161
+ return k && await v(), !!k;
1162
+ } finally {
1163
+ u(void 0);
1164
+ }
1165
+ },
1166
+ [h, v]
1167
+ ), S = z(
1168
+ async ($) => {
1169
+ if (!h || c === void 0)
1170
+ return !1;
1171
+ C(!0);
1172
+ try {
1173
+ const k = await ft({ taskCode: h, roundNo: c, draftGroup: T, command: $ });
1174
+ return k && d(k), !!k;
1175
+ } finally {
1176
+ C(!1);
1177
+ }
1178
+ },
1179
+ [h, c, T]
1180
+ );
1181
+ return {
1182
+ detail: n,
1183
+ loading: m,
1184
+ denied: s,
1185
+ busyItemId: i,
1186
+ fixing: p,
1187
+ reload: N,
1188
+ updateItem: f,
1189
+ removeItem: g,
1190
+ quickFix: S,
1191
+ setDetail: d
1192
+ };
1193
+ }
1194
+ function dn(e, r) {
1195
+ const [n, d] = x(r ?? {}), [m, o] = x({ current: 1, size: 10 }), [s, a] = x([]), [i, u] = x(0), [p, C] = x(!1), [A, h] = x(0), c = _(0);
1196
+ B(() => {
1197
+ const f = ++c.current;
1198
+ C(!0);
1199
+ const g = {
1200
+ ...n,
1201
+ current: m.current,
1202
+ size: m.size
1203
+ };
1204
+ return Nt(g).then((S) => {
1205
+ f === c.current && (a((S == null ? void 0 : S.records) ?? []), u((S == null ? void 0 : S.total) ?? 0), C(!1));
1206
+ }), () => {
1207
+ c.current += 1;
1208
+ };
1209
+ }, [n, m, e, A]);
1210
+ const T = z((f) => {
1211
+ d(f), o((g) => ({ ...g, current: 1 }));
1212
+ }, []), v = z((f, g) => {
1213
+ o({ current: f, size: g });
1214
+ }, []), N = z(() => h((f) => f + 1), []);
1215
+ return {
1216
+ filters: n,
1217
+ pagination: m,
1218
+ records: s,
1219
+ total: i,
1220
+ loading: p,
1221
+ updateFilters: T,
1222
+ updatePagination: v,
1223
+ reload: N
1224
+ };
1225
+ }
1226
+ function _e(e) {
1227
+ const [r, n] = x(0.6), d = _(0);
1228
+ return B(() => {
1229
+ const m = ++d.current;
1230
+ return Fe().then((o) => {
1231
+ m === d.current && n(Kt(o));
1232
+ }), () => {
1233
+ d.current += 1;
1234
+ };
1235
+ }, [e]), r;
1236
+ }
1237
+ const Ue = 4;
1238
+ function un(e, r) {
1239
+ return e === void 0 ? "low" : e >= 0.85 ? "high" : e >= r ? "mid" : "low";
1240
+ }
1241
+ const mn = {
1242
+ high: "var(--green)",
1243
+ mid: "var(--amber)",
1244
+ low: "var(--red)"
1245
+ };
1246
+ function hn(e) {
1247
+ return mn[e];
1248
+ }
1249
+ function fn(e) {
1250
+ return e === void 0 ? "—" : e.toFixed(2);
1251
+ }
1252
+ function Je(e) {
1253
+ return e.toFixed(2);
1254
+ }
1255
+ function Ve(e) {
1256
+ return e.displayName || e.targetName || e.instanceId || "未命名";
1257
+ }
1258
+ function pn(e) {
1259
+ if (!e)
1260
+ return [];
1261
+ try {
1262
+ const r = JSON.parse(e);
1263
+ return typeof r != "object" || r === null || Array.isArray(r) ? [] : Object.entries(r).map(([n, d]) => ({
1264
+ key: n,
1265
+ value: d == null ? "" : String(d)
1266
+ }));
1267
+ } catch {
1268
+ return [];
1269
+ }
1270
+ }
1271
+ function Xe(e) {
1272
+ if (e)
1273
+ try {
1274
+ const r = JSON.parse(e);
1275
+ if (typeof r != "object" || r === null || Array.isArray(r))
1276
+ return;
1277
+ const n = r, d = (s) => typeof n[s] == "string" ? n[s] : "", m = [d("srcTagName"), d("srcInstanceName")].filter(Boolean).join("/"), o = [d("dstTagName"), d("dstInstanceName")].filter(Boolean).join("/");
1278
+ return !m && !o ? void 0 : `${m || "?"} → ${o || "?"}`;
1279
+ } catch {
1280
+ return;
1281
+ }
1282
+ }
1283
+ function Nn(e) {
1284
+ if (e.propertiesJson)
1285
+ try {
1286
+ return JSON.stringify(JSON.parse(e.propertiesJson), null, 2);
1287
+ } catch {
1288
+ return e.propertiesJson;
1289
+ }
1290
+ return "{}";
1291
+ }
1292
+ function je(e) {
1293
+ return e ? `组 ${e.draftGroup}` : "提取草案";
1294
+ }
1295
+ function ze(e) {
1296
+ return e ? `${e.taskName || e.taskCode || "未命名任务"} · 第 ${e.roundNo} 轮` : "—";
1297
+ }
1298
+ function xe(e) {
1299
+ return e ? `${e.taskCode}::${e.roundNo}::${e.draftGroup ?? ""}` : "";
1300
+ }
1301
+ function yn({
1302
+ value: e,
1303
+ threshold: r
1304
+ }) {
1305
+ const n = un(e, r), d = e === void 0 ? 0 : Math.max(0, Math.min(100, Math.round(e * 100)));
1306
+ return /* @__PURE__ */ l("span", { className: "ox-conf", title: e === void 0 ? "无评分" : `置信 ${e.toFixed(2)}`, children: [
1307
+ /* @__PURE__ */ t("span", { className: "ox-conf-bar", children: /* @__PURE__ */ t("span", { style: { width: `${d}%`, background: hn(n) } }) }),
1308
+ /* @__PURE__ */ t("span", { className: "ox-conf-val", children: fn(e) })
1309
+ ] });
1310
+ }
1311
+ function xn(e) {
1312
+ return e === "SUBMITTED" ? "success" : e === "REJECTED" ? "error" : e === "DISCARDED" ? "default" : "processing";
1313
+ }
1314
+ function gn({
1315
+ item: e,
1316
+ busy: r,
1317
+ typeOptions: n,
1318
+ onSave: d,
1319
+ onCancel: m
1320
+ }) {
1321
+ const { message: o } = re.useApp(), s = e.displayName ?? "", a = e.targetName ?? "", i = Nn(e), [u, p] = x(s), [C, A] = x(a), [h, c] = x(i), [T, v] = x(!1), N = async () => {
1322
+ const g = {}, S = u.trim(), $ = C.trim();
1323
+ if (S !== s) {
1324
+ if (!S) {
1325
+ o.error("名称不能为空");
1326
+ return;
1327
+ }
1328
+ g.name = S;
1329
+ }
1330
+ if ($ !== a) {
1331
+ if (!$) {
1332
+ o.error("类型不能为空");
1333
+ return;
1334
+ }
1335
+ g.typeCode = $;
1336
+ }
1337
+ if (h !== i) {
1338
+ let k;
1339
+ try {
1340
+ k = JSON.parse(h || "{}");
1341
+ } catch {
1342
+ o.error("属性 JSON 格式不正确");
1343
+ return;
1344
+ }
1345
+ if (typeof k != "object" || k === null || Array.isArray(k)) {
1346
+ o.error("属性必须是一个 JSON 键值对象");
1347
+ return;
1348
+ }
1349
+ g.properties = k;
1350
+ }
1351
+ if (!Object.keys(g).length) {
1352
+ m();
1353
+ return;
1354
+ }
1355
+ v(!0);
1356
+ try {
1357
+ await d(g) && m();
1358
+ } finally {
1359
+ v(!1);
1360
+ }
1361
+ }, f = e.itemKind === Ue ? Xe(e.endpointsJson) : void 0;
1362
+ return /* @__PURE__ */ l("div", { className: "ox-res-edit", children: [
1363
+ /* @__PURE__ */ l("div", { className: "ox-res-edit-row", children: [
1364
+ /* @__PURE__ */ t("label", { children: "类型" }),
1365
+ /* @__PURE__ */ t(
1366
+ ae,
1367
+ {
1368
+ size: "small",
1369
+ value: C,
1370
+ options: n,
1371
+ onChange: A,
1372
+ placeholder: "对象/关系类型",
1373
+ style: { width: 170 }
1374
+ }
1375
+ ),
1376
+ /* @__PURE__ */ t("label", { children: "名称" }),
1377
+ /* @__PURE__ */ t(
1378
+ ne,
1379
+ {
1380
+ size: "small",
1381
+ value: u,
1382
+ onChange: (g) => p(g.target.value),
1383
+ placeholder: e.instanceId || "对象/关系名称",
1384
+ style: { width: 220 }
1385
+ }
1386
+ ),
1387
+ e.instanceId ? /* @__PURE__ */ t("span", { className: "ox-res-inst mono", children: e.instanceId }) : null
1388
+ ] }),
1389
+ /* @__PURE__ */ l("div", { className: "ox-res-edit-row", children: [
1390
+ /* @__PURE__ */ t("label", { children: "属性" }),
1391
+ /* @__PURE__ */ t(
1392
+ ne.TextArea,
1393
+ {
1394
+ rows: 3,
1395
+ value: h,
1396
+ onChange: (g) => c(g.target.value),
1397
+ className: "mono"
1398
+ }
1399
+ )
1400
+ ] }),
1401
+ f ? /* @__PURE__ */ l("div", { className: "ox-res-src", children: [
1402
+ "端点:",
1403
+ f,
1404
+ "(端点不支持在核对区修改)"
1405
+ ] }) : null,
1406
+ /* @__PURE__ */ l("div", { className: "ox-res-edit-actions", children: [
1407
+ /* @__PURE__ */ t(O, { size: "small", disabled: T, onClick: m, children: "取消" }),
1408
+ /* @__PURE__ */ t(O, { size: "small", type: "primary", loading: T || r, onClick: N, children: "保存" })
1409
+ ] })
1410
+ ] });
1411
+ }
1412
+ function Cn({
1413
+ item: e,
1414
+ threshold: r,
1415
+ editable: n,
1416
+ busy: d,
1417
+ typeOptions: m,
1418
+ onSave: o,
1419
+ onConfirm: s,
1420
+ onRemove: a
1421
+ }) {
1422
+ const [i, u] = x(!1), p = e.confidence !== void 0 && e.confidence < r, C = e.itemKind === Ue, A = pn(e.propertiesJson), h = C ? Xe(e.endpointsJson) : void 0, c = !A.length && !h ? e.remark : void 0, T = Ve(e);
1423
+ return i ? /* @__PURE__ */ t("div", { className: `ox-res-row${p ? " low" : ""}`, children: /* @__PURE__ */ t("div", { className: "ox-res-main", children: /* @__PURE__ */ t(
1424
+ gn,
1425
+ {
1426
+ item: e,
1427
+ busy: d,
1428
+ typeOptions: m,
1429
+ onSave: (v) => o(e, v),
1430
+ onCancel: () => u(!1)
1431
+ }
1432
+ ) }) }) : /* @__PURE__ */ l("div", { className: `ox-res-row${p ? " low" : ""}`, children: [
1433
+ /* @__PURE__ */ l("div", { className: "ox-res-main", children: [
1434
+ /* @__PURE__ */ l("div", { className: "ox-res-line", children: [
1435
+ e.targetName ? /* @__PURE__ */ t(j, { children: e.targetName }) : null,
1436
+ /* @__PURE__ */ t("span", { className: "ox-res-name", title: T, children: T }),
1437
+ e.instanceId && e.instanceId !== T ? /* @__PURE__ */ t("span", { className: "ox-res-inst mono", title: e.instanceId, children: e.instanceId }) : null
1438
+ ] }),
1439
+ h ? /* @__PURE__ */ t("div", { className: "ox-res-src", children: h }) : null,
1440
+ A.length ? /* @__PURE__ */ t("div", { className: "ox-res-props", children: A.map((v) => /* @__PURE__ */ l("span", { className: "ox-res-prop", children: [
1441
+ /* @__PURE__ */ t("em", { children: v.key }),
1442
+ v.value || "—"
1443
+ ] }, v.key)) }) : null,
1444
+ c ? /* @__PURE__ */ t("div", { className: "ox-res-src", children: c }) : null
1445
+ ] }),
1446
+ /* @__PURE__ */ l("div", { className: "ox-res-side", children: [
1447
+ /* @__PURE__ */ t(yn, { value: e.confidence, threshold: r }),
1448
+ n ? /* @__PURE__ */ l("div", { className: "ox-res-actions", children: [
1449
+ p ? /* @__PURE__ */ t(O, { size: "small", type: "link", disabled: d, onClick: () => s(e), children: "确认" }) : null,
1450
+ /* @__PURE__ */ t(O, { size: "small", type: "link", disabled: d, onClick: () => u(!0), children: "编辑" }),
1451
+ /* @__PURE__ */ t(
1452
+ O,
1453
+ {
1454
+ size: "small",
1455
+ type: "link",
1456
+ danger: !0,
1457
+ disabled: d,
1458
+ onClick: () => a(e),
1459
+ children: "剔除"
1460
+ }
1461
+ )
1462
+ ] }) : null
1463
+ ] })
1464
+ ] });
1465
+ }
1466
+ function Ae({
1467
+ title: e,
1468
+ items: r,
1469
+ threshold: n,
1470
+ editable: d,
1471
+ busyItemId: m,
1472
+ typeOptions: o,
1473
+ onSave: s,
1474
+ onConfirm: a,
1475
+ onRemove: i
1476
+ }) {
1477
+ return /* @__PURE__ */ l("section", { className: "ox-draft-sec", children: [
1478
+ /* @__PURE__ */ l("div", { className: "ox-sec-title", children: [
1479
+ e,
1480
+ /* @__PURE__ */ t("span", { className: "count", children: r.length })
1481
+ ] }),
1482
+ r.length ? r.map((u) => /* @__PURE__ */ t(
1483
+ Cn,
1484
+ {
1485
+ item: u,
1486
+ threshold: n,
1487
+ editable: d && u.submitted !== 1,
1488
+ busy: m === u.itemId,
1489
+ typeOptions: o,
1490
+ onSave: s,
1491
+ onConfirm: a,
1492
+ onRemove: i
1493
+ },
1494
+ u.itemId
1495
+ )) : /* @__PURE__ */ t("p", { className: "ox-draft-empty", children: "无" })
1496
+ ] });
1497
+ }
1498
+ function wn({
1499
+ draftRef: e,
1500
+ detail: r,
1501
+ loading: n,
1502
+ threshold: d,
1503
+ manageable: m,
1504
+ denied: o,
1505
+ onOpenReview: s,
1506
+ onChanged: a
1507
+ }) {
1508
+ const { message: i, modal: u } = re.useApp(), [p, C] = x(!1), [A, h] = x(!1);
1509
+ B(() => {
1510
+ h(!1);
1511
+ }, [e == null ? void 0 : e.taskCode, e == null ? void 0 : e.roundNo, e == null ? void 0 : e.draftGroup]);
1512
+ const c = r == null ? void 0 : r.group, T = (c == null ? void 0 : c.status) ?? "DRAFT", v = (r == null ? void 0 : r.nodes) ?? [], N = (r == null ? void 0 : r.relations) ?? [], f = (r == null ? void 0 : r.issues) ?? [], g = (c == null ? void 0 : c.lowConfidenceCount) ?? 0, S = z(
1513
+ async (R, D) => {
1514
+ C(!0);
1515
+ try {
1516
+ const G = await R();
1517
+ if (G === void 0)
1518
+ return;
1519
+ if (typeof G == "object" && "blocked" in G) {
1520
+ if (G.blocked) {
1521
+ h(!0), i.warning("提案已执行生效,改数据请走逆向工单");
1522
+ return;
1523
+ }
1524
+ if (!G.ok)
1525
+ return;
1526
+ } else if (!G)
1527
+ return;
1528
+ i.success(D), a();
1529
+ } finally {
1530
+ C(!1);
1531
+ }
1532
+ },
1533
+ [i, a]
1534
+ ), $ = z(() => {
1535
+ if (!e)
1536
+ return;
1537
+ const R = v.filter((I) => I.submitted !== 1), D = N.filter((I) => I.submitted !== 1), G = [...R, ...D];
1538
+ if (!G.length) {
1539
+ i.warning("本组没有待提交的草案行");
1540
+ return;
1541
+ }
1542
+ u.confirm({
1543
+ title: "提交本组草案为提案?",
1544
+ content: `共 ${G.length} 行(对象 ${R.length} · 关系 ${D.length})会转为提案并进入审批,审批通过后才写入图谱与向量。`,
1545
+ okText: "提交",
1546
+ cancelText: "取消",
1547
+ onOk: async () => {
1548
+ C(!0);
1549
+ try {
1550
+ const I = await yt({
1551
+ ...e,
1552
+ itemIds: G.map((E) => E.itemId)
1553
+ });
1554
+ if (I === void 0)
1555
+ return;
1556
+ if (I.proposalCode || I.orderCode || I.orderNo) {
1557
+ i.success(
1558
+ `已提交为提案${I.proposalCode ? `:${I.proposalCode}` : ""}`
1559
+ ), a();
1560
+ return;
1561
+ }
1562
+ const Z = [
1563
+ ...(I.issues ?? []).map(
1564
+ (E) => E.message || E.field || "校验未通过"
1565
+ ),
1566
+ ...I.restrictedReasons ?? [],
1567
+ ...I.skippedReasons ?? []
1568
+ ];
1569
+ u.warning({
1570
+ title: "提交未通过校验",
1571
+ content: Z.length ? /* @__PURE__ */ t("ul", { className: "ox-issue-list", children: Z.map((E, F) => /* @__PURE__ */ t("li", { children: E }, `${E}-${F}`)) }) : "请检查草案内容后重试"
1572
+ });
1573
+ } finally {
1574
+ C(!1);
1575
+ }
1576
+ }
1577
+ });
1578
+ }, [e, v, N, i, u, a]), k = z(() => {
1579
+ e && S(() => xt(e), "已恢复为草稿");
1580
+ }, [e, S]), P = z(() => {
1581
+ e && u.confirm({
1582
+ title: "撤回为草稿?",
1583
+ content: "撤回后本组回到草稿态,可继续修正后重新提交(生成新提案与新工单)。",
1584
+ okText: "撤回",
1585
+ cancelText: "取消",
1586
+ onOk: () => S(() => gt(e), "已撤回为草稿,可继续修正后重提")
1587
+ });
1588
+ }, [u, e, S]), [V, q] = x(), U = T === "DRAFT" && m && !o, y = Q(() => {
1589
+ const R = /* @__PURE__ */ new Set();
1590
+ return [...v, ...N].forEach((D) => {
1591
+ D.targetName && R.add(D.targetName);
1592
+ }), Array.from(R).map((D) => ({ value: D }));
1593
+ }, [v, N]), b = z(
1594
+ async (R, D, G) => {
1595
+ if (!e)
1596
+ return !1;
1597
+ q(R.itemId);
1598
+ try {
1599
+ return await Re({
1600
+ taskCode: e.taskCode,
1601
+ itemId: R.itemId,
1602
+ ...D
1603
+ }) ? (i.success(G), a(), !0) : !1;
1604
+ } finally {
1605
+ q(void 0);
1606
+ }
1607
+ },
1608
+ [e, i, a]
1609
+ ), W = z(
1610
+ (R, D) => b(R, D, "已保存草案行"),
1611
+ [b]
1612
+ ), w = z(
1613
+ (R) => {
1614
+ b(R, { confirmStatus: "CONFIRMED" }, "已确认,置信度置 1.00");
1615
+ },
1616
+ [b]
1617
+ ), M = z(
1618
+ (R) => {
1619
+ e && u.confirm({
1620
+ title: "剔除这条草案?",
1621
+ content: `「${Ve(R)}」会从本组移除(软删,可随组恢复),不再参与提交。`,
1622
+ okText: "剔除",
1623
+ okButtonProps: { danger: !0 },
1624
+ cancelText: "取消",
1625
+ onOk: async () => {
1626
+ q(R.itemId);
1627
+ try {
1628
+ if (!await $e({
1629
+ taskCode: e.taskCode,
1630
+ itemId: R.itemId
1631
+ }))
1632
+ return;
1633
+ i.success("已剔除"), a();
1634
+ } finally {
1635
+ q(void 0);
1636
+ }
1637
+ }
1638
+ });
1639
+ },
1640
+ [e, u, i, a]
1641
+ );
1642
+ return e ? /* @__PURE__ */ t("div", { className: "ox-draft-detail", children: /* @__PURE__ */ t(pe, { spinning: n, children: c ? /* @__PURE__ */ l(H, { children: [
1643
+ /* @__PURE__ */ l("header", { className: "ox-dd-head", children: [
1644
+ /* @__PURE__ */ l("div", { className: "ox-dd-title", children: [
1645
+ je(c),
1646
+ /* @__PURE__ */ t(j, { color: xn(T), children: Ne(T) }),
1647
+ c.sourceKind ? /* @__PURE__ */ t(j, { children: be(c.sourceKind) }) : null
1648
+ ] }),
1649
+ /* @__PURE__ */ l("div", { className: "ox-dd-meta", children: [
1650
+ /* @__PURE__ */ t("span", { children: c.taskName || c.taskCode }),
1651
+ /* @__PURE__ */ l("span", { children: [
1652
+ "第 ",
1653
+ c.roundNo,
1654
+ " 轮"
1655
+ ] }),
1656
+ /* @__PURE__ */ t("span", { className: "mono", children: c.taskCode }),
1657
+ /* @__PURE__ */ l("span", { children: [
1658
+ "更新 ",
1659
+ c.lastUpdateTime || c.firstCreateTime || "—"
1660
+ ] })
1661
+ ] })
1662
+ ] }),
1663
+ /* @__PURE__ */ l("div", { className: "ox-dd-body", children: [
1664
+ /* @__PURE__ */ l("div", { className: "ox-tiles", children: [
1665
+ /* @__PURE__ */ l("div", { className: "ox-tile", children: [
1666
+ /* @__PURE__ */ t("em", { children: "对象实例" }),
1667
+ /* @__PURE__ */ t("b", { className: "tnum", children: c.nodeCount ?? v.length })
1668
+ ] }),
1669
+ /* @__PURE__ */ l("div", { className: "ox-tile", children: [
1670
+ /* @__PURE__ */ t("em", { children: "关系" }),
1671
+ /* @__PURE__ */ t("b", { className: "tnum", children: c.relationCount ?? N.length })
1672
+ ] }),
1673
+ /* @__PURE__ */ l("div", { className: "ox-tile", children: [
1674
+ /* @__PURE__ */ t("em", { children: "平均置信度" }),
1675
+ /* @__PURE__ */ t("b", { className: "tnum", children: c.avgConfidence === void 0 ? "—" : c.avgConfidence.toFixed(2) })
1676
+ ] })
1677
+ ] }),
1678
+ g > 0 ? /* @__PURE__ */ l("div", { className: "ox-banner amber", children: [
1679
+ g,
1680
+ " 条结果低于置信阈值 ",
1681
+ Je(d),
1682
+ ",已标黄;提交为提案前请逐条确认或剔除。"
1683
+ ] }) : null,
1684
+ /* @__PURE__ */ t(
1685
+ Ae,
1686
+ {
1687
+ title: "抽取出的对象",
1688
+ items: v,
1689
+ threshold: d,
1690
+ editable: U,
1691
+ busyItemId: V,
1692
+ typeOptions: y,
1693
+ onSave: W,
1694
+ onConfirm: w,
1695
+ onRemove: M
1696
+ }
1697
+ ),
1698
+ /* @__PURE__ */ t(
1699
+ Ae,
1700
+ {
1701
+ title: "抽取出的关系",
1702
+ items: N,
1703
+ threshold: d,
1704
+ editable: U,
1705
+ busyItemId: V,
1706
+ typeOptions: y,
1707
+ onSave: W,
1708
+ onConfirm: w,
1709
+ onRemove: M
1710
+ }
1711
+ ),
1712
+ f.length ? /* @__PURE__ */ l("section", { className: "ox-draft-sec", children: [
1713
+ /* @__PURE__ */ t("div", { className: "ox-sec-title", children: "校验问题" }),
1714
+ /* @__PURE__ */ t("ul", { className: "ox-issue-list", children: f.map((R, D) => /* @__PURE__ */ l("li", { children: [
1715
+ R.rowRef ? /* @__PURE__ */ t("span", { className: "mono", children: R.rowRef }) : null,
1716
+ R.message || `${R.field ?? ""} 校验未通过`
1717
+ ] }, `${R.rowRef ?? D}-${R.field ?? ""}`)) })
1718
+ ] }) : null,
1719
+ T !== "DISCARDED" ? /* @__PURE__ */ t("div", { className: "ox-banner blue", children: "提交前可逐行改名称、类型与属性,或剔除不需要的行;提交后草案转为提案进入审批, 审批通过才写入图谱与向量,实例数据可在审批页逐行批注。" }) : null
1720
+ ] }),
1721
+ /* @__PURE__ */ l("footer", { className: "ox-dd-foot", children: [
1722
+ T === "DRAFT" ? /* @__PURE__ */ t(H, { children: m ? /* @__PURE__ */ t(
1723
+ O,
1724
+ {
1725
+ type: "primary",
1726
+ loading: p,
1727
+ disabled: !v.length && !N.length,
1728
+ onClick: $,
1729
+ children: "提交为提案"
1730
+ }
1731
+ ) : /* @__PURE__ */ t("span", { className: "ox-dd-hint", children: "当前域只读,无法提交草案" }) }) : null,
1732
+ T === "SUBMITTED" ? /* @__PURE__ */ l(H, { children: [
1733
+ s ? /* @__PURE__ */ t(O, { type: "primary", ghost: !0, onClick: s, children: "查看提案" }) : null,
1734
+ m ? A ? /* @__PURE__ */ t(fe, { title: "提案已执行生效,改数据请走逆向工单", children: /* @__PURE__ */ t(O, { danger: !0, disabled: !0, children: "撤回为草稿" }) }) : /* @__PURE__ */ t(O, { danger: !0, loading: p, onClick: P, children: "撤回为草稿" }) : null
1735
+ ] }) : null,
1736
+ T === "REJECTED" ? /* @__PURE__ */ l(H, { children: [
1737
+ m ? A ? /* @__PURE__ */ t(fe, { title: "提案已执行生效,改数据请走逆向工单", children: /* @__PURE__ */ t(O, { danger: !0, disabled: !0, children: "撤回为草稿" }) }) : /* @__PURE__ */ t(O, { danger: !0, loading: p, onClick: P, children: "撤回为草稿" }) : null,
1738
+ s ? /* @__PURE__ */ t(O, { type: "link", onClick: s, children: "查看打回原因" }) : null
1739
+ ] }) : null,
1740
+ T === "DISCARDED" && m ? /* @__PURE__ */ t(O, { type: "primary", ghost: !0, loading: p, onClick: k, children: "恢复" }) : null
1741
+ ] })
1742
+ ] }) : /* @__PURE__ */ t("div", { className: "ox-draft-detail-empty", children: o ? /* @__PURE__ */ t("div", { className: "ox-banner amber", children: "该草案组由他人创建,仅创建人可查看与修正" }) : /* @__PURE__ */ t("p", { children: n ? "加载中…" : "草案详情加载失败" }) }) }) }) : /* @__PURE__ */ l("div", { className: "ox-draft-detail ox-draft-detail-empty", children: [
1743
+ /* @__PURE__ */ t(J, { name: "inbox", size: 22 }),
1744
+ /* @__PURE__ */ t("p", { children: "选择左侧一组草案查看核对与提交" })
1745
+ ] });
1746
+ }
1747
+ const vn = ["DRAFT", "SUBMITTED", "REJECTED", "DISCARDED"], bn = "来源筛选将在后续版本开放";
1748
+ function me(e) {
1749
+ return { taskCode: e.taskCode ?? "", roundNo: e.roundNo, draftGroup: e.draftGroup };
1750
+ }
1751
+ function Tn(e) {
1752
+ const r = e.status === "SUBMITTED" ? "success" : e.status === "REJECTED" ? "error" : e.status === "DISCARDED" ? "default" : "processing";
1753
+ return /* @__PURE__ */ t(j, { color: r, children: Ne(e.status) });
1754
+ }
1755
+ function kn({
1756
+ open: e,
1757
+ onClose: r,
1758
+ version: n,
1759
+ initial: d,
1760
+ initialRef: m,
1761
+ manageable: o,
1762
+ onOpenReview: s,
1763
+ onChanged: a
1764
+ }) {
1765
+ const i = dn(n, d), u = _e(n), [p, C] = x(), A = cn(p, n), { updateFilters: h, records: c, total: T, loading: v, pagination: N } = i, f = i.reload, g = A.reload;
1766
+ B(() => {
1767
+ e && (h(d ?? {}), C(m));
1768
+ }, [e, d, m, h]), B(() => {
1769
+ if (!e || p || !c.length)
1770
+ return;
1771
+ const y = c[0];
1772
+ y.taskCode && C(me(y));
1773
+ }, [e, p, c]);
1774
+ const S = z(() => {
1775
+ f(), g(), a == null || a();
1776
+ }, [f, g, a]), $ = z((y) => {
1777
+ y.taskCode && C(me(y));
1778
+ }, []), k = Q(
1779
+ () => [
1780
+ {
1781
+ title: "草案",
1782
+ key: "draftGroup",
1783
+ width: 200,
1784
+ sorter: (y, b) => y.draftGroup - b.draftGroup,
1785
+ render: (y, b) => /* @__PURE__ */ l("div", { className: "ox-draft-cell", children: [
1786
+ /* @__PURE__ */ t("span", { className: "ox-draft-title", children: je(b) }),
1787
+ /* @__PURE__ */ t("span", { className: "ox-draft-sub", title: ze(b), children: ze(b) })
1788
+ ] })
1789
+ },
1790
+ {
1791
+ title: "对象",
1792
+ dataIndex: "nodeCount",
1793
+ key: "nodeCount",
1794
+ width: 58,
1795
+ align: "right",
1796
+ sorter: (y, b) => (y.nodeCount ?? -1) - (b.nodeCount ?? -1),
1797
+ render: (y) => y ?? "—"
1798
+ },
1799
+ {
1800
+ title: "关系",
1801
+ dataIndex: "relationCount",
1802
+ key: "relationCount",
1803
+ width: 58,
1804
+ align: "right",
1805
+ sorter: (y, b) => (y.relationCount ?? -1) - (b.relationCount ?? -1),
1806
+ render: (y) => y ?? "—"
1807
+ },
1808
+ {
1809
+ title: "状态",
1810
+ dataIndex: "status",
1811
+ key: "status",
1812
+ width: 82,
1813
+ sorter: (y, b) => (y.status ?? "").localeCompare(b.status ?? ""),
1814
+ render: (y, b) => Tn(b)
1815
+ }
1816
+ ],
1817
+ []
1818
+ ), { columns: P, components: V } = oe(k), q = k.reduce((y, b) => y + Number(b.width || 0), 0), U = xe(p);
1819
+ return /* @__PURE__ */ t(H, { children: /* @__PURE__ */ t(
1820
+ ce,
1821
+ {
1822
+ open: e,
1823
+ width: 1280,
1824
+ onCancel: r,
1825
+ maskClosable: !1,
1826
+ className: "ox-draft-modal",
1827
+ title: /* @__PURE__ */ l("span", { className: "ox-detail-title", children: [
1828
+ /* @__PURE__ */ t(J, { name: "layers", size: 14 }),
1829
+ "草案核对与提交"
1830
+ ] }),
1831
+ footer: /* @__PURE__ */ l("div", { className: "ox-draft-foot", children: [
1832
+ /* @__PURE__ */ t("span", { className: "note", children: "草案只写提案,不进图谱;审批通过后才落图与向量,实例数据可在审批页逐行批注" }),
1833
+ /* @__PURE__ */ t(O, { onClick: r, children: "关闭" })
1834
+ ] }),
1835
+ children: /* @__PURE__ */ l("div", { className: "ox-draft-split", children: [
1836
+ /* @__PURE__ */ l("section", { className: "ox-draft-list", children: [
1837
+ /* @__PURE__ */ l("div", { className: "ox-draft-toolbar", children: [
1838
+ /* @__PURE__ */ t(
1839
+ ne.Search,
1840
+ {
1841
+ size: "small",
1842
+ placeholder: "搜索任务或草案",
1843
+ allowClear: !0,
1844
+ value: i.filters.keyword ?? "",
1845
+ onChange: (y) => h({ ...i.filters, keyword: y.target.value }),
1846
+ onSearch: (y) => h({ ...i.filters, keyword: y.trim() || void 0 }),
1847
+ style: { width: 200 }
1848
+ }
1849
+ ),
1850
+ /* @__PURE__ */ t(
1851
+ te,
1852
+ {
1853
+ size: "small",
1854
+ placeholder: "状态",
1855
+ allowClear: !0,
1856
+ value: i.filters.status,
1857
+ onChange: (y) => h({ ...i.filters, status: y }),
1858
+ options: vn.map((y) => ({
1859
+ value: y,
1860
+ label: Ne(y)
1861
+ })),
1862
+ style: { width: 110 }
1863
+ }
1864
+ ),
1865
+ /* @__PURE__ */ t(fe, { title: bn, children: /* @__PURE__ */ t(
1866
+ te,
1867
+ {
1868
+ size: "small",
1869
+ placeholder: "来源",
1870
+ disabled: !0,
1871
+ options: [
1872
+ { value: 1, label: "对话" },
1873
+ { value: 2, label: "知识库" },
1874
+ { value: 3, label: "附件" }
1875
+ ],
1876
+ style: { width: 100 }
1877
+ }
1878
+ ) }),
1879
+ i.filters.taskCode ? /* @__PURE__ */ l(
1880
+ j,
1881
+ {
1882
+ closable: !0,
1883
+ onClose: () => h({ ...i.filters, taskCode: void 0 }),
1884
+ children: [
1885
+ "仅看任务 ",
1886
+ i.filters.taskCode
1887
+ ]
1888
+ }
1889
+ ) : null,
1890
+ /* @__PURE__ */ t("span", { className: "ox-draft-sort", children: "按更新时间倒序" })
1891
+ ] }),
1892
+ /* @__PURE__ */ t("div", { className: "ox-draft-table", children: /* @__PURE__ */ t(
1893
+ le,
1894
+ {
1895
+ rowKey: (y) => xe(me(y)),
1896
+ size: "small",
1897
+ loading: v,
1898
+ columns: P,
1899
+ components: V,
1900
+ dataSource: c,
1901
+ pagination: !1,
1902
+ tableLayout: "fixed",
1903
+ scroll: { x: q },
1904
+ rowClassName: (y) => xe(me(y)) === U ? "on" : "",
1905
+ onRow: (y) => ({ onClick: () => $(y) }),
1906
+ locale: {
1907
+ emptyText: /* @__PURE__ */ l("div", { className: "ox-table-empty", children: [
1908
+ /* @__PURE__ */ t(J, { name: "inbox", size: 22 }),
1909
+ /* @__PURE__ */ t("b", { children: "暂无草案组" }),
1910
+ /* @__PURE__ */ t("p", { children: "结构化提取任务产出后,草案组会按轮次出现在这里。" })
1911
+ ] })
1912
+ }
1913
+ }
1914
+ ) }),
1915
+ /* @__PURE__ */ l("div", { className: "ox-draft-pager", children: [
1916
+ /* @__PURE__ */ l("span", { className: "total", children: [
1917
+ "共 ",
1918
+ T,
1919
+ " 组"
1920
+ ] }),
1921
+ /* @__PURE__ */ t(
1922
+ ye,
1923
+ {
1924
+ size: "small",
1925
+ current: N.current,
1926
+ pageSize: N.size,
1927
+ total: T,
1928
+ showSizeChanger: !0,
1929
+ showTotal: (y) => `共 ${y} 条`,
1930
+ onChange: (y, b) => i.updatePagination(y, b)
1931
+ }
1932
+ )
1933
+ ] })
1934
+ ] }),
1935
+ /* @__PURE__ */ t("aside", { className: "ox-draft-side", children: /* @__PURE__ */ t(
1936
+ wn,
1937
+ {
1938
+ draftRef: p,
1939
+ detail: A.detail,
1940
+ loading: A.loading,
1941
+ threshold: u,
1942
+ manageable: o,
1943
+ denied: A.denied,
1944
+ onOpenReview: s,
1945
+ onChanged: S
1946
+ }
1947
+ ) })
1948
+ ] })
1949
+ }
1950
+ ) });
1951
+ }
1952
+ function se(e) {
1953
+ return /* @__PURE__ */ t(j, { color: e === "COMPLETED" ? "success" : e === "FAILED" ? "error" : e === "RUNNING" ? "processing" : e === "NEEDS_REVIEW" ? "warning" : "default", children: Le(e) });
1954
+ }
1955
+ function Sn(e) {
1956
+ if (e == null || e < 0)
1957
+ return "—";
1958
+ if (e < 60)
1959
+ return `${e}s`;
1960
+ const r = Math.floor(e / 60), n = e % 60;
1961
+ return n ? `${r}m ${n}s` : `${r}m`;
1962
+ }
1963
+ function En({
1964
+ records: e,
1965
+ loading: r,
1966
+ onOpen: n,
1967
+ onOpenDraft: d,
1968
+ onOpenSession: m
1969
+ }) {
1970
+ const o = Q(
1971
+ () => [
1972
+ {
1973
+ title: "任务",
1974
+ dataIndex: "name",
1975
+ key: "name",
1976
+ width: 230,
1977
+ ellipsis: !0,
1978
+ sorter: (u, p) => (u.name ?? "").localeCompare(p.name ?? ""),
1979
+ render: (u, p) => p.mine === !1 ? /* @__PURE__ */ t("span", { className: "ox-task-name is-readonly", children: u }) : /* @__PURE__ */ t("button", { type: "button", className: "ox-task-name", onClick: () => n(p), children: u })
1980
+ },
1981
+ {
1982
+ title: "来源",
1983
+ dataIndex: "sourceKind",
1984
+ key: "sourceKind",
1985
+ width: 90,
1986
+ sorter: (u, p) => (u.sourceKind ?? 0) - (p.sourceKind ?? 0),
1987
+ render: (u) => be(u)
1988
+ },
1989
+ {
1990
+ title: "范围",
1991
+ dataIndex: "sourceSummary",
1992
+ key: "sourceSummary",
1993
+ width: 230,
1994
+ ellipsis: !0,
1995
+ sorter: (u, p) => (u.sourceSummary ?? "").localeCompare(p.sourceSummary ?? ""),
1996
+ render: (u) => u || "—"
1997
+ },
1998
+ {
1999
+ title: "状态",
2000
+ dataIndex: "runStatus",
2001
+ key: "runStatus",
2002
+ width: 100,
2003
+ sorter: (u, p) => (u.runStatus ?? "").localeCompare(p.runStatus ?? ""),
2004
+ render: (u) => se(u)
2005
+ },
2006
+ {
2007
+ title: "产出草案",
2008
+ dataIndex: "draftGroupCount",
2009
+ key: "draftGroupCount",
2010
+ width: 100,
2011
+ sorter: (u, p) => (u.draftGroupCount ?? -1) - (p.draftGroupCount ?? -1),
2012
+ render: (u, p) => u ? /* @__PURE__ */ l("button", { type: "button", className: "ox-draft-link", onClick: () => d(p), children: [
2013
+ u,
2014
+ " 条 ›"
2015
+ ] }) : /* @__PURE__ */ t("span", { className: "ox-progress-none", children: "—" })
2016
+ },
2017
+ {
2018
+ title: "耗时",
2019
+ dataIndex: "durationSeconds",
2020
+ key: "durationSeconds",
2021
+ width: 100,
2022
+ align: "right",
2023
+ sorter: (u, p) => (u.durationSeconds ?? -1) - (p.durationSeconds ?? -1),
2024
+ render: (u) => /* @__PURE__ */ t("span", { className: "tnum", children: Sn(u) })
2025
+ },
2026
+ {
2027
+ title: "操作",
2028
+ key: "action",
2029
+ width: 110,
2030
+ render: (u, p) => p.mine === !1 ? /* @__PURE__ */ t(fe, { title: "仅创建人可查看进度", children: /* @__PURE__ */ t(O, { size: "small", type: "link", disabled: !0, children: "查看进度" }) }) : ee(p.runStatus) ? /* @__PURE__ */ t(O, { size: "small", type: "link", onClick: () => m(p), children: "打开会话" }) : /* @__PURE__ */ t(O, { size: "small", type: "primary", ghost: !0, onClick: () => n(p), children: "查看进度" })
2031
+ }
2032
+ ],
2033
+ [n, d, m]
2034
+ ), { columns: s, components: a } = oe(o, { excludeKeys: ["action"] }), i = o.reduce((u, p) => u + Number(p.width || 0), 0);
2035
+ return /* @__PURE__ */ t(
2036
+ le,
2037
+ {
2038
+ rowKey: "code",
2039
+ size: "small",
2040
+ loading: r,
2041
+ columns: s,
2042
+ components: a,
2043
+ dataSource: e,
2044
+ pagination: !1,
2045
+ tableLayout: "fixed",
2046
+ scroll: { x: i },
2047
+ locale: {
2048
+ emptyText: /* @__PURE__ */ l("div", { className: "ox-table-empty", children: [
2049
+ /* @__PURE__ */ t(J, { name: "inbox", size: 22 }),
2050
+ /* @__PURE__ */ t("b", { children: "暂无提取任务" }),
2051
+ /* @__PURE__ */ t("p", { children: "点上方「新建流程」,从知识库资料、本地附件或对话说明抽取实例草案。" })
2052
+ ] })
2053
+ }
2054
+ }
2055
+ );
2056
+ }
2057
+ const In = 3e3;
2058
+ function We(e, r = !0) {
2059
+ const [n, d] = x({}), [m, o] = x(!1), s = _(0), a = _(null), i = z(() => {
2060
+ a.current !== null && (window.clearInterval(a.current), a.current = null);
2061
+ }, []), u = z(async () => {
2062
+ if (!e)
2063
+ return;
2064
+ const p = ++s.current;
2065
+ o(!0);
2066
+ try {
2067
+ const C = await Jt(e);
2068
+ if (p !== s.current)
2069
+ return;
2070
+ d({ scopeId: e, value: C }), C && ee(C.runStatus) && i();
2071
+ } finally {
2072
+ p === s.current && o(!1);
2073
+ }
2074
+ }, [e, i]);
2075
+ return B(() => {
2076
+ if (!(!e || !r))
2077
+ return u(), a.current = window.setInterval(() => void u(), In), () => {
2078
+ s.current += 1, i();
2079
+ };
2080
+ }, [e, r, u, i]), {
2081
+ progress: n.scopeId === e ? n.value : void 0,
2082
+ loading: m,
2083
+ reload: u
2084
+ };
2085
+ }
2086
+ function zn(e, r, n) {
2087
+ var o;
2088
+ const d = n.allowedExtensions.map((s) => s.replace(/^\./, "").toLowerCase());
2089
+ for (const s of e) {
2090
+ const a = s.name.includes(".") ? ((o = s.name.split(".").pop()) == null ? void 0 : o.toLowerCase()) ?? "" : "";
2091
+ if (!d.includes(a))
2092
+ return `「${s.name}」类型不支持,仅允许 ${n.allowedExtensions.join(" / ")}`;
2093
+ if (s.size > n.maxFileBytes)
2094
+ return `「${s.name}」超过单文件上限 ${ie(n.maxFileBytes)}`;
2095
+ }
2096
+ return r.length + e.length > n.maxFilesPerRound ? `每轮最多 ${n.maxFilesPerRound} 个附件,当前已挂 ${r.length} 个` : r.reduce((s, a) => s + (a.size ?? 0), 0) + e.reduce((s, a) => s + a.size, 0) > n.maxTotalBytesPerRound ? `附件总量超过每轮上限 ${ie(n.maxTotalBytesPerRound)}` : null;
2097
+ }
2098
+ function An({
2099
+ attachments: e,
2100
+ onChange: r,
2101
+ ensureConversationId: n,
2102
+ disabled: d
2103
+ }) {
2104
+ const { message: m } = re.useApp(), [o, s] = x(null), [a, i] = x(!1), u = _(e);
2105
+ u.current = e, B(() => {
2106
+ Ct().then((A) => s(A ?? null));
2107
+ }, []);
2108
+ const p = z(
2109
+ async (A) => {
2110
+ if (!A.length || a || d)
2111
+ return;
2112
+ if (!o) {
2113
+ m.warning("附件限额尚未加载,请稍后再试");
2114
+ return;
2115
+ }
2116
+ const h = zn(A, u.current, o);
2117
+ if (h) {
2118
+ m.warning(h);
2119
+ return;
2120
+ }
2121
+ const c = await n();
2122
+ if (c) {
2123
+ i(!0);
2124
+ try {
2125
+ const T = await wt(c, A);
2126
+ if (!(T != null && T.length))
2127
+ return;
2128
+ r([
2129
+ ...u.current,
2130
+ ...T.map((v) => ({
2131
+ kind: "ATTACHMENT",
2132
+ ref: v.ref,
2133
+ name: v.name,
2134
+ size: v.size,
2135
+ sha256: v.sha256,
2136
+ workspaceName: v.workspaceName
2137
+ }))
2138
+ ]), m.success(`已上传 ${T.length} 个附件`);
2139
+ } finally {
2140
+ i(!1);
2141
+ }
2142
+ }
2143
+ },
2144
+ [a, d, o, n, r, m]
2145
+ ), C = o ? `支持 ${o.allowedExtensions.join(" / ")},单文件 ≤ ${ie(o.maxFileBytes)},每轮 ≤ ${o.maxFilesPerRound} 个 / ${ie(o.maxTotalBytesPerRound)}` : "附件限额加载中…";
2146
+ return /* @__PURE__ */ t(
2147
+ Vt,
2148
+ {
2149
+ multiple: !0,
2150
+ showUploadList: !1,
2151
+ disabled: d || a,
2152
+ beforeUpload: (A, h) => (A === h[0] && p(h), !1),
2153
+ children: /* @__PURE__ */ t(
2154
+ O,
2155
+ {
2156
+ type: "link",
2157
+ size: "small",
2158
+ className: "ox-composer-link",
2159
+ title: C,
2160
+ icon: /* @__PURE__ */ t(J, { name: "file", size: 12 }),
2161
+ loading: a,
2162
+ disabled: d,
2163
+ children: "附件"
2164
+ }
2165
+ )
2166
+ }
2167
+ );
2168
+ }
2169
+ const ge = "ontology_extractor";
2170
+ async function Dn() {
2171
+ var n, d;
2172
+ const e = await Fe(), r = (n = e == null ? void 0 : e.items) == null ? void 0 : n.find((m) => m.taskCode === "EXTRACT");
2173
+ if (!(r != null && r.executorConfig))
2174
+ return ge;
2175
+ try {
2176
+ const o = (d = JSON.parse(r.executorConfig).executor) == null ? void 0 : d.agentCode;
2177
+ return typeof o == "string" && o ? o : ge;
2178
+ } catch {
2179
+ return ge;
2180
+ }
2181
+ }
2182
+ function Rn(e) {
2183
+ return e ? e.includes("PREPARE") ? "解析并准备附件" : e.includes("SHARD") || e.includes("EXTRACT") ? "分片提取" : e : "节点";
2184
+ }
2185
+ function $n(e) {
2186
+ return !!(e != null && e.includes("PREPARE"));
2187
+ }
2188
+ function Fn(e) {
2189
+ return !!(e && (e.includes("SHARD") || e.includes("EXTRACT")));
2190
+ }
2191
+ function Ln(e) {
2192
+ if (e.length)
2193
+ return e.some((r) => r.runStatus === "RUNNING" || r.runStatus === "QUEUED") ? "RUNNING" : e.some((r) => r.runStatus === "FAILED") ? "FAILED" : e.every((r) => r.runStatus === "COMPLETED" || r.runStatus === "CANCELED") ? e.some((r) => r.runStatus === "CANCELED") ? "CANCELED" : "COMPLETED" : e[0].runStatus;
2194
+ }
2195
+ function Ye({ progress: e, running: r, fallback: n }) {
2196
+ const d = (e == null ? void 0 : e.totalCount) ?? (n == null ? void 0 : n.total) ?? 0, m = (e == null ? void 0 : e.successCount) ?? (n == null ? void 0 : n.success) ?? 0, o = (e == null ? void 0 : e.failedCount) ?? (n == null ? void 0 : n.failed) ?? 0, s = d ? Math.round((m + o) / d * 100) : 0, a = (e == null ? void 0 : e.runStatus) ?? (n == null ? void 0 : n.status), i = (e == null ? void 0 : e.nodes) ?? [], u = i.find((C) => $n(C.nodeCode)), p = Ln(i.filter((C) => Fn(C.nodeCode)));
2197
+ return /* @__PURE__ */ l("div", { className: "ox-progress-panel", children: [
2198
+ /* @__PURE__ */ l("div", { className: "ox-progress-stages", children: [
2199
+ /* @__PURE__ */ l("span", { className: "stage", children: [
2200
+ /* @__PURE__ */ t(J, { name: "file-text", size: 12 }),
2201
+ "解析并准备附件",
2202
+ u ? se(u.runStatus) : null
2203
+ ] }),
2204
+ /* @__PURE__ */ t(J, { name: "arrow-right", size: 12 }),
2205
+ /* @__PURE__ */ l("span", { className: "stage", children: [
2206
+ /* @__PURE__ */ t(J, { name: "layers", size: 12 }),
2207
+ "分片提取",
2208
+ p ? se(p) : null
2209
+ ] }),
2210
+ r ? /* @__PURE__ */ t("span", { className: "hint", children: "每 3 秒刷新" }) : null
2211
+ ] }),
2212
+ /* @__PURE__ */ l("div", { className: "ox-detail-progress", children: [
2213
+ /* @__PURE__ */ t(
2214
+ Xt,
2215
+ {
2216
+ percent: s,
2217
+ status: a === "FAILED" ? "exception" : r ? "active" : "normal"
2218
+ }
2219
+ ),
2220
+ /* @__PURE__ */ l("span", { className: "ox-progress-counts", children: [
2221
+ "成功 ",
2222
+ m,
2223
+ " / 共 ",
2224
+ d,
2225
+ o ? /* @__PURE__ */ l("em", { className: "fail", children: [
2226
+ "失败 ",
2227
+ o
2228
+ ] }) : null
2229
+ ] })
2230
+ ] }),
2231
+ u != null && u.failureSummary ? /* @__PURE__ */ l("p", { className: "ox-failure-summary", title: u.failureSummary, children: [
2232
+ "解析并准备附件失败:",
2233
+ u.failureSummary
2234
+ ] }) : null,
2235
+ i.length ? /* @__PURE__ */ t("ul", { className: "ox-node-list", children: i.map((C) => /* @__PURE__ */ l("li", { children: [
2236
+ /* @__PURE__ */ t("span", { className: "name", children: Rn(C.nodeCode) }),
2237
+ se(C.runStatus),
2238
+ C.failureSummary ? /* @__PURE__ */ t("span", { className: "fail-summary", title: C.failureSummary, children: C.failureSummary }) : null
2239
+ ] }, C.nodeCode)) }) : null,
2240
+ e != null && e.failureSummary ? /* @__PURE__ */ t("p", { className: "ox-failure-summary", children: e.failureSummary }) : null
2241
+ ] });
2242
+ }
2243
+ function Mn({ kbRefs: e, onChange: r, disabled: n }) {
2244
+ const [d, m] = x([]), [o, s] = x(!1), [a, i] = x(), [u, p] = x([]), [C, A] = x(!1), [h, c] = x(""), T = _(0);
2245
+ B(() => {
2246
+ s(!0), ct({ current: 1, size: 100 }).then((f) => {
2247
+ m((f == null ? void 0 : f.records) ?? []), s(!1);
2248
+ });
2249
+ }, []), B(() => {
2250
+ if (!a) {
2251
+ p([]);
2252
+ return;
2253
+ }
2254
+ const f = ++T.current;
2255
+ return A(!0), jt({ kbId: a, current: 1, size: 200, keyword: h || void 0 }).then(
2256
+ (g) => {
2257
+ f === T.current && (p((g == null ? void 0 : g.records) ?? []), A(!1));
2258
+ }
2259
+ ), () => {
2260
+ T.current += 1;
2261
+ };
2262
+ }, [a, h]);
2263
+ const v = z(
2264
+ (f, g) => {
2265
+ const S = e.filter(($) => $.ref !== f.materialId);
2266
+ r(
2267
+ g ? [...S, { kind: "KB", ref: f.materialId, name: f.title }] : S
2268
+ );
2269
+ },
2270
+ [e, r]
2271
+ ), N = e.filter((f) => !u.some((g) => g.materialId === f.ref));
2272
+ return /* @__PURE__ */ l("div", { className: "ox-kb-panel", children: [
2273
+ /* @__PURE__ */ l("div", { className: "ox-kb-row", children: [
2274
+ /* @__PURE__ */ t(
2275
+ te,
2276
+ {
2277
+ size: "small",
2278
+ placeholder: "选择知识库",
2279
+ loading: o,
2280
+ value: a,
2281
+ onChange: (f) => i(f),
2282
+ options: d.map((f) => ({ value: f.kbId, label: f.name })),
2283
+ showSearch: !0,
2284
+ optionFilterProp: "label",
2285
+ allowClear: !0,
2286
+ disabled: n,
2287
+ style: { width: 200 }
2288
+ }
2289
+ ),
2290
+ /* @__PURE__ */ t(
2291
+ ne.Search,
2292
+ {
2293
+ size: "small",
2294
+ placeholder: "搜索资料标题",
2295
+ allowClear: !0,
2296
+ disabled: n || !a,
2297
+ onSearch: c,
2298
+ style: { width: 180 }
2299
+ }
2300
+ ),
2301
+ /* @__PURE__ */ t("span", { className: "hint", children: e.length ? `已挂 ${e.length} 篇` : "仅已解析就绪的资料可挂" })
2302
+ ] }),
2303
+ a ? /* @__PURE__ */ t(pe, { spinning: C, children: /* @__PURE__ */ t("div", { className: "ox-material-list", children: u.length ? u.map((f) => {
2304
+ const g = f.parseStatus === "READY", S = e.some(($) => $.ref === f.materialId);
2305
+ return /* @__PURE__ */ l("label", { className: `ox-material ${g ? "" : "off"}`, children: [
2306
+ /* @__PURE__ */ t(
2307
+ Wt,
2308
+ {
2309
+ checked: S,
2310
+ disabled: n || !g,
2311
+ onChange: ($) => v(f, $.target.checked)
2312
+ }
2313
+ ),
2314
+ /* @__PURE__ */ t("span", { className: "name", title: f.title, children: f.title }),
2315
+ /* @__PURE__ */ t("span", { className: "meta", children: g ? ie(f.sizeBytes) : "未解析就绪" })
2316
+ ] }, f.materialId);
2317
+ }) : /* @__PURE__ */ t(ke, { image: ke.PRESENTED_IMAGE_SIMPLE, description: "该知识库暂无资料" }) }) }) : null,
2318
+ N.length ? /* @__PURE__ */ t("div", { className: "ox-kb-selected", children: N.map((f) => /* @__PURE__ */ l("span", { className: "ox-tag", children: [
2319
+ /* @__PURE__ */ t(J, { name: "book-open", size: 11 }),
2320
+ f.name || f.ref,
2321
+ /* @__PURE__ */ t(
2322
+ "button",
2323
+ {
2324
+ type: "button",
2325
+ "aria-label": "移除来源",
2326
+ disabled: n,
2327
+ onClick: () => r(e.filter((g) => g.ref !== f.ref)),
2328
+ children: /* @__PURE__ */ t(J, { name: "x", size: 10 })
2329
+ }
2330
+ )
2331
+ ] }, f.ref)) }) : null
2332
+ ] });
2333
+ }
2334
+ const On = "在会话里说清要抽取什么,来源可在输入框上方挂知识库或本地附件;不挂来源时按对话条件抽取。发出后流式回传进度,关闭窗口不影响执行,从「提取任务」可重新拉起本会话。", Pn = "按任务会话恢复:上面是发起时的指令与构建信息,下面是运行进度与产出;重新打开不影响后台执行,结束后可在本会话继续追加来源或对话条件。", Bn = "告诉我要抽取什么,例如「从附件里抽取症状、药品与处置,置信 0.6 以下标出来」。要引用材料时点下方「知识库」选一个知识库、点「附件」从本地上传文件;都不挂时按对话里确认的口径抽取。发出后我会在会话里流式回传进度,关闭窗口不中断执行,从「提取任务」可以重新打开这个会话。";
2335
+ function De(e) {
2336
+ return typeof e == "string" ? e : "";
2337
+ }
2338
+ function Qe({
2339
+ open: e,
2340
+ onClose: r,
2341
+ task: n,
2342
+ historyAttachments: d,
2343
+ onChanged: m
2344
+ }) {
2345
+ const { message: o, modal: s } = re.useApp(), [a, i] = x(""), [u, p] = x(), [C, A] = x(!1), [h, c] = x(""), [T, v] = x(), [N, f] = x(), [g, S] = x([]), [$, k] = x(!1), P = _(""), V = _(g);
2346
+ V.current = g;
2347
+ const q = _(m);
2348
+ q.current = m;
2349
+ const U = _(!1), y = _(!1), b = z((L) => {
2350
+ const K = De(L.taskCode), Y = De(L.scopeId);
2351
+ K && (P.current = K, c(K)), Y && v(Y), typeof L.roundNo == "number" && f(L.roundNo), (K || Y) && q.current();
2352
+ }, []), W = z(() => {
2353
+ const L = P.current;
2354
+ L && Me(L).then((K) => {
2355
+ K !== void 0 && (o.success(K ? "任务已取消" : "任务已结束,无需取消"), q.current());
2356
+ });
2357
+ }, [o]), w = _t(a, void 0, void 0, {
2358
+ agentCode: u,
2359
+ bizType: vt,
2360
+ serverManaged: !0,
2361
+ onServerCancel: W,
2362
+ onMeta: b
2363
+ }), { progress: M } = We(T, e && !!T), R = (M == null ? void 0 : M.runStatus) ?? (T || n == null ? void 0 : n.runStatus), D = !ee(R), G = _(R);
2364
+ G.current = R, B(() => {
2365
+ if (!e) {
2366
+ y.current = !1, U.current = !1;
2367
+ return;
2368
+ }
2369
+ y.current || (y.current = !0, P.current = (n == null ? void 0 : n.code) ?? "", c((n == null ? void 0 : n.code) ?? ""), v(n == null ? void 0 : n.latestScopeId), f(void 0), S((d ?? []).filter((L) => L.kind !== "CHAT")), k(!1), A(!1), i(""), p(void 0));
2370
+ }, [e, n, d]), B(() => {
2371
+ if (!e || !y.current || C)
2372
+ return;
2373
+ let L = !1;
2374
+ return (async () => {
2375
+ const K = await dt(), Y = await Dn();
2376
+ L || (K === null ? o.error("当前租户尚未开通本体,无法发起提取会话") : K || o.error("本体信息加载失败,请重试"), i((K == null ? void 0 : K.code) ?? ""), p(Y), A(!0));
2377
+ })(), () => {
2378
+ L = !0;
2379
+ };
2380
+ }, [e, C, o]), B(() => {
2381
+ !e || !C || !a || !u || U.current || (U.current = !0, n != null && n.conversationId && w.resume(n.conversationId, n.name));
2382
+ }, [e, C, a, u, n, w]);
2383
+ const I = _(void 0);
2384
+ B(() => {
2385
+ !(M != null && M.scopeId) || !ee(M.runStatus) || I.current !== M.scopeId && (I.current = M.scopeId, q.current());
2386
+ }, [M]);
2387
+ const Z = z(() => {
2388
+ const L = { stage: "EXTRACT" };
2389
+ return P.current && (L.taskCode = P.current), L;
2390
+ }, []), E = z(
2391
+ (L) => {
2392
+ const K = V.current;
2393
+ w.send(L, Z(), {
2394
+ sourceRefs: K.length ? K : [{ kind: "CHAT" }]
2395
+ }), k(!1);
2396
+ },
2397
+ [w, Z]
2398
+ ), F = z(() => {
2399
+ if (!P.current) {
2400
+ w.stop();
2401
+ return;
2402
+ }
2403
+ s.confirm({
2404
+ title: "取消本次提取任务?",
2405
+ content: "运行中与排队中的分片都会停止;已产出的草案保留。",
2406
+ okText: "取消任务",
2407
+ okButtonProps: { danger: !0 },
2408
+ cancelText: "再想想",
2409
+ onOk: () => {
2410
+ w.stop();
2411
+ }
2412
+ });
2413
+ }, [w, s]), Ze = z(
2414
+ (L, K) => {
2415
+ w.answerQuestion(L, K, Z());
2416
+ },
2417
+ [w, Z]
2418
+ ), He = z(async () => {
2419
+ const L = await w.startSession();
2420
+ return L || o.error("会话创建失败,请稍后重试"), L;
2421
+ }, [w, o]), et = z((L) => {
2422
+ S(
2423
+ (K) => K.filter((Y) => !(Y.kind === L.kind && Y.ref === L.ref))
2424
+ );
2425
+ }, []), tt = z((L) => {
2426
+ S((K) => [...L, ...K.filter((Y) => Y.kind !== "KB")]);
2427
+ }, []), nt = z((L) => {
2428
+ S((K) => [...K.filter((Y) => Y.kind !== "ATTACHMENT"), ...L]);
2429
+ }, []), Te = z(() => {
2430
+ P.current && !ee(G.current) && o.info("任务后台继续运行,可在任务列表重开"), w.reset(), r();
2431
+ }, [o, w, r]), de = !n, rt = C && (!a || !u), ue = w.streaming || w.historyLoading, at = g.filter((L) => L.kind === "KB"), st = g.filter((L) => L.kind === "ATTACHMENT"), ot = de ? "新建结构化提取任务" : (n == null ? void 0 : n.name) || w.conversationName || "提取会话", lt = de ? "结构化提取任务:发出后即流式执行,完成产出草案" : D ? `任务 ${h || (n == null ? void 0 : n.code) || ""} · 关闭本窗口不影响执行,回到「提取任务」可重新拉起` : `任务 ${h || (n == null ? void 0 : n.code) || ""} · 已跑 ${N ?? 1} 轮,可在本会话再挂来源或补对话条件继续追加`;
2432
+ return /* @__PURE__ */ t(
2433
+ ce,
2434
+ {
2435
+ title: /* @__PURE__ */ l("span", { className: "ox-detail-title", children: [
2436
+ /* @__PURE__ */ t(J, { name: "message-square", size: 14 }),
2437
+ ot,
2438
+ de ? /* @__PURE__ */ t(j, { color: "cyan", children: "结构化提取 · 产出草案" }) : R ? se(R) : null,
2439
+ N !== void 0 ? /* @__PURE__ */ l(j, { children: [
2440
+ "第 ",
2441
+ N,
2442
+ " 轮"
2443
+ ] }) : null
2444
+ ] }),
2445
+ open: e,
2446
+ width: 780,
2447
+ onCancel: Te,
2448
+ destroyOnHidden: !0,
2449
+ maskClosable: !1,
2450
+ className: "ox-session-modal",
2451
+ footer: /* @__PURE__ */ l("div", { className: "ox-session-foot", children: [
2452
+ /* @__PURE__ */ t("span", { className: "note", children: lt }),
2453
+ /* @__PURE__ */ t(O, { onClick: Te, children: "关闭" })
2454
+ ] }),
2455
+ children: C ? rt ? /* @__PURE__ */ t("div", { className: "ox-detail-placeholder", children: "提取会话不可用:请确认本体已开通且 EXTRACT 阶段已发布执行器配置" }) : /* @__PURE__ */ l("div", { className: "ox-session-body", children: [
2456
+ /* @__PURE__ */ t("p", { className: "ox-modal-sub", children: de ? On : Pn }),
2457
+ T ? /* @__PURE__ */ t(
2458
+ Ye,
2459
+ {
2460
+ progress: M,
2461
+ running: D,
2462
+ fallback: n ? {
2463
+ total: n.totalCount,
2464
+ success: n.successCount,
2465
+ failed: n.failedCount,
2466
+ status: n.runStatus
2467
+ } : void 0
2468
+ }
2469
+ ) : null,
2470
+ /* @__PURE__ */ t("div", { className: "ox-session-chat", children: /* @__PURE__ */ t(
2471
+ Ut,
2472
+ {
2473
+ compact: !0,
2474
+ messages: w.messages,
2475
+ streaming: w.streaming,
2476
+ historyLoading: w.historyLoading,
2477
+ onSend: E,
2478
+ onStop: F,
2479
+ onAnswer: Ze,
2480
+ assistantName: "知识提取助手",
2481
+ welcomeTitle: "知识提取助手",
2482
+ welcomeText: Bn,
2483
+ placeholder: de ? "直接描述要抽取的类型、范围或规则…" : "继续追加:说清这一轮还要抽取什么,可再挂知识库或附件",
2484
+ scopeHint: h ? `任务 ${h} · 发送即追加一轮,续跑同一任务` : void 0,
2485
+ leadingSlot: /* @__PURE__ */ l(H, { children: [
2486
+ /* @__PURE__ */ t(
2487
+ O,
2488
+ {
2489
+ type: "link",
2490
+ size: "small",
2491
+ className: "ox-composer-link",
2492
+ icon: /* @__PURE__ */ t(J, { name: "link", size: 12 }),
2493
+ disabled: ue,
2494
+ onClick: () => k((L) => !L),
2495
+ children: "知识库"
2496
+ }
2497
+ ),
2498
+ /* @__PURE__ */ t(
2499
+ An,
2500
+ {
2501
+ attachments: st,
2502
+ onChange: nt,
2503
+ ensureConversationId: He,
2504
+ disabled: ue
2505
+ }
2506
+ )
2507
+ ] }),
2508
+ footerSlot: /* @__PURE__ */ l(H, { children: [
2509
+ $ ? /* @__PURE__ */ t(
2510
+ Mn,
2511
+ {
2512
+ kbRefs: at,
2513
+ onChange: tt,
2514
+ disabled: ue
2515
+ }
2516
+ ) : null,
2517
+ g.length ? /* @__PURE__ */ t("div", { className: "ox-src-chips", children: g.map((L) => /* @__PURE__ */ l(
2518
+ "span",
2519
+ {
2520
+ className: "ox-src-chip",
2521
+ children: [
2522
+ /* @__PURE__ */ t(
2523
+ J,
2524
+ {
2525
+ name: L.kind === "KB" ? "book-open" : "file-text",
2526
+ size: 11
2527
+ }
2528
+ ),
2529
+ /* @__PURE__ */ t("span", { className: "name", title: L.name || L.ref, children: L.name || L.ref }),
2530
+ /* @__PURE__ */ t(
2531
+ "button",
2532
+ {
2533
+ type: "button",
2534
+ "aria-label": "移除来源",
2535
+ disabled: ue,
2536
+ onClick: () => et(L),
2537
+ children: /* @__PURE__ */ t(J, { name: "x", size: 10 })
2538
+ }
2539
+ )
2540
+ ]
2541
+ },
2542
+ `${L.kind}:${L.ref ?? L.name}`
2543
+ )) }) : null
2544
+ ] })
2545
+ }
2546
+ ) })
2547
+ ] }) : /* @__PURE__ */ t("div", { className: "ox-detail-placeholder", children: "正在准备提取会话…" })
2548
+ }
2549
+ );
2550
+ }
2551
+ function qn(e) {
2552
+ const [r, n] = x(void 0), [d, m] = x(!1), o = _(0), s = z(async () => {
2553
+ if (!e)
2554
+ return;
2555
+ const a = ++o.current;
2556
+ m(!0);
2557
+ try {
2558
+ const i = await bt(e);
2559
+ if (a !== o.current)
2560
+ return;
2561
+ n(i);
2562
+ } finally {
2563
+ a === o.current && m(!1);
2564
+ }
2565
+ }, [e]);
2566
+ return B(() => {
2567
+ if (!e) {
2568
+ n(void 0);
2569
+ return;
2570
+ }
2571
+ return s(), () => {
2572
+ o.current += 1;
2573
+ };
2574
+ }, [e, s]), { detail: r, loading: d, reload: s };
2575
+ }
2576
+ function Gn({
2577
+ rounds: e,
2578
+ rerunningNo: r,
2579
+ onRerun: n
2580
+ }) {
2581
+ const d = Q(
2582
+ () => [
2583
+ {
2584
+ title: "轮次",
2585
+ dataIndex: "roundNo",
2586
+ key: "roundNo",
2587
+ width: 70,
2588
+ sorter: (a, i) => a.roundNo - i.roundNo,
2589
+ render: (a, i) => /* @__PURE__ */ l("span", { children: [
2590
+ "第 ",
2591
+ a,
2592
+ " 轮",
2593
+ i.rerunOf ? /* @__PURE__ */ l(j, { className: "ox-rerun-tag", children: [
2594
+ "重跑自 ",
2595
+ i.rerunOf
2596
+ ] }) : null
2597
+ ] })
2598
+ },
2599
+ {
2600
+ title: "状态",
2601
+ dataIndex: "runStatus",
2602
+ key: "runStatus",
2603
+ width: 100,
2604
+ sorter: (a, i) => (a.runStatus ?? "").localeCompare(i.runStatus ?? ""),
2605
+ render: (a) => se(a)
2606
+ },
2607
+ {
2608
+ title: "分片",
2609
+ dataIndex: "totalCount",
2610
+ key: "totalCount",
2611
+ width: 70,
2612
+ sorter: (a, i) => (a.totalCount ?? 0) - (i.totalCount ?? 0),
2613
+ render: (a) => a ?? 0
2614
+ },
2615
+ {
2616
+ title: "成功",
2617
+ dataIndex: "successCount",
2618
+ key: "successCount",
2619
+ width: 70,
2620
+ sorter: (a, i) => (a.successCount ?? 0) - (i.successCount ?? 0),
2621
+ render: (a) => a ?? 0
2622
+ },
2623
+ {
2624
+ title: "失败",
2625
+ dataIndex: "failedCount",
2626
+ key: "failedCount",
2627
+ width: 70,
2628
+ sorter: (a, i) => (a.failedCount ?? 0) - (i.failedCount ?? 0),
2629
+ render: (a) => a ? /* @__PURE__ */ t("span", { className: "ox-fail-count", children: a }) : 0
2630
+ },
2631
+ {
2632
+ title: "开始时间",
2633
+ dataIndex: "startedAt",
2634
+ key: "startedAt",
2635
+ width: 150,
2636
+ sorter: (a, i) => (a.startedAt ?? "").localeCompare(i.startedAt ?? ""),
2637
+ render: (a) => a || "—"
2638
+ },
2639
+ {
2640
+ title: "结束时间",
2641
+ dataIndex: "finishedAt",
2642
+ key: "finishedAt",
2643
+ width: 150,
2644
+ sorter: (a, i) => (a.finishedAt ?? "").localeCompare(i.finishedAt ?? ""),
2645
+ render: (a) => a || "—"
2646
+ },
2647
+ {
2648
+ title: "操作",
2649
+ key: "action",
2650
+ width: 120,
2651
+ render: (a, i) => {
2652
+ const u = ee(i.runStatus) && (i.failedCount ?? 0) > 0;
2653
+ return /* @__PURE__ */ t(
2654
+ O,
2655
+ {
2656
+ size: "small",
2657
+ type: "link",
2658
+ disabled: !u,
2659
+ loading: r === i.roundNo,
2660
+ title: u ? "仅重跑该轮失败分片" : "轮次到终态且有失败分片时可重跑",
2661
+ onClick: () => n(i),
2662
+ children: "重跑失败分片"
2663
+ }
2664
+ );
2665
+ }
2666
+ }
2667
+ ],
2668
+ [r, n]
2669
+ ), { columns: m, components: o } = oe(d, { excludeKeys: ["action"] }), s = d.reduce((a, i) => a + Number(i.width || 0), 0);
2670
+ return /* @__PURE__ */ t(
2671
+ le,
2672
+ {
2673
+ rowKey: "roundNo",
2674
+ size: "small",
2675
+ columns: m,
2676
+ components: o,
2677
+ dataSource: e,
2678
+ pagination: !1,
2679
+ scroll: { x: s }
2680
+ }
2681
+ );
2682
+ }
2683
+ function Kn({
2684
+ groups: e,
2685
+ onOpenGroup: r
2686
+ }) {
2687
+ const n = Q(
2688
+ () => [
2689
+ {
2690
+ title: "轮次",
2691
+ dataIndex: "roundNo",
2692
+ key: "roundNo",
2693
+ width: 70,
2694
+ sorter: (s, a) => s.roundNo - a.roundNo
2695
+ },
2696
+ {
2697
+ title: "草案组",
2698
+ dataIndex: "draftGroup",
2699
+ key: "draftGroup",
2700
+ width: 200,
2701
+ ellipsis: !0,
2702
+ sorter: (s, a) => s.draftGroup - a.draftGroup,
2703
+ render: (s, a) => /* @__PURE__ */ l("button", { type: "button", className: "ox-draft-link", onClick: () => r(a), children: [
2704
+ "组 ",
2705
+ s,
2706
+ " ›"
2707
+ ] })
2708
+ },
2709
+ {
2710
+ title: "行数",
2711
+ dataIndex: "rowCount",
2712
+ key: "rowCount",
2713
+ width: 80,
2714
+ sorter: (s, a) => (s.rowCount ?? 0) - (a.rowCount ?? 0),
2715
+ render: (s) => s ?? 0
2716
+ },
2717
+ {
2718
+ title: "已提交",
2719
+ dataIndex: "submittedCount",
2720
+ key: "submittedCount",
2721
+ width: 80,
2722
+ sorter: (s, a) => (s.submittedCount ?? 0) - (a.submittedCount ?? 0),
2723
+ render: (s) => s ?? 0
2724
+ },
2725
+ {
2726
+ title: "低置信",
2727
+ dataIndex: "lowConfidenceCount",
2728
+ key: "lowConfidenceCount",
2729
+ width: 80,
2730
+ sorter: (s, a) => (s.lowConfidenceCount ?? 0) - (a.lowConfidenceCount ?? 0),
2731
+ render: (s) => s ? /* @__PURE__ */ t("span", { className: "ox-fail-count", children: s }) : 0
2732
+ },
2733
+ {
2734
+ title: "状态",
2735
+ dataIndex: "status",
2736
+ key: "status",
2737
+ width: 90,
2738
+ sorter: (s, a) => (s.status ?? "").localeCompare(a.status ?? ""),
2739
+ render: (s) => /* @__PURE__ */ t(j, { color: s === "SUBMITTED" ? "success" : s === "REJECTED" ? "error" : "default", children: Ne(s) })
2740
+ },
2741
+ {
2742
+ title: "产出时间",
2743
+ dataIndex: "firstCreateTime",
2744
+ key: "firstCreateTime",
2745
+ width: 150,
2746
+ sorter: (s, a) => (s.firstCreateTime ?? "").localeCompare(a.firstCreateTime ?? ""),
2747
+ render: (s) => s || "—"
2748
+ }
2749
+ ],
2750
+ [r]
2751
+ ), { columns: d, components: m } = oe(n), o = n.reduce((s, a) => s + Number(a.width || 0), 0);
2752
+ return /* @__PURE__ */ t(
2753
+ le,
2754
+ {
2755
+ rowKey: (s) => `${s.roundNo}-${s.draftGroup}`,
2756
+ size: "small",
2757
+ columns: d,
2758
+ components: m,
2759
+ dataSource: e,
2760
+ pagination: !1,
2761
+ scroll: { x: o },
2762
+ onRow: (s) => ({ onClick: () => r(s) })
2763
+ }
2764
+ );
2765
+ }
2766
+ function _n({
2767
+ code: e,
2768
+ onClose: r,
2769
+ onChanged: n,
2770
+ onOpenDraft: d
2771
+ }) {
2772
+ var U;
2773
+ const { message: m, modal: o } = re.useApp(), { detail: s, loading: a, reload: i } = qn(e), [u, p] = x(!1), [C, A] = x(!1), [h, c] = x(), [T, v] = x(), N = s == null ? void 0 : s.task, f = !!(N && !ee(N.runStatus)), { progress: g } = We(N == null ? void 0 : N.latestScopeId, f), S = _(void 0);
2774
+ B(() => {
2775
+ !(g != null && g.scopeId) || !ee(g.runStatus) || S.current !== g.scopeId && (S.current = g.scopeId, i(), n());
2776
+ }, [g, i, n]), B(() => {
2777
+ p(!1), S.current = void 0;
2778
+ }, [e]);
2779
+ const $ = z(
2780
+ (y) => {
2781
+ e && o.confirm({
2782
+ title: `重跑第 ${y.roundNo} 轮的失败分片?`,
2783
+ content: `将只重跑 ${y.failedCount ?? 0} 个失败分片,成功分片不重复提取。`,
2784
+ okText: "重跑",
2785
+ cancelText: "取消",
2786
+ onOk: async () => {
2787
+ c(y.roundNo);
2788
+ try {
2789
+ const b = await Tt({ code: e, roundNo: y.roundNo });
2790
+ if (!b)
2791
+ return;
2792
+ m.success(`已下发重跑(第 ${b.roundNo} 轮)`), i(), n();
2793
+ } finally {
2794
+ c(void 0);
2795
+ }
2796
+ }
2797
+ });
2798
+ },
2799
+ [e, o, m, i, n]
2800
+ ), k = z(() => {
2801
+ !e || !N || o.confirm({
2802
+ title: `取消任务「${N.name}」?`,
2803
+ content: "运行中与排队中的分片都会停止;已产出的草案保留。",
2804
+ okText: "取消任务",
2805
+ okButtonProps: { danger: !0 },
2806
+ cancelText: "再想想",
2807
+ onOk: async () => {
2808
+ A(!0);
2809
+ try {
2810
+ const y = await Me(e);
2811
+ if (y === void 0)
2812
+ return;
2813
+ y ? m.success("任务已取消") : m.info("任务已结束,无需取消"), i(), n();
2814
+ } finally {
2815
+ A(!1);
2816
+ }
2817
+ }
2818
+ });
2819
+ }, [e, N, o, m, i, n]), P = z(
2820
+ async (y) => {
2821
+ if (!(!e || !y.ref)) {
2822
+ v(y.ref);
2823
+ try {
2824
+ const b = await kt(e, y.ref), W = URL.createObjectURL(b), w = document.createElement("a");
2825
+ w.href = W, w.download = y.name || "attachment", w.click(), URL.revokeObjectURL(W);
2826
+ } catch (b) {
2827
+ m.error(b.message || "附件下载失败");
2828
+ } finally {
2829
+ v(void 0);
2830
+ }
2831
+ }
2832
+ },
2833
+ [e, m]
2834
+ ), V = (g == null ? void 0 : g.runStatus) ?? (N == null ? void 0 : N.runStatus), q = z(() => {
2835
+ i(), n();
2836
+ }, [i, n]);
2837
+ return /* @__PURE__ */ l(H, { children: [
2838
+ /* @__PURE__ */ t(
2839
+ ce,
2840
+ {
2841
+ title: /* @__PURE__ */ l("span", { className: "ox-detail-title", children: [
2842
+ (N == null ? void 0 : N.name) || "提取任务",
2843
+ se(V)
2844
+ ] }),
2845
+ open: !!e,
2846
+ width: 920,
2847
+ onCancel: r,
2848
+ maskClosable: !1,
2849
+ footer: /* @__PURE__ */ l("span", { className: "ox-detail-footer", children: [
2850
+ f ? /* @__PURE__ */ t(O, { danger: !0, loading: C, onClick: k, children: "取消任务" }) : null,
2851
+ /* @__PURE__ */ t(O, { onClick: r, children: "关 闭" })
2852
+ ] }),
2853
+ children: /* @__PURE__ */ t(pe, { spinning: a && !s, children: N ? /* @__PURE__ */ l("div", { className: "ox-detail-body", children: [
2854
+ /* @__PURE__ */ t(
2855
+ Oe,
2856
+ {
2857
+ size: "small",
2858
+ column: 3,
2859
+ items: [
2860
+ { key: "kind", label: "来源", children: be(N.sourceKind) },
2861
+ { key: "rounds", label: "轮次", children: N.roundCount ?? 0 },
2862
+ { key: "groups", label: "草案组", children: N.draftGroupCount ?? 0 },
2863
+ { key: "created", label: "创建时间", children: N.createTime || "—" },
2864
+ {
2865
+ key: "duration",
2866
+ label: "耗时",
2867
+ children: N.durationSeconds !== void 0 ? `${N.durationSeconds} 秒` : "—"
2868
+ },
2869
+ {
2870
+ key: "summary",
2871
+ label: "来源摘要",
2872
+ children: N.sourceSummary || "—",
2873
+ span: 3
2874
+ }
2875
+ ]
2876
+ }
2877
+ ),
2878
+ N.latestScopeId ? /* @__PURE__ */ l("section", { className: "ox-detail-section", children: [
2879
+ /* @__PURE__ */ t("header", { children: /* @__PURE__ */ t("b", { children: "最新一轮进度" }) }),
2880
+ /* @__PURE__ */ t(
2881
+ Ye,
2882
+ {
2883
+ progress: g,
2884
+ running: f,
2885
+ fallback: {
2886
+ total: N.totalCount,
2887
+ success: N.successCount,
2888
+ failed: N.failedCount,
2889
+ status: N.runStatus
2890
+ }
2891
+ }
2892
+ )
2893
+ ] }) : null,
2894
+ /* @__PURE__ */ l("section", { className: "ox-detail-section", children: [
2895
+ /* @__PURE__ */ l("header", { children: [
2896
+ /* @__PURE__ */ t("b", { children: "轮次" }),
2897
+ /* @__PURE__ */ t(
2898
+ O,
2899
+ {
2900
+ size: "small",
2901
+ type: "primary",
2902
+ ghost: !0,
2903
+ icon: /* @__PURE__ */ t(J, { name: "message-square", size: 13 }),
2904
+ onClick: () => p(!0),
2905
+ children: "继续会话"
2906
+ }
2907
+ )
2908
+ ] }),
2909
+ /* @__PURE__ */ t(
2910
+ Gn,
2911
+ {
2912
+ rounds: (s == null ? void 0 : s.rounds) ?? [],
2913
+ rerunningNo: h,
2914
+ onRerun: $
2915
+ }
2916
+ )
2917
+ ] }),
2918
+ /* @__PURE__ */ l("section", { className: "ox-detail-section", children: [
2919
+ /* @__PURE__ */ l("header", { children: [
2920
+ /* @__PURE__ */ t("b", { children: "草案组" }),
2921
+ /* @__PURE__ */ t("span", { className: "hint", children: "点任一行打开草案核对,可提交为提案" })
2922
+ ] }),
2923
+ /* @__PURE__ */ t(
2924
+ Kn,
2925
+ {
2926
+ groups: (s == null ? void 0 : s.draftGroups) ?? [],
2927
+ onOpenGroup: (y) => {
2928
+ !(N != null && N.code) || !d || d({
2929
+ taskCode: N.code,
2930
+ roundNo: y.roundNo,
2931
+ draftGroup: y.draftGroup
2932
+ });
2933
+ }
2934
+ }
2935
+ )
2936
+ ] }),
2937
+ (U = s == null ? void 0 : s.attachments) != null && U.length ? /* @__PURE__ */ l("section", { className: "ox-detail-section", children: [
2938
+ /* @__PURE__ */ l("header", { children: [
2939
+ /* @__PURE__ */ t("b", { children: "会话附件" }),
2940
+ /* @__PURE__ */ t("span", { className: "hint", children: "已发送清单只读,可下载原件" })
2941
+ ] }),
2942
+ /* @__PURE__ */ t("div", { className: "ox-attachment-list", children: s.attachments.map((y) => /* @__PURE__ */ l("span", { className: "ox-tag", children: [
2943
+ /* @__PURE__ */ t(J, { name: "file-text", size: 12 }),
2944
+ y.name || y.ref,
2945
+ /* @__PURE__ */ t("em", { children: ie(y.size) }),
2946
+ /* @__PURE__ */ t(
2947
+ O,
2948
+ {
2949
+ size: "small",
2950
+ type: "link",
2951
+ icon: /* @__PURE__ */ t(J, { name: "download", size: 12 }),
2952
+ loading: T === y.ref,
2953
+ onClick: () => void P(y),
2954
+ children: "下载"
2955
+ }
2956
+ )
2957
+ ] }, y.ref)) })
2958
+ ] }) : null
2959
+ ] }) : /* @__PURE__ */ t("div", { className: "ox-detail-placeholder", children: a ? "" : "任务详情加载失败" }) })
2960
+ }
2961
+ ),
2962
+ N ? /* @__PURE__ */ t(
2963
+ Qe,
2964
+ {
2965
+ open: u,
2966
+ onClose: () => p(!1),
2967
+ task: N,
2968
+ historyAttachments: s == null ? void 0 : s.attachments,
2969
+ onChanged: q
2970
+ }
2971
+ ) : null
2972
+ ] });
2973
+ }
2974
+ function Un(e = 0) {
2975
+ const [r, n] = x({}), [d, m] = x({ current: 1, size: 20 }), [o, s] = x([]), [a, i] = x(0), [u, p] = x(!1), [C, A] = x(0), h = _(0);
2976
+ B(() => {
2977
+ const N = ++h.current;
2978
+ return p(!0), St({
2979
+ ...r,
2980
+ current: d.current,
2981
+ size: d.size
2982
+ }).then((f) => {
2983
+ N === h.current && (s((f == null ? void 0 : f.records) ?? []), i((f == null ? void 0 : f.total) ?? 0), p(!1));
2984
+ }), () => {
2985
+ h.current += 1;
2986
+ };
2987
+ }, [r, d, e, C]);
2988
+ const c = z((N) => {
2989
+ n(N), m((f) => ({ ...f, current: 1 }));
2990
+ }, []), T = z((N, f) => {
2991
+ m({ current: N, size: f });
2992
+ }, []), v = z(() => {
2993
+ A((N) => N + 1);
2994
+ }, []);
2995
+ return {
2996
+ filters: r,
2997
+ pagination: d,
2998
+ records: o,
2999
+ total: a,
3000
+ loading: u,
3001
+ updateFilters: c,
3002
+ updatePagination: T,
3003
+ reload: v
3004
+ };
3005
+ }
3006
+ const Jn = [
3007
+ { value: 1, label: "对话" },
3008
+ { value: 2, label: "知识库" },
3009
+ { value: 3, label: "附件" }
3010
+ ], Vn = [
3011
+ "QUEUED",
3012
+ "RUNNING",
3013
+ "PAUSED",
3014
+ "NEEDS_REVIEW",
3015
+ "COMPLETED",
3016
+ "FAILED",
3017
+ "CANCELED"
3018
+ ];
3019
+ function wr(e = {}) {
3020
+ const r = ve(), n = `${r.currentCode}:${r.version}`;
3021
+ return e.taskKind === "collection" ? /* @__PURE__ */ t(ln, { ...e }, n) : /* @__PURE__ */ t(Xn, { ...e }, n);
3022
+ }
3023
+ function Xn({
3024
+ startCreate: e,
3025
+ onStartCreateHandled: r,
3026
+ openTaskCode: n,
3027
+ onOpenTaskHandled: d,
3028
+ onOpenReview: m
3029
+ }) {
3030
+ const o = ve(), s = ut().can("structure.write"), a = Un(o.version), i = Pe(o.version), u = _e(o.version), [p, C] = x(""), [A, h] = x(!1), [c, T] = x(), [v, N] = x(!1), [f, g] = x(), [S, $] = x();
3031
+ B(() => {
3032
+ e && (N(!0), r == null || r());
3033
+ }, [e, r]), B(() => {
3034
+ n && (T(n), d == null || d());
3035
+ }, [n, d]);
3036
+ const { filters: k, updateFilters: P } = a, V = z((b) => {
3037
+ P({ ...k, ...b });
3038
+ }, [k, P]), { stats: q, loading: U, reload: y } = i;
3039
+ return /* @__PURE__ */ l("div", { className: "view ontology-extract", children: [
3040
+ /* @__PURE__ */ l("header", { className: "ox-head", children: [
3041
+ /* @__PURE__ */ t("h2", { children: "结构化提取" }),
3042
+ /* @__PURE__ */ l("span", { className: "sub", children: [
3043
+ "从知识库、附件或对话抽取实例草案,确认后提交审核。",
3044
+ /* @__PURE__ */ t("button", { type: "button", className: "ox-help-link", onClick: () => h(!0), children: "来源说明" })
3045
+ ] }),
3046
+ /* @__PURE__ */ t("div", { className: "ox-head-actions", children: /* @__PURE__ */ t(
3047
+ O,
3048
+ {
3049
+ size: "small",
3050
+ icon: /* @__PURE__ */ t(J, { name: "refresh", size: 13 }),
3051
+ onClick: () => {
3052
+ y(), a.reload();
3053
+ },
3054
+ children: "刷新"
3055
+ }
3056
+ ) })
3057
+ ] }),
3058
+ /* @__PURE__ */ l("section", { className: "ox-kpis", "aria-label": "提取概览", "aria-busy": U || void 0, children: [
3059
+ /* @__PURE__ */ l("div", { className: "ox-kpi", children: [
3060
+ /* @__PURE__ */ t("span", { className: "k-label", children: "今日产出草案" }),
3061
+ /* @__PURE__ */ t("span", { className: "k-value tnum", children: q ? q.todayGroupCount : "—" }),
3062
+ /* @__PURE__ */ t("span", { className: "k-foot", children: "来自结构化提取会话 · 域内合计" })
3063
+ ] }),
3064
+ /* @__PURE__ */ l("div", { className: "ox-kpi", children: [
3065
+ /* @__PURE__ */ t("span", { className: "k-label", children: "待提交为提案" }),
3066
+ /* @__PURE__ */ t("span", { className: "k-value tnum", children: q ? q.pendingGroupCount : "—" }),
3067
+ /* @__PURE__ */ l("span", { className: "k-foot", children: [
3068
+ /* @__PURE__ */ t(
3069
+ "button",
3070
+ {
3071
+ type: "button",
3072
+ className: "ox-kpi-link",
3073
+ onClick: () => $({ initial: { status: "DRAFT" } }),
3074
+ children: "查看待提交草案"
3075
+ }
3076
+ ),
3077
+ "· 域内合计"
3078
+ ] })
3079
+ ] }),
3080
+ /* @__PURE__ */ l("div", { className: `ox-kpi${q && q.lowConfidenceRowCount > 0 ? " warn" : ""}`, children: [
3081
+ /* @__PURE__ */ t("span", { className: "k-label", children: "低置信待人工确认" }),
3082
+ /* @__PURE__ */ t("span", { className: "k-value tnum", children: q ? q.lowConfidenceRowCount : "—" }),
3083
+ /* @__PURE__ */ l("span", { className: "k-foot", children: [
3084
+ "阈值 ",
3085
+ Je(u),
3086
+ "(可在阶段配置调整)· 域内合计"
3087
+ ] })
3088
+ ] })
3089
+ ] }),
3090
+ /* @__PURE__ */ l("div", { className: "ox-toolbar", children: [
3091
+ /* @__PURE__ */ t(
3092
+ ne.Search,
3093
+ {
3094
+ size: "small",
3095
+ placeholder: "搜索任务名称",
3096
+ allowClear: !0,
3097
+ value: p,
3098
+ onChange: (b) => C(b.target.value),
3099
+ onSearch: (b) => V({ keyword: b.trim() || void 0 }),
3100
+ style: { width: 220 }
3101
+ }
3102
+ ),
3103
+ /* @__PURE__ */ t(
3104
+ te,
3105
+ {
3106
+ size: "small",
3107
+ placeholder: "来源",
3108
+ allowClear: !0,
3109
+ value: a.filters.sourceKind,
3110
+ onChange: (b) => V({ sourceKind: b }),
3111
+ options: Jn,
3112
+ style: { width: 110 }
3113
+ }
3114
+ ),
3115
+ /* @__PURE__ */ t(
3116
+ te,
3117
+ {
3118
+ size: "small",
3119
+ placeholder: "状态",
3120
+ allowClear: !0,
3121
+ value: a.filters.runStatus,
3122
+ onChange: (b) => V({ runStatus: b }),
3123
+ options: Vn.map((b) => ({ value: b, label: Le(b) })),
3124
+ style: { width: 120 }
3125
+ }
3126
+ ),
3127
+ /* @__PURE__ */ l("span", { className: "ox-total", children: [
3128
+ "共 ",
3129
+ a.total,
3130
+ " 个任务"
3131
+ ] })
3132
+ ] }),
3133
+ /* @__PURE__ */ t("div", { className: "ox-table-wrap", children: /* @__PURE__ */ t(
3134
+ En,
3135
+ {
3136
+ records: a.records,
3137
+ loading: a.loading,
3138
+ onOpen: (b) => T(b.code),
3139
+ onOpenDraft: (b) => $({ initial: { taskCode: b.code } }),
3140
+ onOpenSession: g
3141
+ }
3142
+ ) }),
3143
+ /* @__PURE__ */ t("div", { className: "ox-pagination", children: /* @__PURE__ */ t(
3144
+ ye,
3145
+ {
3146
+ size: "small",
3147
+ current: a.pagination.current,
3148
+ pageSize: a.pagination.size,
3149
+ total: a.total,
3150
+ showSizeChanger: !0,
3151
+ showTotal: (b) => `共 ${b} 条`,
3152
+ onChange: (b, W) => a.updatePagination(b, W)
3153
+ }
3154
+ ) }),
3155
+ /* @__PURE__ */ t(
3156
+ Qe,
3157
+ {
3158
+ open: v || !!f,
3159
+ task: f,
3160
+ onClose: () => {
3161
+ N(!1), g(void 0);
3162
+ },
3163
+ onChanged: a.reload
3164
+ }
3165
+ ),
3166
+ /* @__PURE__ */ t(
3167
+ _n,
3168
+ {
3169
+ code: c,
3170
+ onClose: () => T(void 0),
3171
+ onChanged: a.reload,
3172
+ onOpenDraft: (b) => {
3173
+ T(void 0), $({ initial: { taskCode: b.taskCode }, initialRef: b });
3174
+ }
3175
+ }
3176
+ ),
3177
+ /* @__PURE__ */ t(
3178
+ kn,
3179
+ {
3180
+ open: !!S,
3181
+ onClose: () => $(void 0),
3182
+ version: o.version,
3183
+ initial: S == null ? void 0 : S.initial,
3184
+ initialRef: S == null ? void 0 : S.initialRef,
3185
+ manageable: s,
3186
+ onOpenReview: m ? () => {
3187
+ $(void 0), m();
3188
+ } : void 0,
3189
+ onChanged: () => {
3190
+ y(), a.reload();
3191
+ }
3192
+ }
3193
+ ),
3194
+ /* @__PURE__ */ t(Ke, { open: A, onClose: () => h(!1) })
3195
+ ] });
3196
+ }
3197
+ export {
3198
+ wr as default
3199
+ };