@customize-agent/server 4.60.34 → 4.60.36

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 (341) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +197 -297
  3. package/.next/prerender-manifest.json +3 -3
  4. package/.next/required-server-files.json +3 -7
  5. package/.next/routes-manifest.json +19 -30
  6. package/.next/server/chunks/{8645.js → 1026.js} +1 -1
  7. package/.next/server/chunks/1146.js +1 -0
  8. package/.next/server/chunks/1547.js +385 -0
  9. package/.next/server/chunks/3074.js +1 -0
  10. package/.next/server/chunks/3750.js +2 -0
  11. package/.next/server/chunks/407.js +1 -0
  12. package/.next/server/chunks/5037.js +46 -0
  13. package/.next/server/chunks/5304.js +2 -2
  14. package/.next/server/chunks/5599.js +1 -0
  15. package/.next/server/chunks/5763.js +159 -0
  16. package/.next/server/chunks/6138.js +5 -0
  17. package/.next/server/chunks/6355.js +1 -0
  18. package/.next/server/chunks/6822.js +1 -1
  19. package/.next/server/chunks/702.js +3 -0
  20. package/.next/server/chunks/7296.js +1 -0
  21. package/.next/server/chunks/8176.js +1 -0
  22. package/.next/server/chunks/8204.js +1 -1
  23. package/.next/server/chunks/8459.js +11 -0
  24. package/.next/server/chunks/8570.js +1 -0
  25. package/.next/server/chunks/9270.js +1 -0
  26. package/.next/server/chunks/9283.js +7 -0
  27. package/.next/server/chunks/9301.js +2 -2
  28. package/.next/server/chunks/9522.js +5 -0
  29. package/.next/server/chunks/9559.js +1 -0
  30. package/.next/server/chunks/9688.js +10 -0
  31. package/.next/server/middleware-build-manifest.js +1 -1
  32. package/.next/server/pages/404.html +1 -1
  33. package/.next/server/pages/500.html +1 -1
  34. package/.next/server/pages/_app.js +1 -1
  35. package/.next/server/pages/_app.js.nft.json +1 -1
  36. package/.next/server/pages/_document.js +1 -1
  37. package/.next/server/pages/_document.js.nft.json +1 -1
  38. package/.next/server/pages/_error.js +1 -1
  39. package/.next/server/pages/_error.js.nft.json +1 -1
  40. package/.next/server/pages/api/assets/generated/preview.js +2 -1
  41. package/.next/server/pages/api/assets/generated/preview.js.nft.json +1 -1
  42. package/.next/server/pages/api/assets/generated.js +2 -1
  43. package/.next/server/pages/api/assets/generated.js.nft.json +1 -1
  44. package/.next/server/pages/api/config/embedding/healthCheck.js +2 -3
  45. package/.next/server/pages/api/config/embedding/healthCheck.js.nft.json +1 -1
  46. package/.next/server/pages/api/config/embedding.js +2 -3
  47. package/.next/server/pages/api/config/embedding.js.nft.json +1 -1
  48. package/.next/server/pages/api/config/healthCheck.js +2 -3
  49. package/.next/server/pages/api/config/healthCheck.js.nft.json +1 -1
  50. package/.next/server/pages/api/config/models.js +2 -3
  51. package/.next/server/pages/api/config/models.js.nft.json +1 -1
  52. package/.next/server/pages/api/config/providers/[provider].js +2 -3
  53. package/.next/server/pages/api/config/providers/[provider].js.nft.json +1 -1
  54. package/.next/server/pages/api/config/providers.js +2 -3
  55. package/.next/server/pages/api/config/providers.js.nft.json +1 -1
  56. package/.next/server/pages/api/config/reset.js +2 -3
  57. package/.next/server/pages/api/config/reset.js.nft.json +1 -1
  58. package/.next/server/pages/api/config/web-access.js +2 -3
  59. package/.next/server/pages/api/config/web-access.js.nft.json +1 -1
  60. package/.next/server/pages/api/documents/canvas/[id].js +2 -1
  61. package/.next/server/pages/api/documents/canvas/[id].js.nft.json +1 -1
  62. package/.next/server/pages/api/documents/delivery-review.js +2 -0
  63. package/.next/server/pages/api/documents/delivery-review.js.nft.json +1 -0
  64. package/.next/server/pages/api/documents/export.js +5 -2
  65. package/.next/server/pages/api/documents/export.js.nft.json +1 -1
  66. package/.next/server/pages/api/documents/generate/preview.js +6 -1
  67. package/.next/server/pages/api/documents/generate/preview.js.nft.json +1 -1
  68. package/.next/server/pages/api/documents/generate.js +2 -1
  69. package/.next/server/pages/api/documents/generate.js.nft.json +1 -1
  70. package/.next/server/pages/api/documents/generated/[id]/events.js +4 -3
  71. package/.next/server/pages/api/documents/generated/[id]/events.js.nft.json +1 -1
  72. package/.next/server/pages/api/documents/generated/[id]/figure/[name].js +2 -1
  73. package/.next/server/pages/api/documents/generated/[id]/figure/[name].js.nft.json +1 -1
  74. package/.next/server/pages/api/documents/generated/[id]/instruction.js +4 -2
  75. package/.next/server/pages/api/documents/generated/[id]/instruction.js.nft.json +1 -1
  76. package/.next/server/pages/api/documents/generated/[id]/messages.js +2 -0
  77. package/.next/server/pages/api/documents/generated/[id]/messages.js.nft.json +1 -0
  78. package/.next/server/pages/api/documents/generated/[id]/nodes/[nodeId].js +2 -1
  79. package/.next/server/pages/api/documents/generated/[id]/nodes/[nodeId].js.nft.json +1 -1
  80. package/.next/server/pages/api/documents/generated/[id]/nodes.js +2 -1
  81. package/.next/server/pages/api/documents/generated/[id]/nodes.js.nft.json +1 -1
  82. package/.next/server/pages/api/documents/generated/[id]/pause.js +2 -1
  83. package/.next/server/pages/api/documents/generated/[id]/pause.js.nft.json +1 -1
  84. package/.next/server/pages/api/documents/generated/[id]/preview.js +2 -1
  85. package/.next/server/pages/api/documents/generated/[id]/preview.js.nft.json +1 -1
  86. package/.next/server/pages/api/documents/generated/[id]/repair/[rid]/confirm.js +2 -1
  87. package/.next/server/pages/api/documents/generated/[id]/repair/[rid]/confirm.js.nft.json +1 -1
  88. package/.next/server/pages/api/documents/generated/[id]/repair/[rid]/rollback.js +2 -1
  89. package/.next/server/pages/api/documents/generated/[id]/repair/[rid]/rollback.js.nft.json +1 -1
  90. package/.next/server/pages/api/documents/generated/[id]/repair.js +2 -1
  91. package/.next/server/pages/api/documents/generated/[id]/repair.js.nft.json +1 -1
  92. package/.next/server/pages/api/documents/generated/[id]/report.js +2 -1
  93. package/.next/server/pages/api/documents/generated/[id]/report.js.nft.json +1 -1
  94. package/.next/server/pages/api/documents/generated/[id]/resume-generate.js +2 -1
  95. package/.next/server/pages/api/documents/generated/[id]/resume-generate.js.nft.json +1 -1
  96. package/.next/server/pages/api/documents/generated/[id].js +2 -1
  97. package/.next/server/pages/api/documents/generated/[id].js.nft.json +1 -1
  98. package/.next/server/pages/api/documents/generated.js +2 -1
  99. package/.next/server/pages/api/documents/generated.js.nft.json +1 -1
  100. package/.next/server/pages/api/health.js +1 -1
  101. package/.next/server/pages/api/health.js.nft.json +1 -1
  102. package/.next/server/pages/api/jobs/[id].js +2 -2
  103. package/.next/server/pages/api/jobs/[id].js.nft.json +1 -1
  104. package/.next/server/pages/api/kb/categories.js +2 -1
  105. package/.next/server/pages/api/kb/categories.js.nft.json +1 -1
  106. package/.next/server/pages/api/kb/duplicates.js +2 -1
  107. package/.next/server/pages/api/kb/duplicates.js.nft.json +1 -1
  108. package/.next/server/pages/api/kb/features.js +2 -3
  109. package/.next/server/pages/api/kb/features.js.nft.json +1 -1
  110. package/.next/server/pages/api/kb/files/detail.js +2 -1
  111. package/.next/server/pages/api/kb/files/detail.js.nft.json +1 -1
  112. package/.next/server/pages/api/kb/files/export.js +2 -1
  113. package/.next/server/pages/api/kb/files/export.js.nft.json +1 -1
  114. package/.next/server/pages/api/kb/files/open.js +2 -1
  115. package/.next/server/pages/api/kb/files/open.js.nft.json +1 -1
  116. package/.next/server/pages/api/kb/files/preview-pdf-page.js +2 -1
  117. package/.next/server/pages/api/kb/files/preview-pdf-page.js.nft.json +1 -1
  118. package/.next/server/pages/api/kb/files/reindex.js +1 -2
  119. package/.next/server/pages/api/kb/files/reindex.js.nft.json +1 -1
  120. package/.next/server/pages/api/kb/files/search.js +2 -1
  121. package/.next/server/pages/api/kb/files/search.js.nft.json +1 -1
  122. package/.next/server/pages/api/kb/files/source-preview.js +2 -1
  123. package/.next/server/pages/api/kb/files/source-preview.js.nft.json +1 -1
  124. package/.next/server/pages/api/kb/files.js +2 -2
  125. package/.next/server/pages/api/kb/files.js.nft.json +1 -1
  126. package/.next/server/pages/api/kb/ignore.js +2 -1
  127. package/.next/server/pages/api/kb/ignore.js.nft.json +1 -1
  128. package/.next/server/pages/api/kb/material-groups.js +2 -1
  129. package/.next/server/pages/api/kb/material-groups.js.nft.json +1 -1
  130. package/.next/server/pages/api/kb/operations.js +2 -2
  131. package/.next/server/pages/api/kb/operations.js.nft.json +1 -1
  132. package/.next/server/pages/api/kb/reindex.js +1 -2
  133. package/.next/server/pages/api/kb/reindex.js.nft.json +1 -1
  134. package/.next/server/pages/api/kb/stats.js +2 -1
  135. package/.next/server/pages/api/kb/stats.js.nft.json +1 -1
  136. package/.next/server/pages/api/kb/tags.js +2 -1
  137. package/.next/server/pages/api/kb/tags.js.nft.json +1 -1
  138. package/.next/server/pages/api/kb/upload/complete.js +1 -2
  139. package/.next/server/pages/api/kb/upload/complete.js.nft.json +1 -1
  140. package/.next/server/pages/api/kb/upload.js +1 -2
  141. package/.next/server/pages/api/kb/upload.js.nft.json +1 -1
  142. package/.next/server/pages/api/prompt/chat.js +3 -4
  143. package/.next/server/pages/api/prompt/chat.js.nft.json +1 -1
  144. package/.next/server/pages/api/skills/[id].js +2 -1
  145. package/.next/server/pages/api/skills/[id].js.nft.json +1 -1
  146. package/.next/server/pages/api/skills/validate.js +2 -1
  147. package/.next/server/pages/api/skills/validate.js.nft.json +1 -1
  148. package/.next/server/pages/api/skills.js +2 -1
  149. package/.next/server/pages/api/skills.js.nft.json +1 -1
  150. package/.next/server/pages/api/system/data-health.js +2 -2
  151. package/.next/server/pages/api/system/data-health.js.nft.json +1 -1
  152. package/.next/server/pages/api/system/reset.js +1 -1
  153. package/.next/server/pages/api/system/reset.js.nft.json +1 -1
  154. package/.next/server/pages/documents.html +1 -1
  155. package/.next/server/pages/documents.js.nft.json +1 -1
  156. package/.next/server/pages/generation/[id].html +1 -0
  157. package/.next/server/pages/generation/[id].js.nft.json +1 -0
  158. package/.next/server/pages/generation.html +1 -0
  159. package/.next/server/pages/generation.js.nft.json +1 -0
  160. package/.next/server/pages/index.js +1 -0
  161. package/.next/server/pages/index.js.nft.json +1 -1
  162. package/.next/server/pages/jobs.html +1 -1
  163. package/.next/server/pages/jobs.js.nft.json +1 -1
  164. package/.next/server/pages/knowledge/file-detail.html +1 -1
  165. package/.next/server/pages/knowledge/file-detail.js.nft.json +1 -1
  166. package/.next/server/pages/knowledge/files.html +1 -1
  167. package/.next/server/pages/knowledge/files.js.nft.json +1 -1
  168. package/.next/server/pages/knowledge/manage.html +1 -1
  169. package/.next/server/pages/knowledge/manage.js.nft.json +1 -1
  170. package/.next/server/pages/knowledge/source-preview.html +1 -1
  171. package/.next/server/pages/knowledge/source-preview.js.nft.json +1 -1
  172. package/.next/server/pages/knowledge.html +1 -1
  173. package/.next/server/pages/knowledge.js.nft.json +1 -1
  174. package/.next/server/pages/models.html +1 -1
  175. package/.next/server/pages/models.js.nft.json +1 -1
  176. package/.next/server/pages/settings.html +1 -1
  177. package/.next/server/pages/settings.js.nft.json +1 -1
  178. package/.next/server/pages/skills/[id]/edit.html +1 -1
  179. package/.next/server/pages/skills/[id]/edit.js.nft.json +1 -1
  180. package/.next/server/pages/skills/[id].html +1 -1
  181. package/.next/server/pages/skills/[id].js.nft.json +1 -1
  182. package/.next/server/pages/skills/new.html +1 -1
  183. package/.next/server/pages/skills/new.js.nft.json +1 -1
  184. package/.next/server/pages/skills.html +1 -1
  185. package/.next/server/pages/skills.js.nft.json +1 -1
  186. package/.next/server/pages-manifest.json +35 -40
  187. package/.next/static/chunks/112-9eacc7c0686813d6.js +1 -0
  188. package/.next/static/chunks/127-5ee1899eef559281.js +1 -0
  189. package/.next/static/chunks/{1210-703ad87eaeee1e4e.js → 210-71eaf9de9aa92051.js} +1 -1
  190. package/.next/static/chunks/325-45106bb003a2c5ce.js +4 -0
  191. package/.next/static/chunks/326-a3915e61888b0dbf.js +1 -0
  192. package/.next/static/chunks/333-7642e65bff6b8465.js +1 -0
  193. package/.next/static/chunks/338-19ccbaec57a7bf9c.js +4 -0
  194. package/.next/static/chunks/350-87b9c900a356d9b9.js +1 -0
  195. package/.next/static/chunks/359-f87c659236e0e0fe.js +1 -0
  196. package/.next/static/chunks/{8399-a001bb2a0cb1640b.js → 399-aa8a45d80e989621.js} +1 -1
  197. package/.next/static/chunks/430-f288e16301b9aea5.js +1 -0
  198. package/.next/static/chunks/465-80fbb245d43232c8.js +6 -0
  199. package/.next/static/chunks/499-2233cadc6d4da647.js +10 -0
  200. package/.next/static/chunks/551-fd86e95935b0957f.js +16 -0
  201. package/.next/static/chunks/576-6699fed6c88502fe.js +1 -0
  202. package/.next/static/chunks/61-de1dd9c104680470.js +1 -0
  203. package/.next/static/chunks/665-0634aa49137defc4.js +1 -0
  204. package/.next/static/chunks/681-e31b13114497e058.js +1 -0
  205. package/.next/static/chunks/687-644a12a5b584e19f.js +1 -0
  206. package/.next/static/chunks/702-4d9cc8d4d7775ea9.js +1 -0
  207. package/.next/static/chunks/748-9e5bf4181d7482f3.js +1 -0
  208. package/.next/static/chunks/759-280cf4040fae83af.js +25 -0
  209. package/.next/static/chunks/855-cbf7cd1db33198f0.js +17 -0
  210. package/.next/static/chunks/862-13d1c84d0938b824.js +1 -0
  211. package/.next/static/chunks/937-ccd3ceb1b3739535.js +1 -0
  212. package/.next/static/chunks/{8964-e959915ecfae86b2.js → 964-82cc4701f08f7351.js} +1 -1
  213. package/.next/static/chunks/992-8032f477230baaaf.js +1 -0
  214. package/.next/static/chunks/framework-4b565b3ddc94cdac.js +1 -0
  215. package/.next/static/chunks/main-0c91f573696223ca.js +1 -0
  216. package/.next/static/chunks/pages/_app-a70de062f1be1c59.js +140 -0
  217. package/.next/static/chunks/pages/_error-282257fbdcc167b4.js +1 -0
  218. package/.next/static/chunks/pages/documents-2d99ae9287f9739b.js +1 -0
  219. package/.next/static/chunks/pages/generation/[id]-1f97e47ce545bd11.js +1 -0
  220. package/.next/static/chunks/pages/generation-043e325d635c96af.js +1 -0
  221. package/.next/static/chunks/pages/index-24d1f8f39ae0beb0.js +1 -0
  222. package/.next/static/chunks/pages/jobs-ff2f899a081b616e.js +1 -0
  223. package/.next/static/chunks/pages/knowledge/file-detail-9a9a89e4fa33c0d9.js +1 -0
  224. package/.next/static/chunks/pages/knowledge/files-b3ef5324e4b74c4a.js +1 -0
  225. package/.next/static/chunks/pages/knowledge/manage-d9eaebf3a8307953.js +1 -0
  226. package/.next/static/chunks/pages/knowledge/{source-preview-24936b9a746ed07f.js → source-preview-f000b4d63cd65a54.js} +1 -1
  227. package/.next/static/chunks/pages/knowledge-8fa842d21892e2c3.js +1 -0
  228. package/.next/static/chunks/pages/models-6d9b301009f82395.js +1 -0
  229. package/.next/static/chunks/pages/settings-08893ba8afa1a486.js +1 -0
  230. package/.next/static/chunks/pages/skills/[id]/edit-378249e662ebf31f.js +1 -0
  231. package/.next/static/chunks/pages/skills/[id]-0ca4cde22e4a518b.js +1 -0
  232. package/.next/static/chunks/pages/skills/new-c1eb16d98fad4e02.js +1 -0
  233. package/.next/static/chunks/pages/skills-9fb1fa2b669ad4e3.js +1 -0
  234. package/.next/static/chunks/{webpack-2da1769ff35eb1ed.js → webpack-6224d37324e372cb.js} +1 -1
  235. package/.next/static/css/1f6d2a1bf5e15e0f.css +1 -0
  236. package/.next/static/css/b420c193e0e99857.css +1 -0
  237. package/.next/static/e5c2576dc1ab66edac22c9534755509cc2e1354bd840260e3154f2c95cf8bbf2/_buildManifest.js +1 -0
  238. package/README.md +14 -4
  239. package/messages/en-US.json +46 -100
  240. package/messages/zh-CN.json +44 -98
  241. package/next.config.ts +6 -5
  242. package/package.json +5 -6
  243. package/scripts/build-identity.cjs +16 -5
  244. package/scripts/check-workspace-deps.cjs +3 -3
  245. package/scripts/purge-next-artifacts.cjs +8 -5
  246. package/scripts/upload-matrix.cjs +1 -2
  247. package/scripts/verify-next-static.js +1 -1
  248. package/.next/server/chunks/1001.js +0 -2
  249. package/.next/server/chunks/1243.js +0 -3
  250. package/.next/server/chunks/1928.js +0 -1
  251. package/.next/server/chunks/1936.js +0 -385
  252. package/.next/server/chunks/2328.js +0 -6
  253. package/.next/server/chunks/2434.js +0 -4
  254. package/.next/server/chunks/3806.js +0 -1
  255. package/.next/server/chunks/4974.js +0 -2
  256. package/.next/server/chunks/5746.js +0 -5
  257. package/.next/server/chunks/6321.js +0 -1
  258. package/.next/server/chunks/7848.js +0 -145
  259. package/.next/server/chunks/9666.js +0 -146
  260. package/.next/server/instrumentation.js +0 -1
  261. package/.next/server/instrumentation.js.nft.json +0 -1
  262. package/.next/server/pages/api/prompt.js +0 -2
  263. package/.next/server/pages/api/prompt.js.nft.json +0 -1
  264. package/.next/server/pages/api/system/logs.js +0 -2
  265. package/.next/server/pages/api/system/logs.js.nft.json +0 -1
  266. package/.next/server/pages/api/system/stats.js +0 -2
  267. package/.next/server/pages/api/system/stats.js.nft.json +0 -1
  268. package/.next/server/pages/canvas/[id].html +0 -1
  269. package/.next/server/pages/canvas/[id].js.nft.json +0 -1
  270. package/.next/server/pages/canvas.html +0 -1
  271. package/.next/server/pages/canvas.js.nft.json +0 -1
  272. package/.next/server/pages/guide.html +0 -1
  273. package/.next/server/pages/guide.js.nft.json +0 -1
  274. package/.next/server/pages/index.html +0 -1
  275. package/.next/server/pages/overview.html +0 -1
  276. package/.next/server/pages/overview.js.nft.json +0 -1
  277. package/.next/server/pages/prompt.html +0 -1
  278. package/.next/server/pages/prompt.js.nft.json +0 -1
  279. package/.next/server/pages/system/logs.html +0 -1
  280. package/.next/server/pages/system/logs.js.nft.json +0 -1
  281. package/.next/static/0e37797d2ec62d17ca5f253c10b385fa939228f353538722f095755edce292af/_buildManifest.js +0 -1
  282. package/.next/static/chunks/1141-d420a7685bc3623c.js +0 -1
  283. package/.next/static/chunks/1499-ff8f02f6bb6f3d45.js +0 -10
  284. package/.next/static/chunks/1702-f5e99af7aface475.js +0 -1
  285. package/.next/static/chunks/2864-b040f2bffa08c139.js +0 -6
  286. package/.next/static/chunks/3456-70bb03a39473f693.js +0 -1
  287. package/.next/static/chunks/3980-73841c40d55ddfa1.js +0 -1
  288. package/.next/static/chunks/4052-199e61ca9e6a33e7.js +0 -1
  289. package/.next/static/chunks/4337-a670a1a94ab505d9.js +0 -1
  290. package/.next/static/chunks/4530-8b9788da40548ec6.js +0 -1
  291. package/.next/static/chunks/4565-3c5ff667062ccec9.js +0 -21
  292. package/.next/static/chunks/4665-1984a3d8b0573fa1.js +0 -1
  293. package/.next/static/chunks/5061-80765d4a612286e0.js +0 -1
  294. package/.next/static/chunks/5544-d77b8289662b4c28.js +0 -4
  295. package/.next/static/chunks/5760-f4191aac081b12d4.js +0 -11
  296. package/.next/static/chunks/6409-5a3bb0fbad4f64b1.js +0 -14
  297. package/.next/static/chunks/6506-ac0ba7338cc84b7d.js +0 -1
  298. package/.next/static/chunks/6748-07b0b05bf03c72f0.js +0 -1
  299. package/.next/static/chunks/7217-416b8488e0d2d498.js +0 -1
  300. package/.next/static/chunks/7576-ba6fc03060415b0e.js +0 -1
  301. package/.next/static/chunks/7646-159733564c7eb8dc.js +0 -1
  302. package/.next/static/chunks/7795-c11ff1a81c67c5aa.js +0 -1
  303. package/.next/static/chunks/8318-cb3a94de1617f983.js +0 -1
  304. package/.next/static/chunks/8338-b2ea00050048ba9f.js +0 -4
  305. package/.next/static/chunks/8564-ac3e2f1bf87765b3.js +0 -1
  306. package/.next/static/chunks/8569-1d5c61a3f4fa0e26.js +0 -16
  307. package/.next/static/chunks/8715-ee013bd7f5ba38e8.js +0 -1
  308. package/.next/static/chunks/8750-a3c55a576effb3a6.js +0 -1
  309. package/.next/static/chunks/8787-49b1f35eb4acfac9.js +0 -10
  310. package/.next/static/chunks/9551-f4b09bf2213ad571.js +0 -16
  311. package/.next/static/chunks/9605-3dee531f8a7ecbe0.js +0 -4
  312. package/.next/static/chunks/9937-e4b2deadd24e3962.js +0 -1
  313. package/.next/static/chunks/framework-9cde5013cd555765.js +0 -1
  314. package/.next/static/chunks/main-b313efde54fa6d2e.js +0 -1
  315. package/.next/static/chunks/pages/_app-51c48c5efcf5c721.js +0 -140
  316. package/.next/static/chunks/pages/_error-c01b6fb772028676.js +0 -1
  317. package/.next/static/chunks/pages/canvas/[id]-18865f1b7e3a4696.js +0 -1
  318. package/.next/static/chunks/pages/canvas-1d3589790493e955.js +0 -1
  319. package/.next/static/chunks/pages/documents-a1af5c6be26daed2.js +0 -1
  320. package/.next/static/chunks/pages/guide-fdf0822dc1d28813.js +0 -1
  321. package/.next/static/chunks/pages/index-c572e9caa60cb278.js +0 -1
  322. package/.next/static/chunks/pages/jobs-ebd1877dbf788a83.js +0 -1
  323. package/.next/static/chunks/pages/knowledge/file-detail-3d1ffd43f4f0e47b.js +0 -1
  324. package/.next/static/chunks/pages/knowledge/files-b796702bb5f8ac50.js +0 -1
  325. package/.next/static/chunks/pages/knowledge/manage-6d7b21cdca1255f2.js +0 -1
  326. package/.next/static/chunks/pages/knowledge-2a776c1740386874.js +0 -1
  327. package/.next/static/chunks/pages/models-8a89dd5bf0f81242.js +0 -1
  328. package/.next/static/chunks/pages/overview-7e8018014009682e.js +0 -1
  329. package/.next/static/chunks/pages/prompt-11f87694feb6514c.js +0 -1
  330. package/.next/static/chunks/pages/settings-e8dcaba1551a0b2b.js +0 -1
  331. package/.next/static/chunks/pages/skills/[id]/edit-99e616d5019e80b1.js +0 -1
  332. package/.next/static/chunks/pages/skills/[id]-71f696be252bbf0d.js +0 -1
  333. package/.next/static/chunks/pages/skills/new-00886ea4c676f927.js +0 -1
  334. package/.next/static/chunks/pages/skills-8ad2577b4aa17f3b.js +0 -1
  335. package/.next/static/chunks/pages/system/logs-0856f7c65432befb.js +0 -1
  336. package/.next/static/css/2da1c822e3bdb4bb.css +0 -1
  337. package/.next/static/css/9eb02c1a401fd278.css +0 -1
  338. package/scripts/half-built-scan.allow.json +0 -152
  339. package/scripts/half-built-scan.baseline.json +0 -190
  340. package/scripts/half-built-scan.mjs +0 -287
  341. /package/.next/static/{0e37797d2ec62d17ca5f253c10b385fa939228f353538722f095755edce292af → e5c2576dc1ab66edac22c9534755509cc2e1354bd840260e3154f2c95cf8bbf2}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[731],{5122:(_,n,e)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/_error",function(){return e(75599)}])}},_=>{_.O(0,[636,593,792],()=>_(_.s=5122)),_N_E=_.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[298],{16403:(e,o,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/documents",function(){return t(19562)}])},19562:(e,o,t)=>{"use strict";t.r(o),t.d(o,{default:()=>c});var n=t(97109),r=t(86109);function c(){let e=(0,r.useRouter)(),o="string"==typeof e.query.id?e.query.id:"",t="string"==typeof e.query.projectRoot?e.query.projectRoot:"";return(0,n.useEffect)(()=>{e.isReady&&e.replace(o?"/generation/".concat(encodeURIComponent(o)).concat(t?"?projectRoot=".concat(encodeURIComponent(t)):""):"/generation")},[o,t,e,e.isReady]),null}}},e=>{e.O(0,[636,593,792],()=>e(e.s=16403)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[200],{70130:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/generation/[id]",function(){return r(74024)}])},74024:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>e1});var n=r(65321),s=r(97109),l=r(3454),a=r.n(l),i=r(43220),o=r.n(i),c=r(86109),d=r(48399),u=r(17807),p=r(42700),m=r(32941),g=r(33442),h=r(85114),f=r(14932),x=r(99811),v=r(82930),y=r(45042),j=r(6578),b=r(48702),w=r(93533),k=r(11702),A=r(85493),N=r(84662),S=r(30486),C=r(4527),R=r(80042),I=r(99650),E=r(25345),T=r(7851),P=r(33555),M=r(23216),D=r(49075),L=r(43240),q=r(26619),_=r(46791),z=r(8579),B=r(26631),F=r(35459),W=r(64629),U=r(76824),H=r(83374),$=r(81668),O=r(39356),Q=r(8263),G=r(61024),X=r(32919),V=r(96538);let K=["failed","paused","repairing","blocked","running","pending","completed"],Z=["chars","costUsd"];function J(e,t){return e.seq!==t.seq?e.seq-t.seq:e.id===t.id?0:e.id<t.id?-1:1}function Y(e){let t=new Map;for(let r of e){if(void 0===r.parentId)continue;let e=t.get(r.parentId);e?e.push(r):t.set(r.parentId,[r])}for(let e of t.values())e.sort(J);return t}function ee(e){let t=new Map(e.map(e=>[e.id,e])),r=new Map;for(let n of e){let e=0,s=n,l=new Set([n.id]);for(;(null==s?void 0:s.parentId)!==void 0;){let r=t.get(s.parentId);if(!r||l.has(r.id))break;l.add(r.id),e+=1,s=r}r.set(n.id,e)}return r}let et=["responsibility","purpose","round","round.decide","round.fix","decision","chapter","repair.request","repair.localize","repair.impact","repair.transaction","repair.recheck","supervisor","resume.plan","skill.load"],er=new Set([...et,"prepare","understand","plan","blueprint","write","close","deliver","block","turn"]);[...et];let en=new Set(["failed","paused","repairing","blocked","running","pending","completed"]);var es=r(2181);let el={pending:{key:"common.statusWaiting",text:"等待中",color:"default"},running:{key:"common.statusRunning",text:es.Uu.running,color:"processing"},completed:{key:"common.statusCompleted",text:es.Uu.success,color:"success"},paused:{key:"common.statusPaused",text:"已暂停",color:"gold"},repairing:{key:"common.statusRepairing",text:"修复中",color:"warning"},blocked:{key:"common.statusBlocked",text:"已放弃(阻塞)",color:"warning"},failed:{key:"common.statusAbnormal",text:"异常",color:"error"}};function ea(e,t,r,n){let s=e[t];if(!s)return"未知".concat(r,"(").concat(t||"空",")");if(s.key&&n){let e=n(s.key);if(e&&e!==s.key)return e}return s.text}function ei(e,t){return ea(el,e,"状态",t)}let eo={queued:{key:"common.statusWaiting",text:"排队中",color:"default"},generating:{key:"common.statusRunning",text:"生成中",color:"processing"},paused:{key:"common.statusPaused",text:"已暂停",color:"gold"},completed:{key:"common.statusCompleted",text:"已完成",color:"success"},completed_with_issues:{key:"common.statusReview",text:"完成(有需复核项)",color:"warning"},warning:{key:"common.statusReview",text:"需复核",color:"warning"},failed:{key:"common.statusAbnormal",text:"失败",color:"error"},aborted:{key:"common.statusAbnormal",text:"已中止",color:"default"}},ec={responsibility:"职责",purpose:"目的",decision:"已生效决定",prepare:"生成准备",understand:"资料理解",plan:"规划",blueprint:"蓝图",write:"正文撰写",close:"收口",deliver:"交付",chapter:"章节",block:"块",turn:"轮次",round:"收口轮","round.decide":"收口\xb7判定","round.fix":"收口\xb7修复","repair.request":"修复\xb7请求","repair.localize":"修复\xb7定位","repair.impact":"修复\xb7影响面","repair.transaction":"修复\xb7事务","repair.recheck":"修复\xb7复检","skill.load":"技能命中",supervisor:"调度决策","resume.plan":"续跑任务书"},ed={role_binding:(0,s.createElement)(N.A),knowledge_retrieval:(0,s.createElement)(S.A),file_understanding:(0,s.createElement)(C.A),fact_extraction:(0,s.createElement)(R.A),chapter_generation:(0,s.createElement)(I.A),llm_review:(0,s.createElement)(E.A),validation:(0,s.createElement)(T.A),reference:(0,s.createElement)(P.A),responsibility:(0,s.createElement)(M.A),purpose:(0,s.createElement)(D.A),decision:(0,s.createElement)(T.A),prepare:(0,s.createElement)(L.A),understand:(0,s.createElement)(q.A),plan:(0,s.createElement)(M.A),blueprint:(0,s.createElement)(_.A),write:(0,s.createElement)(z.A),chapter:(0,s.createElement)(B.A),block:(0,s.createElement)(F.A),turn:(0,s.createElement)(W.A),round:(0,s.createElement)(U.A),close:(0,s.createElement)(H.A),deliver:(0,s.createElement)($.A),repair:(0,s.createElement)(O.A),skill:(0,s.createElement)(Q.A),supervisor:(0,s.createElement)(G.A),resume:(0,s.createElement)(X.A),default:(0,s.createElement)(L.A)};function eu(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:160,r=e.replace(/^\s*#{1,6}\s*/u,"").replace(/\s+/gu," ").trim();return r.length>t?"".concat(r.slice(0,t),"…"):r}function ep(e){var t,r;let n=e.issues;return{id:e.id,...void 0!==e.parentId?{parentId:e.parentId}:{},type:e.type||"block",title:null!=(t=e.title)?t:"",seq:"number"==typeof e.seq&&Number.isFinite(e.seq)?e.seq:0,status:"string"==typeof(r=e.status)&&en.has(r)?e.status:"failed",startedAt:"number"==typeof e.startedAt&&Number.isFinite(e.startedAt)&&e.startedAt>0?e.startedAt:0,...void 0!==e.completedAt?{completedAt:e.completedAt}:{},...e.progress?{progress:e.progress}:{},...e.metrics?{metrics:e.metrics}:{},...Array.isArray(n)&&n.length>0?{issues:n}:{},...void 0!==e.payloadRef?{payloadRef:e.payloadRef}:{}}}function em(e){var t;if("number"!=typeof e.startedAt||(null==(t=e.metrics)?void 0:t.instantEvent)===!0)return;let r=("number"==typeof e.completedAt?e.completedAt:Date.now())-e.startedAt;return r>=0?r:void 0}function eg(e){return void 0===e?"—":(0,V.a)(e,{unit:"ms",style:"fine"})}function eh(e){let{readings:t}=e,r=null==t?void 0:t.contractQuality;if(!r)return null;let s=r.score,l=null==t?void 0:t.contractQualityStale;return Array.isArray(s.defects)?(0,n.jsxs)("div",{"aria-label":"七维评价",style:{fontSize:12,lineHeight:1.8},children:[(0,n.jsx)("strong",{children:l?"编辑前的历史七维诊断":"七维专业诊断"}),(0,n.jsxs)("span",{children:[";",l?"当前正文须重新评价":s.deliveryReady?"适用职责核验满足,待专业验收":"仍有缺陷或待核事项"]}),(0,n.jsxs)("div",{children:["阻断 ",s.blocking.length," 项;按根因归并的问题 ",s.defects.length," 项。专业档位不换算为未经标定的百分分数。"]}),l&&(0,n.jsx)("div",{children:l.reason}),(0,n.jsxs)("details",{children:[(0,n.jsx)("summary",{children:"查看七个维度"}),(0,n.jsxs)("table",{style:{width:"100%"},children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{children:"维度"}),(0,n.jsx)("th",{children:"质量档位"}),(0,n.jsx)("th",{children:"满足 / 未满足 / 未判定"})]})}),(0,n.jsx)("tbody",{children:s.dimensions.map(e=>(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{children:e.label}),(0,n.jsx)("td",{children:"not-applicable"===e.status?"不适用":e.qualityLabel}),(0,n.jsxs)("td",{children:[e.verification.met," / ",e.verification.failed," / ",e.verification.unmeasured]})]},e.id))})]}),(0,n.jsx)("div",{children:r.expertValidated?"已完成专家校准。":"尚未完成专家校准。"})]})]}):(0,n.jsx)("div",{role:"status",children:"历史评价回执保留;按当前专业诊断口径重新评价后显示核验与质量档位。"})}let{Paragraph:ef,Text:ex}=d.A,ev={"out-of-scope":"本次范围外",untracked:"未建立轨道",planned:"已建立轨道","section-planned":"已规划小节",drafting:"写作中",reviewing:"审查中",resolved:"已收口",blocked:"阻塞",locked:"已锁定"};function ey(e){return new Date(e).toLocaleString()}function ej(e){var t,r;let{status:s,title:l,html:a,source:i,truncated:o,totalChars:c,renderedChars:d,stats:u,gate:m,loading:f,error:x,onRetry:v,updatedAt:y,generatedAt:j,className:b,t:w,deliveryReadings:N,sectionProgress:S,budgetPause:C}=e,R=null!=a?a:"",I=R.trim().length>0,E=u?function(e){let t=[];return e.droppedDangerousBlocks>0&&t.push("删除了 ".concat(e.droppedDangerousBlocks," 处可执行/可加载内容(脚本、样式、内嵌页面等)")),e.blockedUrls>0&&t.push("拦截了 ".concat(e.blockedUrls," 个协议不安全的链接(如 javascript: / data:)")),e.escapedTags>0&&t.push("转义了 ".concat(e.escapedTags," 个不支持的标签(原文里的原始 HTML 会以文字显示)")),e.droppedAttributes>0&&t.push("剥离了 ".concat(e.droppedAttributes," 个属性(样式、事件、非白名单属性)")),e.droppedComments>0&&t.push("删除了 ".concat(e.droppedComments," 处注释/声明")),t}(u):[],T=(0,n.jsxs)("div",{className:"deliverablePreviewMeta",children:[l&&(0,n.jsx)(ex,{strong:!0,style:{fontSize:15},children:l}),s&&(0,n.jsx)(k.A,{color:null!=(r=null==(t=eo[s])?void 0:t.color)?r:"default",children:ea(eo,s,"记录状态",w)}),i&&(0,n.jsx)(ex,{type:"secondary",style:{fontSize:12},children:"预览正文:".concat("editedMarkdown"===i?"编辑后的正文(以它为准)":"markdown"===i?"记录里的正文(markdown 字段)":"draft"===i?"生成时的草案正文(draft.markdown)":"none"===i?"没有正文":"未识别的正文来源(".concat(i,")"))}),j?(0,n.jsx)(ex,{type:"secondary",style:{fontSize:12},children:"生成于 ".concat(ey(j))}):null,y?(0,n.jsx)(ex,{type:"secondary",style:{fontSize:12},children:"更新于 ".concat(ey(y))}):null]}),P=null!=S?S:[],M=P.filter(e=>e.locked).length,D=P.length>0?Math.round(M/P.length*100):0,L=P.length>0?(0,n.jsxs)("section",{className:"sectionProgressBlock","aria-label":"章节完整性",children:[(0,n.jsxs)("div",{className:"sectionProgressHead",children:[(0,n.jsx)("span",{className:"sectionProgressTitle",children:"章节完整性"}),(0,n.jsx)("span",{className:"sectionProgressCount",children:"".concat(M,"/").concat(P.length," 已锁定")})]}),(0,n.jsx)("div",{className:"sectionProgressBar","aria-hidden":!0,children:(0,n.jsx)("div",{className:"sectionProgressBarFill",style:{width:"".concat(D,"%")}})}),(0,n.jsx)("ul",{className:"sectionProgressList",children:P.map(e=>(0,n.jsxs)("li",{className:"sectionProgressRow",children:[(0,n.jsx)("span",{className:"sectionProgressOrder",children:e.order}),(0,n.jsxs)("span",{className:"sectionProgressName",title:"".concat(e.chapterTitle,"/").concat(e.title),children:[e.chapterTitle,"/",e.title]}),(0,n.jsxs)("span",{className:"sectionProgressPhase is-".concat(e.phase),children:[ev[e.phase],e.unitCount?" \xb7 ".concat(e.unitCount," 单元"):""]}),e.reason?(0,n.jsx)("span",{className:"sectionProgressReason",children:e.reason}):null]},e.sectionId))})]}):null,q=C?(0,n.jsx)(A.A,{style:{width:"100%"},type:"warning",showIcon:!0,title:"生成已按预算".concat("hard-stop"===C.enforcement?"硬停":"安全暂停"),description:(0,n.jsx)(ex,{style:{fontSize:12},children:C.message})}):null;return(0,n.jsx)("div",{className:null!=b?b:"deliverablePreview",children:(0,n.jsxs)("div",{className:"deliverablePreviewStack",children:[T,(0,n.jsx)(eh,{readings:N}),L,q,o&&(0,n.jsx)(A.A,{style:{width:"100%"},type:"warning",showIcon:!0,title:"正文过长,预览只渲染了前 ".concat((null!=d?d:0).toLocaleString()," 字(共 ").concat((null!=c?c:0).toLocaleString()," 字)"),description:"后续内容未渲染;导出物是完整正文,不受预览截断影响。"}),E.length>0&&(0,n.jsx)(A.A,{style:{width:"100%"},type:"info",showIcon:!0,title:"预览已对内容做安全处置(与导出物可能存在差异)",description:(0,n.jsx)("div",{style:{fontSize:12,lineHeight:1.7},children:E.map(e=>(0,n.jsxs)("div",{children:["\xb7 ",e]},e))})}),f&&(0,n.jsxs)(g.A,{align:"center",size:8,children:[(0,n.jsx)(p.A,{size:"small"}),(0,n.jsx)(ex,{type:"secondary",children:"正在取回成稿预览(服务端渲染 + 清洗)…"})]}),!f&&x&&(0,n.jsx)(A.A,{style:{width:"100%"},type:"error",showIcon:!0,title:"取回成稿预览失败",description:(0,n.jsxs)(g.A,{orientation:"vertical",size:6,children:[(0,n.jsx)(ex,{style:{fontSize:12},children:x}),v&&(0,n.jsx)(h.Ay,{size:"small",onClick:v,children:"重新取回"})]})}),!f&&!x&&!I&&(0,n.jsx)(A.A,{style:{width:"100%"},type:"info",showIcon:!0,title:"这条记录还没有可预览的正文",description:"生成完成后这里会显示成稿全文;生成中的记录只有动作与消息(见生成页),没有正文可预览。"}),!x&&I&&(0,n.jsxs)("div",{className:"deliverablePreviewPaper",children:[(0,n.jsx)("article",{className:"deliverablePreviewBody","aria-label":"成稿预览正文",dangerouslySetInnerHTML:{__html:R}}),(0,n.jsxs)("div",{className:"deliverablePreviewEnd",children:[(0,n.jsx)(ex,{type:"secondary",style:{fontSize:12},children:o?"正文到此为止(预览有截断,见上方提示;导出物是完整正文)":d&&d>0?"正文到此为止:以上是本记录的全部正文,共 ".concat(d.toLocaleString()," 字(未截断)"):"正文到此为止:以上是本记录的全部正文(未截断)"}),m&&!m.passed&&(0,n.jsx)(ex,{style:{fontSize:12,color:"var(--colorWarning)"},children:"交付门禁未通过(阻断 ".concat(m.blockingCount," 项)——正文在这里结束并不代表成稿完整,缺什么见上方的阻断项清单。")})]})]}),!x&&I&&(0,n.jsx)(ef,{type:"secondary",style:{fontSize:12,marginBottom:0,textAlign:"left"},children:"预览为服务端渲染结果;排版细节(字体、页眉页脚、分页)以导出物为准。"})]})})}var eb=r(45907),ew=r(34052),ek=r(84253),eA=r(76830);function eN(e){let{reports:t,deliveryReadings:r,t:l}=e,[a,i]=(0,s.useState)(!1),o=(e,t)=>{let r=null==l?void 0:l(e);return r&&r!==e?r:t},c=(0,s.useSyncExternalStore)(j.p5,j.dH,j.dH),d=c?function(e,t){var r,n;let{receipt:s}=e,l=(e,r,n,s)=>t(e,r).replace("{count}",String(n))+(s?":".concat(s):""),a=[];"review"===s.exportPurpose&&a.push({key:"review-purpose",tone:"info",text:"审阅稿:验收结论保持原状态,独立问题报告与正文版本绑定"}),s.issuesReport&&a.push({key:"review-report",tone:"info",text:"独立问题报告:".concat(s.issuesReport.id.slice(0,12),";正文 SHA256:").concat(s.issuesReport.bodySha256)}),"mismatch"===s.gateBinding?a.push({key:"binding-mismatch",tone:"error",text:t("records.receiptBindingMismatch","正文与门禁指纹不匹配:放行依据不是这份正文(收口后被编辑/替换过)")}):"absent"===s.gateBinding&&a.push({key:"binding-absent",tone:"warning",text:t("records.receiptBindingAbsent","门禁未绑定正文指纹:无法核对放行依据是否就是这份正文")}),s.gateIssues&&s.gateIssues.length>0&&a.push({key:"gate-issues",tone:"error",text:l("records.receiptGateIssues","门禁阻断清单 {count} 项",s.gateIssues.length,s.gateIssues[0])}),s.contentIssues&&s.contentIssues.length>0&&a.push({key:"content-issues",tone:"warning",text:l("records.receiptContentIssues","内容问题 {count} 条",s.contentIssues.length,s.contentIssues[0])});let i=null!=(n=null==(r=s.figureInline)?void 0:r.failed)?n:[];return i.length>0&&a.push({key:"figure-inline",tone:"warning",text:l("records.receiptFigureFailures","图件未内联 {count} 张",i.length,i[0])}),s.renderAudit&&s.renderAudit.blockerCount>0&&a.push({key:"render-blockers",tone:"error",text:l("records.receiptRenderBlockers","渲染审计:源层结构缺陷 {count} 项",s.renderAudit.blockerCount)}),s.renderAudit&&s.renderAudit.notices.length>0&&a.push({key:"render-notices",tone:"warning",text:l("records.receiptRenderNotices","渲染审计告警 {count} 条",s.renderAudit.notices.length,s.renderAudit.notices[0])}),s.templateWarning&&a.push({key:"template-warning",tone:"warning",text:"".concat(t("records.receiptTemplateWarning","模板占位符缺失,已回退:")).concat(s.templateWarning)}),s.pageLimit&&a.push({key:"page-limit",tone:"warning",text:s.pageLimit}),"number"==typeof s.pdfPageCount&&a.push({key:"pdf-pages",tone:"info",text:t("records.receiptPdfPages","PDF 共 {count} 页").replace("{count}",String(s.pdfPageCount))}),a}(c,o):[],u=d.filter(e=>"info"!==e.tone),p=d.length>0;if(0===t.length&&!r&&0===u.length&&!(null==c?void 0:c.receipt.issuesReport)&&(null==c?void 0:c.receipt.exportPurpose)!=="review")return null;let m=[...t].sort((e,t)=>t.exportedAt-e.exportedAt),g=m.find(e=>{var t,r;return(null!=(r=null==(t=e.gateChecklist)?void 0:t.items.length)?r:0)>0});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(f.A,{title:o("records.reportTitle","导出闭环报告"),children:(0,n.jsxs)(h.Ay,{size:"small",icon:(0,n.jsx)(eA.A,{}),onClick:()=>i(!0),children:[(null==r?void 0:r.contractQuality)?"七维诊断".concat(r.contractQualityStale?"(历史)":r.contractQuality.score.deliveryReady?"(待验收)":"(待修验)"):o("records.reportEntry","导出报告"),t.length>0&&(0,n.jsx)("span",{className:"ml-1 text-[var(--colorTextTertiary)]",children:t.length}),u.length>0&&(0,n.jsx)(k.A,{color:u.some(e=>"error"===e.tone)?"error":"warning",className:"m-0 ml-1 border-0",children:o("records.receiptBadge","本次导出 {count} 项提醒").replace("{count}",String(u.length))})]})}),(0,n.jsxs)(ew.A,{title:o("records.reportTitle","导出闭环报告"),placement:"right",size:"default",open:a,onClose:()=>i(!1),styles:{body:{padding:16}},children:[p&&c&&(0,n.jsxs)("div",{className:"mb-3 rounded-xl border px-3 py-2.5 text-xs ".concat(u.length>0?"border-[var(--colorWarning)] bg-[var(--colorWarningBg)]":"border-[var(--borderColor)] bg-[var(--colorFillAlter)]"),children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("span",{className:"font-semibold",children:o("records.receiptTitle","最近一次导出回执")}),(0,n.jsx)(k.A,{color:"blue",className:"m-0 border-0 font-semibold",children:c.format.toUpperCase()}),(0,n.jsx)("span",{className:"text-[var(--colorTextTertiary)]",children:new Date(c.at).toLocaleString()}),c.filename&&(0,n.jsx)("span",{className:"break-all text-[var(--colorTextTertiary)]",children:c.filename})]}),c.receipt.issuesReport&&(0,n.jsx)("a",{className:"text-[var(--colorPrimary)] underline",href:(0,j.Es)(c,c.receipt.issuesReport),children:"下载本份正文的独立问题报告"}),(0,n.jsx)("div",{className:"mt-2 flex flex-col gap-1.5",children:d.map(e=>(0,n.jsx)("div",{className:"error"===e.tone?"text-[var(--colorError)]":"warning"===e.tone?"text-[var(--colorWarning)]":"text-[var(--colorTextSecondary)]",children:e.text},e.key))})]}),r&&(0,n.jsxs)("div",{className:"mb-3 flex flex-col gap-2 rounded-xl border border-[var(--borderColor)] bg-[var(--colorFillAlter)] px-3 py-2.5 text-xs",children:[r.contractQuality&&(0,n.jsx)(eh,{readings:r}),r.netChars&&(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("span",{className:"text-[var(--colorTextSecondary)]",children:o("records.netCharsLabel","修复链净增字数")}),(0,n.jsxs)("span",{className:"font-semibold",children:[r.netChars.delta>0?"+":"",r.netChars.delta]}),(0,n.jsxs)("span",{className:"text-[var(--colorTextSecondary)]",children:["(",r.netChars.before," → ",r.netChars.after,",",o("records.netCharsRatio","占原稿")," ",(100*r.netChars.ratio).toFixed(1),"%)"]}),r.netChars.ratio>.05&&(0,n.jsx)(f.A,{title:o("records.netCharsWarn",'目标 ≤5%:净增越大,"分是修出来的"成分越高——首过写作的缺口被修复链补上了'),children:(0,n.jsx)(k.A,{color:"warning",className:"m-0 border-0",children:o("records.netCharsOver","超目标")})})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("span",{className:"text-[var(--colorTextSecondary)]",children:o("records.reviewReportLabel","交付三件套报告")}),(0,n.jsx)("a",{href:"/api/documents/generated/".concat(encodeURIComponent(r.docId),"/report").concat(r.projectRoot?"?projectRoot=".concat(encodeURIComponent(r.projectRoot),"&download=1"):"?download=1"),className:"text-[var(--colorPrimary)] underline",children:o("records.reviewReportDownload","下载 .md")}),(0,n.jsx)("a",{href:"/api/documents/generated/".concat(encodeURIComponent(r.docId),"/report").concat(r.projectRoot?"?projectRoot=".concat(encodeURIComponent(r.projectRoot)):""),target:"_blank",rel:"noreferrer",className:"text-[var(--colorPrimary)] underline",children:o("records.reviewReportView","在线查看")}),(0,n.jsx)("span",{className:"text-[var(--colorTextTertiary)]",children:o("records.reviewReportHint","未跑到终门禁的记录没有报告(打开会说明原因)")})]})]}),0===m.length?(0,n.jsx)(ek.A,{image:ek.A.PRESENTED_IMAGE_SIMPLE,description:o("records.reportEmpty","还没有导出记录")}):(0,n.jsxs)("div",{className:"flex flex-col gap-3",children:[m.map((e,t)=>(0,n.jsxs)("div",{className:"rounded-xl border border-[var(--borderColor)] bg-[var(--colorFillAlter)] px-3 py-2.5 text-xs",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)(k.A,{color:"blue",className:"m-0 border-0 font-semibold",children:e.format.toUpperCase()}),(0,n.jsx)("span",{className:"text-[var(--colorTextSecondary)]",children:new Date(e.exportedAt).toLocaleString()}),"review"===e.exportPurpose&&(0,n.jsx)(k.A,{children:"审阅稿"}),e.reviewReport&&(0,n.jsx)("a",{className:"text-[var(--colorPrimary)] underline",href:(0,j.Es)({documentId:null==r?void 0:r.docId,projectRoot:null==r?void 0:r.projectRoot},e.reviewReport),children:"下载独立问题报告"})]}),(0,n.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-[var(--colorTextSecondary)]",children:[void 0!==e.durationMs&&(0,n.jsxs)("span",{children:[o("records.reportDuration","总用时")," ",(0,V.a)(e.durationMs,{unit:"ms",style:"fine-decimal"})]}),void 0!==e.repairedCount&&(0,n.jsxs)("span",{children:[o("records.reportRepaired","修复")," ",e.repairedCount,void 0!==e.blockingCount?"(".concat(o("records.reportBlocking","质量诊断快照阻断")," ").concat(e.blockingCount,")"):""]}),e.ruleSummary&&e.ruleSummary.length>0&&(0,n.jsxs)("span",{children:[o("records.reportRules","规则")," ",e.ruleSummary.length]}),!1===e.gatePassed&&(0,n.jsxs)(k.A,{color:"error",className:"m-0 border-0",children:[o("records.reportGateBlocked","非交付物"),void 0!==e.gateIssueCount&&e.gateIssueCount>0?" \xb7 ".concat(o("records.reportGateBlockedCount","门禁阻断")," ").concat(e.gateIssueCount," ").concat(o("records.reportGateBlockedUnit","项")):" \xb7 ".concat(o("records.reportGateBlockedUnknown","阻断数未记录(清单缺失)"))]}),e.healthAlerts&&e.healthAlerts.length>0&&(0,n.jsxs)(k.A,{color:"warning",className:"m-0 border-0",children:[o("records.reportHealthAlerts","健康告警")," ",e.healthAlerts.length]})]})]},"".concat(e.exportedAt,"-").concat(t))),(null==g?void 0:g.gateChecklist)&&(0,n.jsxs)("div",{className:"rounded-xl border border-[var(--colorWarning)] bg-[var(--colorWarningBg)] px-3 py-2.5",children:[(0,n.jsxs)("div",{className:"text-xs font-semibold text-[var(--colorWarning)]",children:[o("records.reportChecklistTitle","最近一次非交付物导出的未收敛项"),"(",o("records.reportChecklistTotal","共 {count} 项").replace("{count}",String(g.gateChecklist.total)),")"]}),(0,n.jsx)("div",{className:"mt-2 flex flex-col gap-2",children:g.gateChecklist.items.map(e=>(0,n.jsxs)("div",{className:"text-xs",children:[(0,n.jsx)("div",{className:"whitespace-pre-wrap text-[var(--colorText)]",children:"".concat(e.index,".【").concat(e.category,"】").concat(e.problem)}),(0,n.jsxs)("div",{className:"text-[var(--colorTextSecondary)]",children:[e.repairPath,e.detectorId?"|".concat(e.detectorId):""]})]},e.index))})]})]})]})]})}var eS=r(28629),eC=r(2518);function eR(e){let t=[],r=[];for(let n of e.issues)("stage-details"===n.source?r:t).push(n);return{problems:t,details:r,counts:{error:t.filter(e=>"error"===e.level).length,warning:t.filter(e=>"warning"===e.level).length,info:t.filter(e=>"info"===e.level).length}}}let eI=new Set(["responsibility:actor:chief","responsibility:material-preparation","responsibility:facts-verification","responsibility:structure-planning","responsibility:derivation","responsibility:writing","responsibility:finalize","responsibility:delivery"]);function eE(e,t){let r=e;for(let e=0;r&&e<64&&!eI.has(r.id);e+=1){if(r.id.startsWith("responsibility:actor:"))return function(e){var t,r,n,s;let l=String(null!=e?e:"").replace(/\s+/gu," ").trim(),a=[...(null!=(n=null==(t=l.match(/承接([^::\n]{0,240})/u))?void 0:t[1])?n:"").matchAll(/「([^」]+)」/gu)].map(e=>e[1].trim()).filter(Boolean);if(a.length)return"".concat(a.slice(0,2).join("、")).concat(a.length>2?" 等":"");let i=null!=(s=null==(r=l.split(/[::\n]/u)[0])?void 0:r.replace(/^#{1,6}\s*/u,"").trim())?s:"";return i&&i.length<=28?i:"专业智能体"}(r.title);r=r.parentId?t.get(r.parentId):void 0}return"主控智能体"}function eT(e){return e.replace(/^[A-Z][A-Z0-9_]{2,}\s*[::]\s*/u,"").replace(/^document\s*[::]\s*/iu,"")}function eP(e){return e.replace(/(^|\n)\s*#{1,6}\s+/gu,"$1").replace(/([::])\s*#{1,6}\s+/gu,"$1").replace(/\s#{1,6}\s+/gu," ")}function eM(e){return e.replace(/[;;]?\s*已结束调用\s*\d+(?:\s*[,,]\s*在途\s*\d+)?/gu,"").replace(/[;;]?\s*在途\s*\d+/gu,"").replace(/[;;]?\s*耗时\s*\d+(?:\.\d+)?\s*秒/gu,"").replace(/[;;]?\s*正在等待\/处理[::][^;;。]*/gu,"").replace(/[。;;]?\s*执行结束不等于整稿通过。?/gu,"").replace(/[::]?\s*(?:本项执行结束|正在执行)(?=[;;。,,]|$)/gu,"").replace(/([,,;;、])\s*[,,;;、]+/gu,"$1")}function eD(e){return e.replace(/^[\s,,、;;。.::]+|[\s,,、;;。.::]+$/gu,"")}function eL(e){return e?[...new Set(e.split(/[;;。]/u).map(e=>eD(eM(eT(e.trim())))).map(e=>e.replace(/\s+/gu," ").trim()).filter(Boolean).filter(e=>!/^(?:本项)?执行结束$|^正在执行$|^执行结束$|^未执行$|^已完成$|^完成$|^暂无$/u.test(e)))].join(";"):""}let eq=[{key:"chars",label:"字数",format:e=>Number.isFinite(Number(e))?"".concat(Number(e).toLocaleString()," 字"):""},{key:"chapters",label:"章数",format:e=>"".concat(e," 章")},{key:"facts",label:"事实",format:e=>"".concat(e," 条")},{key:"toolCalls",label:"工具调用",format:e=>"".concat(e," 次")},{key:"attempt",label:"尝试",format:e=>"第 ".concat(e," 次")},{key:"turn",label:"轮次",format:e=>"第 ".concat(e," 轮")},{key:"residual",label:"残余",format:e=>String(e)}],e_={error:"错误",warning:"警告",info:"提示"};function ez(e){let{node:t,agentLabel:r,parentTitle:s,previousTitle:l,nextTitle:a,narrative:i,t:o}=e,c=eR(t),d="running"===t.status?void 0:em(t),u=eu(t.title,300),p=ei(t.status,o),m=function(e){if(!e)return"";let t=eP(eD(eM(eT(e.replace(/^\s*(?:开始|完成|失败|暂停|继续)[::]\s*/u,"").split(/\n+/u).map(e=>e.trim()).filter(e=>e&&!/^#{1,6}\s/u.test(e)).join(" "))))).replace(/\s+/gu," ").trim();return t?t.length>240?"".concat(t.slice(0,240),"…"):t:""}(i),g=t.progress&&t.progress.total>0?"".concat(t.progress.current,"/").concat(t.progress.total).concat(t.progress.label?" \xb7 ".concat(t.progress.label):""):"",h=[s?"所属:".concat(eu(s,80)):"",l?"上一步:".concat(eu(l,80)):"",a?"下一步:".concat(eu(a,80)):""].filter(Boolean),f=function(e){let t=[];for(let{key:r,label:n,format:s}of eq){let l=e[r];if(void 0===l||""===l||!1===l)continue;let a=s(l).trim();a&&t.push({label:n,value:a})}return t}(t.metrics);return(0,n.jsxs)("div",{className:"stepDetails",children:[(0,n.jsxs)("div",{className:"stepDetailHeader",children:[(0,n.jsx)("span",{className:"stepDetailAgent",children:null!=r?r:"主控智能体"}),(0,n.jsx)("span",{className:"stepDetailAction",children:u})]}),(0,n.jsxs)("div",{className:"stepDetailStatusLine",children:[(0,n.jsx)("span",{className:"stepDetailStatus is-".concat(t.status),children:p}),void 0!==d&&(0,n.jsx)("span",{children:eg(d)}),g&&(0,n.jsx)("span",{children:g})]}),m&&(0,n.jsx)("p",{className:"stepDetailLead",children:m}),h.length>0&&(0,n.jsx)("div",{className:"stepDetailFlow",children:h.join(" \xb7 ")}),c.problems.length>0&&(0,n.jsxs)("section",{className:"stepDetailIssues",children:[(0,n.jsx)("div",{className:"stepDetailSectionTitle",children:"问题(".concat(c.problems.length,")")}),(0,n.jsx)("div",{className:"stepDetailIssueList",children:c.problems.slice(0,3).map((e,t)=>(0,n.jsxs)("div",{className:"stepDetailIssue",children:[(0,n.jsx)("span",{className:"stepDetailIssueLevel is-".concat(e.level),children:e_[e.level]}),(0,n.jsx)("span",{className:"stepDetailGridValue",children:e.message})]},"".concat(e.level,"-").concat(t)))}),c.problems.length>3&&(0,n.jsxs)("div",{className:"stepDetailMore",children:["还有 ",c.problems.length-3," 条问题未显示"]})]}),f.length>0&&(0,n.jsxs)("section",{className:"stepDetailMetrics",children:[(0,n.jsx)("div",{className:"stepDetailSectionTitle",children:"执行数据"}),(0,n.jsx)("div",{className:"stepDetailMetricList",children:f.map(e=>(0,n.jsxs)("div",{className:"stepDetailMetric",children:[(0,n.jsx)("span",{className:"stepDetailMetricLabel",children:e.label}),(0,n.jsx)("span",{className:"stepDetailMetricValue",children:e.value})]},e.label))})]})]})}var eB=r(12167),eF=r(97137),eW=r(1169);let{Text:eU}=d.A;function eH(e){var t,r,s;let{node:l,repeat:a,detailOpen:i,onOpenDetails:o}=e,c=eR(l),d="running"===l.status?void 0:em(l),u=eu(l.title),p=c.counts.error,m=c.counts.warning,g=eL("string"==typeof l.metrics.note?l.metrics.note:""),h=l.progress&&l.progress.total>0?"".concat(l.progress.current,"/").concat(l.progress.total).concat(l.progress.label?" \xb7 ".concat(l.progress.label):""):"",f=g||h,x=ei(l.status);return(0,n.jsx)("div",{className:"sessionStep","data-node-id":l.id,children:(0,n.jsxs)("div",{className:"sessionStepSummary",role:"button",tabIndex:0,"aria-expanded":i,"aria-label":"".concat(i?"收起":"查看","节点详情:").concat(eu(l.title,120)),onClick:()=>o(l),onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),o(l))},children:[(0,n.jsx)("span",{className:"sessionStepKind","aria-hidden":!0,children:null!=(r=ed[(t=l.type).split(".")[0]||t])?r:ed.default}),(0,n.jsxs)("div",{className:"sessionStepText",children:[(0,n.jsxs)("div",{className:"sessionStepTitleRow",children:[(0,n.jsx)(eU,{className:"sessionStepTitle".concat((s=l.title,/^[a-z][a-z0-9_.-]*$/u.test(s))?" sessionStepTitleTool":""),ellipsis:!0,children:u}),void 0!==a&&a>1&&(0,n.jsxs)("span",{className:"sessionStepRepeat",title:"连续 ".concat(a," 条相同动作已合并"),children:["\xd7",a]}),(p>0||m>0)&&(0,n.jsx)(eF.A,{className:"sessionStepAlert".concat(p>0?"":" isWarning"),"aria-label":"".concat(p," 个错误 \xb7 ").concat(m," 个警告"),title:"".concat(p," 个错误 \xb7 ").concat(m," 个警告")})]}),f&&(0,n.jsx)("div",{className:"sessionStepSub",children:f})]}),(0,n.jsxs)("div",{className:"sessionStepMeta",children:[(0,n.jsx)("span",{className:"sessionStepStatusDot is-".concat(l.status),title:x,"aria-label":x}),void 0!==d&&(0,n.jsx)("span",{className:"sessionStepDuration",children:eg(d)}),(0,n.jsx)(eW.A,{className:"sessionStepChevron".concat(i?" isOpen":""),"aria-hidden":!0})]})]})})}let{Text:e$}=d.A;function eO(e){let{entries:t,detailNodeId:r,onOpenDetails:l,renderDetails:a}=e,i=function(e){let t=[];for(let n of e)if("action"===n.kind){var r;let e=null!=(r=n.agentLabel)?r:"主控智能体",s=t[t.length-1];(null==s?void 0:s.kind)==="actions"&&s.agentLabel===e?s.entries.push(n):t.push({kind:"actions",agentLabel:e,entries:[n]})}else t.push({kind:"single",entry:n});return t}(t);return(0,n.jsx)("div",{className:"sessionStreamInner",children:i.map((e,t)=>"single"===e.kind?((e,t)=>{if("message"===e.kind){var r,s;let{message:l}=e;if("system"===l.role)return(0,n.jsx)("div",{className:"sessionSystemMessage",children:(0,n.jsx)(e$,{type:"secondary",children:l.text})},"message-".concat(l.id,"-").concat(t));let a="assistant"===l.role?eP(eM(l.text)).replace(/^[\s,,、;;]+|[\s,,、;;]+$/gu,"").replace(/[ \t]{2,}/gu," ").trim():l.text;return a?(0,n.jsxs)("div",{className:"sessionMessage sessionMessage-".concat(l.role),children:[(0,n.jsxs)("div",{className:"sessionMessageMeta",children:[(0,n.jsx)("span",{children:null!=(r=e.agentLabel)?r:"user"===l.role?"你":"主控智能体"}),(0,n.jsx)("span",{children:!Number.isFinite(s=l.t)||s<=0?"":new Date(s).toLocaleString()})]}),(0,n.jsx)("div",{className:"sessionMessageBubble",children:a})]},"message-".concat(l.id,"-").concat(t)):null}return"notice"===e.kind?(0,n.jsx)("div",{className:"sessionNotice sessionNotice-".concat(e.notice.kind),children:e.notice.text},"notice-".concat(e.notice.id)):null})(e.entry,t):(0,n.jsxs)("div",{className:"sessionAgentGroup",children:[(0,n.jsxs)("div",{className:"sessionAgentHeader",children:[(0,n.jsx)("span",{className:"sessionAgentIcon","aria-hidden":!0,children:"主控智能体"===e.agentLabel?(0,n.jsx)(M.A,{}):(0,n.jsx)(eB.A,{})}),(0,n.jsx)("span",{children:e.agentLabel})]}),(0,n.jsx)("div",{className:"sessionStepGroup",children:e.entries.map(e=>(0,n.jsxs)(s.Fragment,{children:[(0,n.jsx)(eH,{node:e.node,repeat:e.repeat,detailOpen:r===e.node.id,onOpenDetails:l}),r===e.node.id&&(0,n.jsx)("div",{className:"sessionStepOutput",children:a(e.node)})]},e.node.id))})]},"agent-".concat(t,"-").concat(e.agentLabel)))})}let eQ={message:0,action:1,notice:2};function eG(e,t){let r="action"===e.kind?e.node.seq:0;return[e.at,eQ[e.kind],r,t]}function eX(e){let t=[];for(let r of e)t.push(r),t.push(...eX(r.children));return t}function eV(e,t){let r=eG(e.entry,e.index),n=eG(t.entry,t.index);for(let e=0;e<r.length;e+=1)if(r[e]!==n[e])return r[e]-n[e];return 0}function eK(e){var t,r;let{node:n}=e,s=eR(n).counts,l=["running","pending","repairing"].includes(n.status)&&n.progress?"".concat(n.progress.current,"/").concat(n.progress.total,"/").concat(null!=(t=n.progress.label)?t:""):"";return[null!=(r=e.agentLabel)?r:"",eu(n.title,300),n.status,eL("string"==typeof n.metrics.note?n.metrics.note:""),l,s.error,s.warning,s.info].join("\0")}let{Text:eZ}=d.A,eJ=["upsert","status","rollup","reset","start","stage","thinking","text","tool_call_preview","progress","error","done","complete","log"],eY="generation.deliverablePanelWidth";function e0(e,t){let r=t.node;if(!r||"string"!=typeof r.id)return!0;if("upsert"===t.type)return e.set(r.id,r),!0;let n=e.get(r.id);if(!n){var s,l;return e.set(r.id,{...r,title:null!=(s=r.title)?s:r.id,seq:null!=(l=r.seq)?l:0}),!1}let{startedAt:a,...i}=r;return e.set(r.id,{...n,...i,id:n.id}),!0}function e1(){var e,t,r,l,i,d,k,A,N,S,C,R,I,E,T,P,M,D,L,q,_,z;let B=(0,c.useRouter)(),F=(0,b.Vr)(),{message:W}=u.A.useApp(),U="string"==typeof B.query.id?B.query.id:"",H="string"==typeof B.query.projectRoot?B.query.projectRoot:void 0,[$,O]=(0,s.useState)(null),[Q,G]=(0,s.useState)(!0),[X,V]=(0,s.useState)(null),[et,en]=(0,s.useState)(new Map),[es,el]=(0,s.useState)("connecting"),[ea,ei]=(0,s.useState)(""),[eo,ed]=(0,s.useState)(!1),[eu,em]=(0,s.useState)([]),[eg,eh]=(0,s.useState)([]),[ef,ex]=(0,s.useState)(!1),[ev,ey]=(0,s.useState)(!1),[ew,ek]=(0,s.useState)([]),[eA,eR]=(0,s.useState)(null),[eI,eT]=(0,s.useState)(null),eP=(0,s.useRef)(new Map),eM=(0,s.useRef)(0),eD=(0,s.useRef)({nodes:[],cursor:0}),eL=(0,s.useRef)(null),eq=(0,s.useRef)(0),e_=(0,s.useRef)(H),eB=(0,s.useRef)(()=>{}),eF=(0,s.useRef)(null),eW=(0,s.useRef)(null),eU=(0,s.useRef)(null),eH=(0,s.useCallback)(e=>{let t=e.key?F(e.key):e.text,r=t===e.key?e.text:t;eq.current+=1,em(t=>[{id:eq.current,kind:e.kind,text:r,at:Date.now()},...t].slice(0,100)),"error"===e.kind?W.error(r):"warning"===e.kind?W.warning(r):"success"===e.kind&&W.success(r)},[W,F]),e$=(0,w.tl)({projectRoot:H,documentId:U||null,onNotice:eH,t:F}),{refreshDocuments:eQ,applyRecord:eG}=e$,e1=function(e,t){let[r,n]=(0,s.useState)({loading:!1,error:null,preview:null}),l=(0,s.useRef)(0),a=(0,s.useCallback)(async()=>{if(!e)return void n({loading:!1,error:"缺少记录 id,无法取回成稿预览",preview:null});let r=l.current+1;l.current=r,n(e=>({...e,loading:!0,error:null}));try{let{preview:s}=await (0,j.sz)(e,t);if(l.current!==r)return;n({loading:!1,error:null,preview:s})}catch(e){if(l.current!==r)return;n({loading:!1,error:e instanceof Error?e.message:"取回成稿预览失败",preview:null})}},[e,t]),i=(0,s.useCallback)(()=>{l.current+=1,n({loading:!1,error:null,preview:null})},[]);return{...r,load:a,reset:i}}(U,null!=(E=e_.current)?E:H),e2=(0,s.useCallback)(()=>{e1.reset()},[e1]),e3=(0,s.useCallback)(()=>{ex(!1),eU.current&&clearTimeout(eU.current),eU.current=setTimeout(()=>{eU.current=null,ey(!1),e2()},260)},[e2]),e4=(0,s.useCallback)(()=>{if(ef)return void e3();eU.current&&(clearTimeout(eU.current),eU.current=null),ev?ex(!0):(ey(!0),requestAnimationFrame(()=>ex(!0))),e1.load()},[e3,ev,ef,e1]);(0,s.useEffect)(()=>{if(!ef)return;let e=Number(window.localStorage.getItem(eY));if(!Number.isFinite(e)||e<420)return;let t=Math.min(e,Math.max(420,window.innerWidth-360));eF.current=t,eT(t)},[ef]),(0,s.useEffect)(()=>()=>{eU.current&&clearTimeout(eU.current)},[]);let e6=e=>Math.min(Math.max(420,window.innerWidth-360),Math.max(420,Math.round(e))),e5=e6(null!=eI?eI:Math.max(480,Math.min(920,Math.round(.6*window.innerWidth)))),e9=()=>{if(null!==eF.current)try{window.localStorage.setItem(eY,String(eF.current))}catch(e){}},e8=e=>{if(eW.current){eW.current=null;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch(e){}e9()}},e7=(0,s.useCallback)(e=>{ek(t=>t.includes(e)?t:[...t,e])},[]),te=(0,s.useCallback)(()=>{eL.current||(eL.current=setTimeout(()=>{eL.current=null;let e=eD.current;if(eD.current={nodes:[],cursor:0},e.nodes.length>0){let t=eP.current,r=0;for(let n of e.nodes)e0(t,n)||(r+=1);en(new Map(t)),r>0&&e7("通道收到 ".concat(r," 条指向未知节点的补丁:已按最小节点收下(说明本客户端漏读了 upsert,或日志存在损坏)"))}e.cursor>eM.current&&(eM.current=e.cursor)},120))},[e7]);(0,s.useEffect)(()=>()=>{eL.current&&clearTimeout(eL.current)},[]);let tt=(0,s.useCallback)(e=>{let t=eD.current;t.nodes.push(e),e.logT&&e.logT>t.cursor&&(t.cursor=e.logT),te()},[te]),tr=(0,s.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(U){e.silent||G(!0);try{var t,r,n,s,l,a;let e=e_.current?"?projectRoot=".concat(encodeURIComponent(e_.current)):"",i=await fetch("/api/documents/canvas/".concat(encodeURIComponent(U)).concat(e));if(404===i.status)return void V("记录不存在(可能已被删除)");if(!i.ok)throw Error(await i.text()||"HTTP ".concat(i.status));let o=await i.json();e_.current=null!=(n=o.document.projectRoot)?n:e_.current,O(o),V(null),ek(null!=(s=o.degraded)?s:[]);let c=function(e){let t=[],r=e=>{for(let n of e){let{children:e,...s}=n;t.push(s),e&&r(e)}};return r(e),t}(null!=(l=null==(t=o.nodes)?void 0:t.tree)?l:[]),d=new Map(c.map(e=>[e.id,e]));eP.current=d,en(d),eM.current=Math.max(eM.current,null!=(a=null==(r=o.nodes)?void 0:r.cursor)?a:0)}catch(e){V(e instanceof Error?e.message:String(e))}finally{e.silent||G(!1)}}},[U]);(0,s.useEffect)(()=>{tr()},[tr]),(0,s.useEffect)(()=>{U&&eQ()},[U,eQ]),(0,s.useEffect)(()=>{let e=e$.documents.find(e=>e.id===U);e&&eG(e)},[eG,U,e$.documents]);let tn=(0,s.useCallback)(async()=>{if(U)try{var e,t;let r=new URLSearchParams({since:String(eM.current)});e_.current&&r.set("projectRoot",e_.current);let n=await fetch("/api/documents/generated/".concat(encodeURIComponent(U),"/nodes?").concat(r.toString()));if(!n.ok)return;let s=await n.json(),l=eP.current;for(let t of null!=(e=s.nodes)?e:[])e0(l,{type:"upsert",node:t});(null!=(t=s.nodes)?t:[]).length>0&&en(new Map(l)),s.cursor&&(eM.current=Math.max(eM.current,s.cursor)),s.downgraded&&e7(s.reason||"增量过大,服务端已降级为全量快照")}catch(e){}},[e7,U]);(0,s.useEffect)(()=>{if(!U)return;let e=setInterval(()=>{tn()},1e4);return()=>clearInterval(e)},[U,tn]),(0,s.useEffect)(()=>{if(!U||"undefined"==typeof EventSource)return;let e=e_.current?"?projectRoot=".concat(encodeURIComponent(e_.current)):"",t=new EventSource("/api/documents/generated/".concat(encodeURIComponent(U),"/events").concat(e));el("connecting");let r=e=>t=>{var r;let n={};try{n=JSON.parse(t.data)}catch(e){}let s=null!=(r=n.type)?r:e;"reset"===s&&(tr({silent:!0}),e7("通道补发不可用(服务端重启或环形覆盖):已重取全量快照")),n.node&&(tt({type:s,node:n.node,...n.logT?{logT:n.logT}:{}}),eQ())},n=eJ.map(e=>[e,r(e)]);for(let[e,r]of(t.onopen=()=>el("open"),t.onerror=()=>{el("error"),tn()},n))t.addEventListener(e,r);return t.onmessage=r("message"),()=>{for(let[e,r]of n)t.removeEventListener(e,r);t.close()}},[e7,U,tr,tt,eQ,tn]);let ts=(0,s.useMemo)(()=>(function(e,t){let r=new Map(e.map(e=>[e.id,e]));return(function(e,t){let r=function(e){let t=Y(e),r=ee(e),n=[...e].sort((e,t)=>{var n,s;return(null!=(n=r.get(t.id))?n:0)-(null!=(s=r.get(e.id))?s:0)||J(e,t)}),s=new Map(e.map(e=>[e.id,e]));for(let e of n){let r=t.get(e.id);if(!r||0===r.length)continue;let n=r.map(e=>{var t;return null!=(t=s.get(e.id))?t:e});s.set(e.id,function(e,t){var r,n,s;if(0===t.length)return{...e};let l=[...t].sort(J),a={...null!=(n=e.metrics)?n:{}};for(let t of Z){let r=function(e,t,r){var n,s;let l=0,a=!1,i=null==(n=e.metrics)?void 0:n[r];for(let e of("number"==typeof i&&Number.isFinite(i)&&(l+=i,a=!0),t)){let t=null==(s=e.metrics)?void 0:s[r];"number"==typeof t&&Number.isFinite(t)&&(l+=t,a=!0)}return a?l:void 0}(e,l,t);void 0===r?delete a[t]:a[t]=r}let i=null==(r=e.progress)?void 0:r.label,o={current:l.filter(e=>"completed"===e.status).length,total:l.length,...void 0!==i?{label:i}:{}},c=function(e){let t=new Set,r=[];for(let s of e){var n;let e=null==(n=s.provenance)?void 0:n.fingerprint;if("string"==typeof e&&e.length>0){if(t.has(e))continue;t.add(e)}r.push(s)}return r}(l.flatMap(e=>{var t;return null!=(t=e.issues)?t:[]})),d=null!=(s=function(e){let t,r=1/0;for(let n of e){let e=function(e){let t=K.indexOf(e);return t>=0?t:0}(n);e<r&&(r=e,t=n)}return t}(l.map(e=>e.status)))?s:e.status;return{...e,status:d,progress:o,...Object.keys(a).length>0?{metrics:a}:{},...c.length>0?{issues:c}:{}}}(e,n))}return[...e].sort(J).map(e=>{var t;return null!=(t=s.get(e.id))?t:e})}(e),n=Y(r),s=new Set(r.map(e=>e.id)),l=1/0,a=(e,t)=>{var r;let s=t+1<l?(null!=(r=n.get(e.id))?r:[]).filter(t=>t.id!==e.id).map(e=>a(e,t+1)):[];return{...e,children:s}},i=r.filter(e=>void 0===e.parentId||!s.has(e.parentId)).sort(J).map(e=>a(e,0)),o=new Set,c=e=>{for(let t of e)o.add(t.id),c(t.children)};for(let e of(c(i),r))o.has(e.id)||i.push(a(e,0));return i})(function(e,t){if(void 0===t)return[...e];let r=ee(e),n=Math.max(0,Math.floor(t));return e.filter(e=>{var t;return(null!=(t=r.get(e.id))?t:0)<n})}(e.map(ep),void 0)).map(e=>(function e(t,r){var n,s,l;let a=r.get(t.id),i=null!=(n=null==a?void 0:a.type)?n:String(t.type),o=t.issues;return{id:t.id,...void 0!==t.parentId?{parentId:t.parentId}:{},type:i,unknownType:!("string"==typeof i&&er.has(i)),title:t.title||(i?null!=(l=ec[i])?l:i:"未知节点"),seq:t.seq,status:t.status,..."number"==typeof t.startedAt&&t.startedAt>0?{startedAt:t.startedAt}:{},...void 0!==t.completedAt?{completedAt:t.completedAt}:{},...t.progress?{progress:t.progress}:{},metrics:null!=(s=t.metrics)?s:{},issues:Array.isArray(o)?o:[],...void 0!==t.payloadRef?{payloadRef:t.payloadRef}:{},children:t.children.map(t=>e(t,r))}})(e,r))})([...et.values()]),[et]),tl=(0,s.useMemo)(()=>(function(e){let t=[],r=e=>{for(let n of e)t.push(n),r(n.children)};return r(e),t.sort(J)})(ts),[ts]),ta=(0,s.useMemo)(()=>new Map(tl.map(e=>[e.id,e])),[tl]),ti=(0,s.useCallback)(()=>{let e=null==$?void 0:$.document;if(!e)return;let t=ea.trim();t&&(ed(!0),(0,j.wI)(e.id,t,{...e_.current?{projectRoot:e_.current}:{}}).then(e=>{var t;eH({kind:"info",text:e.answer?"".concat(e.receipt,"\n").concat(e.answer):e.receipt}),eh(null!=(t=e.candidates)?t:[]),ei(""),eB.current()}).catch(e=>eH({kind:"error",text:e instanceof Error?e.message:"指令未受理"})).finally(()=>ed(!1)))},[$,eH,ea]),to=(0,s.useCallback)(e=>{let t=null==$?void 0:$.document;t&&(ed(!0),(0,j.wI)(t.id,"(选定:".concat(e.label,")"),{...e_.current?{projectRoot:e_.current}:{},acceptedCandidate:{kind:e.kind}}).then(e=>{eH({kind:"info",text:e.receipt}),eh([]),eB.current()}).catch(e=>eH({kind:"error",text:e instanceof Error?e.message:"指令未受理"})).finally(()=>ed(!1)))},[$,eH]),tc=(0,s.useCallback)(()=>{e$.pauseDocument(U).catch(e=>eH({kind:"error",text:e instanceof Error?e.message:"暂停失败"}))},[U,e$,eH]),td=(0,s.useCallback)(()=>{e$.resumePausedDocument(U).catch(e=>eH({kind:"error",text:e instanceof Error?e.message:"继续失败"}))},[U,e$,eH]),tu=(0,s.useCallback)(async e=>{if(U)try{let{document:t}=await (0,j.v7)(U,!1,e_.current);if(!t)return void eH({kind:"warning",text:"记录不存在,无法导出"});await e$.export.exportRecord(t,e)}catch(e){eH({kind:"error",text:e instanceof Error?e.message:"导出失败"})}},[U,e$.export,eH]),tp=e$.boundRecord,tm=function(e,t){if(!e)return;let r=(null==t?void 0:t.docId)===e.id?t:void 0,n=e.deliveryQuality;return n?{...r,docId:e.id,...e.projectRoot?{projectRoot:e.projectRoot}:{},contractQuality:n.receipt,...n.stale?{contractQualityStale:n.stale}:{contractQualityStale:void 0}}:r}(null==$?void 0:$.document,e$.deliveryReadings),tg=e$.canResume,th=null!=(T=null==tp?void 0:tp.status)?T:null==$?void 0:$.document.status,tf=e$.loading||"generating"===th||"queued"===th,tx="paused"===th,tv=function(e,t,r){let[n,l]=(0,s.useState)([]),[a,i]=(0,s.useState)([]),[o,c]=(0,s.useState)(!1),d=(0,s.useRef)(!0),u=(0,s.useRef)(null);(0,s.useEffect)(()=>(d.current=!0,()=>{var e;d.current=!1,null==(e=u.current)||e.abort()}),[]);let p=(0,s.useCallback)(async()=>{var r,n;if(!e){l([]),i([]),c(!1);return}null==(r=u.current)||r.abort();let s=new AbortController;u.current=s;try{let r=await (0,j.lS)(e,t,s.signal);if(!d.current||s.signal.aborted)return;l(Array.isArray(r.messages)?r.messages:[]),i(null!=(n=r.degraded)?n:[]),c(!0===r.tornTail)}catch(e){if(!d.current||s.signal.aborted)return;i([e instanceof Error?e.message:String(e)])}},[e,t]);return(0,s.useEffect)(()=>{p()},[p]),(0,s.useEffect)(()=>{if(!e||"generating"!==r&&"queued"!==r)return;let t=setInterval(()=>{p()},2e3);return()=>clearInterval(t)},[e,p,r]),{messages:n,degraded:a,tornTail:o,reload:p}}(U||null,null!=(P=e_.current)?P:H,th);eB.current=()=>{tv.reload()};let ty=(0,s.useRef)(void 0);(0,s.useEffect)(()=>{let e=ty.current;ty.current=th,void 0!==e&&e!==th&&"generating"!==th&&"queued"!==th&&tv.reload()},[tv.reload,th]);let tj=(0,s.useMemo)(()=>[...ew,...tv.degraded,...tv.tornTail?["会话消息日志末行不完整(进程中断残留):已忽略该行"]:[]],[ew,tv.degraded,tv.tornTail]),tb=(0,s.useMemo)(()=>({...(null==tp?void 0:tp.createdAt)!==void 0?{createdAt:tp.createdAt}:(null==$?void 0:$.document.createdAt)!==void 0?{createdAt:$.document.createdAt}:{},...(null==tp?void 0:tp.requirement)?{requirement:tp.requirement}:{},...(null==tp?void 0:tp.instructions)?{instructions:tp.instructions}:{}}),[$,tp]),tw=(0,s.useMemo)(()=>(function(e){let{tree:t,notices:r,record:n}=e,s=Array.isArray(e.messages)?e.messages:[],l=function(e){let t=new Map;for(let r of eX(e))t.set(r.id,r);return t}(t),a=null!=(c=n.createdAt)?c:0,i=[],o=new Set;for(let e of[...s,...function(e,t){var r,n,s,l;if(t.length>0)return[];let a=null!=(r=e.createdAt)?r:0,i=[];for(let[t,r]of(e.requirement&&e.requirement.trim().length>0&&i.push({id:"record-requirement",t:a,role:"user",text:e.requirement,kind:"requirement"}),(null!=(n=e.instructions)?n:[]).entries()))i.push({id:null!=(s=r.id)?s:"record-instruction-".concat(t),t:r.at,role:"user",text:r.text,...r.kind?{kind:r.kind}:{},...r.status?{status:r.status}:{}}),r.receipt&&r.receipt.trim().length>0&&i.push({id:"".concat(null!=(l=r.id)?l:"record-instruction-".concat(t),"-receipt"),t:r.at+1,role:"assistant",text:r.receipt,kind:"instruction.receipt"});return i}(n,s)]){if("assistant"===e.role){let t="".concat(null!=(d=e.kind)?d:"","\0").concat(e.text);if(o.has(t))continue;o.add(t)}i.push({kind:"message",at:e.t,message:e,agentLabel:function(e,t){var r;if("user"===e.role)return"你";if("system"===e.role)return"系统";let n=null==(r=e.roleName)?void 0:r.trim();if(n)return n;let s=e.nodeId?t.get(e.nodeId):void 0;return s?eE(s,t):"主控智能体"}(e,l)})}for(let e of eX(t))i.push({kind:"action",at:null!=(u=e.startedAt)?u:a,node:e,agentLabel:eE(e,l)});for(let e of r)i.push({kind:"notice",at:e.at,notice:e});var c,d,u,p,m=i.map((e,t)=>({entry:e,index:t})).sort(eV).map(e=>e.entry);let g=[];for(let e of m){let t=g[g.length-1];if("action"===e.kind&&(null==t?void 0:t.kind)==="action"&&eK(e)===eK(t)){g[g.length-1]={...t,repeat:(null!=(p=t.repeat)?p:1)+1};continue}g.push(e)}return g})({tree:ts,messages:tv.messages,notices:eu,record:tb}),[ts,tv.messages,eu,tb]),tk=eA&&null!=(M=ta.get(eA))?M:null,tA=(0,s.useCallback)(e=>{eR(t=>t===e.id?null:e.id)},[]),tN=(0,s.useMemo)(()=>tw.filter(e=>"action"===e.kind),[tw]),tS=(0,s.useCallback)(e=>{var t;let r=tN.findIndex(t=>t.node.id===e.id),s=r>=0?tN[r]:void 0,l=r>0?tN[r-1]:void 0,a=r>=0&&r<tN.length-1?tN[r+1]:void 0,i=e.parentId?ta.get(e.parentId):void 0,o=null==(t=[...tv.messages].reverse().find(t=>t.nodeId===e.id))?void 0:t.text;return(0,n.jsx)(ez,{node:e,agentLabel:null==s?void 0:s.agentLabel,parentTitle:null==i?void 0:i.title,previousTitle:null==l?void 0:l.node.title,nextTitle:null==a?void 0:a.node.title,narrative:o,t:F})},[tN,ta,tv.messages,F]);return U?X?(0,n.jsx)(m.Ay,{status:"warning",title:"生成页打不开",subTitle:X,extra:(0,n.jsxs)(g.A,{children:[(0,n.jsx)(h.Ay,{icon:(0,n.jsx)(x.A,{}),onClick:()=>{tr()},children:"重试"}),(0,n.jsx)(o(),{href:"/generation",children:(0,n.jsx)(h.Ay,{type:"primary",children:"回到生成页"})})]})}):(0,n.jsxs)("div",{className:"sessionPage",children:[(0,n.jsx)(a(),{children:(0,n.jsx)("title",{children:(null==$?void 0:$.document.title)?"".concat($.document.title," \xb7 生成"):"生成"})}),(0,n.jsxs)("div",{className:"sessionBody",children:[(0,n.jsxs)("div",{className:"sessionColumn",children:[(0,n.jsx)("div",{className:"sessionStream",role:"log",children:Q?(0,n.jsx)("div",{className:"sessionLoading",children:(0,n.jsxs)(g.A,{orientation:"vertical",align:"center",children:[(0,n.jsx)(p.A,{}),(0,n.jsx)(eZ,{type:"secondary",children:"正在读取执行记录…"})]})}):(0,n.jsxs)(n.Fragment,{children:["error"===es&&(0,n.jsx)("div",{className:"sessionConnectionNote",children:"连接中断,正在重连…"}),tj.length>0&&(0,n.jsxs)("div",{className:"sessionDegraded",children:[(0,n.jsx)(v.A,{})," ",(0,n.jsx)("span",{children:tj.join(";")})]}),(0,n.jsx)(eO,{entries:tw,detailNodeId:eA,onOpenDetails:tA,renderDetails:e=>tk&&tk.id===e.id?tS(tk):null,t:F})]})}),(0,n.jsx)("div",{className:"sessionBottom",children:(0,n.jsx)(eC.D,{suggestions:eg.map(e=>({key:e.kind,label:"按「".concat(e.label,"」执行"),onClick:()=>to(e)})),value:ea,onChange:ei,onSend:ti,generating:!!tf,submitting:eo,disabled:!$,...$?{}:{disabledReason:"正在读取记录…"},paused:tx,resumable:tg,onPause:tc,onResume:td,onContinue:()=>{tp&&e$.resumeDocument(tp)},hasDeliverable:(null!=(D=null==tp?void 0:tp.wordCount)?D:0)>0||["completed","completed_with_issues","warning"].includes(null!=th?th:""),onPreviewDeliverable:e4})}),(0,n.jsx)(eb._,{currentDocumentId:U,...H?{projectRoot:H}:{},onSelect:e=>{e3(),B.push((0,eS.T)(e.id,e.projectRoot||H))},onCurrentDeleted:()=>{e3(),B.push("/generation")}})]}),ev&&(0,n.jsx)("aside",{className:"deliverablePanel".concat(ef?" is-open":""),"aria-label":"成稿面板",style:{width:ef?e5:0},children:(0,n.jsxs)("div",{className:"deliverablePanelInner",style:{width:e5},children:[ef&&(0,n.jsx)("div",{className:"deliverablePanelResize",role:"separator","aria-orientation":"vertical","aria-label":"调整成稿面板宽度","aria-valuemin":420,"aria-valuenow":e5,tabIndex:0,onPointerDown:e=>{e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),eW.current={startX:e.clientX,startWidth:e5}},onPointerMove:e=>{let t=eW.current;if(!t)return;let r=e6(t.startWidth+(t.startX-e.clientX));eF.current=r,eT(r)},onPointerUp:e8,onPointerCancel:e8,onKeyDown:e=>{if("ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.preventDefault();let t=e6(e5+("ArrowLeft"===e.key?24:-24));eF.current=t,eT(t),e9()}}),(0,n.jsxs)("header",{className:"deliverablePanelHeader",children:[(0,n.jsx)("div",{className:"deliverablePanelHeading",children:(0,n.jsx)(eZ,{strong:!0,children:"成稿"})}),(0,n.jsxs)(g.A,{size:4,wrap:!0,className:"deliverablePanelActions",children:[(0,n.jsx)(eN,{reports:e$.export.exportReports,deliveryReadings:tm,t:F}),(0,n.jsx)(h.Ay,{size:"small",onClick:()=>{tu("docx")},loading:!!e$.export.exporting,children:"DOCX"}),(0,n.jsx)(h.Ay,{size:"small",onClick:()=>{tu("pdf")},loading:!!e$.export.exporting,children:"PDF"}),(0,n.jsx)(f.A,{title:"重新取回",children:(0,n.jsx)(h.Ay,{size:"small","aria-label":"重新取回成稿",icon:(0,n.jsx)(x.A,{}),onClick:()=>{e1.load()},loading:e1.loading})}),(0,n.jsx)(f.A,{title:"关闭",children:(0,n.jsx)(h.Ay,{size:"small","aria-label":"关闭成稿面板",icon:(0,n.jsx)(y.A,{}),onClick:e3})})]})]}),(0,n.jsx)("div",{className:"deliverablePanelBody",children:(0,n.jsx)(ej,{status:null!=(L=null==(e=e1.preview)?void 0:e.status)?L:th,title:null!=(q=null==(t=e1.preview)?void 0:t.title)?q:null==$?void 0:$.document.title,html:null==(r=e1.preview)?void 0:r.html,source:null==(l=e1.preview)?void 0:l.source,truncated:null==(i=e1.preview)?void 0:i.truncated,totalChars:null==(d=e1.preview)?void 0:d.totalChars,renderedChars:null==(k=e1.preview)?void 0:k.renderedChars,stats:null==(A=e1.preview)?void 0:A.stats,gate:null!=(z=null!=(_=null==(N=e1.preview)?void 0:N.gate)?_:null==$?void 0:$.gate)?z:null,sectionProgress:null==(S=e1.preview)?void 0:S.sectionProgress,budgetPause:null==(C=e1.preview)?void 0:C.budgetPause,deliveryReadings:tm,loading:e1.loading,error:e1.error,onRetry:()=>{e1.load()},updatedAt:null==(R=e1.preview)?void 0:R.updatedAt,generatedAt:null==(I=e1.preview)?void 0:I.generatedAt,t:F})})]})})]})]}):(0,n.jsx)("div",{className:"appShellPlaceholder",children:(0,n.jsx)(p.A,{style:{margin:48}})})}}},e=>{e.O(0,[855,551,210,702,399,576,499,61,112,333,350,326,636,593,792],()=>e(e.s=70130)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2],{9452:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>p});var n=s(65321),a=s(97109),r=s(3454),o=s.n(r),i=s(86109),c=s(17807),l=s(6578),u=s(48702),d=s(2518),h=s(45907),f=s(28629);function p(){var e;let t=(0,i.useRouter)(),s=(0,u.Vr)(),{message:r}=c.A.useApp(),[p,v]=(0,a.useState)([]),[m,g]=(0,a.useState)(""),[j,b]=(0,a.useState)(""),[y,w]=(0,a.useState)(""),[E,_]=(0,a.useState)(!1),[x,N]=(0,a.useState)(null);(0,a.useEffect)(()=>{(async()=>{try{var e;let t=await (0,l.le)();N((null==(e=t.constructionRuntime)?void 0:e.generationReady)===!0)}catch(e){N(!1)}})()},[]),(0,a.useEffect)(()=>{(async()=>{try{let e=await (0,l.ef)();v(e.groups),g(e.projectRoot)}catch(e){r.error(e instanceof Error?e.message:"读取项目资料失败")}})()},[r]);let O=(0,a.useMemo)(()=>p.map(e=>({value:e.root,label:"".concat(e.root,"(").concat(e.fileCount," 份").concat(e.mixedProjectNos?" \xb7 含多个项目编号,需先拆分":"",")")})),[p]),A=null!=(e=O.find(e=>e.value===j))?e:null,P=(0,a.useCallback)(async()=>{if(A){_(!0);try{let e=await (0,l.OX)({requirement:y,materialRoot:j,...j?{projectName:j}:{},projectRoot:m});if(!e.documentId)throw Error("服务端未返回 documentId");await t.push((0,f.T)(e.documentId,m))}catch(e){r.error(e instanceof Error?e.message:"创建生成任务失败")}finally{_(!1)}}},[j,r,m,y,t,A]);return(0,n.jsxs)("div",{className:"sessionPage sessionEmptyPage",children:[(0,n.jsx)(o(),{children:(0,n.jsx)("title",{children:s("nav.generation")})}),(0,n.jsxs)("div",{className:"sessionEmpty",children:[(0,n.jsx)("div",{className:"sessionEmptyTitle",children:"开始一次生成"}),(0,n.jsx)("div",{className:"sessionEmptyHint",children:"选好项目资料,直接点输入框右下角的箭头生成;有额外要求再写进输入框。 生成开始后,智能体的动作与消息会在这里逐条展开。"})]}),(0,n.jsx)(h._,{...m?{projectRoot:m}:{},onSelect:e=>{t.push((0,f.T)(e.id,e.projectRoot||m))},onCurrentDeleted:()=>void 0}),(0,n.jsx)("div",{className:"sessionBottom",children:(0,n.jsx)(d.D,{value:y,onChange:w,onSend:()=>{P()},generating:!1,submitting:E,disabled:!0!==x,disabledReason:null===x?"正在读取生成入口状态…":"生成入口尚未就绪(新链路装配未完成):发起会被显式拒收,不会排队等待",requireGenerationSetup:!0,projectOptions:O,selectedProject:A,onSelectProject:b,paused:!1,resumable:!1,onPause:()=>void 0,onResume:()=>void 0,onContinue:()=>void 0})})]})}},26681:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/generation",function(){return s(9452)}])},29071:(e,t,s)=>{"use strict";s.d(t,{A:()=>i});var n=s(97109),a=s(78847),r=s(88483);function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e}).apply(this,arguments)}let i=n.forwardRef((e,t)=>n.createElement(r.A,o({},e,{ref:t,icon:a.A})))},54746:(e,t,s)=>{"use strict";s.d(t,{A:()=>i});var n=s(97109),a=s(71242),r=s(88483);function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e}).apply(this,arguments)}let i=n.forwardRef((e,t)=>n.createElement(r.A,o({},e,{ref:t,icon:a.A})))},71242:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"}},78847:(e,t)=>{"use strict";t.A={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M848 359.3H627.7L825.8 109c4.1-5.3.4-13-6.3-13H436c-2.8 0-5.5 1.5-6.9 4L170 547.5c-3.1 5.3.7 12 6.9 12h174.4l-89.4 357.6c-1.9 7.8 7.5 13.3 13.3 7.7L853.5 373c5.2-4.9 1.7-13.7-5.5-13.7zM378.2 732.5l60.3-241H281.1l189.6-327.4h224.6L487 427.4h211L378.2 732.5z"}}]},name:"thunderbolt",theme:"outlined"}}},e=>{e.O(0,[855,551,210,399,576,499,61,333,326,636,593,792],()=>e(e.s=26681)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[332],{15766:(_,n,u)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return u(76933)}])},76933:(_,n,u)=>{"use strict";u.r(n),u.d(n,{__N_SSP:()=>e,default:()=>r});var e=!0;function r(){return null}}},_=>{_.O(0,[636,593,792],()=>_(_.s=15766)),_N_E=_.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[232],{46196:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>O});var a=t(65321),r=t(97109),l=t(17807),n=t(25258),o=t(84253),i=t(85114),c=t(49292),d=t(14932),x=t(7576),m=t(88762),u=t(58209),j=t(53998),g=t(30486),h=t(48702),b=t(93360),p=t(82238),v=t(64629),f=t(84742),w=t(58740),N=t(38762),y=t(11702),T=t(99605),A=t(32965),S=t(38964),k=t(48399),C=t(58690);let L={processing:"jobs.statusProcessing",success:"jobs.statusSuccess",warning:"jobs.statusWarning",error:"jobs.statusError"},P={document:"jobs.typeDocument",upload:"jobs.typeUpload",reindex:"jobs.typeReindex",delete:"jobs.typeDelete"},_={uploading:"jobs.stageUploading",parsing:"jobs.stageParsing",chunking:"jobs.stageChunking",vectorizing:"jobs.stageVectorizing",generating:"jobs.stageGenerating",validating:"jobs.stageValidating",done:"jobs.stageDone",error:"jobs.stageError"};function z(e,s){return s?new Date(e).toLocaleString():String(e)}function D(e){let{rows:s,mounted:t,onRemove:r,empty:l}=e,n=(0,h.Vr)(),o=[{title:n("jobs.colStatus"),dataIndex:"status",width:108,render:(e,s)=>{var t,r;return(0,a.jsx)(y.A,{color:"processing"===(t=s.status)?"processing":"success"===t?"success":"warning"===t?"warning":"error",icon:"processing"===(r=s.status)?(0,a.jsx)(v.A,{spin:!0}):"success"===r?(0,a.jsx)(f.A,{}):"warning"===r?(0,a.jsx)(w.A,{}):(0,a.jsx)(N.A,{}),className:"m-0",children:n(L[s.status])})}},{title:n("jobs.colTask"),dataIndex:"title",render:(e,s)=>{let t=s.error||s.message;return(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,a.jsx)("span",{className:"jobsCellLine font-medium text-[var(--colorText)]",title:s.title,children:s.title}),s.id.startsWith("intelligence-mixed-")?(0,a.jsx)(d.A,{title:n("jobs.residentHint"),children:(0,a.jsx)(y.A,{color:"purple",className:"m-0 shrink-0",children:n("jobs.resident")})}):null]}),t?(0,a.jsx)("div",{className:"jobsCellLine mt-1 text-xs ".concat(s.error?"text-[var(--colorDanger)]":"text-[var(--colorTextTertiary)]"),title:t,children:t}):null]})}},{title:n("jobs.typeLabel"),dataIndex:"type",width:104,render:(e,s)=>(0,a.jsx)("span",{className:"text-[var(--colorTextSecondary)]",children:n(P[s.type])})},{title:n("jobs.stageLabel"),dataIndex:"stage",width:116,render:(e,s)=>(0,a.jsx)("span",{className:"jobsCellLine block font-mono text-xs text-[var(--colorTextSecondary)]",title:s.stage,children:_[s.stage]?n(_[s.stage]):s.stage})},{title:n("jobs.colProgress"),dataIndex:"percent",width:168,render:(e,s)=>{let t=Math.max(0,Math.min(100,Math.round(s.percent||0))),r="error"===s.status?"exception":"success"===s.status?"success":"processing"===s.status?"active":"normal";return(0,a.jsx)(T.A,{percent:t,status:r,size:"small"})}},{title:n("jobs.updatedAtLabel"),dataIndex:"updatedAt",width:176,render:e=>(0,a.jsx)("span",{className:"font-mono text-xs text-[var(--colorTextSecondary)]",children:z(e,t)})},{title:n("jobs.colActions"),key:"actions",width:72,align:"right",render:(e,s)=>"processing"===s.status?null:(0,a.jsx)(A.A,{title:n("jobs.removeConfirm"),onConfirm:()=>r(s),okText:n("common.confirm"),cancelText:n("common.cancel"),children:(0,a.jsx)(i.Ay,{size:"small",type:"text",danger:!0,icon:(0,a.jsx)(u.A,{}),title:n("jobs.remove")})})}];return(0,a.jsx)(S.A,{rowKey:"id",dataSource:s,columns:o,size:"middle",className:"flex-1 border-0 modern-table tableFillHeight",tableLayout:"fixed",locale:{emptyText:l},pagination:(0,C.B)(n),expandable:{expandedRowRender:e=>(0,a.jsx)(E,{job:e,mounted:t})}})}function F(e){let{label:s,value:t,className:r}=e;return(0,a.jsxs)("div",{className:"flex gap-3 ".concat(null!=r?r:""),children:[(0,a.jsx)("span",{className:"w-20 shrink-0 text-[var(--colorTextTertiary)]",children:s}),(0,a.jsx)("span",{className:"min-w-0 break-words text-[var(--colorTextSecondary)]",children:t})]})}function E(e){var s;let{job:t,mounted:r}=e,l=(0,h.Vr)(),n=null!=(s=t.details)?s:[],o=n.slice(0,200),i=n.length-o.length;return(0,a.jsxs)("div",{className:"flex flex-col gap-3 px-4 py-3 text-xs",children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-x-8 gap-y-2 sm:grid-cols-2 xl:grid-cols-3",children:[(0,a.jsx)(F,{label:l("jobs.createdAtLabel"),value:z(t.createdAt,r)}),t.chunkCount?(0,a.jsx)(F,{label:l("jobs.chunksLabel"),value:t.chunkCount}):null,(0,a.jsx)(F,{label:l("jobs.idLabel"),value:(0,a.jsx)(k.A.Text,{copyable:!0,className:"font-mono text-xs",children:t.id})}),t.filePath?(0,a.jsx)(F,{className:"sm:col-span-2 xl:col-span-3",label:l("jobs.fileLabel"),value:(0,a.jsx)("span",{className:"break-all font-mono",children:t.filePath})}):null]}),t.error?(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"mb-1 text-[var(--colorTextTertiary)]",children:l("jobs.errorLabel")}),(0,a.jsx)("div",{className:"max-h-40 overflow-auto whitespace-pre-wrap break-words text-[var(--colorDanger)]",children:t.error})]}):null,t.message&&t.message!==t.error?(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"mb-1 text-[var(--colorTextTertiary)]",children:l("jobs.messageLabel")}),(0,a.jsx)("div",{className:"max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-[var(--colorTextSecondary)]",children:t.message})]}):null,n.length>0?(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"mb-1 text-[var(--colorTextTertiary)]",children:l("jobs.diagnostics")}),(0,a.jsx)("ul",{className:"m-0 max-h-80 overflow-auto rounded-lg border border-[var(--borderColor)] bg-[var(--colorFillAlter)] py-2 pl-6 leading-5 text-[var(--colorTextSecondary)]",children:o.map((e,s)=>(0,a.jsx)("li",{className:"break-words",children:e},"".concat(t.id,"-").concat(s)))}),i>0?(0,a.jsx)("div",{className:"mt-1 text-[var(--colorTextTertiary)]",children:l("jobs.detailsMore").replace("{count}",String(i))}):null]}):null]})}var I=t(73662),M=t(6578);function O(){let e=(0,h.Vr)(),{message:s}=l.A.useApp(),{jobs:t,loaded:v,loadFailed:f,mounted:w,truncated:N,reload:y}=(0,I.M4)(),[T,A]=(0,r.useState)("all"),[S,k]=(0,r.useState)(""),[C,L]=(0,r.useState)(!1),P=async t=>{try{await (0,M.CU)(t),s.success(e("jobs.removed")),await y()}catch(t){s.error(e("jobs.removeFailed"))}},_=(0,r.useMemo)(()=>({all:t.length,processing:t.filter(e=>"processing"===e.status).length,warning:t.filter(e=>"warning"===e.status).length,error:t.filter(e=>"error"===e.status).length}),[t]),z=(0,r.useMemo)(()=>{let e=S.trim().toLowerCase();return t.filter(s=>{var t;return("all"===T||s.status===T)&&(!e||[s.title,s.stage,s.message,s.error,s.fileName,s.filePath,s.id,...null!=(t=s.details)?t:[]].filter(Boolean).some(s=>String(s).toLowerCase().includes(e)))})},[t,T,S]),F="all"!==T||S.trim().length>0,E=f?(0,a.jsx)("span",{className:"text-sm text-[var(--colorTextTertiary)]",children:"—"}):0===t.length?(0,a.jsx)(o.A,{className:"py-12",description:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"text-[var(--colorTextSecondary)]",children:e("jobs.empty")}),(0,a.jsx)("div",{className:"mt-1 text-xs text-[var(--colorTextTertiary)]",children:e("jobs.emptyHint")})]})}):(0,a.jsx)(o.A,{className:"py-12",description:e("jobs.noMatch")});return(0,a.jsxs)("div",{className:"h-[calc(100vh_-_72px)] flex flex-col animateFadeIn",children:[(0,a.jsx)(b.z,{title:e("jobs.title"),description:e("jobs.pageSubtitle"),extra:(0,a.jsx)(i.Ay,{danger:!0,icon:(0,a.jsx)(u.A,{}),disabled:0===t.length,loading:C,onClick:()=>{n.A.confirm({title:e("jobs.clearConfirmTitle"),content:(0,a.jsxs)("div",{className:"text-sm",children:[(0,a.jsx)("div",{children:e("jobs.clearConfirmContent")}),(0,a.jsx)("div",{className:"mt-1 text-[var(--colorTextSecondary)]",children:e("jobs.clearConfirmWarning")})]}),okText:e("jobs.clearAll"),cancelText:e("common.cancel"),okButtonProps:{danger:!0},onOk:async()=>{L(!0);try{await (0,M.H7)(),s.success(e("jobs.cleared")),await y()}catch(t){s.error(e("jobs.clearFailed"))}finally{L(!1)}}})},children:e("jobs.clearAll")})}),(0,a.jsxs)("div",{className:"mt-6 flex min-h-0 flex-1 flex-col overflow-hidden rounded-2xl bg-[var(--colorBgContainer)] shadow-[var(--shadowSurface)]",children:[f&&(0,a.jsx)("div",{className:"shrink-0 p-4 pb-0",children:(0,a.jsx)(p.X,{failures:["后台任务列表"],note:t.length>0?"下方列表仍是上次成功读取的内容,可能已过期。":void 0})}),(0,a.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center justify-between gap-x-3 gap-y-2 border-b border-[var(--borderColor)] bg-[var(--colorBgHover)] p-4",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[(0,a.jsx)(c.A,{value:T,onChange:e=>A(e),options:[{label:"".concat(e("jobs.filterAll")," ").concat(_.all),value:"all"},{label:"".concat(e("jobs.statusProcessing")," ").concat(_.processing),value:"processing"},{label:"".concat(e("jobs.statusWarning")," ").concat(_.warning),value:"warning"},{label:"".concat(e("jobs.statusError")," ").concat(_.error),value:"error"}]}),F&&(0,a.jsx)("span",{className:"text-xs text-[var(--colorTextSecondary)]",children:e("jobs.filteredRecords").replace("{count}",String(z.length))}),N&&(0,a.jsx)(d.A,{title:e("jobs.limitHint").replace("{count}",String(I.FX)),children:(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs text-[var(--colorTextTertiary)]",children:[(0,a.jsx)(j.A,{})," ",e("jobs.limitNotice").replace("{count}",String(I.FX))]})})]}),(0,a.jsx)("div",{className:"w-full shrink-0 lg:w-80",children:(0,a.jsx)(x.A,{allowClear:!0,prefix:(0,a.jsx)(g.A,{}),value:S,onChange:e=>k(e.target.value),placeholder:e("jobs.searchPlaceholder"),className:"w-full"})})]}),v||f?(0,a.jsx)(D,{rows:z,mounted:w,onRemove:e=>{P(e.id)},empty:E}):(0,a.jsx)("div",{className:"p-6",children:(0,a.jsx)(m.A,{active:!0,paragraph:{rows:6}})})]})]})}},47457:(e,s,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/jobs",function(){return t(46196)}])},58690:(e,s,t)=>{"use strict";function a(e){var s,t,a;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{defaultPageSize:null!=(s=r.pageSize)?s:10,pageSizeOptions:null!=(t=r.pageSizeOptions)?t:[10,20,50,100],showSizeChanger:!0,showTotal:s=>{var t,a;return e(null!=(t=r.totalLabelKey)?t:"common.totalRows",null!=(a=r.totalLabelFallback)?a:"共 {count} 条").replace("{count}",String(s))},hideOnSinglePage:null!=(a=r.hideOnSinglePage)&&a,showQuickJumper:!1}}t.d(s,{B:()=>a})},82238:(e,s,t)=>{"use strict";t.d(s,{X:()=>r});var a=t(65321);function r(e){let{failures:s,note:t}=e;return 0===s.length?null:(0,a.jsxs)("div",{role:"alert",className:"rounded-xl border border-[var(--colorDanger)]/30 bg-[var(--colorDanger)]/10 px-4 py-3 text-sm text-[var(--colorDanger)]",children:["".concat(s.length," 项数据读取失败:").concat(s.join("、"),"——相关读数显示为「—」(未知),**不代表 0**;请稍后重试。"),t?(0,a.jsx)("div",{className:"mt-1 text-xs opacity-90",children:t}):null]})}},93360:(e,s,t)=>{"use strict";t.d(s,{z:()=>l});var a=t(65321);t(97109);var r=t(33442);function l(e){let{title:s,description:t,extra:l,bottomContent:n}=e;return(0,a.jsxs)("div",{className:"animateFadeIn",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-end justify-between gap-4 pb-6 border-b border-[var(--borderColor)]",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h1",{className:"text-3xl font-extrabold tracking-tight text-[var(--colorText)] mb-2",children:s}),t&&(0,a.jsx)("p",{className:"text-sm text-[var(--colorTextSecondary)] m-0",children:t})]}),l&&(0,a.jsx)(r.A,{className:"w-full sm:w-auto overflow-x-auto pb-1 sm:pb-0 shrink-0",size:"middle",wrap:!1,children:l})]}),n&&(0,a.jsx)("div",{className:"mt-6",children:n})]})}}},e=>{e.O(0,[855,551,210,702,665,399,576,499,338,61,964,325,636,593,792],()=>e(e.s=47457)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[309],{14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusCard:"style_statusCard__H7Mee",statusSummary:"style_statusSummary__7KavF",statusSummaryText:"style_statusSummaryText__Shw3j",statusClearBtn:"style_statusClearBtn__uJ9bE",statusExpandBtn:"style_statusExpandBtn__HhgIj",statusFilters:"style_statusFilters__g_LbG",filterPill:"style_filterPill__1pjFW",filterPillActive:"style_filterPillActive___UZVi",statusPanel:"style_statusPanel__9arTu",statusEmpty:"style_statusEmpty__8LWzH",timelineList:"style_timelineList__dqJrz",timelineItem:"style_timelineItem__dbuL_",timelineStatusIcon:"style_timelineStatusIcon__SkRwb",timelinePercent:"style_timelinePercent__pEyH4",timelineRow:"style_timelineRow__EDOVa",timelineTitle:"style_timelineTitle__Yujr8",timelineClose:"style_timelineClose__Byx_9",timelineDetail:"style_timelineDetail__nALei",timelineDesc:"style_timelineDesc__FMjWE",timelinePath:"style_timelinePath__C9VQI",timelineMeta:"style_timelineMeta__u_pCn",timelineMetaTag:"style_timelineMetaTag__G3jF1",timelineExpandArrow:"style_timelineExpandArrow__xIBdF",timelineExpandArrowOpen:"style_timelineExpandArrowOpen__TWWDC",fileNameCell:"style_fileNameCell__EHsnt",folderName:"style_folderName__VhLXP",folderRow:"style_folderRow__d7k9S",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG"}},37690:(e,t,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/file-detail",function(){return l(89791)}])},45551:(e,t,l)=>{"use strict";function n(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),l=e/Math.pow(1024,t);return"".concat(l.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let l=Math.floor(Math.floor((Date.now()-e)/1e3)/60),n=Math.floor(l/60),r=Math.floor(n/24);return r>30?new Date(e).toLocaleDateString(t):"en-US"===t?r>0?"".concat(r,"d ago"):n>0?"".concat(n,"h ago"):l>0?"".concat(l,"m ago"):"Just now":r>0?"".concat(r," 天前"):n>0?"".concat(n," 小时前"):l>0?"".concat(l," 分钟前"):"刚刚"}l.d(t,{Jm:()=>o,fw:()=>r,mc:()=>i,z3:()=>n});let s={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},a={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function o(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===l?a:s)[e])?t:e}let i={active:"common.statusIndexed",outdated:"common.statusOutdated",error:"common.statusAbnormal",deleted:"common.statusDeleted",disk:"common.statusNotIndexed"}},58690:(e,t,l)=>{"use strict";function n(e){var t,l,n;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{defaultPageSize:null!=(t=r.pageSize)?t:10,pageSizeOptions:null!=(l=r.pageSizeOptions)?l:[10,20,50,100],showSizeChanger:!0,showTotal:t=>{var l,n;return e(null!=(l=r.totalLabelKey)?l:"common.totalRows",null!=(n=r.totalLabelFallback)?n:"共 {count} 条").replace("{count}",String(t))},hideOnSinglePage:null!=(n=r.hideOnSinglePage)&&n,showQuickJumper:!1}}l.d(t,{B:()=>n})},85979:(e,t,l)=>{"use strict";l.d(t,{k:()=>o});var n=l(65321),r=l(43220),s=l.n(r),a=l(91648);function o(e){let{backHref:t,backLabel:l,title:r,description:o,extra:i}=e;return(0,n.jsx)("div",{className:"mb-6 bg-[var(--colorBgContainer)] rounded-2xl overflow-hidden border border-[var(--borderColor)] p-6",children:(0,n.jsxs)("div",{className:"flex flex-col md:flex-row md:items-end justify-between gap-4 md:gap-6",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,n.jsxs)(s(),{href:t,prefetch:!1,className:"detailBack",children:[(0,n.jsx)(a.A,{size:16,strokeWidth:2,"aria-hidden":!0}),(0,n.jsx)("span",{children:l})]}),(0,n.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,n.jsx)("h1",{className:"text-2xl font-bold text-[var(--colorText)] m-0 truncate",children:r}),o?(0,n.jsx)("p",{className:"text-sm text-[var(--colorTextSecondary)] m-0 break-all",children:o}):null]})]}),i?(0,n.jsx)("div",{className:"shrink-0 flex items-center gap-2",children:i}):null]})})}},89791:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>K});var n=l(65321),r=l(97109),s=l(86109),a=l(48399),o=l(9750),i=l(42644),c=l(10252),d=l(74567),u=l(48921),m=l(98379),h=l(3638),g=l(632),x=l(34475),p=l(52093),f=l(60815),w=l(5741);let _=null,y=e=>e(),k=[],b={};function j(){let{getContainer:e,duration:t,rtl:l,maxCount:n,top:r,stack:s}=b,a=e?.()||document.body;return{getContainer:()=>a,duration:t,rtl:l,maxCount:n,top:r,stack:s}}let v=r.forwardRef((e,t)=>{let{messageConfig:l,sync:n}=e,{getPrefixCls:s}=(0,r.useContext)(d.QO),a=b.prefixCls||s("message"),o=(0,r.useContext)(c.B),[i,u]=(0,f.y)({...l,prefixCls:a,...o.message});return r.useImperativeHandle(t,()=>{let e={...i};return Object.keys(e).forEach(t=>{e[t]=(...e)=>(n(),i[t].apply(i,e))}),{instance:e,sync:n}}),u}),C=r.forwardRef((e,t)=>{let[l,n]=r.useState(j),s=()=>{n(j)};r.useEffect(s,[]);let a=(0,u.cr)(),o=a.getRootPrefixCls(),i=a.getIconPrefixCls(),c=a.getTheme(),d=r.createElement(v,{ref:t,sync:s,messageConfig:l});return r.createElement(u.Ay,{prefixCls:o,iconPrefixCls:i,theme:c},a.holderRender?a.holderRender(d):d)}),A=()=>{if(!_){let e=document.createDocumentFragment(),t={fragment:e};_=t,y(()=>{(0,i.XX)(r.createElement(C,{ref:e=>{let{instance:l,sync:n}=e||{};Promise.resolve().then(()=>{!t.instance&&l&&(t.instance=l,t.sync=n,A())})}}),e)});return}_.instance&&(k.forEach(e=>{let{type:t,skipped:l}=e;if(!l)switch(t){case"open":y(()=>{let t=_.instance.open({...b,...e.config});t?.then(e.resolve),e.setCloseFn(t)});break;case"destroy":y(()=>{_?.instance.destroy(e.key)});break;default:y(()=>{var l;let n=(l=_.instance)[t].apply(l,(0,o.A)(e.args));n?.then(e.resolve),e.setCloseFn(n)})}}),k=[])},N={open:function(e){let t=(0,w.E)(t=>{let l,n={type:"open",config:e,resolve:t,setCloseFn:e=>{l=e}};return k.push(n),()=>{l?y(()=>{l()}):n.skipped=!0}});return A(),t},destroy:e=>{k.push({type:"destroy",key:e}),A()},config:function(e){b={...b,...e},y(()=>{_?.sync?.()})},useMessage:f.A,_InternalPanelDoNotUseOrYouWillBeFired:x.Ay,_InternalListDoNotUseOrYouWillBeFired:e=>{let{items:t,classNames:l,style:n}=e,{getPrefixCls:s}=(0,d.TP)("message"),a=s("message"),o=(0,g.A)(a),[i,c]=(0,p.A)(a,o),u=`${a}-notice`,f=t.map(e=>{let{content:t,duration:l,key:n,type:r}=e,s=r?`${u}-icon-${r}`:void 0;return{key:n,duration:l,icon:(0,x.HC)(r),title:t,className:`${u}-${r}`,classNames:{wrapper:`${a}-${r}`,icon:s}}});return r.createElement(m.qb,{prefixCls:a,placement:"top",configList:f,className:(0,h.$)(i,c,o),classNames:{...l,wrapper:l?.wrapper,title:l?.title},style:n,stack:!1})}};["success","info","warning","error","loading"].forEach(e=>{N[e]=(...t)=>(function(e,t){(0,u.cr)();let l=(0,w.E)(l=>{let n,r={type:e,args:t,resolve:l,setCloseFn:e=>{n=e}};return k.push(r),()=>{n?y(()=>{n()}):r.skipped=!0}});return A(),l})(e,t)});var S=l(11702),I=l(33442),F=l(88762),P=l(68787),E=l(85493),R=l(84253),T=l(85114),L=l(76506),B=l(7576),z=l(38964),D=l(6578),M=l(48702),O=l(85979),J=l(45551),H=l(14569),V=l.n(H),$=l(58690);let{Paragraph:U}=a.A;function W(e){if(!e)return{};try{return JSON.parse(e)}catch(e){return{}}}function q(e,t){let l=t.trim()?[t.trim(),...t.split(/[\s,,。;;::、]+/u)].filter(Boolean).sort((e,t)=>t.length-e.length):[];if(0===l.length)return e;let r=RegExp("(".concat(l.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")).join("|"),")"),"giu");return e.split(r).map((e,t)=>l.some(t=>t.toLowerCase()===e.toLowerCase())?(0,n.jsx)("mark",{children:e},t):e)}function K(){var e,t,l,a,o,i,c,d;let u=(0,M.Vr)(),m=(0,s.useRouter)(),h="string"==typeof m.query.relativePath?m.query.relativePath:"",g="string"==typeof m.query.projectRoot?m.query.projectRoot:void 0,[x,p]=(0,r.useState)(),[f,w]=(0,r.useState)(!1),[_,y]=(0,r.useState)(""),[k,b]=(0,r.useState)(!1),[j,v]=(0,r.useState)("");(0,r.useEffect)(()=>{h&&(w(!0),y(""),(0,D.xC)(h,g).then(p).catch(e=>{p(void 0),y(e instanceof Error?e.message:u("knowledge.fileDetailLoadFailed"))}).finally(()=>w(!1)))},[h,g,u]);let C=(0,r.useMemo)(()=>(function(e){let t=W(null==e?void 0:e.file.metadataJson);return"object"==typeof t.extraction&&t.extraction?t.extraction:t})(x),[x]),A=j.trim().toLowerCase(),H=(0,r.useMemo)(()=>{var e;return x&&A?x.chunks.filter(e=>{let t=W(e.metadataJson);return[e.content,e.sectionTitle,t.rowRange,t.chunkKind,t.parentId,JSON.stringify(t)].some(e=>String(null!=e?e:"").toLowerCase().includes(A))}):null!=(e=null==x?void 0:x.chunks)?e:[]},[x,A]),K=(0,r.useMemo)(()=>{var e;return x&&A?x.parents.filter(e=>[e.content,e.sectionTitle,e.parentId,e.metadataJson].some(e=>String(null!=e?e:"").toLowerCase().includes(A))):null!=(e=null==x?void 0:x.parents)?e:[]},[x,A]),X=async()=>{if(h){b(!0);try{let e=await (0,D.HC)(h,g);e.detail&&p(e.detail),N.success(u("knowledge.fileReindexed"))}finally{b(!1)}}},G=async e=>{h&&(await (0,D.tn)(h,e,g),N.success("file"===e?u("knowledge.openFileRequested"):u("knowledge.openDirectoryRequested")))},Q=[{title:u("knowledge.index"),key:"index",width:70,render:(e,t,l)=>l+1},{title:u("knowledge.chunkIndex"),dataIndex:"chunkIndex",width:90,render:e=>String(e)},{title:u("knowledge.chunkType"),width:110,render:(e,t)=>{var l;return(0,n.jsx)(S.A,{children:String(null!=(l=W(t.metadataJson).chunkKind)?l:t.category)})}},{title:u("knowledge.sectionOrRange"),width:220,render:(e,t)=>{let l=W(t.metadataJson),r="string"==typeof l.rowRange?l.rowRange:void 0;return(0,n.jsxs)(I.A,{wrap:!0,children:[t.sectionTitle?(0,n.jsx)(S.A,{color:"cyan",children:t.sectionTitle}):null,r?(0,n.jsxs)(S.A,{color:"gold",children:[u("knowledge.rowPrefix")," ",r]}):null]})}},{title:u("knowledge.tokens"),dataIndex:"tokenCount",width:90},{title:u("knowledge.chunkContent"),render:(e,t)=>(0,n.jsx)(U,{ellipsis:{rows:3,expandable:!0,symbol:u("knowledge.openExpand")},className:V().searchContent,children:q(t.content,j)})}],Y=[{title:u("knowledge.index"),key:"index",width:70,render:(e,t,l)=>l+1},{title:u("knowledge.parentChunkId"),dataIndex:"parentId",width:260,render:e=>(0,n.jsx)("span",{className:"break-all",children:e})},{title:u("knowledge.chunkCount"),dataIndex:"chunkCount",width:90},{title:u("knowledge.section"),dataIndex:"sectionTitle",width:220},{title:u("knowledge.chunkContent"),render:(e,t)=>(0,n.jsx)(U,{ellipsis:{rows:3,expandable:!0,symbol:u("knowledge.openExpand")},className:V().searchContent,children:q(t.content,j)})}];return f?(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsx)(F.A,{active:!0,paragraph:{rows:1}}),(0,n.jsx)(P.A,{size:"small",children:(0,n.jsx)(F.A,{active:!0,paragraph:{rows:6}})}),(0,n.jsx)(P.A,{size:"small",children:(0,n.jsx)(F.A,{active:!0,paragraph:{rows:4}})})]}):_?(0,n.jsx)(E.A,{type:"error",showIcon:!0,description:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{children:u("knowledge.fileDetailLoadFailed")}),(0,n.jsx)("div",{children:_})]})}):x?(0,n.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,n.jsx)(O.k,{backHref:"/knowledge",backLabel:u("knowledge.backToFileList"),title:u("knowledge.fileDetailTitle"),description:u("knowledge.fileDetailDesc"),extra:(0,n.jsxs)(I.A,{wrap:!0,children:[(0,n.jsx)(T.Ay,{size:"small",onClick:()=>{m.push("/knowledge/source-preview?".concat(new URLSearchParams({relativePath:h,...g?{projectRoot:g}:{}})))},children:"解析核查预览"}),(0,n.jsx)(T.Ay,{size:"small",onClick:()=>{G("file")},children:u("assets.openFile")}),(0,n.jsx)(T.Ay,{size:"small",onClick:()=>{G("directory")},children:u("assets.openDirectory")}),(0,n.jsx)(T.Ay,{size:"small",type:"primary",loading:k,onClick:()=>{X()},children:u("knowledge.reindexFile")})]})}),(null==(e=x.parseAttempt)?void 0:e.status)==="error"&&(0,n.jsx)(E.A,{showIcon:!0,type:"error",message:u("knowledge.latestParseFailed"),description:"".concat(null!=(l=x.parseAttempt.error)?l:"").concat(x.parseAttempt.recordRetained?";".concat(u("knowledge.previousParseRetained")):"")}),(null==(t=x.parseAttempt)?void 0:t.status)==="parsing"&&(0,n.jsx)(E.A,{showIcon:!0,type:"info",message:u("knowledge.currentParseInProgress")}),(0,n.jsx)(P.A,{className:"rounded-2xl border-[var(--borderColor)]",title:(0,n.jsx)("span",{className:"font-semibold",children:u("knowledge.basicInfo")}),children:(0,n.jsxs)(L.A,{size:"small",column:{xxl:3,xl:2,lg:2,md:1,sm:1,xs:1},bordered:!0,styles:{label:{width:"120px",background:"var(--colorFillAlter)",color:"var(--colorTextSecondary)"}},children:[(0,n.jsx)(L.A.Item,{label:u("knowledge.path"),span:3,children:(0,n.jsx)("span",{className:"break-all",children:x.file.relativePath})}),(0,n.jsx)(L.A.Item,{label:u("knowledge.originalFile"),span:3,children:(0,n.jsx)("span",{className:"break-all",children:null!=(a=x.absolutePath)?a:"-"})}),(0,n.jsx)(L.A.Item,{label:u("knowledge.directory"),span:3,children:(0,n.jsx)("span",{className:"break-all",children:null!=(o=x.directory)?o:"-"})}),(0,n.jsx)(L.A.Item,{label:u("knowledge.fileCategory"),children:(0,n.jsxs)(I.A,{size:4,children:[(0,n.jsx)(S.A,{className:"m-0 border-0 bg-[var(--colorFillSecondary)]",children:(0,J.Jm)(x.file.category)})," ",(0,n.jsx)(S.A,{className:"m-0 border-0 bg-[var(--colorFillSecondary)]",children:x.file.format})]})}),(0,n.jsx)(L.A.Item,{label:u("knowledge.fileSize"),children:(0,J.z3)(x.file.fileSize)}),(0,n.jsx)(L.A.Item,{label:u("knowledge.chunkCount"),children:x.file.chunkCount}),(0,n.jsx)(L.A.Item,{label:u("knowledge.status"),children:(0,n.jsx)(S.A,{color:"active"===x.file.status?"success":"error"===x.file.status?"error":"outdated"===x.file.status?"warning":"disk"===x.file.status||"deleted"===x.file.status?"default":"processing",className:"m-0",children:u(J.mc[x.file.status]||"common.unknown")})}),(0,n.jsx)(L.A.Item,{label:u("knowledge.extractionMode"),children:String(null!=(i=C.extractionMode)?i:"-")}),(0,n.jsx)(L.A.Item,{label:u("knowledge.contentCoverage"),children:String(null!=(c=C.contentCoverage)?c:"-")}),(0,n.jsx)(L.A.Item,{label:u("knowledge.textLength"),children:String(null!=(d=C.textLength)?d:"-")})]})}),(0,n.jsx)(P.A,{className:"rounded-2xl border-[var(--borderColor)]",title:(0,n.jsx)("span",{className:"font-semibold",children:u("knowledge.detailFilter")}),children:(0,n.jsxs)("div",{className:"flex flex-col w-full gap-4",children:[(0,n.jsx)(B.A,{allowClear:!0,size:"large",value:j,onChange:e=>v(e.target.value),placeholder:u("knowledge.detailFilterPlaceholder"),className:"rounded-xl bg-[var(--colorBgHover)] border-[var(--borderColor)] focus:bg-[var(--colorBgContainer)] hover:bg-[var(--colorBgContainer)] w-full"}),j?(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 items-center bg-[var(--colorFillAlter)] p-3 rounded-xl border border-[var(--colorBorderSecondary)]",children:[(0,n.jsx)("span",{className:"text-sm font-medium text-[var(--colorTextSecondary)] mr-2",children:"过滤结果:"}),(0,n.jsxs)(S.A,{color:"blue",className:"m-0 border-0",children:[u("knowledge.parentMatches")," ",K.length]}),(0,n.jsxs)(S.A,{color:"green",className:"m-0 border-0",children:[u("knowledge.childMatches")," ",H.length]}),(0,n.jsx)("div",{className:"w-[1px] h-3 bg-[var(--colorBorderSecondary)] mx-1"}),(0,n.jsxs)("span",{className:"text-xs text-[var(--colorTextTertiary)]",children:[u("knowledge.filterTerm")," ",(0,n.jsx)("strong",{className:"text-[var(--colorText)]",children:j})]})]}):null]})}),(0,n.jsxs)(P.A,{className:"rounded-2xl border-[var(--borderColor)]",title:(0,n.jsxs)("span",{className:"font-semibold",children:[u("knowledge.parentChunks")," ",(0,n.jsxs)(S.A,{className:"ml-2 border-0 bg-[var(--colorFillSecondary)] text-xs font-normal",children:[K.length," / ",x.parents.length]})]}),children:[(0,n.jsx)(E.A,{type:"info",showIcon:!0,description:u("knowledge.parentChunkHint"),className:"mb-4 rounded-xl border-blue-200 bg-blue-50/50"}),(0,n.jsx)(z.A,{rowKey:"id",columns:Y,dataSource:K,pagination:(0,$.B)(u),size:"small",className:"custom-table"})]}),(0,n.jsx)(P.A,{className:"rounded-2xl border-[var(--borderColor)]",title:(0,n.jsxs)("span",{className:"font-semibold",children:[u("knowledge.childChunks")," ",(0,n.jsxs)(S.A,{className:"ml-2 border-0 bg-[var(--colorFillSecondary)] text-xs font-normal",children:[H.length," / ",x.chunks.length]})]}),children:(0,n.jsx)(z.A,{rowKey:"id",columns:Q,dataSource:H,pagination:(0,$.B)(u),size:"small",className:"custom-table"})})]}):(0,n.jsx)(R.A,{description:u("knowledge.selectFile")})}}},e=>{e.O(0,[855,551,210,702,665,399,576,499,759,338,964,127,636,593,792],()=>e(e.s=37690)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[28],{45505:(e,u,n)=>{"use strict";n.r(u),n.d(u,{default:()=>s});var _=n(97109),l=n(86109);function s(){let e=(0,l.useRouter)();return(0,_.useEffect)(()=>{e.replace("/knowledge")},[e]),null}},90426:(e,u,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/files",function(){return n(45505)}])}},e=>{e.O(0,[636,593,792],()=>e(e.s=90426)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[414],{54178:(e,n,u)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/manage",function(){return u(87277)}])},87277:(e,n,u)=>{"use strict";u.r(n),u.d(n,{default:()=>l});var _=u(97109),t=u(86109);function l(){let e=(0,t.useRouter)();return(0,_.useEffect)(()=>{e.replace("/knowledge")},[e]),null}}},e=>{e.O(0,[636,593,792],()=>e(e.s=54178)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[95],{2232:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>P});var r=s(65321),a=s(97109),l=s(1873),n=s.n(l),c=s(86109),i=s(33442),o=s(14932),d=s(85114),x=s(85493),h=s(48318),m=s(75174),u=s(57271),p=s(42700),j=s(84253),v=s(68787),g=s(11702),f=s(76506),y=s(58569),b=s(88762),N=s(99271),w=s(37510),C=s(99811),k=s(6578),S=s(85979);let A={whiteSpace:"pre-wrap",overflowWrap:"anywhere",margin:0,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:12.5,lineHeight:1.75};function T(e){let{children:t,maxHeight:s=520}=e;return(0,r.jsx)("div",{className:"rounded-xl border border-[var(--borderColor)] bg-[var(--colorFillAlter)] px-3 py-2.5",style:{maxHeight:s,overflow:"auto"},children:t})}function z(e){let{zoom:t,onChange:s,viewportRef:a}=e,l=e=>Math.min(4,Math.max(.2,Math.round(100*e)/100));return(0,r.jsxs)(i.A,{size:4,align:"center",children:[(0,r.jsx)(o.A,{title:"缩小(Ctrl/⌘ + 滚轮同效)",children:(0,r.jsx)(d.Ay,{size:"small",icon:(0,r.jsx)(N.A,{}),"aria-label":"缩小",onClick:()=>s(l(t-.1))})}),(0,r.jsxs)("span",{className:"text-xs tabular-nums text-[var(--colorTextSecondary)] w-12 text-center",children:[Math.round(100*t),"%"]}),(0,r.jsx)(o.A,{title:"放大(Ctrl/⌘ + 滚轮同效)",children:(0,r.jsx)(d.Ay,{size:"small",icon:(0,r.jsx)(w.A,{}),"aria-label":"放大",onClick:()=>s(l(t+.1))})}),(0,r.jsx)(d.Ay,{size:"small",onClick:()=>{let e=a.current,r=null==e?void 0:e.firstElementChild;if(!e||!r)return;let n=r.clientWidth/t;n&&s(l((e.clientWidth-2)/n))},children:"适应宽度"}),(0,r.jsx)(d.Ay,{size:"small",disabled:1===t,onClick:()=>s(1),children:"原始比例"})]})}function M(e){let{zoom:t,viewportRef:s,children:a}=e;return(0,r.jsx)("div",{ref:s,className:"rounded-xl border border-[var(--borderColor)] bg-[var(--colorBgContainer)] p-3 overflow-auto",style:{maxHeight:"68vh"},children:1===t?a:(0,r.jsx)("div",{style:{zoom:t},children:a})})}function R(e){var t,s,a;let{block:l,parts:n}=e;if("undefined"==typeof DOMParser)return(0,r.jsx)(T,{children:(0,r.jsx)("pre",{style:A,children:l.text})});let c=null!=(a=null==(t=/<[^!?][^>]*?\s([^>]*)>/u.exec(null!=(s=n[l.part])?s:""))?void 0:t[1])?a:'xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"',i=new DOMParser().parseFromString("<root ".concat(c,">").concat(l.xml,"</root>"),"application/xml"),o=i.documentElement.firstElementChild;if(!o||i.querySelector("parsererror"))return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(x.A,{type:"warning",message:"表格XML显示未完成,保留原文及结构供核查"}),(0,r.jsx)(T,{children:(0,r.jsx)("pre",{style:A,children:l.text})})]});let d=[...o.children].filter(e=>"tr"===e.localName).map(e=>{let t=0;return[...e.children].filter(e=>"tc"===e.localName).map(e=>{var s,r,a;let l=Number(null!=(r=null==(s=e.getElementsByTagName("w:gridSpan")[0])?void 0:s.getAttribute("w:val"))?r:1),n=e.getElementsByTagName("w:vMerge")[0],c={column:t,span:l,merge:n?null!=(a=n.getAttribute("w:val"))?a:"continue":void 0,text:[...e.getElementsByTagName("w:t")].map(e=>{var t;return null!=(t=e.textContent)?t:""}).join("")};return t+=l,c})});return(0,r.jsx)("table",{className:"w-full border-collapse my-3 text-sm",children:(0,r.jsx)("tbody",{children:d.map((e,t)=>(0,r.jsx)("tr",{className:"even:bg-[var(--colorFillAlter)]",children:e.filter(e=>"continue"!==e.merge).map(e=>{var s,a;let l=1;if("restart"===e.merge)for(;(null==(a=d[t+l])||null==(s=a.find(t=>t.column===e.column))?void 0:s.merge)==="continue";)l++;return(0,r.jsx)("td",{className:"border border-[var(--borderColor)] p-2 align-top whitespace-pre-wrap",colSpan:e.span,rowSpan:l,children:e.text},e.column)})},t))})})}function I(e){let{sheet:t,zoom:s,viewportRef:l}=e,[n,c]=(0,a.useState)(1),[i,o]=(0,a.useState)(1),d=t.cells.reduce((e,t)=>Math.max(e,t.row),t.merges.reduce((e,t)=>Math.max(e,t.endRow),1)),x=t.cells.reduce((e,t)=>Math.max(e,t.col),t.merges.reduce((e,t)=>Math.max(e,t.endCol),1)),u=(0,a.useMemo)(()=>new Map(t.cells.map(e=>["".concat(e.row,":").concat(e.col),e])),[t]),p=(n-1)*50+1,j=Math.min(d,p+49),v=Math.min(x,i+19);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mb-3 text-xs text-[var(--colorTextSecondary)]",children:[(0,r.jsx)("span",{children:"原工作表物理坐标;公式使用已保存缓存值"}),(0,r.jsxs)("span",{className:"inline-flex items-center gap-2",children:["起始列 ",(0,r.jsx)(h.A,{size:"small",min:1,max:x,value:i,onChange:e=>o(null!=e?e:1)})]})]}),(0,r.jsx)(M,{zoom:s,viewportRef:l,children:(0,r.jsxs)("table",{className:"border-collapse text-xs",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{className:"border border-[var(--borderColor)] bg-[var(--colorFillSecondary)] px-2 py-1 sticky top-0 left-0 z-[2]",children:"行"}),Array.from({length:v-i+1},(e,t)=>(0,r.jsxs)("th",{className:"border border-[var(--borderColor)] bg-[var(--colorFillSecondary)] px-2 py-1 sticky top-0 z-[1] min-w-24",children:["C",i+t]},t))]})}),(0,r.jsx)("tbody",{children:Array.from({length:j-p+1},(e,s)=>{let a=p+s;return(0,r.jsxs)("tr",{className:"even:bg-[var(--colorFillAlter)]",children:[(0,r.jsxs)("th",{className:"border border-[var(--borderColor)] bg-[var(--colorFillSecondary)] px-2 py-1 text-[var(--colorTextSecondary)] sticky left-0 z-[1]",children:["R",a]}),Array.from({length:v-i+1},(e,s)=>{var l,n,c;let o=i+s,d=u.get("".concat(a,":").concat(o)),x=t.merges.find(e=>a>=e.startRow&&a<=e.endRow&&o>=e.startCol&&o<=e.endCol);if(x&&(a!==Math.max(p,x.startRow)||o!==Math.max(i,x.startCol)))return null;let h=x?u.get("".concat(x.startRow,":").concat(x.startCol)):d,m=null!=(l=null==h?void 0:h.display)?l:"";return(0,r.jsxs)("td",{className:"border border-[var(--borderColor)] px-2 py-1 whitespace-pre-wrap align-top ".concat("number"==typeof m||"string"==typeof m&&/^-?[\d,]+(\.\d+)?$/u.test(m.trim())?"text-right tabular-nums":""," ").concat(""===m?"bg-[var(--colorFillQuaternary)]":""),rowSpan:x?Math.min(j,x.endRow)-Math.max(p,x.startRow)+1:1,colSpan:x?Math.min(v,x.endCol)-Math.max(i,x.startCol)+1:1,title:"".concat(null!=(n=null==h?void 0:h.address)?n:"R".concat(a,"C").concat(o),"\n原值: ").concat(String(null!=(c=null==h?void 0:h.value)?c:"")).concat((null==h?void 0:h.formula)?"\n公式: =".concat(h.formula):""),children:[m,(null==h?void 0:h.formula)&&(0,r.jsxs)("div",{className:"text-[10px] text-[var(--colorTextTertiary)]",children:["=",h.formula]})]},o)})]},a)})})]})}),(0,r.jsx)("div",{className:"mt-3 flex justify-end",children:(0,r.jsx)(m.A,{size:"small",current:n,pageSize:50,total:d,showSizeChanger:!1,onChange:c})})]})}function F(e){let{frameIds:t,endpoint:s,zoom:l,viewportRef:c}=e,[i,o]=(0,a.useState)(0),[d,h]=(0,a.useState)(""),[m,v]=(0,a.useState)(),[g,f]=(0,a.useState)(""),[y,b]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{let e=!0;h(""),f(""),v(void 0);let r=t[i];if(r)return b(!0),(0,k.x6)("".concat(s,"&frame=").concat(encodeURIComponent(r),"&format=json")).then(t=>{e&&(h(t.image),v(t.receipt))}).catch(t=>{e&&f(String(t))}).finally(()=>{e&&b(!1)}),()=>{e=!1}},[i,t,s]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-3",children:[(0,r.jsx)(u.A,{size:"small",className:"min-w-64",value:i,onChange:o,options:t.map((e,t)=>({value:t,label:e}))}),(0,r.jsx)("span",{className:"text-xs text-[var(--colorTextSecondary)]",children:"显示实际库内实体与块实例;绘制限制不等同数据丢失。"})]}),(0,r.jsxs)(p.A,{spinning:y,children:[g&&(0,r.jsx)(x.A,{type:"warning",message:"图框显示未完成",description:"".concat(g,";请区分已入库结构和绘制能力,已有库内文字仍可读取。")}),d?(0,r.jsx)(M,{zoom:l,viewportRef:c,children:(0,r.jsx)("div",{className:"bg-white inline-block p-2",children:(0,r.jsx)(n(),{unoptimized:!0,width:2400,height:1800,src:d,alt:"已解析CAD图框",style:{width:"100%",height:"auto",display:"block"}})})}):!y&&!g&&(0,r.jsx)(j.A,{description:"尚未识别到可显示图框"}),void 0!==m&&(0,r.jsxs)("details",{className:"mt-3",children:[(0,r.jsx)("summary",{className:"text-xs cursor-pointer text-[var(--colorTextSecondary)]",children:"本次绘制回执与限制"}),(0,r.jsx)(T,{maxHeight:260,children:(0,r.jsx)("pre",{style:A,children:JSON.stringify(m,null,2)})})]})]})]})}function O(e){let{structure:t,endpoint:s,zoom:l,viewportRef:c}=e,[i,o]=(0,a.useState)(0);if(t.spreadsheet){let e=t.spreadsheet.sheets;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"mb-3",children:(0,r.jsx)(u.A,{size:"small",className:"min-w-64",value:i,options:e.map((e,t)=>({value:t,label:e.name})),onChange:o})}),e[i]&&(0,r.jsx)(I,{sheet:e[i],zoom:l,viewportRef:c},i)]})}if(t.docx)return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(M,{zoom:l,viewportRef:c,children:(0,r.jsxs)("div",{className:"mx-auto",style:{maxWidth:860},children:[t.docx.blocks.map(e=>(0,r.jsxs)("div",{id:e.id,className:"mb-4",children:[(0,r.jsxs)("div",{className:"mb-1 text-[10px] text-[var(--colorTextTertiary)]",children:[e.part," \xb7 第 ",e.index+1," 块"]}),"table"===e.kind?(0,r.jsx)(R,{block:e,parts:t.docx.parts}):(0,r.jsx)("p",{className:e.headingLevel?"font-semibold text-lg whitespace-pre-wrap mt-2":"whitespace-pre-wrap leading-8 text-sm",children:e.text}),(0,r.jsxs)("details",{children:[(0,r.jsx)("summary",{className:"text-xs cursor-pointer text-[var(--colorTextTertiary)]",children:"来源 XML"}),(0,r.jsx)(T,{maxHeight:260,children:(0,r.jsx)("pre",{style:A,children:e.xml})})]})]},e.id)),t.docx.images.map(e=>(0,r.jsxs)("div",{className:"mb-4",children:[(0,r.jsx)("div",{className:"mb-1 text-xs text-[var(--colorTextSecondary)]",children:e.name}),/^image\/(?:png|jpeg|gif|webp|svg\+xml|bmp)$/u.test(e.mediaType)?(0,r.jsx)(n(),{unoptimized:!0,width:1200,height:900,src:"".concat(s,"&image=").concat(encodeURIComponent(e.name)),alt:e.name,style:{maxWidth:"100%",height:"auto"}}):(0,r.jsx)(x.A,{type:"info",message:"已保留".concat(e.mediaType,"图片数据,浏览器未声明支持显示")})]},e.name))]})})});if(t.pdf){var d,h,p,v;let e=t.pdf.pages,s=e[i],a=null!=(h=null!=(d=null==s?void 0:s.width)?d:null==s?void 0:s.glyphs.reduce((e,t)=>Math.max(e,t.x+t.width+20),600))?h:600,n=null!=(v=null!=(p=null==s?void 0:s.height)?p:null==s?void 0:s.glyphs.reduce((e,t)=>Math.max(e,t.y+t.height+20),800))?v:800;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-3",children:[(0,r.jsx)("span",{className:"text-xs text-[var(--colorTextSecondary)]",children:"显示库内已保存文字与位置;可选原版本对照不影响本页及后续生成。"}),(0,r.jsx)(m.A,{size:"small",current:i+1,pageSize:1,total:e.length,showSizeChanger:!1,onChange:e=>o(e-1)})]}),s&&(0,r.jsxs)(M,{zoom:l,viewportRef:c,children:[(0,r.jsx)("div",{className:"mx-auto bg-white shadow-sm border border-[var(--borderColor)]",style:{width:a},children:(0,r.jsx)("svg",{viewBox:"0 0 ".concat(a," ").concat(n),width:"100%",role:"img","aria-label":"解析第".concat(s.page,"页"),children:s.glyphs.map(e=>(0,r.jsx)("text",{x:e.x,y:n-e.y,fontSize:Math.max(6,e.height),children:e.str},e.id))})}),s.ocrText&&(0,r.jsxs)("div",{className:"mt-3",children:[(0,r.jsx)("div",{className:"mb-1 text-xs text-[var(--colorTextSecondary)]",children:"该页 OCR 文本"}),(0,r.jsx)(T,{maxHeight:260,children:(0,r.jsx)("pre",{style:A,children:s.ocrText})})]}),!s.glyphs.length&&!s.ocrText&&(0,r.jsx)(j.A,{description:"该页没有可展示文字,不能据此断言原页为空"})]})]})}return t.cad?(0,r.jsx)(F,{frameIds:t.cad.frameIds,endpoint:s,zoom:l,viewportRef:c}):(0,r.jsx)(j.A,{description:"此解析结果尚无结构显示适配,完整解析文字仍可查看"})}function E(e){let{data:t}=e,s=t.conservation,a=[{key:"chars",label:"文本覆盖",value:"".concat(s.coveredNonWhitespaceChars," / ").concat(s.sourceNonWhitespaceChars," 个非空白字符"),trouble:s.coveredNonWhitespaceChars!==s.sourceNonWhitespaceChars,...s.uncovered.length?{detail:(0,r.jsxs)(r.Fragment,{children:[s.uncovered.slice(0,5).map((e,t)=>(0,r.jsxs)("div",{className:"mb-1",children:["字符 ",e.start,"–",e.end,":",e.text.slice(0,120)]},t)),s.uncovered.length>5?(0,r.jsxs)("div",{children:["…还有 ",s.uncovered.length-5," 段"]}):null]})}:{}},{key:"chunks",label:"切片数",value:"".concat(t.totalChunks," 块(库内登记 ").concat(s.registeredChunkCount,",与底稿一致:").concat(s.chunkCountMatches?"是":"否",")"),trouble:!s.chunkCountMatches},{key:"stale",label:"身份过期的切片",value:s.staleChunkIdentities.length?"".concat(s.staleChunkIdentities.length," 块"):"无",trouble:s.staleChunkIdentities.length>0,...s.staleChunkIdentities.length?{detail:(0,r.jsxs)("div",{children:["切片序号:",s.staleChunkIdentities.slice(0,20).join(", "),s.staleChunkIdentities.length>20?" …":""]})}:{}},{key:"unmapped",label:"未能映射回底稿的切片",value:s.unmapped.length?"".concat(s.unmapped.length," 块"):"无",trouble:s.unmapped.length>0,...s.unmapped.length?{detail:(0,r.jsxs)(r.Fragment,{children:[s.unmapped.slice(0,5).map(e=>(0,r.jsxs)("div",{className:"mb-1",children:["切片 ",e.chunkIndex,":",e.text.slice(0,120)]},e.chunkIndex)),s.unmapped.length>5?(0,r.jsxs)("div",{children:["…还有 ",s.unmapped.length-5," 块"]}):null]})}:{}},{key:"order",label:"切片顺序",value:s.outOfOrderChunks.length?"乱序 ".concat(s.outOfOrderChunks.length," 块"):"与底稿一致",trouble:s.outOfOrderChunks.length>0,...s.outOfOrderChunks.length?{detail:(0,r.jsxs)("div",{children:["切片序号:",s.outOfOrderChunks.slice(0,20).join(", ")]})}:{}},{key:"repeated",label:"重复上下文跨度",value:"".concat(s.repeatedContextSpans," 处"),trouble:!1}];return(0,r.jsx)("div",{className:"flex flex-col",children:a.map(e=>(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row gap-1 sm:gap-3 py-2 border-b border-[var(--colorBorderSecondary)] last:border-0",children:[(0,r.jsx)("div",{className:"sm:w-44 shrink-0 text-xs text-[var(--colorTextTertiary)] sm:pt-0.5",children:e.label}),(0,r.jsxs)("div",{className:"min-w-0 flex-1 text-sm",children:[(0,r.jsx)("span",{className:e.trouble?"text-[var(--colorError)]":"text-[var(--colorText)]",children:e.value}),e.detail&&(0,r.jsxs)("details",{className:"mt-1",children:[(0,r.jsx)("summary",{className:"text-xs cursor-pointer text-[var(--colorTextSecondary)]",children:"展开明细"}),(0,r.jsx)(T,{maxHeight:220,children:(0,r.jsx)("div",{className:"text-xs text-[var(--colorTextSecondary)]",children:e.detail})})]})]})]},e.key))})}function P(){let e=(0,c.useRouter)(),t="string"==typeof e.query.relativePath?e.query.relativePath:"",s="string"==typeof e.query.projectRoot?e.query.projectRoot:"",[l,n]=(0,a.useState)(),[o,h]=(0,a.useState)(""),[u,N]=(0,a.useState)(!1),[w,M]=(0,a.useState)(1),[R,I]=(0,a.useState)("structure"),F=(0,a.useRef)(null),P=(0,a.useRef)(0),_=new URLSearchParams({relativePath:t,...s?{projectRoot:s}:{}}),H="/api/kb/files/source-preview?".concat(_),W="".concat(H).concat((null==l?void 0:l.status)==="recorded"?"&snapshotId=".concat(l.identity.snapshotId):""),B=(0,a.useCallback)(async e=>{let t=++P.current;N(!0),h("");try{let s=await (0,k.x6)(e);t===P.current&&n(s)}catch(e){t===P.current&&h(e instanceof Error?e.message:String(e))}finally{t===P.current&&N(!1)}},[]);(0,a.useEffect)(()=>{n(void 0),t&&B(H)},[t,H,B]);let D=null==l?void 0:l.pdfCoverage,q=D&&"complete"!==D.status?(0,r.jsx)(x.A,{showIcon:!0,type:"warning",message:"unmeasured"===D.status?"PDF 页覆盖未记录":"PDF 页覆盖不完整",description:(0,r.jsxs)(i.A,{direction:"vertical",size:2,children:[D.pageCount?(0,r.jsx)("span",{children:"已处理页:".concat(D.processedPages,"/").concat(D.pageCount)}):(0,r.jsx)("span",{children:'没有记录到声明页数,无法据此断言"处理了几页"。'}),D.missingPages.length>0&&(0,r.jsx)("span",{children:"缺少页:".concat(D.missingPages.join(", "))}),D.failedPages.length>0&&(0,r.jsx)("span",{children:"失败页:".concat(D.failedPages.join(", "))}),(0,r.jsx)("span",{children:"这条读数只说明解析侧处理了哪些页,不证明内容、版式或专业采用正确。"})]})}):null;return(0,r.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,r.jsx)(S.k,{backHref:"/knowledge/file-detail?".concat(_),backLabel:"返回切片详情",title:"解析核查预览",description:t,extra:(0,r.jsxs)(i.A,{wrap:!0,children:["structure"===R&&(0,r.jsx)(z,{zoom:w,onChange:M,viewportRef:F}),(0,r.jsx)(d.Ay,{size:"small",icon:(0,r.jsx)(C.A,{}),onClick:()=>{B(H)},loading:u,children:"刷新"})]})}),o&&(0,r.jsx)(x.A,{type:"error",message:o}),(0,r.jsx)(p.A,{spinning:u,children:(null==l?void 0:l.status)==="not-recorded"?(0,r.jsxs)(v.A,{className:"rounded-2xl border-[var(--borderColor)]",children:[(0,r.jsx)(x.A,{type:"warning",message:"独立解析底稿尚未记录",description:l.reason}),q&&(0,r.jsx)("div",{className:"mt-3",children:q}),(0,r.jsx)(d.Ay,{className:"mt-4",onClick:()=>{(async()=>{try{await (0,k.HC)(t,s||void 0),h("重新解析任务已提交,请在处理完成后刷新本页。")}catch(e){h(String(e))}})()},children:"重新解析此文件"}),(0,r.jsx)("p",{className:"mt-4 mb-2 text-sm text-[var(--colorTextSecondary)]",children:"当前实际库内切片(不是独立底稿):"}),l.chunks.map(e=>(0,r.jsxs)("div",{className:"my-3",children:[(0,r.jsxs)(g.A,{children:["切片 ",e.chunkIndex]}),(0,r.jsx)(T,{children:(0,r.jsx)("pre",{style:A,children:e.content})})]},e.id)),(0,r.jsx)("div",{className:"mt-3 flex justify-end",children:(0,r.jsx)(m.A,{current:Math.floor(l.offset/30)+1,pageSize:30,total:l.totalChunks,showSizeChanger:!1,onChange:e=>{B("".concat(H,"&offset=").concat((e-1)*30))}})})]}):(null==l?void 0:l.status)==="recorded"?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(v.A,{className:"rounded-2xl border-[var(--borderColor)] mb-5",children:[(0,r.jsx)(E,{data:l}),(0,r.jsx)("p",{className:"mt-3 mb-0 text-xs text-[var(--colorTextSecondary)]",children:"这项检查只证明独立解析文字与切片的内容覆盖,不证明原文件解析、版式、工程理解或专业采用全部正确。"}),q&&(0,r.jsx)("div",{className:"mt-3",children:q}),l.identity.limitations.map(e=>(0,r.jsx)("p",{className:"mt-2 mb-0 text-xs text-[var(--colorTextSecondary)]",children:e},e)),(0,r.jsxs)("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[(0,r.jsx)(d.Ay,{size:"small",href:"".concat(W,"&original=1"),target:"_blank",children:"查看/下载入库原版本"}),(0,r.jsx)(d.Ay,{size:"small",onClick:()=>{(0,k.tn)(t,"source-version",s||void 0).catch(e=>h("可选原版本对照不可用:".concat(String(e),";库内数据仍可读取")))},children:"本机打开入库原版本"})]}),(0,r.jsxs)("details",{className:"mt-4",children:[(0,r.jsx)("summary",{className:"text-xs cursor-pointer text-[var(--colorTextSecondary)]",children:"技术详情(原文件哈希 / 解析版本 / 解析身份 / 核查口径)"}),(0,r.jsx)("div",{className:"mt-3",children:(0,r.jsxs)(f.A,{size:"small",column:1,bordered:!0,styles:{label:{width:"120px",background:"var(--colorFillAlter)",color:"var(--colorTextSecondary)"}},children:[(0,r.jsx)(f.A.Item,{label:"原文件SHA256",children:(0,r.jsx)("span",{className:"break-all text-xs",children:l.identity.sourceHash})}),(0,r.jsx)(f.A.Item,{label:"解析版本",children:(0,r.jsx)("span",{className:"text-xs",children:l.identity.parserVersion})}),(0,r.jsx)(f.A.Item,{label:"解析身份",children:(0,r.jsx)("span",{className:"break-all text-xs",children:l.identity.snapshotId})}),(0,r.jsx)(f.A.Item,{label:"核查口径",children:(0,r.jsxs)("span",{className:"text-xs",children:[l.conservation.version," \xb7 ",l.conservation.scope," \xb7 入库状态 ",l.conservation.ingestionStatus]})}),(0,r.jsx)(f.A.Item,{label:"底稿快照",children:(0,r.jsx)("span",{className:"break-all text-xs",children:l.conservation.snapshotId})})]})})]})]}),(0,r.jsx)(y.A,{className:"documents-tabs",activeKey:R,onChange:I,items:[{key:"structure",label:"解析结构",children:(0,r.jsx)(v.A,{className:"rounded-2xl border-[var(--borderColor)]",onWheelCapture:e=>{(e.ctrlKey||e.metaKey)&&(e.preventDefault(),M(t=>Math.min(4,Math.max(.2,Math.round((t-.1*Math.sign(e.deltaY))*100)/100))))},children:(0,r.jsx)(O,{structure:l.structure,endpoint:W,zoom:w,viewportRef:F},l.identity.snapshotId)})},{key:"chunks",label:"实际切片重组",children:(0,r.jsxs)(v.A,{className:"rounded-2xl border-[var(--borderColor)]",children:[(0,r.jsxs)("p",{className:"text-xs text-[var(--colorTextSecondary)]",children:["当前展示切片 ",l.offset+1," 至 ",l.offset+l.chunks.length,",共 ",l.totalChunks," 块;分页不代表其余内容不存在。"]}),l.chunks.map(e=>(0,r.jsxs)("div",{className:"my-4",children:[(0,r.jsxs)(i.A,{size:4,wrap:!0,children:[(0,r.jsxs)(g.A,{children:["切片 ",e.chunkIndex]}),e.sectionTitle?(0,r.jsx)(g.A,{color:"cyan",children:e.sectionTitle}):null]}),(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(T,{children:(0,r.jsx)("pre",{style:A,children:e.content})})}),(0,r.jsxs)("details",{className:"mt-2",children:[(0,r.jsx)("summary",{className:"text-xs cursor-pointer text-[var(--colorTextTertiary)]",children:"库内解析底稿区间"}),(0,r.jsx)(T,{maxHeight:240,children:(0,r.jsx)("pre",{style:A,children:JSON.stringify(e.sourceSpans,null,2)})})]})]},e.id)),(0,r.jsx)("div",{className:"mt-3 flex justify-end",children:(0,r.jsx)(m.A,{current:Math.floor(l.offset/30)+1,pageSize:30,total:l.totalChunks,showSizeChanger:!1,onChange:e=>{B("".concat(W,"&offset=").concat((e-1)*30))}})})]})}]})]}):u?(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)(b.A,{active:!0,title:!1,paragraph:{rows:3}}),(0,r.jsx)(b.A,{active:!0,title:!1,paragraph:{rows:6}})]}):(0,r.jsx)(j.A,{description:"选择文件后查看解析结果"})})]})}},59528:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/source-preview",function(){return s(2232)}])},85979:(e,t,s)=>{"use strict";s.d(t,{k:()=>c});var r=s(65321),a=s(43220),l=s.n(a),n=s(91648);function c(e){let{backHref:t,backLabel:s,title:a,description:c,extra:i}=e;return(0,r.jsx)("div",{className:"mb-6 bg-[var(--colorBgContainer)] rounded-2xl overflow-hidden border border-[var(--borderColor)] p-6",children:(0,r.jsxs)("div",{className:"flex flex-col md:flex-row md:items-end justify-between gap-4 md:gap-6",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,r.jsxs)(l(),{href:t,prefetch:!1,className:"detailBack",children:[(0,r.jsx)(n.A,{size:16,strokeWidth:2,"aria-hidden":!0}),(0,r.jsx)("span",{children:s})]}),(0,r.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,r.jsx)("h1",{className:"text-2xl font-bold text-[var(--colorText)] m-0 truncate",children:a}),c?(0,r.jsx)("p",{className:"text-sm text-[var(--colorTextSecondary)] m-0 break-all",children:c}):null]})]}),i?(0,r.jsx)("div",{className:"shrink-0 flex items-center gap-2",children:i}):null]})})}}},e=>{e.O(0,[6409,1702,5544,9551,4665,1499,8569,8787,6506,8318,1141,636,6593,8792],()=>e(e.s=59528)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[95],{2232:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>P});var r=s(65321),a=s(97109),l=s(1873),n=s.n(l),c=s(86109),i=s(33442),o=s(14932),d=s(85114),x=s(85493),h=s(94992),m=s(75174),u=s(57271),p=s(42700),j=s(84253),v=s(68787),g=s(11702),f=s(76506),y=s(58569),b=s(88762),N=s(99271),w=s(37510),C=s(99811),k=s(6578),S=s(85979);let A={whiteSpace:"pre-wrap",overflowWrap:"anywhere",margin:0,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:12.5,lineHeight:1.75};function T(e){let{children:t,maxHeight:s=520}=e;return(0,r.jsx)("div",{className:"rounded-xl border border-[var(--borderColor)] bg-[var(--colorFillAlter)] px-3 py-2.5",style:{maxHeight:s,overflow:"auto"},children:t})}function z(e){let{zoom:t,onChange:s,viewportRef:a}=e,l=e=>Math.min(4,Math.max(.2,Math.round(100*e)/100));return(0,r.jsxs)(i.A,{size:4,align:"center",children:[(0,r.jsx)(o.A,{title:"缩小(Ctrl/⌘ + 滚轮同效)",children:(0,r.jsx)(d.Ay,{size:"small",icon:(0,r.jsx)(N.A,{}),"aria-label":"缩小",onClick:()=>s(l(t-.1))})}),(0,r.jsxs)("span",{className:"text-xs tabular-nums text-[var(--colorTextSecondary)] w-12 text-center",children:[Math.round(100*t),"%"]}),(0,r.jsx)(o.A,{title:"放大(Ctrl/⌘ + 滚轮同效)",children:(0,r.jsx)(d.Ay,{size:"small",icon:(0,r.jsx)(w.A,{}),"aria-label":"放大",onClick:()=>s(l(t+.1))})}),(0,r.jsx)(d.Ay,{size:"small",onClick:()=>{let e=a.current,r=null==e?void 0:e.firstElementChild;if(!e||!r)return;let n=r.clientWidth/t;n&&s(l((e.clientWidth-2)/n))},children:"适应宽度"}),(0,r.jsx)(d.Ay,{size:"small",disabled:1===t,onClick:()=>s(1),children:"原始比例"})]})}function M(e){let{zoom:t,viewportRef:s,children:a}=e;return(0,r.jsx)("div",{ref:s,className:"rounded-xl border border-[var(--borderColor)] bg-[var(--colorBgContainer)] p-3 overflow-auto",style:{maxHeight:"68vh"},children:1===t?a:(0,r.jsx)("div",{style:{zoom:t},children:a})})}function R(e){var t,s,a;let{block:l,parts:n}=e;if("undefined"==typeof DOMParser)return(0,r.jsx)(T,{children:(0,r.jsx)("pre",{style:A,children:l.text})});let c=null!=(a=null==(t=/<[^!?][^>]*?\s([^>]*)>/u.exec(null!=(s=n[l.part])?s:""))?void 0:t[1])?a:'xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"',i=new DOMParser().parseFromString("<root ".concat(c,">").concat(l.xml,"</root>"),"application/xml"),o=i.documentElement.firstElementChild;if(!o||i.querySelector("parsererror"))return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(x.A,{type:"warning",message:"表格XML显示未完成,保留原文及结构供核查"}),(0,r.jsx)(T,{children:(0,r.jsx)("pre",{style:A,children:l.text})})]});let d=[...o.children].filter(e=>"tr"===e.localName).map(e=>{let t=0;return[...e.children].filter(e=>"tc"===e.localName).map(e=>{var s,r,a;let l=Number(null!=(r=null==(s=e.getElementsByTagName("w:gridSpan")[0])?void 0:s.getAttribute("w:val"))?r:1),n=e.getElementsByTagName("w:vMerge")[0],c={column:t,span:l,merge:n?null!=(a=n.getAttribute("w:val"))?a:"continue":void 0,text:[...e.getElementsByTagName("w:t")].map(e=>{var t;return null!=(t=e.textContent)?t:""}).join("")};return t+=l,c})});return(0,r.jsx)("table",{className:"w-full border-collapse my-3 text-sm",children:(0,r.jsx)("tbody",{children:d.map((e,t)=>(0,r.jsx)("tr",{className:"even:bg-[var(--colorFillAlter)]",children:e.filter(e=>"continue"!==e.merge).map(e=>{var s,a;let l=1;if("restart"===e.merge)for(;(null==(a=d[t+l])||null==(s=a.find(t=>t.column===e.column))?void 0:s.merge)==="continue";)l++;return(0,r.jsx)("td",{className:"border border-[var(--borderColor)] p-2 align-top whitespace-pre-wrap",colSpan:e.span,rowSpan:l,children:e.text},e.column)})},t))})})}function I(e){let{sheet:t,zoom:s,viewportRef:l}=e,[n,c]=(0,a.useState)(1),[i,o]=(0,a.useState)(1),d=t.cells.reduce((e,t)=>Math.max(e,t.row),t.merges.reduce((e,t)=>Math.max(e,t.endRow),1)),x=t.cells.reduce((e,t)=>Math.max(e,t.col),t.merges.reduce((e,t)=>Math.max(e,t.endCol),1)),u=(0,a.useMemo)(()=>new Map(t.cells.map(e=>["".concat(e.row,":").concat(e.col),e])),[t]),p=(n-1)*50+1,j=Math.min(d,p+49),v=Math.min(x,i+19);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mb-3 text-xs text-[var(--colorTextSecondary)]",children:[(0,r.jsx)("span",{children:"原工作表物理坐标;公式使用已保存缓存值"}),(0,r.jsxs)("span",{className:"inline-flex items-center gap-2",children:["起始列 ",(0,r.jsx)(h.A,{size:"small",min:1,max:x,value:i,onChange:e=>o(null!=e?e:1)})]})]}),(0,r.jsx)(M,{zoom:s,viewportRef:l,children:(0,r.jsxs)("table",{className:"border-collapse text-xs",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{className:"border border-[var(--borderColor)] bg-[var(--colorFillSecondary)] px-2 py-1 sticky top-0 left-0 z-[2]",children:"行"}),Array.from({length:v-i+1},(e,t)=>(0,r.jsxs)("th",{className:"border border-[var(--borderColor)] bg-[var(--colorFillSecondary)] px-2 py-1 sticky top-0 z-[1] min-w-24",children:["C",i+t]},t))]})}),(0,r.jsx)("tbody",{children:Array.from({length:j-p+1},(e,s)=>{let a=p+s;return(0,r.jsxs)("tr",{className:"even:bg-[var(--colorFillAlter)]",children:[(0,r.jsxs)("th",{className:"border border-[var(--borderColor)] bg-[var(--colorFillSecondary)] px-2 py-1 text-[var(--colorTextSecondary)] sticky left-0 z-[1]",children:["R",a]}),Array.from({length:v-i+1},(e,s)=>{var l,n,c;let o=i+s,d=u.get("".concat(a,":").concat(o)),x=t.merges.find(e=>a>=e.startRow&&a<=e.endRow&&o>=e.startCol&&o<=e.endCol);if(x&&(a!==Math.max(p,x.startRow)||o!==Math.max(i,x.startCol)))return null;let h=x?u.get("".concat(x.startRow,":").concat(x.startCol)):d,m=null!=(l=null==h?void 0:h.display)?l:"";return(0,r.jsxs)("td",{className:"border border-[var(--borderColor)] px-2 py-1 whitespace-pre-wrap align-top ".concat("number"==typeof m||"string"==typeof m&&/^-?[\d,]+(\.\d+)?$/u.test(m.trim())?"text-right tabular-nums":""," ").concat(""===m?"bg-[var(--colorFillQuaternary)]":""),rowSpan:x?Math.min(j,x.endRow)-Math.max(p,x.startRow)+1:1,colSpan:x?Math.min(v,x.endCol)-Math.max(i,x.startCol)+1:1,title:"".concat(null!=(n=null==h?void 0:h.address)?n:"R".concat(a,"C").concat(o),"\n原值: ").concat(String(null!=(c=null==h?void 0:h.value)?c:"")).concat((null==h?void 0:h.formula)?"\n公式: =".concat(h.formula):""),children:[m,(null==h?void 0:h.formula)&&(0,r.jsxs)("div",{className:"text-[10px] text-[var(--colorTextTertiary)]",children:["=",h.formula]})]},o)})]},a)})})]})}),(0,r.jsx)("div",{className:"mt-3 flex justify-end",children:(0,r.jsx)(m.A,{size:"small",current:n,pageSize:50,total:d,showSizeChanger:!1,onChange:c})})]})}function F(e){let{frameIds:t,endpoint:s,zoom:l,viewportRef:c}=e,[i,o]=(0,a.useState)(0),[d,h]=(0,a.useState)(""),[m,v]=(0,a.useState)(),[g,f]=(0,a.useState)(""),[y,b]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{let e=!0;h(""),f(""),v(void 0);let r=t[i];if(r)return b(!0),(0,k.x6)("".concat(s,"&frame=").concat(encodeURIComponent(r),"&format=json")).then(t=>{e&&(h(t.image),v(t.receipt))}).catch(t=>{e&&f(String(t))}).finally(()=>{e&&b(!1)}),()=>{e=!1}},[i,t,s]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-3",children:[(0,r.jsx)(u.A,{size:"small",className:"min-w-64",value:i,onChange:o,options:t.map((e,t)=>({value:t,label:e}))}),(0,r.jsx)("span",{className:"text-xs text-[var(--colorTextSecondary)]",children:"显示实际库内实体与块实例;绘制限制不等同数据丢失。"})]}),(0,r.jsxs)(p.A,{spinning:y,children:[g&&(0,r.jsx)(x.A,{type:"warning",message:"图框显示未完成",description:"".concat(g,";请区分已入库结构和绘制能力,已有库内文字仍可读取。")}),d?(0,r.jsx)(M,{zoom:l,viewportRef:c,children:(0,r.jsx)("div",{className:"bg-white inline-block p-2",children:(0,r.jsx)(n(),{unoptimized:!0,width:2400,height:1800,src:d,alt:"已解析CAD图框",style:{width:"100%",height:"auto",display:"block"}})})}):!y&&!g&&(0,r.jsx)(j.A,{description:"尚未识别到可显示图框"}),void 0!==m&&(0,r.jsxs)("details",{className:"mt-3",children:[(0,r.jsx)("summary",{className:"text-xs cursor-pointer text-[var(--colorTextSecondary)]",children:"本次绘制回执与限制"}),(0,r.jsx)(T,{maxHeight:260,children:(0,r.jsx)("pre",{style:A,children:JSON.stringify(m,null,2)})})]})]})]})}function O(e){let{structure:t,endpoint:s,zoom:l,viewportRef:c}=e,[i,o]=(0,a.useState)(0);if(t.spreadsheet){let e=t.spreadsheet.sheets;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"mb-3",children:(0,r.jsx)(u.A,{size:"small",className:"min-w-64",value:i,options:e.map((e,t)=>({value:t,label:e.name})),onChange:o})}),e[i]&&(0,r.jsx)(I,{sheet:e[i],zoom:l,viewportRef:c},i)]})}if(t.docx)return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(M,{zoom:l,viewportRef:c,children:(0,r.jsxs)("div",{className:"mx-auto",style:{maxWidth:860},children:[t.docx.blocks.map(e=>(0,r.jsxs)("div",{id:e.id,className:"mb-4",children:[(0,r.jsxs)("div",{className:"mb-1 text-[10px] text-[var(--colorTextTertiary)]",children:[e.part," \xb7 第 ",e.index+1," 块"]}),"table"===e.kind?(0,r.jsx)(R,{block:e,parts:t.docx.parts}):(0,r.jsx)("p",{className:e.headingLevel?"font-semibold text-lg whitespace-pre-wrap mt-2":"whitespace-pre-wrap leading-8 text-sm",children:e.text}),(0,r.jsxs)("details",{children:[(0,r.jsx)("summary",{className:"text-xs cursor-pointer text-[var(--colorTextTertiary)]",children:"来源 XML"}),(0,r.jsx)(T,{maxHeight:260,children:(0,r.jsx)("pre",{style:A,children:e.xml})})]})]},e.id)),t.docx.images.map(e=>(0,r.jsxs)("div",{className:"mb-4",children:[(0,r.jsx)("div",{className:"mb-1 text-xs text-[var(--colorTextSecondary)]",children:e.name}),/^image\/(?:png|jpeg|gif|webp|svg\+xml|bmp)$/u.test(e.mediaType)?(0,r.jsx)(n(),{unoptimized:!0,width:1200,height:900,src:"".concat(s,"&image=").concat(encodeURIComponent(e.name)),alt:e.name,style:{maxWidth:"100%",height:"auto"}}):(0,r.jsx)(x.A,{type:"info",message:"已保留".concat(e.mediaType,"图片数据,浏览器未声明支持显示")})]},e.name))]})})});if(t.pdf){var d,h,p,v;let e=t.pdf.pages,s=e[i],a=null!=(h=null!=(d=null==s?void 0:s.width)?d:null==s?void 0:s.glyphs.reduce((e,t)=>Math.max(e,t.x+t.width+20),600))?h:600,n=null!=(v=null!=(p=null==s?void 0:s.height)?p:null==s?void 0:s.glyphs.reduce((e,t)=>Math.max(e,t.y+t.height+20),800))?v:800;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-3",children:[(0,r.jsx)("span",{className:"text-xs text-[var(--colorTextSecondary)]",children:"显示库内已保存文字与位置;可选原版本对照不影响本页及后续生成。"}),(0,r.jsx)(m.A,{size:"small",current:i+1,pageSize:1,total:e.length,showSizeChanger:!1,onChange:e=>o(e-1)})]}),s&&(0,r.jsxs)(M,{zoom:l,viewportRef:c,children:[(0,r.jsx)("div",{className:"mx-auto bg-white shadow-sm border border-[var(--borderColor)]",style:{width:a},children:(0,r.jsx)("svg",{viewBox:"0 0 ".concat(a," ").concat(n),width:"100%",role:"img","aria-label":"解析第".concat(s.page,"页"),children:s.glyphs.map(e=>(0,r.jsx)("text",{x:e.x,y:n-e.y,fontSize:Math.max(6,e.height),children:e.str},e.id))})}),s.ocrText&&(0,r.jsxs)("div",{className:"mt-3",children:[(0,r.jsx)("div",{className:"mb-1 text-xs text-[var(--colorTextSecondary)]",children:"该页 OCR 文本"}),(0,r.jsx)(T,{maxHeight:260,children:(0,r.jsx)("pre",{style:A,children:s.ocrText})})]}),!s.glyphs.length&&!s.ocrText&&(0,r.jsx)(j.A,{description:"该页没有可展示文字,不能据此断言原页为空"})]})]})}return t.cad?(0,r.jsx)(F,{frameIds:t.cad.frameIds,endpoint:s,zoom:l,viewportRef:c}):(0,r.jsx)(j.A,{description:"此解析结果尚无结构显示适配,完整解析文字仍可查看"})}function E(e){let{data:t}=e,s=t.conservation,a=[{key:"chars",label:"文本覆盖",value:"".concat(s.coveredNonWhitespaceChars," / ").concat(s.sourceNonWhitespaceChars," 个非空白字符"),trouble:s.coveredNonWhitespaceChars!==s.sourceNonWhitespaceChars,...s.uncovered.length?{detail:(0,r.jsxs)(r.Fragment,{children:[s.uncovered.slice(0,5).map((e,t)=>(0,r.jsxs)("div",{className:"mb-1",children:["字符 ",e.start,"–",e.end,":",e.text.slice(0,120)]},t)),s.uncovered.length>5?(0,r.jsxs)("div",{children:["…还有 ",s.uncovered.length-5," 段"]}):null]})}:{}},{key:"chunks",label:"切片数",value:"".concat(t.totalChunks," 块(库内登记 ").concat(s.registeredChunkCount,",与底稿一致:").concat(s.chunkCountMatches?"是":"否",")"),trouble:!s.chunkCountMatches},{key:"stale",label:"身份过期的切片",value:s.staleChunkIdentities.length?"".concat(s.staleChunkIdentities.length," 块"):"无",trouble:s.staleChunkIdentities.length>0,...s.staleChunkIdentities.length?{detail:(0,r.jsxs)("div",{children:["切片序号:",s.staleChunkIdentities.slice(0,20).join(", "),s.staleChunkIdentities.length>20?" …":""]})}:{}},{key:"unmapped",label:"未能映射回底稿的切片",value:s.unmapped.length?"".concat(s.unmapped.length," 块"):"无",trouble:s.unmapped.length>0,...s.unmapped.length?{detail:(0,r.jsxs)(r.Fragment,{children:[s.unmapped.slice(0,5).map(e=>(0,r.jsxs)("div",{className:"mb-1",children:["切片 ",e.chunkIndex,":",e.text.slice(0,120)]},e.chunkIndex)),s.unmapped.length>5?(0,r.jsxs)("div",{children:["…还有 ",s.unmapped.length-5," 块"]}):null]})}:{}},{key:"order",label:"切片顺序",value:s.outOfOrderChunks.length?"乱序 ".concat(s.outOfOrderChunks.length," 块"):"与底稿一致",trouble:s.outOfOrderChunks.length>0,...s.outOfOrderChunks.length?{detail:(0,r.jsxs)("div",{children:["切片序号:",s.outOfOrderChunks.slice(0,20).join(", ")]})}:{}},{key:"repeated",label:"重复上下文跨度",value:"".concat(s.repeatedContextSpans," 处"),trouble:!1}];return(0,r.jsx)("div",{className:"flex flex-col",children:a.map(e=>(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row gap-1 sm:gap-3 py-2 border-b border-[var(--colorBorderSecondary)] last:border-0",children:[(0,r.jsx)("div",{className:"sm:w-44 shrink-0 text-xs text-[var(--colorTextTertiary)] sm:pt-0.5",children:e.label}),(0,r.jsxs)("div",{className:"min-w-0 flex-1 text-sm",children:[(0,r.jsx)("span",{className:e.trouble?"text-[var(--colorError)]":"text-[var(--colorText)]",children:e.value}),e.detail&&(0,r.jsxs)("details",{className:"mt-1",children:[(0,r.jsx)("summary",{className:"text-xs cursor-pointer text-[var(--colorTextSecondary)]",children:"展开明细"}),(0,r.jsx)(T,{maxHeight:220,children:(0,r.jsx)("div",{className:"text-xs text-[var(--colorTextSecondary)]",children:e.detail})})]})]})]},e.key))})}function P(){let e=(0,c.useRouter)(),t="string"==typeof e.query.relativePath?e.query.relativePath:"",s="string"==typeof e.query.projectRoot?e.query.projectRoot:"",[l,n]=(0,a.useState)(),[o,h]=(0,a.useState)(""),[u,N]=(0,a.useState)(!1),[w,M]=(0,a.useState)(1),[R,I]=(0,a.useState)("structure"),F=(0,a.useRef)(null),P=(0,a.useRef)(0),_=new URLSearchParams({relativePath:t,...s?{projectRoot:s}:{}}),H="/api/kb/files/source-preview?".concat(_),W="".concat(H).concat((null==l?void 0:l.status)==="recorded"?"&snapshotId=".concat(l.identity.snapshotId):""),B=(0,a.useCallback)(async e=>{let t=++P.current;N(!0),h("");try{let s=await (0,k.x6)(e);t===P.current&&n(s)}catch(e){t===P.current&&h(e instanceof Error?e.message:String(e))}finally{t===P.current&&N(!1)}},[]);(0,a.useEffect)(()=>{n(void 0),t&&B(H)},[t,H,B]);let D=null==l?void 0:l.pdfCoverage,q=D&&"complete"!==D.status?(0,r.jsx)(x.A,{showIcon:!0,type:"warning",message:"unmeasured"===D.status?"PDF 页覆盖未记录":"PDF 页覆盖不完整",description:(0,r.jsxs)(i.A,{direction:"vertical",size:2,children:[D.pageCount?(0,r.jsx)("span",{children:"已处理页:".concat(D.processedPages,"/").concat(D.pageCount)}):(0,r.jsx)("span",{children:'没有记录到声明页数,无法据此断言"处理了几页"。'}),D.missingPages.length>0&&(0,r.jsx)("span",{children:"缺少页:".concat(D.missingPages.join(", "))}),D.failedPages.length>0&&(0,r.jsx)("span",{children:"失败页:".concat(D.failedPages.join(", "))}),(0,r.jsx)("span",{children:"这条读数只说明解析侧处理了哪些页,不证明内容、版式或专业采用正确。"})]})}):null;return(0,r.jsxs)("div",{className:"space-y-5 animateFadeIn",children:[(0,r.jsx)(S.k,{backHref:"/knowledge/file-detail?".concat(_),backLabel:"返回切片详情",title:"解析核查预览",description:t,extra:(0,r.jsxs)(i.A,{wrap:!0,children:["structure"===R&&(0,r.jsx)(z,{zoom:w,onChange:M,viewportRef:F}),(0,r.jsx)(d.Ay,{size:"small",icon:(0,r.jsx)(C.A,{}),onClick:()=>{B(H)},loading:u,children:"刷新"})]})}),o&&(0,r.jsx)(x.A,{type:"error",message:o}),(0,r.jsx)(p.A,{spinning:u,children:(null==l?void 0:l.status)==="not-recorded"?(0,r.jsxs)(v.A,{className:"rounded-2xl border-[var(--borderColor)]",children:[(0,r.jsx)(x.A,{type:"warning",message:"独立解析底稿尚未记录",description:l.reason}),q&&(0,r.jsx)("div",{className:"mt-3",children:q}),(0,r.jsx)(d.Ay,{className:"mt-4",onClick:()=>{(async()=>{try{await (0,k.HC)(t,s||void 0),h("重新解析任务已提交,请在处理完成后刷新本页。")}catch(e){h(String(e))}})()},children:"重新解析此文件"}),(0,r.jsx)("p",{className:"mt-4 mb-2 text-sm text-[var(--colorTextSecondary)]",children:"当前实际库内切片(不是独立底稿):"}),l.chunks.map(e=>(0,r.jsxs)("div",{className:"my-3",children:[(0,r.jsxs)(g.A,{children:["切片 ",e.chunkIndex]}),(0,r.jsx)(T,{children:(0,r.jsx)("pre",{style:A,children:e.content})})]},e.id)),(0,r.jsx)("div",{className:"mt-3 flex justify-end",children:(0,r.jsx)(m.A,{current:Math.floor(l.offset/30)+1,pageSize:30,total:l.totalChunks,showSizeChanger:!1,onChange:e=>{B("".concat(H,"&offset=").concat((e-1)*30))}})})]}):(null==l?void 0:l.status)==="recorded"?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(v.A,{className:"rounded-2xl border-[var(--borderColor)] mb-5",children:[(0,r.jsx)(E,{data:l}),(0,r.jsx)("p",{className:"mt-3 mb-0 text-xs text-[var(--colorTextSecondary)]",children:"这项检查只证明独立解析文字与切片的内容覆盖,不证明原文件解析、版式、工程理解或专业采用全部正确。"}),q&&(0,r.jsx)("div",{className:"mt-3",children:q}),l.identity.limitations.map(e=>(0,r.jsx)("p",{className:"mt-2 mb-0 text-xs text-[var(--colorTextSecondary)]",children:e},e)),(0,r.jsxs)("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[(0,r.jsx)(d.Ay,{size:"small",href:"".concat(W,"&original=1"),target:"_blank",children:"查看/下载入库原版本"}),(0,r.jsx)(d.Ay,{size:"small",onClick:()=>{(0,k.tn)(t,"source-version",s||void 0).catch(e=>h("可选原版本对照不可用:".concat(String(e),";库内数据仍可读取")))},children:"本机打开入库原版本"})]}),(0,r.jsxs)("details",{className:"mt-4",children:[(0,r.jsx)("summary",{className:"text-xs cursor-pointer text-[var(--colorTextSecondary)]",children:"技术详情(原文件哈希 / 解析版本 / 解析身份 / 核查口径)"}),(0,r.jsx)("div",{className:"mt-3",children:(0,r.jsxs)(f.A,{size:"small",column:1,bordered:!0,styles:{label:{width:"120px",background:"var(--colorFillAlter)",color:"var(--colorTextSecondary)"}},children:[(0,r.jsx)(f.A.Item,{label:"原文件SHA256",children:(0,r.jsx)("span",{className:"break-all text-xs",children:l.identity.sourceHash})}),(0,r.jsx)(f.A.Item,{label:"解析版本",children:(0,r.jsx)("span",{className:"text-xs",children:l.identity.parserVersion})}),(0,r.jsx)(f.A.Item,{label:"解析身份",children:(0,r.jsx)("span",{className:"break-all text-xs",children:l.identity.snapshotId})}),(0,r.jsx)(f.A.Item,{label:"核查口径",children:(0,r.jsxs)("span",{className:"text-xs",children:[l.conservation.version," \xb7 ",l.conservation.scope," \xb7 入库状态 ",l.conservation.ingestionStatus]})}),(0,r.jsx)(f.A.Item,{label:"底稿快照",children:(0,r.jsx)("span",{className:"break-all text-xs",children:l.conservation.snapshotId})})]})})]})]}),(0,r.jsx)(y.A,{className:"documents-tabs",activeKey:R,onChange:I,items:[{key:"structure",label:"解析结构",children:(0,r.jsx)(v.A,{className:"rounded-2xl border-[var(--borderColor)]",onWheelCapture:e=>{(e.ctrlKey||e.metaKey)&&(e.preventDefault(),M(t=>Math.min(4,Math.max(.2,Math.round((t-.1*Math.sign(e.deltaY))*100)/100))))},children:(0,r.jsx)(O,{structure:l.structure,endpoint:W,zoom:w,viewportRef:F},l.identity.snapshotId)})},{key:"chunks",label:"实际切片重组",children:(0,r.jsxs)(v.A,{className:"rounded-2xl border-[var(--borderColor)]",children:[(0,r.jsxs)("p",{className:"text-xs text-[var(--colorTextSecondary)]",children:["当前展示切片 ",l.offset+1," 至 ",l.offset+l.chunks.length,",共 ",l.totalChunks," 块;分页不代表其余内容不存在。"]}),l.chunks.map(e=>(0,r.jsxs)("div",{className:"my-4",children:[(0,r.jsxs)(i.A,{size:4,wrap:!0,children:[(0,r.jsxs)(g.A,{children:["切片 ",e.chunkIndex]}),e.sectionTitle?(0,r.jsx)(g.A,{color:"cyan",children:e.sectionTitle}):null]}),(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(T,{children:(0,r.jsx)("pre",{style:A,children:e.content})})}),(0,r.jsxs)("details",{className:"mt-2",children:[(0,r.jsx)("summary",{className:"text-xs cursor-pointer text-[var(--colorTextTertiary)]",children:"库内解析底稿区间"}),(0,r.jsx)(T,{maxHeight:240,children:(0,r.jsx)("pre",{style:A,children:JSON.stringify(e.sourceSpans,null,2)})})]})]},e.id)),(0,r.jsx)("div",{className:"mt-3 flex justify-end",children:(0,r.jsx)(m.A,{current:Math.floor(l.offset/30)+1,pageSize:30,total:l.totalChunks,showSizeChanger:!1,onChange:e=>{B("".concat(W,"&offset=").concat((e-1)*30))}})})]})}]})]}):u?(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)(b.A,{active:!0,title:!1,paragraph:{rows:3}}),(0,r.jsx)(b.A,{active:!0,title:!1,paragraph:{rows:6}})]}):(0,r.jsx)(j.A,{description:"选择文件后查看解析结果"})})]})}},59528:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge/source-preview",function(){return s(2232)}])},85979:(e,t,s)=>{"use strict";s.d(t,{k:()=>c});var r=s(65321),a=s(43220),l=s.n(a),n=s(91648);function c(e){let{backHref:t,backLabel:s,title:a,description:c,extra:i}=e;return(0,r.jsx)("div",{className:"mb-6 bg-[var(--colorBgContainer)] rounded-2xl overflow-hidden border border-[var(--borderColor)] p-6",children:(0,r.jsxs)("div",{className:"flex flex-col md:flex-row md:items-end justify-between gap-4 md:gap-6",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,r.jsxs)(l(),{href:t,prefetch:!1,className:"detailBack",children:[(0,r.jsx)(n.A,{size:16,strokeWidth:2,"aria-hidden":!0}),(0,r.jsx)("span",{children:s})]}),(0,r.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,r.jsx)("h1",{className:"text-2xl font-bold text-[var(--colorText)] m-0 truncate",children:a}),c?(0,r.jsx)("p",{className:"text-sm text-[var(--colorTextSecondary)] m-0 break-all",children:c}):null]})]}),i?(0,r.jsx)("div",{className:"shrink-0 flex items-center gap-2",children:i}):null]})})}}},e=>{e.O(0,[855,551,702,665,499,759,992,127,862,636,593,792],()=>e(e.s=59528)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[12],{13841:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>$});var r=l(65321),a=l(97109),n=l(48702),s=l(43220),i=l.n(s),o=l(86109),c=l(17807),d=l(25258),u=l(11702),m=l(71102),h=l(85114),f=l(7576),p=l(57271),x=l(33442),g=l(38964),y=l(56768),v=l(2285),w=l(59067),b=l(57544),j=l(4651),_=l(93314),k=l(61825),C=l(26619),S=l(26631),A=l(29606),P=l(64254),z=l(64629),N=l(58209),F=l(85855),T=l(30486),E=l(54746),M=l(58740),R=l(38762),I=l(76830),B=l(39219),L=l(22931),D=l(6578),O=l(45551),H=l(14569),U=l.n(H),V=l(58690),J=l(93360),Q=l(46758),X=l(73662);function q(){let e=(0,n.Vr)(),t=(0,o.useRouter)().pathname,{jobs:l}=(0,X.M4)(),s=(0,a.useMemo)(()=>l.filter(e=>"processing"===e.status),[l]),c=s[0];return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i(),{href:"/jobs",prefetch:!1,className:"shrink-0",children:(0,r.jsx)(Q.A,{count:s.length,size:"small",children:(0,r.jsx)(h.Ay,{type:"text",icon:s.length?(0,r.jsx)(z.A,{spin:!0}):(0,r.jsx)(M.A,{}),children:e("jobs.title")})})}),c&&"/jobs"!==t?(0,r.jsxs)("span",{className:"max-w-[260px] truncate text-[var(--colorTextSecondary)]",children:[c.title," \xb7 ",c.percent,"%"]}):null]})}let W=["document","spreadsheet","image","cad","code","data","web","diagram","archive","other"],K=/\.(zip|jar|war|apk|tar|gz|tgz|bz2|rar|7z)$/iu,G=/(^|\/)\.DS_Store$|(^|\/)Thumbs\.db$|(^|\/)__MACOSX\/|\.bak$/iu;function $(){let e=(0,n.Vr)("knowledge"),{locale:t}=(0,n.x_)(),{message:l}=c.A.useApp(),[s,H]=(0,a.useState)(!1),[Q,X]=(0,a.useState)([]),[$,Z]=(0,a.useState)(""),[Y,ee]=(0,a.useState)(!1),et=(0,a.useCallback)(async()=>{try{X(await (0,D.Ls)())}catch(t){l.error(e("ignoreRulesLoadFailed"))}},[e]),el=(0,a.useCallback)(()=>{H(!0),Z(""),et()},[et]),er=(0,a.useCallback)(async()=>{let t=$.trim();if(t){ee(!0);try{await (0,D.YO)([t]),Z(""),await et(),l.success(e("ignoreRulesAdded"))}catch(t){l.error(e("ignoreRulesSaveFailed"))}finally{ee(!1)}}},[$,et,e]),ea=(0,a.useCallback)(async t=>{ee(!0);try{await (0,D.Pw)(t),await et(),l.success(e("ignoreRulesDeleted"))}catch(t){l.error(e("ignoreRulesSaveFailed"))}finally{ee(!1)}},[et,e]),en=(0,o.useRouter)(),es="string"==typeof en.query.category?en.query.category:"",{stats:ei,reload:eo}=function(){let[e,t]=(0,a.useState)(null),[l,r]=(0,a.useState)(!1),n=(0,a.useCallback)(async()=>{r(!0);try{t(await (0,D.hc)())}catch(e){}finally{r(!1)}},[]);return(0,a.useEffect)(()=>{n()},[n]),{stats:e,loading:l,reload:n}}(),[ec,ed]=(0,a.useState)([]),[eu,em]=(0,a.useState)(!1),[eh,ef]=(0,a.useState)(""),[ep,ex]=(0,a.useState)(""),[eg,ey]=(0,a.useState)(es),[ev,ew]=(0,a.useState)(!1),[eb,ej]=(0,a.useState)(!1),[e_,ek]=(0,a.useState)([]),[eC,eS]=(0,a.useState)([]),[eA,eP]=(0,a.useState)([]),[ez,eN]=(0,a.useState)({}),eF=(0,a.useRef)(eg),eT=(0,a.useRef)(new Set),eE=(0,a.useRef)(new Map);(0,a.useEffect)(()=>{eF.current=eg},[eg]),(0,a.useEffect)(()=>{ey("string"==typeof en.query.category?en.query.category:"")},[en.query.category]);let eM=(0,a.useCallback)(async()=>{try{let e=await (0,D.BO)(),t={};for(let l of e)t[l.category]=l.fileCount;eN(t)}catch(e){}},[]);(0,a.useEffect)(()=>{eM()},[eM]);let eR=(0,a.useCallback)(async(e,t)=>{let l=null!=e?e:eF.current;(null==t?void 0:t.silent)||(em(!0),ef(""));try{let e=await (0,D.HT)({category:l||void 0,limit:5e3});ed(e.files||[]),e.initializing&&window.setTimeout(()=>{eR(l,{silent:!0})},3e3)}catch(e){(null==t?void 0:t.silent)||(ed([]),ef(e instanceof Error?e.message:"文件列表加载失败"))}finally{(null==t?void 0:t.silent)||em(!1)}},[]);(0,a.useEffect)(()=>{eR(eg)},[eg,eR]);let eI=(0,a.useCallback)(async e=>{await eR(void 0,e),eo(),eM()},[eM,eR,eo]),eB=e=>"document"===e.type?null:{id:e.id,type:e.type,title:e.title,description:e.message,status:e.status,percent:e.percent,filePath:e.filePath,chunkCount:e.chunkCount,textLength:e.textLength,extractionMode:e.extractionMode,error:e.error,createdAt:e.createdAt},eL=(0,a.useCallback)(async()=>{try{let t=await (0,D.Qx)(),l=t.operations.map(eB).filter(e=>!!e);for(let l of[...eT.current]){var e;let r=t.operations.find(e=>e.id===l);if(!r)continue;let a="".concat(r.status,":").concat(r.stage),n=null!=(e=eE.current.get(l))?e:"";"success"===r.status||"error"===r.status?(eT.current.delete(l),eE.current.delete(l),eI({silent:!0})):a!==n&&(eE.current.set(l,a),eI({silent:!0}))}ek(e=>{let t=new Set(l.map(e=>e.id).filter(Boolean)),r=l.map(t=>{var l;let r=e.find(e=>e.id===t.id);return r?{...r,...t,createdAt:null!=(l=r.createdAt)?l:t.createdAt}:t}),a=e.filter(e=>e.id&&!t.has(e.id)&&"processing"===e.status);return[...r,...a].slice(0,50)})}catch(e){}},[eI]),eD=(0,a.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];ek(l=>{let r=l.findIndex(l=>e.id&&l.id===e.id||t.includes(l.title));if(r>=0){var a;let t=[...l];return t[r]={...l[r],...e,createdAt:null!=(a=l[r].createdAt)?a:e.createdAt},t}return[e,...l].slice(0,50)})},[]);(0,a.useEffect)(()=>{eL()},[eL]);let eO=(0,a.useMemo)(()=>{let e=0,t=0,l=0;for(let r of e_)"processing"===r.status?e++:"success"===r.status?t++:("error"===r.status||"warning"===r.status)&&l++;return{processing:e,success:t,error:l}},[e_]);(0,a.useEffect)(()=>{if(0===eO.processing)return;let e=window.setInterval(()=>{eL()},2e3),t=window.setInterval(()=>{eI({silent:!0})},8e3);return()=>{window.clearInterval(e),window.clearInterval(t)}},[eL,eI,eO.processing]);let eH=async e=>{let t=e.filter(e=>{let t=e.webkitRelativePath||e.name;return e.size>0&&!K.test(e.name)&&!G.test(t)}),r=e.length-t.length;if(r>0&&l.warning("已跳过 ".concat(r," 个空文件、系统文件、备份文件或压缩包")),0===t.length)return;let a=1===t.length?t[0].name:"".concat(t.length," 个文件");ew(!0);let n="".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2));eT.current.add(n),eE.current.set(n,""),eD({id:n,type:"upload",title:"上传 ".concat(a),description:"等待上传、解析、切片和入库;同路径文件会更新,其他已有文件不会清除",status:"processing",percent:5});try{await (0,D.c1)(t,void 0,n,e=>{eD({id:n,type:"upload",title:"上传 ".concat(a),description:"正在上传文件:".concat(e.uploadedFiles,"/").concat(e.totalFiles,",批次 ").concat(e.batchIndex+1,"/").concat(e.totalBatches),status:"processing",percent:Math.min(5,Math.max(1,Math.round(e.uploadedFiles/Math.max(1,e.totalFiles)*5)))})});let e=ep||eg?"当前筛选(".concat([ep?"搜索「".concat(ep,"」"):"",eg?"分类「".concat(eg,"」"):""].filter(Boolean).join(" + "),")不会自动清空——新文件若未出现在列表里,调整筛选即可看到"):"新文件会随解析进度出现在列表里";l.info("文件已上传,正在后台解析、切片和入库;同路径文件会更新,其他已有文件不会清除,可在顶部“后台任务”查看进度。".concat(e)),await eL()}catch(e){if(e instanceof D.NH){let t=e.failures.slice(0,3).map(e=>"批次 ".concat(e.batchIndex+1,"(").concat(e.files.join("、")).concat(e.files.length<5?"":" 等","):").concat(e.message)).join(";");l.warning("".concat(e.message,",失败文件可重新选择上传")),eD({id:n,type:"upload",title:"部分文件上传失败 ".concat(a),description:t||e.message,status:"warning",percent:100,error:t||e.message})}else{eT.current.delete(n),eE.current.delete(n);let t=e instanceof Error?e.message:"请重试或检查文件格式";l.error(t||"上传失败"),eD({id:n,type:"error",title:"上传失败 ".concat(a),description:t,status:"error",percent:100})}}finally{ew(!1),eI({silent:!0})}},eU=async()=>{ej(!0);let e="reindex-ui-".concat(Date.now());eD({id:e,type:"reindex",title:"重新解析入库",description:"正在提交后台任务",status:"processing",percent:5});try{var t;let r=await (0,D.H1)(),a=r.operationId||e,n=r.job;l.info(r.alreadyRunning?"已有重新解析任务正在后台执行":"已提交重新解析入库任务,可在顶部“后台任务”查看进度"),eD({id:a,type:"reindex",title:(null==n?void 0:n.title)||"重新解析入库",description:(null==n?void 0:n.message)||"后台将重新扫描文件、解析、切片并重建索引",status:(null==n?void 0:n.status)||"processing",percent:null!=(t=null==n?void 0:n.percent)?t:10,error:null==n?void 0:n.error},["重新解析入库"]);for(let e=0;e<360;e++){let e=await (0,D.ax)(a).then(e=>e.job).catch(async()=>(await (0,D.Qx)()).operations.find(e=>e.id===a));if(e){let t="success"===e.status||"error"===e.status;if(eD({id:a,type:"error"===e.status?"error":"reindex",title:"success"===e.status?"重新解析入库完成":"error"===e.status?"重新解析入库失败":e.title,description:e.error||e.message,status:e.status,percent:e.percent,filePath:e.filePath,chunkCount:e.chunkCount,error:e.error}),t){"success"===e.status?l.success(e.message||"重新解析入库完成"):l.error(e.error||e.message||"重新解析入库失败");break}}await new Promise(e=>setTimeout(e,1e3))}await eI(),await eL()}catch(r){let t=r instanceof Error?r.message:"重新解析入库失败";l.error(t),eD({id:e,type:"error",title:"重新解析入库失败",description:t,status:"error",percent:100},["重新解析入库","重新解析入库完成","重新解析入库失败"])}finally{ej(!1)}},eV=async function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r="file-reindex-ui-".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2));eD({id:r,type:"reindex",title:"".concat(t?"重新解析文件夹":"重新解析"," ").concat(e),description:t?"正在提交文件夹后台任务":"正在提交单文件后台任务",status:"processing",percent:5,filePath:e});try{var a;let t=await (0,D.HC)(e),n=t.operationId||r,s=t.job;l.info(t.alreadyRunning?"已有知识库任务正在后台执行":"已提交单文件重新解析任务"),eD({id:n,type:"reindex",title:(null==s?void 0:s.title)||"重新解析 ".concat(e),description:(null==s?void 0:s.message)||"后台将重新解析、分块并入库该文件",status:(null==s?void 0:s.status)||"processing",percent:null!=(a=null==s?void 0:s.percent)?a:10,filePath:(null==s?void 0:s.filePath)||e,chunkCount:null==s?void 0:s.chunkCount,error:null==s?void 0:s.error},["重新解析 ".concat(e)]);for(let t=0;t<240;t++){let t=await (0,D.ax)(n).then(e=>e.job).catch(async()=>(await (0,D.Qx)()).operations.find(e=>e.id===n));if(t){let r="success"===t.status||"error"===t.status;if(eD({id:n,type:"error"===t.status?"error":"reindex",title:"success"===t.status?"重新解析完成 ".concat(e):"error"===t.status?"重新解析失败 ".concat(e):t.title,description:t.error||t.message,status:t.status,percent:t.percent,filePath:t.filePath||e,chunkCount:t.chunkCount,error:t.error}),await eR(),r){"success"===t.status?l.success(t.message||"单文件重新解析完成"):l.error(t.error||t.message||"单文件重新解析失败");break}}await new Promise(e=>setTimeout(e,1e3))}await eI(),await eL()}catch(a){let t=a instanceof Error?a.message:"单文件重新解析失败";l.error(t),eD({id:r,type:"error",title:"重新解析失败 ".concat(e),description:t,status:"error",percent:100,filePath:e},["重新解析 ".concat(e)])}},eJ=t=>{let r="selected"===t?e1:"filtered"===t?eX.map(e=>e.relativePath):[],a=ec.length;if("all"!==t&&0===r.length||"all"===t&&0===a)return void l.info("没有可删除的文件");let n="all"===t?"删除全部文件 ".concat(a," 个?"):"filtered"===t?"删除当前筛选结果中的文件 ".concat(r.length," 个?"):"删除已选文件 ".concat(r.length," 个?");d.A.confirm({title:n,content:"将同时删除文件、切片、索引和向量记录。此操作不可撤销。",okText:e("common.delete"),cancelText:e("common.cancel"),okButtonProps:{danger:!0},onOk:async()=>{ek(e=>[{type:"delete",title:n,description:"正在批量删除文件和索引",status:"processing",percent:10},...e].slice(0,50));try{var e;let n=null!=(e=("all"===t?await (0,D.X8)():"selected"===t?await (0,D.tZ)(e0,eY):await (0,D.SJ)(r)).deleted)?e:"all"===t?a:r.length;l.success("已删除 ".concat(n," 个文件")),eS([]),ek(e=>[{type:"delete",title:"批量删除完成",description:"已删除 ".concat(n," 个文件、切片和索引"),status:"success"},...e].slice(0,50)),await eI(),await eL()}catch(t){let e=t instanceof Error&&t.message?t.message:"批量删除失败";l.error(e),ek(t=>[{type:"error",title:"批量删除失败",description:e,status:"error"},...t].slice(0,50))}}})},eQ=async()=>{if(0===e0.length&&0===eY.length)return;let t=l.loading(e("exporting"),0);try{let{blob:t,fileName:r,exported:a,skipped:n}=await (0,D.G8)({relativePaths:e0,folderPaths:eY}),s=URL.createObjectURL(t),i=document.createElement("a");i.href=s,i.download=r,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(s),n>0?l.warning(e("exportParsedSkipped").replace("{count}",String(n))):l.success(e("exportParsedSuccess").replace("{count}",String(a)))}catch(t){l.error(t instanceof Error&&t.message?t.message:e("exportParsedFailed"))}finally{t()}},eX=(0,a.useMemo)(()=>ep?ec.filter(e=>e.relativePath.toLowerCase().includes(ep.toLowerCase())):ec,[ep,ec]),eq=(0,a.useMemo)(()=>new Set(eX.map(e=>e.relativePath)),[eX]),eW=(0,a.useMemo)(()=>ec.filter(e=>"error"===e.status).length,[ec]),eK=(0,a.useMemo)(()=>{let l=W.filter(e=>"other"!==e),r=Object.keys(ez).filter(e=>!l.includes(e)&&"other"!==e);return[{label:e("allCategories"),value:""},...[...l,...r,"other"].map(e=>{var l;let r=null!=(l=ez[e])?l:0,a=(0,O.Jm)(e,t);return{label:r>0?"".concat(a," (").concat(r,")"):a,value:e}})]},[ez,t,e]),eG=(0,a.useMemo)(()=>{let e={};for(let l of[...eX].sort((e,t)=>e.relativePath.localeCompare(t.relativePath))){let r=l.relativePath.split("/"),a="";for(let n=0;n<r.length;n++){let s=r[n],i=a;a=a?"".concat(a,"/").concat(s):s;let o=n===r.length-1;if(e[a])o||e[a].isFolder?o&&(e[a].isFolder=!1,e[a].file=l,e[a].fileCount=1,e[a].totalSize=l.fileSize,e[a].totalChunks=l.chunkCount):(e[a].isFolder=!0,e[a].children=[],e[a].fileCount=0,e[a].totalSize=0,e[a].totalChunks=0);else{var t;e[a]={key:a,name:s,isFolder:!o,...o?{file:l,fileCount:1,totalSize:l.fileSize,totalChunks:l.chunkCount}:{children:[],fileCount:0,totalSize:0,totalChunks:0}},i&&(null==(t=e[i])?void 0:t.children)&&e[i].children.push(e[a])}}}let l=e=>{for(let n of e)if(n.children){l(n.children);let e=0,s=0,i=0;for(let l of n.children){var t,r,a;e+=null!=(t=l.fileCount)?t:0,s+=null!=(r=l.totalSize)?r:0,i+=null!=(a=l.totalChunks)?a:0}n.fileCount=e,n.totalSize=s,n.totalChunks=i}},r=e=>e.map(e=>e.children?{...e,children:r(e.children)}:e).filter(e=>{var t,l,r;return!e.isFolder||(null!=(l=e.fileCount)?l:0)>0&&(null!=(r=null==(t=e.children)?void 0:t.length)?r:0)>0}),a=Object.values(e).filter(e=>!e.key.includes("/"));return l(a),r(a)},[eX]),e$=(0,a.useMemo)(()=>{let e=[],t=l=>{for(let r of l)e.push(r.key),r.children&&t(r.children)};return t(eG),e},[eG]),eZ=(0,a.useMemo)(()=>new Set([...eq,...e$]),[e$,eq]),eY=(0,a.useMemo)(()=>eC.map(String).filter(e=>!eq.has(e)&&e$.includes(e)),[e$,eC,eq]),e0=(0,a.useMemo)(()=>eC.map(String).filter(e=>eq.has(e)),[eC,eq]),e1=(0,a.useMemo)(()=>{let e=new Set;for(let t of e0){let l=ec.find(e=>e.relativePath===t);l&&e.add(l.relativePath)}for(let t of eY){let l="".concat(t,"/");for(let t of ec)t.relativePath.startsWith(l)&&e.add(t.relativePath)}return Array.from(e)},[ec,e0,eY]),e5=e1.length;(0,a.useEffect)(()=>{eS(e=>e.filter(e=>eZ.has(String(e))))},[eZ]);let e6=(0,a.useRef)(ep);(0,a.useEffect)(()=>{e6.current!==ep&&(e6.current=ep,eP(ep?e$:[]))},[ep,e$]);let e3=(e,t)=>{eP(l=>e?[...l,t.key]:l.filter(e=>e!==t.key))},e2=[{title:e("fileName"),dataIndex:"name",key:"name",render:(e,t)=>(0,r.jsxs)("span",{className:U().fileNameCell,children:[t.isFolder?(0,r.jsx)("span",{style:{cursor:"pointer"},onClick:e=>{e.stopPropagation(),e3(!eA.includes(t.key),t)},children:(e=>{let t=e.children;return t&&0!==t.length?(0,r.jsx)(P.A,{style:{color:"var(--colorBrand)",fontSize:15}}):(0,r.jsx)(A.A,{style:{color:"var(--colorBrand)",fontSize:15}})})(t)}):(e=>{if(!e)return(0,r.jsx)(y.A,{style:{fontSize:15}});let t=e.category;return"image"===t?(0,r.jsx)(v.A,{style:{color:"#eb2f96",fontSize:15}}):"spreadsheet"===t?(0,r.jsx)(w.A,{style:{color:"#52c41a",fontSize:15}}):"document"===t?(0,r.jsx)(b.A,{style:{color:"#1677ff",fontSize:15}}):"code"===t?(0,r.jsx)(j.A,{style:{color:"#fa8c16",fontSize:15}}):"archive"===t?(0,r.jsx)(_.A,{style:{color:"#8c8c8c",fontSize:15}}):"web"===t?(0,r.jsx)(k.A,{style:{color:"#13c2c2",fontSize:15}}):"data"===t?(0,r.jsx)(C.A,{style:{color:"#722ed1",fontSize:15}}):"cad"===t?(0,r.jsx)(y.A,{style:{color:"#fa541c",fontSize:15}}):"diagram"===t?(0,r.jsx)(v.A,{style:{color:"#a0d911",fontSize:15}}):(0,r.jsx)(S.A,{style:{fontSize:15}})})(t.file),t.isFolder?(0,r.jsx)("span",{className:U().folderName,onClick:e=>{e.stopPropagation(),e3(!eA.includes(t.key),t)},children:t.name}):(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(i(),{className:"min-w-0 max-w-[520px] whitespace-normal break-words leading-relaxed",href:"/knowledge/file-detail?relativePath=".concat(encodeURIComponent(t.key)),children:t.name})})]})},{title:e("fileCategory"),dataIndex:"category",key:"cat",width:110,render:(e,l)=>{var a,n;return l.isFolder?(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(0,r.jsx)(u.A,{children:(0,O.Jm)(null!=(n=null==(a=l.file)?void 0:a.category)?n:"",t)})}},{title:e("fileSize"),dataIndex:"fileSize",key:"size",width:90,render:(e,t)=>{var l,r,a;return(0,O.z3)(t.isFolder?null!=(r=t.totalSize)?r:0:null!=(a=null==(l=t.file)?void 0:l.fileSize)?a:0)}},{title:e("chunksCount"),dataIndex:"chunkCount",key:"chunks",width:80,render:(e,t)=>{var l,a,n;let s=t.isFolder?null!=(a=t.totalChunks)?a:0:null!=(n=null==(l=t.file)?void 0:l.chunkCount)?n:0;return(0,r.jsx)(u.A,{color:s>1?"green":"orange",children:s})}},{title:e("parsingStatus"),dataIndex:"status",key:"status",width:100,render:(e,t)=>{var l,a,n,s;return t.isFolder?(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(0,r.jsx)(u.A,{color:"active"===(s=null==(l=t.file)?void 0:l.status)?"green":"processing"===s||"indexing"===s?"blue":"error"===s?"red":"orange",children:(null==(a=t.file)?void 0:a.errorMessage)||(null==(n=t.file)?void 0:n.status)||"—"})}},{title:e("fileDate"),dataIndex:"mtime",key:"date",width:130,render:(e,l)=>{var a;return l.isFolder?(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(null==(a=l.file)?void 0:a.mtime)?new Date(l.file.mtime).toLocaleDateString(t):"—"}},{title:e("source"),key:"source",width:100,render:(t,l)=>l.isFolder?(0,r.jsx)("span",{style:{color:"var(--colorTextQuaternary)"},children:"—"}):(0,r.jsx)(u.A,{color:"cyan",children:e("fileSource")})},{title:"",key:"act",width:80,align:"center",render:(t,a)=>{var n;return(0,r.jsx)(m.A,{menu:{items:a.isFolder?[{key:"reindex-folder",label:"重新索引文件夹",icon:(0,r.jsx)(z.A,{}),disabled:(null!=(n=a.fileCount)?n:0)===0,onClick:()=>{eV(a.key,!0)}}]:[{key:"reindex",label:e("reindex"),icon:(0,r.jsx)(z.A,{}),onClick:()=>{eV(a.file.relativePath)}},{type:"divider"},{key:"delete",label:e("delete"),icon:(0,r.jsx)(N.A,{}),danger:!0,onClick:()=>{var t;return t=a.file,void d.A.confirm({title:e("delete"),content:e("deleteConfirm"),okText:e("common.confirm"),cancelText:e("common.cancel"),okButtonProps:{danger:!0},onOk:async()=>{ek(e=>[{type:"delete",title:"删除 ".concat(t.relativePath),description:"正在删除文件记录",status:"processing"},...e].slice(0,50));try{await (0,D.xq)(t.relativePath),l.success("已删除"),ek(e=>[{type:"delete",title:"删除完成 ".concat(t.relativePath),description:"文件和索引记录已移除",status:"success"},...e].slice(0,50)),eS([]),await eI(),await eL()}catch(r){let e=r instanceof Error&&r.message?r.message:"删除失败";l.error(e),ek(l=>[{type:"error",title:"删除失败 ".concat(t.relativePath),description:e,status:"error"},...l].slice(0,50))}}})}}]},trigger:["click"],children:(0,r.jsx)(h.Ay,{type:"text",size:"small",icon:(0,r.jsx)(F.A,{})})})}}],e4=(0,r.jsxs)("div",{className:"flex flex-1 md:flex-none w-full md:w-auto items-center gap-3",children:[(0,r.jsx)(f.A,{placeholder:e("searchPlaceholder"),prefix:(0,r.jsx)(T.A,{className:"text-[var(--colorTextTertiary)]"}),value:ep,onChange:e=>{ex(e.target.value)},allowClear:!0,variant:"borderless",className:"max-w-[420px] flex-1 bg-transparent hover:bg-transparent focus:bg-transparent",style:{borderBottom:"1px solid var(--borderColor)",borderRadius:0,paddingLeft:0,paddingRight:0}}),(0,r.jsx)(p.A,{value:eg||void 0,onChange:e=>{ey(e||"")},placeholder:e("filterCategory"),allowClear:!0,style:{width:170},variant:"borderless",options:eK}),(0,r.jsx)("div",{className:"w-[1px] h-6 bg-[var(--borderColor)] mx-1"}),(0,r.jsx)(q,{}),(0,r.jsx)(m.A,{menu:{items:[{key:"file",label:e("uploadFiles"),icon:(0,r.jsx)(y.A,{}),onClick:()=>{var e;return null==(e=document.getElementById("kb-file-upload-input"))?void 0:e.click()}},{key:"folder",label:e("uploadFolder"),icon:(0,r.jsx)(A.A,{}),onClick:()=>{var e;return null==(e=document.getElementById("kb-folder-upload-input"))?void 0:e.click()}},{type:"divider"},{key:"reindex",label:e("reindexAll"),icon:(0,r.jsx)(z.A,{}),onClick:()=>{eU()},danger:!0}]},trigger:["click"],children:(0,r.jsx)(h.Ay,{type:"primary",icon:(0,r.jsx)(E.A,{}),loading:ev||eb,className:"rounded-md px-4",children:e("new")})}),(0,r.jsx)("input",{id:"kb-file-upload-input",type:"file",multiple:!0,hidden:!0,accept:".pdf,.doc,.docx,.txt,.md,.csv,.tsv,.xls,.xlsx,.png,.jpg,.jpeg,.webp,.svg,.dwg,.dxf,.step,.stp,.iges,.igs,.js,.ts,.tsx,.jsx,.py,.go,.java,.cs,.cpp,.c,.h,.json,.jsonl,.yaml,.yml,.xml,.html,.htm,.drawio,.dio,.vsdx,.vdx,.puml,.plantuml,.mmd,.mermaid,.excalidraw",onChange:e=>{var t;let l=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",eH(l)}}),(0,r.jsx)("input",{id:"kb-folder-upload-input",type:"file",multiple:!0,hidden:!0,webkitdirectory:"",onChange:e=>{var t;let l=Array.from(null!=(t=e.target.files)?t:[]);e.target.value="",eH(l)}})]}),e8=[{icon:(0,r.jsx)(y.A,{}),label:e("totalFiles"),value:ei?String(ei.fileCount):"—"},{icon:(0,r.jsx)(C.A,{}),label:e("totalChunks"),value:ei?String(ei.chunkCount):"—"},{icon:(0,r.jsx)(_.A,{}),label:e("totalSize"),value:ei?(0,O.z3)(ei.totalSizeBytes):"—"},{icon:(0,r.jsx)(M.A,{}),label:e("lastIndexed"),value:ei?ei.lastIndexedAt?(0,O.fw)(ei.lastIndexedAt,t):e("common.never"):"—"}];return(0,r.jsxs)("div",{className:"h-[calc(100vh_-_172px)] flex flex-col",children:[(0,r.jsx)(J.z,{title:e("title"),description:e("description"),extra:e4}),(0,r.jsx)("div",{className:"bg-[var(--colorBgContainer)] rounded-2xl border border-[var(--borderColor)] px-6 py-5 mb-4 shrink-0 animateFadeIn",children:(0,r.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-6 stagger-1",children:e8.map(e=>(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)("div",{className:"w-12 h-12 rounded-xl bg-[var(--colorBgHover)] flex items-center justify-center text-xl text-[var(--colorTextSecondary)]",children:e.icon}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("div",{className:"text-[11px] font-semibold text-[var(--colorTextTertiary)] uppercase tracking-wider mb-1",children:e.label}),(0,r.jsx)("div",{className:"text-xl font-bold text-[var(--colorText)] leading-none truncate",children:e.value})]})]},e.label))})}),eh&&(0,r.jsx)("div",{role:"alert",className:"p-4 mb-4 bg-[var(--colorDanger)]/10 text-[var(--colorDanger)] rounded-xl border border-[var(--colorDanger)]/20",children:eh}),(0,r.jsxs)("div",{className:"flex-1 min-h-0 bg-[var(--colorBgContainer)] rounded-2xl border border-[var(--borderColor)] overflow-hidden flex flex-col animateFadeIn stagger-3",style:{opacity:0},children:[(0,r.jsxs)("div",{className:"flex flex-wrap justify-between items-center gap-3 p-4 bg-[var(--colorBgHover)] border-b border-[var(--borderColor)] shrink-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 text-xs text-[var(--colorTextSecondary)] font-medium",children:[(0,r.jsx)("span",{children:e("showingMatchingFiles").replace("{count}",String(eX.length))}),eW>0&&(0,r.jsxs)(u.A,{color:"red",icon:(0,r.jsx)(R.A,{}),className:"m-0 border-0",children:[e("parsingErrors")," ",eW]})]}),(0,r.jsxs)(x.A,{size:8,children:[e5>0&&(0,r.jsxs)(h.Ay,{size:"small",icon:(0,r.jsx)(I.A,{}),onClick:()=>void eQ(),className:"rounded-lg",children:[e("exportParsed")," (",e5,")"]}),e5>0&&(0,r.jsxs)(h.Ay,{danger:!0,size:"small",icon:(0,r.jsx)(N.A,{}),onClick:()=>eJ("selected"),className:"rounded-lg",children:[e("deleteSelected")," (",e5,")"]}),(0,r.jsx)(h.Ay,{danger:!0,size:"small",disabled:0===ec.length,onClick:()=>eJ("all"),className:"rounded-lg",children:e("deleteAll")}),(0,r.jsx)(h.Ay,{size:"small",onClick:el,className:"rounded-lg",children:e("ignoreRules")})]})]}),(0,r.jsx)(g.A,{rowKey:"key",columns:e2,dataSource:eG,loading:eu&&!ev&&!eb,size:"middle",className:"flex-1 border-0 tableFillHeight",expandable:{expandedRowKeys:eA,onExpand:e3,expandIcon:e=>{let{expanded:t,onExpand:l,record:a}=e;return a.isFolder?(0,r.jsx)("button",{type:"button",onClick:e=>l(a,e),className:"w-6 h-6 mr-1 inline-flex items-center justify-center align-middle text-[var(--colorTextTertiary)] hover:text-[var(--colorText)] transition-colors bg-transparent border-0 p-0 leading-none",children:t?(0,r.jsx)(B.A,{size:16}):(0,r.jsx)(L.A,{size:16})}):null}},locale:{emptyText:eh?"—":eu?e("common.loading"):ep?e("emptySearch"):e("noFiles")},pagination:(0,V.B)(e,{totalLabelKey:"knowledge.topLevelCount",totalLabelFallback:"共 {count} 个顶层项目"}),rowClassName:e=>"hover:bg-[var(--colorBgHover)] transition-colors ".concat(e.isFolder?"font-medium bg-[var(--colorBgSecondary)]/30":""),rowSelection:{selectedRowKeys:eC,onChange:eS,checkStrictly:!1,getCheckboxProps:e=>{var t;return{disabled:!!e.isFolder&&(null!=(t=e.fileCount)?t:0)===0}}}})]}),(0,r.jsxs)(d.A,{title:e("ignoreRules"),open:s,onCancel:()=>H(!1),footer:null,width:560,children:[(0,r.jsx)("p",{className:"text-xs text-[var(--colorTextSecondary)] m-0 mb-3",children:e("ignoreRulesHint")}),(0,r.jsxs)(x.A.Compact,{style:{width:"100%"},className:"mb-3",children:[(0,r.jsx)(f.A,{value:$,onChange:e=>Z(e.target.value),onPressEnter:()=>void er(),placeholder:e("ignoreRulesPlaceholder"),"aria-label":e("ignoreRulesAdd")}),(0,r.jsx)(h.Ay,{type:"primary",loading:Y,onClick:()=>void er(),children:e("ignoreRulesAdd")})]}),0===Q.length?(0,r.jsx)("p",{className:"text-xs text-[var(--colorTextTertiary)] m-0",children:e("ignoreRulesEmpty")}):(0,r.jsx)("ul",{className:"m-0 p-0 list-none flex flex-col gap-2",children:Q.map(t=>(0,r.jsxs)("li",{className:"flex items-center justify-between gap-3 rounded-lg border border-[var(--borderColor)] px-3 py-2",children:[(0,r.jsx)("code",{className:"text-xs break-all",children:t}),(0,r.jsx)(h.Ay,{size:"small",danger:!0,type:"text",disabled:Y,onClick:()=>void ea(t),children:e("ignoreRulesDelete")})]},t))})]})]})}},14569:e=>{e.exports={featureLabel:"style_featureLabel__XFSTX",featureValue:"style_featureValue__I_wMP",filterInput:"style_filterInput__4_Elu",filterSelect:"style_filterSelect__vUBJ9",statusCard:"style_statusCard__H7Mee",statusSummary:"style_statusSummary__7KavF",statusSummaryText:"style_statusSummaryText__Shw3j",statusClearBtn:"style_statusClearBtn__uJ9bE",statusExpandBtn:"style_statusExpandBtn__HhgIj",statusFilters:"style_statusFilters__g_LbG",filterPill:"style_filterPill__1pjFW",filterPillActive:"style_filterPillActive___UZVi",statusPanel:"style_statusPanel__9arTu",statusEmpty:"style_statusEmpty__8LWzH",timelineList:"style_timelineList__dqJrz",timelineItem:"style_timelineItem__dbuL_",timelineStatusIcon:"style_timelineStatusIcon__SkRwb",timelinePercent:"style_timelinePercent__pEyH4",timelineRow:"style_timelineRow__EDOVa",timelineTitle:"style_timelineTitle__Yujr8",timelineClose:"style_timelineClose__Byx_9",timelineDetail:"style_timelineDetail__nALei",timelineDesc:"style_timelineDesc__FMjWE",timelinePath:"style_timelinePath__C9VQI",timelineMeta:"style_timelineMeta__u_pCn",timelineMetaTag:"style_timelineMetaTag__G3jF1",timelineExpandArrow:"style_timelineExpandArrow__xIBdF",timelineExpandArrowOpen:"style_timelineExpandArrowOpen__TWWDC",fileNameCell:"style_fileNameCell__EHsnt",folderName:"style_folderName__VhLXP",folderRow:"style_folderRow__d7k9S",searchResultList:"style_searchResultList__cVKZg",searchResultItem:"style_searchResultItem__boj6D",searchResultHeader:"style_searchResultHeader__meVdJ",searchContent:"style_searchContent__XbUVk",pdfPreviewStrip:"style_pdfPreviewStrip__94_eG"}},45551:(e,t,l)=>{"use strict";function r(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),l=e/Math.pow(1024,t);return"".concat(l.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let l=Math.floor(Math.floor((Date.now()-e)/1e3)/60),r=Math.floor(l/60),a=Math.floor(r/24);return a>30?new Date(e).toLocaleDateString(t):"en-US"===t?a>0?"".concat(a,"d ago"):r>0?"".concat(r,"h ago"):l>0?"".concat(l,"m ago"):"Just now":a>0?"".concat(a," 天前"):r>0?"".concat(r," 小时前"):l>0?"".concat(l," 分钟前"):"刚刚"}l.d(t,{Jm:()=>i,fw:()=>a,mc:()=>o,z3:()=>r});let n={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},s={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function i(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===l?s:n)[e])?t:e}let o={active:"common.statusIndexed",outdated:"common.statusOutdated",error:"common.statusAbnormal",deleted:"common.statusDeleted",disk:"common.statusNotIndexed"}},58690:(e,t,l)=>{"use strict";function r(e){var t,l,r;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{defaultPageSize:null!=(t=a.pageSize)?t:10,pageSizeOptions:null!=(l=a.pageSizeOptions)?l:[10,20,50,100],showSizeChanger:!0,showTotal:t=>{var l,r;return e(null!=(l=a.totalLabelKey)?l:"common.totalRows",null!=(r=a.totalLabelFallback)?r:"共 {count} 条").replace("{count}",String(t))},hideOnSinglePage:null!=(r=a.hideOnSinglePage)&&r,showQuickJumper:!1}}l.d(t,{B:()=>r})},74183:(e,t,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/knowledge",function(){return l(13841)}])},93360:(e,t,l)=>{"use strict";l.d(t,{z:()=>n});var r=l(65321);l(97109);var a=l(33442);function n(e){let{title:t,description:l,extra:n,bottomContent:s}=e;return(0,r.jsxs)("div",{className:"animateFadeIn",children:[(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-end justify-between gap-4 pb-6 border-b border-[var(--borderColor)]",children:[(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("h1",{className:"text-3xl font-extrabold tracking-tight text-[var(--colorText)] mb-2",children:t}),l&&(0,r.jsx)("p",{className:"text-sm text-[var(--colorTextSecondary)] m-0",children:l})]}),n&&(0,r.jsx)(a.A,{className:"w-full sm:w-auto overflow-x-auto pb-1 sm:pb-0 shrink-0",size:"middle",wrap:!1,children:n})]}),s&&(0,r.jsx)("div",{className:"mt-6",children:s})]})}}},e=>{e.O(0,[855,551,210,702,665,576,499,338,964,681,636,593,792],()=>e(e.s=74183)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[46],{22708:(e,l,a)=>{"use strict";a.r(l),a.d(l,{default:()=>R});var r=a(65321),s=a(97109),o=a(48702),t=a(93360),n=a(17807),i=a(88762),d=a(85493),c=a(85114),m=a(25258),x=a(56985),p=a(84253),v=a(88278),h=a(33442),u=a(32965),g=a(11702),b=a(57271),j=a(7576),y=a(94992),f=a(34052),N=a(75822),A=a(44534),w=a(8383),C=a(54746),k=a(29071),S=a(59188),T=a(4216),B=a(13114),E=a(99650),P=a(58209),I=a(76981),K=a(61825),U=a(6578),H=a(85310),D=a(82238);let _=[{labelKey:"models.openAICompatible",value:"openai"},{labelKey:"models.anthropic",value:"anthropic"},{labelKey:"models.google",value:"google"},{labelKey:"models.ollama",value:"ollama"},{labelKey:"models.openRouter",value:"openrouter"}],z=[{key:"imageGeneration",labelKey:"models.imageGeneration"},{key:"imageUnderstanding",labelKey:"models.imageUnderstanding"},{key:"fileUnderstanding",labelKey:"models.fileUnderstanding"},{key:"audio",labelKey:"models.audioCapability"},{key:"video",labelKey:"models.videoCapability"}],F="••••••••",M=e=>e.includes("•");function R(){let e=(0,o.Vr)(),{message:l}=n.A.useApp(),[a,R]=(0,s.useState)(!0),[Z,O]=(0,s.useState)([]),[G,L]=(0,s.useState)(null),[X,q]=(0,s.useState)(!1),[V,J]=(0,s.useState)(null),[Q,W]=(0,s.useState)(!1),[Y,$]=(0,s.useState)(!1),[ee,el]=(0,s.useState)(null),[ea,er]=(0,s.useState)(null),[es,eo]=(0,s.useState)({}),[et,en]=(0,s.useState)(!1),[ei,ed]=(0,s.useState)(!1),[ec,em]=(0,s.useState)(""),[ex,ep]=(0,s.useState)(""),[ev,eh]=(0,s.useState)(""),[eu,eg]=(0,s.useState)(""),[eb,ej]=(0,s.useState)(""),[ey,ef]=(0,s.useState)("openai"),[eN,eA]=(0,s.useState)(!1),[ew,eC]=(0,s.useState)({}),[ek,eS]=(0,s.useState)(!1),[eT,eB]=(0,s.useState)(!1),[eE,eP]=(0,s.useState)(!1),[eI,eK]=(0,s.useState)(!0),[eU,eH]=(0,s.useState)(!1),[eD,e_]=(0,s.useState)([]),ez=async()=>{R(!0);try{let e=[],l=(l,a,r)=>a.catch(()=>(e.push(l),r)),[a,r,s]=await Promise.all([l("模型供应商",(0,U.Z3)(),null),l("生成模型",(0,U.zr)(),null),l("嵌入配置",(0,U.II)(),null)]);e_(e),a&&O(a),r&&L(r),s&&J(s)}catch(a){l.error(e("common.error"))}finally{R(!1)}};(0,s.useEffect)(()=>{ez()},[]);let eF=async()=>{eH(!0);try{let a=await (0,U.jU)(eI?"all":"models");eP(!1),eK(!1),l.success(e("models.resetConfigDone")),a.backupPath&&l.info(e("models.resetConfigBackup").replace("{path}",a.backupPath),8),"models"===a.mode&&l.info(e("models.resetConfigKeptProviders"),8),await ez()}catch(a){l.error(a instanceof Error?a.message:e("models.resetConfigFailed"))}finally{eH(!1)}},eM=eD.includes("模型供应商"),eR=eD.includes("生成模型"),eZ=async e=>{var l,a,r,s;ed(!0),em(e.name),ep(e.name),eh(null!=(r=null==G||null==(l=G.list.find(l=>l.provider===e.name))?void 0:l.name)?r:e.name),eg(""),ej(e.baseUrl||""),eA(!0===e.directEndpoint),ef(e.protocol||e.detectedProtocol||"openai"),eC(e.capabilities||{}),eS(!!(null==(a=e.capabilities)?void 0:a.webSearch));try{let l=await (0,U.Bh)(e.name);eg(l.apiKey?F:""),ej(l.baseUrl||""),eC(l.capabilities||{}),eA(!0===l.directEndpoint),eS(!!(null==(s=l.capabilities)?void 0:s.webSearch))}catch(e){}en(!0)},eO=async()=>{if(ex.trim()){eB(!0);try{let a=ei&&M(eu)?void 0:eu||void 0,r={...ew,webSearch:ek};await (0,U._m)(ex.trim(),{modelName:ev.trim()||ex.trim(),oldName:ei?ec:void 0,apiKey:a,baseUrl:eb||void 0,protocol:ey,directEndpoint:eN,capabilities:r}),en(!1),await ez(),l.success(e("common.success"))}catch(a){l.error(e("common.error"))}finally{eB(!1)}}},eG=async a=>{try{await (0,U.h1)(a),await ez(),l.success(e("common.success"))}catch(a){l.error(e("common.error"))}},eL=async a=>{er(a);try{let r=await (0,U.bZ)(a);eo(e=>({...e,[a]:r.success}));let s=r.success?e("models.connected"):"".concat(e("models.connectionFailed")).concat(r.message?":".concat(r.message):"").concat(r.requestId?" (".concat(r.requestId,")"):"");l[r.success?"success":"error"](s)}catch(r){eo(e=>({...e,[a]:!1})),l.error(r instanceof Error?r.message:e("models.connectionFailed"))}finally{er(null)}},eX=async a=>{if(X)return!1;q(!0);try{let e=await (0,U.aP)(a);return L(e.models),!0}catch(a){return l.error(a instanceof Error?a.message:e("common.error")),!1}finally{q(!1)}},eq=async a=>{var r;if(!G)return;let s=G.list.find(e=>e.provider===a),o=null!=s?s:{provider:a,name:a};await eX({active:{provider:o.provider,name:o.name},list:s?G.list:[...G.list,o],roles:null!=(r=G.roles)?r:{}})&&!s&&l.info(e("models.modelIdentifierDefaulted").replace("{name}",a),8)},eV=async()=>{if(V){W(!0);try{let a=await (0,U.dd)(V);J(a),el(null),l.success(e("common.success"))}catch(a){l.error(e("common.error"))}finally{W(!1)}}},eJ=async()=>{$(!0);try{let a=await (0,U.u6)();el(a.success),l[a.success?"success":"error"](a.message||(a.success?e("models.connected"):e("models.connectionFailed")))}catch(e){el(!1)}finally{$(!1)}};return a?(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)(i.A,{active:!0,title:!0,paragraph:{rows:1}}),(0,r.jsx)("div",{className:"p-4 bg-[var(--colorBgHover)] rounded-xl border border-[var(--borderColor)]",children:(0,r.jsx)(i.A,{active:!0,paragraph:{rows:6}})}),(0,r.jsx)("div",{className:"p-4 bg-[var(--colorBgHover)] rounded-xl border border-[var(--borderColor)]",children:(0,r.jsx)(i.A,{active:!0,paragraph:{rows:4}})}),(0,r.jsx)("div",{className:"p-4 bg-[var(--colorBgHover)] rounded-xl border border-[var(--borderColor)]",children:(0,r.jsx)(i.A,{active:!0,paragraph:{rows:3}})})]}):(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)(D.X,{failures:eD}),eD.length>0&&(0,r.jsx)(d.A,{type:"error",showIcon:!0,message:e("models.configBrokenTitle"),description:(0,r.jsxs)("div",{className:"text-xs",children:[(0,r.jsx)("div",{children:e("models.configBrokenBody")}),(0,r.jsx)(c.Ay,{className:"mt-2",size:"small",danger:!0,icon:(0,r.jsx)(w.A,{}),onClick:()=>eP(!0),children:e("models.resetConfig")})]})}),(0,r.jsx)(t.z,{title:e("models.title"),description:e("models.description"),extra:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.Ay,{danger:!0,icon:(0,r.jsx)(w.A,{}),onClick:()=>eP(!0),children:e("models.resetConfig")}),(0,r.jsx)(c.Ay,{type:"primary",icon:(0,r.jsx)(C.A,{}),onClick:()=>{ed(!1),em(""),ep(""),eh(""),eg(""),ej(""),ef("openai"),eA(!1),eC({}),eS(!1),en(!0)},children:e("models.addProvider")})]})}),(0,r.jsx)(m.A,{open:eE,title:e("models.resetConfigTitle"),okText:e("models.resetConfig"),cancelText:e("common.cancel"),okButtonProps:{danger:!0,loading:eU},onOk:()=>void eF(),onCancel:()=>{eP(!1),eK(!0)},children:(0,r.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,r.jsx)("div",{children:e("models.resetConfigBody")}),(0,r.jsx)(x.A,{checked:eI,onChange:e=>eK(e.target.checked),children:e("models.resetConfigIncludeAll")}),(0,r.jsx)("div",{className:"text-xs text-[var(--colorTextTertiary)]",children:e("models.resetConfigBackupNote")})]})}),(0,r.jsx)(H.Zk,{title:e("models.modelList"),count:eM?void 0:Z.length,description:e("models.modelListDesc"),children:eM?(0,r.jsx)("div",{className:"py-10 rounded-xl border border-dashed border-[var(--borderColorStrong)] bg-[var(--colorBgHover)] text-center",children:(0,r.jsx)("span",{className:"text-sm text-[var(--colorTextTertiary)]",children:"—"})}):0===Z.length?(0,r.jsx)("div",{className:"py-10 rounded-xl border border-dashed border-[var(--borderColorStrong)] bg-[var(--colorBgHover)]",children:(0,r.jsx)(p.A,{image:p.A.PRESENTED_IMAGE_SIMPLE,description:(0,r.jsx)("span",{className:"text-[var(--colorTextTertiary)] text-sm",children:e("models.noProviders")})})}):(0,r.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5",children:Z.map(l=>{var a,s,o;let t=null==G?void 0:G.list.find(e=>e.provider===l.name),n=null!=(o=null==t?void 0:t.name)?o:l.name,i=(null==G||null==(a=G.active)?void 0:a.provider)===l.name&&G.active.name===n;return(0,r.jsxs)("div",{role:"group","aria-label":l.name,className:"group p-5 ".concat(H.wD," flex flex-col"),children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-3 mb-4 min-w-0",children:[(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)(v.Ay,{name:"generation-model-service",checked:i,disabled:eR||!G||X,onChange:()=>{eq(l.name)},children:(0,r.jsx)("span",{className:"font-bold text-base text-[var(--colorText)]",children:l.name})}),n!==l.name&&(0,r.jsx)("div",{className:"text-xs text-[var(--colorTextSecondary)] mt-1 break-all",children:n}),(0,r.jsxs)("div",{className:"text-xs text-[var(--colorTextTertiary)] flex items-center gap-1 uppercase tracking-wider font-semibold",children:[(0,r.jsx)(k.A,{})," ",l.protocol||l.detectedProtocol||"openai"]})]}),(0,r.jsxs)(h.A,{size:0,className:"-mr-2 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity",children:[(0,r.jsx)(c.Ay,{type:"text",size:"small",loading:ea===l.name,title:e("models.testConnection"),"aria-label":e("models.testConnection"),onClick:e=>{e.stopPropagation(),eL(l.name)},icon:!0===es[l.name]?(0,r.jsx)(S.A,{className:"text-[var(--colorOk)]"}):!1===es[l.name]?(0,r.jsx)(T.A,{className:"text-[var(--colorDanger)]"}):(0,r.jsx)(B.A,{className:"text-[var(--colorTextSecondary)]"})}),(0,r.jsx)(c.Ay,{type:"text",size:"small",title:e("common.edit"),icon:(0,r.jsx)(E.A,{className:"text-[var(--colorTextSecondary)]"}),onClick:e=>{e.stopPropagation(),eZ(l)}}),(0,r.jsx)(u.A,{title:e("models.deleteProviderConfirm"),onConfirm:e=>{null==e||e.stopPropagation(),eG(l.name)},onCancel:e=>null==e?void 0:e.stopPropagation(),children:(0,r.jsx)(c.Ay,{type:"text",size:"small",danger:!0,title:e("common.delete"),icon:(0,r.jsx)(P.A,{}),onClick:e=>e.stopPropagation()})})]})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-3 mt-auto pt-4 border-t border-[var(--borderColor)]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between text-xs text-[var(--colorTextSecondary)]",children:[(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)(I.A,{})," ",e("models.apiKey")]}),(0,r.jsx)("span",{className:"font-mono text-[var(--colorTextTertiary)]",children:l.hasApiKey?F:e("models.none")})]}),l.baseUrl&&(0,r.jsxs)("div",{className:"flex items-center justify-between text-xs text-[var(--colorTextSecondary)]",children:[(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)(K.A,{})," URL"]}),(0,r.jsx)("span",{className:"truncate max-w-[120px] font-mono text-[var(--colorTextTertiary)]",title:l.baseUrl,children:l.baseUrl.replace(/^https?:\/\//,"")})]}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-1 mt-2",children:[z.filter(e=>{var a;return null==(a=l.capabilities)?void 0:a[e.key]}).map(l=>(0,r.jsx)(g.A,{color:"blue",bordered:!1,className:"m-0 text-[10px] bg-[var(--colorBrand)]/5 text-[var(--colorBrand)] leading-[18px]",children:e(l.labelKey)},l.key)),(null==(s=l.capabilities)?void 0:s.webSearch)&&(0,r.jsx)(g.A,{color:"green",bordered:!1,className:"m-0 text-[10px] leading-[18px]",children:e("models.webEnhancement")})]})]})]},l.name)})})}),(0,r.jsx)(H.Zk,{title:e("models.roleModelSectionTitle"),description:e("models.roleModelSectionDesc"),children:(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-6",children:["writer","planner","reviewer"].map(l=>{var a,s,o;let t=(null!=(s=null==G?void 0:G.list)?s:[]).map(e=>({label:"".concat(e.name,"(").concat(e.provider,")"),value:"".concat(e.provider,"\0").concat(e.name)})),n=null!=(o=null==G||null==(a=G.roles)?void 0:a[l])?o:null==G?void 0:G.active,i=n?"".concat(n.provider,"\0").concat(n.name):void 0;return(0,r.jsxs)("div",{children:[(0,r.jsx)(H.dh,{children:e("models.roleModel".concat(l[0].toUpperCase()).concat(l.slice(1)))}),(0,r.jsx)(b.A,{value:i,className:"w-full h-10",variant:"borderless",allowClear:!0,disabled:eR||!G||X,style:{background:"var(--colorBgHover)",borderRadius:"8px"},placeholder:e("models.roleModelDefault"),options:t,onChange:e=>{var a;if(!G)return;let r={...null!=(a=G.roles)?a:{}};if(e){let[a,s]=String(e).split("\0");r[l]={provider:a,name:s}}else delete r[l];eX({...G,roles:r})}})]},l)})})}),(0,r.jsx)(H.Zk,{title:e("models.embeddingConfig"),description:e("models.embeddingConfigDesc"),extra:(0,r.jsxs)(h.A,{size:6,children:[V?(0,r.jsx)(g.A,{color:"blue",bordered:!1,className:"m-0",children:"transformers-local"===V.provider?e("models.localEmbedding"):e("models.openAICompatible")}):(0,r.jsx)(g.A,{bordered:!1,className:"m-0",children:"—"}),!0===ee&&(0,r.jsx)(g.A,{color:"success",bordered:!1,className:"m-0",icon:(0,r.jsx)(S.A,{}),children:e("models.connected")}),!1===ee&&(0,r.jsx)(g.A,{color:"error",bordered:!1,className:"m-0",icon:(0,r.jsx)(T.A,{}),children:e("models.connectionFailed")})]}),children:V?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(H.dh,{children:e("models.embeddingProvider")}),(0,r.jsx)(b.A,{value:V.provider,className:"w-full h-10",variant:"borderless",style:{background:"var(--colorBgHover)",borderRadius:"8px"},options:[{label:e("models.localRecommended"),value:"transformers-local"},{label:e("models.externalAdvanced"),value:"openai-compatible"}],onChange:e=>J(l=>l?{...l,provider:e,model:"transformers-local"===e?l.model||"BAAI/bge-small-zh-v1.5":l.model,dimensions:"transformers-local"===e?512:l.dimensions||1024}:l)})]}),"openai-compatible"===V.provider&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(H.dh,{children:e("models.baseUrl")}),(0,r.jsx)(j.A,{className:"h-10 px-4 bg-[var(--colorBgHover)]",value:V.baseUrl,onChange:e=>J(l=>l?{...l,baseUrl:e.target.value}:l),placeholder:"http://localhost:11434/v1"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(H.dh,{children:e("models.model")}),(0,r.jsx)(j.A,{className:"h-10 px-4 bg-[var(--colorBgHover)]",value:V.model,onChange:e=>J(l=>l?{...l,model:e.target.value}:l),placeholder:"bge-m3"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(H.dh,{children:e("models.apiKey")}),(0,r.jsx)(j.A.Password,{className:"h-10 px-4 bg-[var(--colorBgHover)]",value:V.apiKey,onFocus:()=>{V.apiKey&&M(V.apiKey)&&J(e=>e?{...e,apiKey:""}:e)},onChange:e=>J(l=>l?{...l,apiKey:e.target.value}:l),placeholder:e("models.optional")})]})]}),"transformers-local"===V.provider&&(0,r.jsxs)("div",{children:[(0,r.jsx)(H.dh,{children:e("models.model")}),(0,r.jsx)(j.A,{className:"h-10 px-4 bg-[var(--colorBgHover)]",disabled:!0,value:V.model,placeholder:"BAAI/bge-small-zh-v1.5"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(H.dh,{children:e("models.dimensions")}),(0,r.jsx)(y.A,{className:"w-full h-10 px-2 bg-[var(--colorBgHover)] border-transparent flex items-center",min:1,value:V.dimensions,onChange:e=>J(l=>l?{...l,dimensions:Number(e||("transformers-local"===l.provider?512:1024))}:l)})]})]}),(0,r.jsxs)("div",{className:"mt-6 flex flex-wrap gap-3",children:[(0,r.jsx)(c.Ay,{type:"primary",className:"h-10 px-6 font-medium shadow-none",loading:Q,onClick:()=>{eV()},children:e("models.saveEmbedding")}),(0,r.jsx)(c.Ay,{className:"h-10 px-6 font-medium shadow-none bg-[var(--colorBgHover)] border-transparent hover:border-[var(--borderColorStrong)]",loading:Y,onClick:()=>{eJ()},children:e("models.testEmbedding")})]})]}):(0,r.jsx)("div",{className:"text-sm text-[var(--colorTextTertiary)]",children:"—"})}),(0,r.jsx)(f.A,{title:ei?e("models.editProvider"):e("models.addProvider"),open:et,onClose:()=>en(!1),size:"large",styles:{body:{padding:"24px 32px"},header:{padding:"16px 32px",borderBottom:"1px solid var(--colorBorderSecondary)"}},extra:(0,r.jsx)(h.A,{children:(0,r.jsx)(c.Ay,{type:"primary",loading:eT,onClick:()=>{eO()},children:e("common.save")})}),children:(0,r.jsxs)(N.A,{layout:"vertical",children:[(0,r.jsx)(N.A.Item,{label:e("models.providerName"),children:(0,r.jsx)(j.A,{value:ex,onChange:e=>ep(e.target.value),placeholder:e("models.providerNamePlaceholder")})}),(0,r.jsx)(N.A.Item,{label:e("models.modelIdentifier"),help:e("models.modelIdentifierHint"),children:(0,r.jsx)(j.A,{value:ev,onChange:e=>eh(e.target.value),placeholder:ex||e("models.modelIdentifierPlaceholder")})}),(0,r.jsx)(N.A.Item,{label:e("models.apiKey"),help:ei?e("models.apiKeyEditHint"):void 0,children:(0,r.jsx)(j.A.Password,{value:eu,onFocus:()=>{ei&&M(eu)&&eg("")},onChange:e=>eg(e.target.value),placeholder:ei?e("models.apiKeyEditPlaceholder"):"sk-..."})}),(0,r.jsx)(N.A.Item,{label:e("models.baseUrl"),children:(0,r.jsx)(j.A,{value:eb,onChange:e=>ej(e.target.value),placeholder:"https://api.openai.com/v1"})}),(0,r.jsx)(N.A.Item,{label:e("models.protocol"),children:(0,r.jsx)(b.A,{value:ey,onChange:ef,options:_.map(l=>({label:e(l.labelKey),value:l.value}))})}),(0,r.jsx)(N.A.Item,{label:e("models.directEndpoint"),children:(0,r.jsx)(x.A,{checked:eN,onChange:e=>eA(e.target.checked),children:e("models.directEndpointDesc")})}),(0,r.jsxs)(N.A.Item,{label:e("models.webEnhancement"),children:[(0,r.jsx)(A.A,{checked:ek,onChange:eS}),(0,r.jsx)("span",{className:"ml-3 text-xs text-[var(--colorTextSecondary)]",children:e("models.webEnhancementDesc")})]}),(0,r.jsx)(N.A.Item,{label:e("models.capabilities"),children:(0,r.jsx)(x.A.Group,{value:z.filter(e=>ew[e.key]).map(e=>e.key),options:z.map(l=>({label:e(l.labelKey),value:l.key})),onChange:e=>eC(Object.fromEntries(z.map(l=>[l.key,e.includes(l.key)])))})})]})})]})}},77305:(e,l,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/models",function(){return a(22708)}])},82238:(e,l,a)=>{"use strict";a.d(l,{X:()=>s});var r=a(65321);function s(e){let{failures:l,note:a}=e;return 0===l.length?null:(0,r.jsxs)("div",{role:"alert",className:"rounded-xl border border-[var(--colorDanger)]/30 bg-[var(--colorDanger)]/10 px-4 py-3 text-sm text-[var(--colorDanger)]",children:["".concat(l.length," 项数据读取失败:").concat(l.join("、"),"——相关读数显示为「—」(未知),**不代表 0**;请稍后重试。"),a?(0,r.jsx)("div",{className:"mt-1 text-xs opacity-90",children:a}):null]})}},85310:(e,l,a)=>{"use strict";a.d(l,{Zk:()=>o,dh:()=>t,wD:()=>s});var r=a(65321);a(97109);let s="rounded-xl bg-[var(--colorBgContainer)] shadow-[var(--shadowSurface)] hover:shadow-[var(--shadowSurfaceHover)] transition-shadow";function o(e){let{title:l,count:a,description:s,extra:o,className:t,children:n}=e;return(0,r.jsxs)("section",{className:"rounded-2xl bg-[var(--colorBgContainer)] shadow-[var(--shadowSurface)] p-6 animateFadeIn ".concat(null!=t?t:""),children:[(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start justify-between gap-3 mb-5",children:[(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsxs)("h2",{className:"text-base font-semibold text-[var(--colorText)] tracking-wide flex items-center gap-2 m-0",children:[l,void 0!==a&&(0,r.jsx)("span",{className:"text-[var(--colorTextTertiary)] font-normal text-sm",children:a})]}),s&&(0,r.jsx)("p",{className:"text-xs text-[var(--colorTextTertiary)] mt-1.5 mb-0 leading-relaxed max-w-3xl",children:s})]}),o]}),n]})}function t(e){let{children:l}=e;return(0,r.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wider mb-2 text-[var(--colorTextTertiary)]",children:l})}},93360:(e,l,a)=>{"use strict";a.d(l,{z:()=>o});var r=a(65321);a(97109);var s=a(33442);function o(e){let{title:l,description:a,extra:o,bottomContent:t}=e;return(0,r.jsxs)("div",{className:"animateFadeIn",children:[(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-end justify-between gap-4 pb-6 border-b border-[var(--borderColor)]",children:[(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("h1",{className:"text-3xl font-extrabold tracking-tight text-[var(--colorText)] mb-2",children:l}),a&&(0,r.jsx)("p",{className:"text-sm text-[var(--colorTextSecondary)] m-0",children:a})]}),o&&(0,r.jsx)(s.A,{className:"w-full sm:w-auto overflow-x-auto pb-1 sm:pb-0 shrink-0",size:"middle",wrap:!1,children:o})]}),t&&(0,r.jsx)("div",{className:"mt-6",children:t})]})}}},e=>{e.O(0,[855,551,210,702,576,338,61,465,992,112,430,636,593,792],()=>e(e.s=77305)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[199],{45551:(e,t,a)=>{"use strict";function s(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024)),a=e/Math.pow(1024,t);return"".concat(a.toFixed(+(0!==t))," ").concat(["B","KB","MB","GB","TB"][t])}function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";if(!e||e<=0)return"en-US"===t?"Never":"从未";let a=Math.floor(Math.floor((Date.now()-e)/1e3)/60),s=Math.floor(a/60),r=Math.floor(s/24);return r>30?new Date(e).toLocaleDateString(t):"en-US"===t?r>0?"".concat(r,"d ago"):s>0?"".concat(s,"h ago"):a>0?"".concat(a,"m ago"):"Just now":r>0?"".concat(r," 天前"):s>0?"".concat(s," 小时前"):a>0?"".concat(a," 分钟前"):"刚刚"}a.d(t,{Jm:()=>n,fw:()=>r,mc:()=>o,z3:()=>s});let l={document:"文档",spreadsheet:"表格",image:"图片",cad:"图纸",code:"代码",data:"数据",web:"网页",diagram:"图表",archive:"压缩包",other:"其他"},c={document:"Document",spreadsheet:"Spreadsheet",image:"Image",cad:"CAD",code:"Code",data:"Data",web:"Web",diagram:"Diagram",archive:"Archive",other:"Other"};function n(e){var t;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"zh-CN";return null!=(t=("en-US"===a?c:l)[e])?t:e}let o={active:"common.statusIndexed",outdated:"common.statusOutdated",error:"common.statusAbnormal",deleted:"common.statusDeleted",disk:"common.statusNotIndexed"}},49877:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>k});var s=a(65321),r=a(97109),l=a(48702),c=a(49759),n=a(17807),o=a(11702),i=a(85114),d=a(88762),x=a(25258),m=a(73340),h=a(1253),u=a(56733),p=a(38300),g=a(95997),v=a(87824),f=a(56014),j=a(6578),N=a(85310),w=a(93360),y=a(82238),b=a(45551);function k(){var e;let t=(0,l.Vr)("settings"),{theme:a,resolvedTheme:k,setTheme:T}=(0,c.D)(),{locale:D,setLocale:S}=(0,l.x_)(),{message:C}=n.A.useApp(),[A,z]=(0,r.useState)(null),[B,F]=(0,r.useState)([]),[M,_]=(0,r.useState)(!1),[E,O]=(0,r.useState)(null),[I,Z]=(0,r.useState)(null),[U,V]=(0,r.useState)(!1),[P,W]=(0,r.useState)([]),[X,H]=(0,r.useState)(!1),[L,J]=(0,r.useState)(null),[R,G]=(0,r.useState)(!1),[K,q]=(0,r.useState)(!1),Q=(0,r.useCallback)(async()=>{_(!0);let e=Date.now(),a="settings-health-recheck";C.loading({content:t("rechecking"),key:a,duration:0});let s=[];try{let r,l=await (r=(0,j.nn)(),r.catch(()=>(s.push("数据体检"),null)));F(s),l?(z(l),O(e),Z(Date.now()-e),C.success({content:t("recheckedAt").replace("{time}",new Date(e).toLocaleTimeString(D)).replace("{ms}",String(Date.now()-e)),key:a})):C.error({content:t("noHealthData"),key:a})}finally{_(!1)}},[D,C,t]),Y=async()=>{q(!0);try{await (0,j.NI)(),C.success(t("formatDone")),window.setTimeout(()=>window.location.reload(),800)}catch(e){C.error(e instanceof Error?e.message:t("formatFailed"))}finally{q(!1),G(!1)}},$="system"===a?"system":k,ee=e=>"flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-xl border transition-colors ".concat(e?"bg-[var(--colorText)] text-[var(--colorBg)] border-transparent":"bg-transparent text-[var(--colorTextSecondary)] border-[var(--borderColor)] hover:border-[var(--colorTextTertiary)]"),et=(null!=(e=null==A?void 0:A.scopes)?e:[]).filter(e=>"legacy-snapshots"!==e.key&&"env-contract"!==e.key&&!e.key.startsWith("capability-gap-")),ea=et.filter(e=>e.deletable),es=A?"string"==typeof A.workflowVersion?A.workflowVersion:A.workflowVersion.version:"";return(0,s.jsxs)("div",{className:"space-y-6 animateFadeIn",children:[(0,s.jsx)(w.z,{title:t("title"),description:t("description")}),(0,s.jsx)(y.X,{failures:B}),(0,s.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,s.jsx)(N.Zk,{title:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(m.A,{size:18,className:"text-[var(--colorTextTertiary)]"}),t("language")]}),description:t("languageDesc"),children:(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)("button",{className:ee("zh-CN"===D),onClick:()=>S("zh-CN"),children:"中文"}),(0,s.jsx)("button",{className:ee("en-US"===D),onClick:()=>S("en-US"),children:"English"})]})}),(0,s.jsx)(N.Zk,{title:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.A,{size:18,className:"text-[var(--colorTextTertiary)]"}),t("theme")]}),description:t("themeDesc"),children:(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsxs)("button",{className:ee("light"===$),onClick:()=>T("light"),children:[(0,s.jsx)(u.A,{size:14}),t("light")]}),(0,s.jsxs)("button",{className:ee("dark"===$),onClick:()=>T("dark"),children:[(0,s.jsx)(p.A,{size:14}),t("dark")]}),(0,s.jsxs)("button",{className:ee("system"===$),onClick:()=>T("system"),children:[(0,s.jsx)(h.A,{size:14}),t("system")]})]})})]}),(0,s.jsx)(N.Zk,{title:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(g.A,{size:18,className:"text-[var(--colorTextTertiary)]"}),t("localData")]}),description:t("localDataDesc"),children:(0,s.jsxs)("div",{className:"p-4 ".concat(N.wD),children:[(0,s.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-[var(--colorTextTertiary)]",children:t("directory")}),(0,s.jsx)("div",{className:"mt-2 font-mono text-sm text-[var(--colorText)]",children:"~/.customize-agent/"}),(0,s.jsx)("div",{className:"mt-2 text-xs text-[var(--colorTextTertiary)]",children:t("dataHint")})]})}),(0,s.jsx)(N.Zk,{title:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(v.A,{size:18,className:"text-[var(--colorTextTertiary)]"}),t("maintenance")]}),description:t("maintenanceDesc"),children:A?(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,s.jsx)("div",{className:"text-xs text-[var(--colorTextTertiary)]",children:"".concat(t("storageRoot")," ").concat(A.storageRoot,"|").concat(t("workflowVersion")," ").concat(es)}),(0,s.jsx)("div",{className:"flex flex-col gap-2",children:et.map(e=>(0,s.jsx)("div",{className:"p-3 flex items-start gap-3 ".concat(N.wD),children:(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-[var(--colorText)]",children:e.label}),(0,s.jsx)(o.A,{color:e.deletable?"blue":void 0,className:"m-0",children:e.deletable?t("deletable"):t("inspectOnly")}),(0,s.jsx)("span",{className:"text-xs text-[var(--colorTextTertiary)]",children:"".concat(t("scopeFiles").replace("{count}",String(e.files)),"|").concat((0,b.z3)(e.bytes))})]}),(0,s.jsx)("div",{className:"mt-1 text-xs text-[var(--colorTextTertiary)]",children:e.note})]})},e.key))}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,s.jsx)(i.Ay,{size:"small",disabled:0===ea.length,onClick:()=>{W([]),J(null),V(!0)},children:t("cleanupAction")}),(0,s.jsx)(i.Ay,{size:"small",type:"text",loading:M,onClick:()=>{Q()},children:t("recheck")}),E?(0,s.jsx)("span",{className:"text-xs text-[var(--colorTextTertiary)]",children:t("recheckedAt").replace("{time}",new Date(E).toLocaleTimeString(D)).replace("{ms}",String(null!=I?I:0))}):null]}),L?(0,s.jsx)("div",{className:"text-xs text-[var(--colorOk)]",children:L}):null]}):M?(0,s.jsx)(d.A,{active:!0,paragraph:{rows:2}}):(0,s.jsxs)("div",{className:"flex flex-col items-start gap-3",children:[(0,s.jsx)("span",{className:"text-sm text-[var(--colorTextTertiary)]",children:t("notChecked")}),(0,s.jsx)(i.Ay,{size:"small",onClick:()=>{Q()},children:t("startCheck")})]})}),(0,s.jsx)(N.Zk,{title:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(f.A,{size:18,className:"text-[var(--colorDanger)]"}),t("formatTitle")]}),description:t("formatDesc"),children:(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 rounded-xl border border-[var(--colorDanger)]/30 bg-[var(--colorDanger)]/5 px-4 py-3",children:[(0,s.jsx)("div",{className:"min-w-0 text-xs text-[var(--colorDanger)]",children:t("formatModalWarning")}),(0,s.jsx)(i.Ay,{danger:!0,size:"small",icon:(0,s.jsx)(f.A,{size:14}),onClick:()=>G(!0),children:t("formatAction")})]})}),(0,s.jsx)(x.A,{title:t("cleanupTitle"),open:U,onCancel:()=>V(!1),okText:X?t("cleanupBusy"):t("cleanupConfirm"),cancelText:t("common.cancel"),okButtonProps:{disabled:0===P.length||X,danger:!0},onOk:()=>{H(!0),(0,j.fc)(P).then(e=>{let a=e.removed.reduce((e,t)=>e+t.bytes,0);J(t("cleanupDone").replace("{count}",String(e.removed.length)).replace("{size}",(0,b.z3)(a))),z(e.report),V(!1)}).catch(e=>J(t("cleanupFailed").replace("{message}",e instanceof Error?e.message:String(e)))).finally(()=>H(!1))},children:(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)("div",{className:"text-xs text-[var(--colorTextTertiary)]",children:t("cleanupDesc")}),ea.map(e=>(0,s.jsxs)("label",{className:"flex items-start gap-2 cursor-pointer",children:[(0,s.jsx)("input",{type:"checkbox",checked:P.includes(e.key),onChange:t=>W(a=>t.target.checked?[...a,e.key]:a.filter(t=>t!==e.key))}),(0,s.jsxs)("span",{className:"min-w-0",children:[(0,s.jsx)("span",{className:"text-sm",children:"".concat(e.label,"(").concat(t("scopeFiles").replace("{count}",String(e.files)),"|").concat((0,b.z3)(e.bytes),")")}),(0,s.jsx)("span",{className:"block text-xs text-[var(--colorTextTertiary)]",children:e.note})]})]},e.key))]})}),(0,s.jsx)(x.A,{title:t("formatModalTitle"),open:R,onCancel:()=>G(!1),okText:K?t("formatBusy"):t("formatConfirm"),cancelText:t("common.cancel"),okButtonProps:{danger:!0,disabled:K},onOk:()=>{Y()},children:(0,s.jsxs)("div",{className:"text-sm text-[var(--colorTextSecondary)]",children:[(0,s.jsx)("div",{children:t("formatModalBody")}),(0,s.jsx)("div",{className:"mt-2 text-[var(--colorDanger)]",children:t("formatModalWarning")})]})})]})}},58451:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/settings",function(){return a(49877)}])},82238:(e,t,a)=>{"use strict";a.d(t,{X:()=>r});var s=a(65321);function r(e){let{failures:t,note:a}=e;return 0===t.length?null:(0,s.jsxs)("div",{role:"alert",className:"rounded-xl border border-[var(--colorDanger)]/30 bg-[var(--colorDanger)]/10 px-4 py-3 text-sm text-[var(--colorDanger)]",children:["".concat(t.length," 项数据读取失败:").concat(t.join("、"),"——相关读数显示为「—」(未知),**不代表 0**;请稍后重试。"),a?(0,s.jsx)("div",{className:"mt-1 text-xs opacity-90",children:a}):null]})}},85310:(e,t,a)=>{"use strict";a.d(t,{Zk:()=>l,dh:()=>c,wD:()=>r});var s=a(65321);a(97109);let r="rounded-xl bg-[var(--colorBgContainer)] shadow-[var(--shadowSurface)] hover:shadow-[var(--shadowSurfaceHover)] transition-shadow";function l(e){let{title:t,count:a,description:r,extra:l,className:c,children:n}=e;return(0,s.jsxs)("section",{className:"rounded-2xl bg-[var(--colorBgContainer)] shadow-[var(--shadowSurface)] p-6 animateFadeIn ".concat(null!=c?c:""),children:[(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start justify-between gap-3 mb-5",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("h2",{className:"text-base font-semibold text-[var(--colorText)] tracking-wide flex items-center gap-2 m-0",children:[t,void 0!==a&&(0,s.jsx)("span",{className:"text-[var(--colorTextTertiary)] font-normal text-sm",children:a})]}),r&&(0,s.jsx)("p",{className:"text-xs text-[var(--colorTextTertiary)] mt-1.5 mb-0 leading-relaxed max-w-3xl",children:r})]}),l]}),n]})}function c(e){let{children:t}=e;return(0,s.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wider mb-2 text-[var(--colorTextTertiary)]",children:t})}},93360:(e,t,a)=>{"use strict";a.d(t,{z:()=>l});var s=a(65321);a(97109);var r=a(33442);function l(e){let{title:t,description:a,extra:l,bottomContent:c}=e;return(0,s.jsxs)("div",{className:"animateFadeIn",children:[(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-end justify-between gap-4 pb-6 border-b border-[var(--borderColor)]",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("h1",{className:"text-3xl font-extrabold tracking-tight text-[var(--colorText)] mb-2",children:t}),a&&(0,s.jsx)("p",{className:"text-sm text-[var(--colorTextSecondary)] m-0",children:a})]}),l&&(0,s.jsx)(r.A,{className:"w-full sm:w-auto overflow-x-auto pb-1 sm:pb-0 shrink-0",size:"middle",wrap:!1,children:l})]}),c&&(0,s.jsx)("div",{className:"mt-6",children:c})]})}}},e=>{e.O(0,[702,687,636,593,792],()=>e(e.s=58451)),_N_E=e.O()}]);