index.html 98 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049
  1. <!doctype html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta
  6. name="viewport"
  7. content="width=device-width, initial-scale=1"
  8. />
  9. <title>mode_workflow · 解构工作台</title>
  10. <script src="https://cdn.jsdelivr.net/npm/echarts@5/dist/echarts.min.js"></script>
  11. <link
  12. rel="preconnect"
  13. href="https://fonts.googleapis.com"
  14. />
  15. <link
  16. href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@600;900&family=Noto+Sans+SC:wght@400;500;700&family=IBM+Plex+Mono:wght@500;700&display=swap"
  17. rel="stylesheet"
  18. />
  19. <style>
  20. /* ── 主题:净白工作台 + 墨蓝/朱砂点缀 ─────────────────────────────────────── */
  21. :root {
  22. --bg: #f4f4f1;
  23. --card: #ffffff;
  24. --ink: #1c2433;
  25. --ink-soft: #5a6577;
  26. --ink-faint: #9aa3b0;
  27. --line: #e8e6e0;
  28. --line-dark: #d4d1c8;
  29. --navy: #1e3a5f;
  30. --navy-deep: #13243a; /* 需求区 / 品牌 */
  31. --blue: #2563eb;
  32. --blue-bg: #eef3fe; /* 评分/交互强调 */
  33. --amber: #b45309;
  34. --amber-bg: #fff7e8; /* 输入区 */
  35. --teal: #0f6b5c;
  36. --teal-bg: #eef8f3; /* 实现区 */
  37. --green: #15803d;
  38. --green-bg: #effaf1; /* 输出区 / 采纳 */
  39. --seal: #bb3a22; /* 朱砂印 */
  40. --infer: #fdf0d2;
  41. --infer-edge: #d97706;
  42. --shadow: 0 1px 2px rgba(20, 30, 46, 0.04), 0 8px 24px -12px rgba(20, 30, 46, 0.12);
  43. --shadow-lg: 0 4px 10px rgba(20, 30, 46, 0.06), 0 24px 60px -20px rgba(20, 30, 46, 0.25);
  44. }
  45. * {
  46. box-sizing: border-box;
  47. margin: 0;
  48. padding: 0;
  49. }
  50. html {
  51. font-size: 14px;
  52. }
  53. body {
  54. font-family: "Noto Sans SC", sans-serif;
  55. color: var(--ink);
  56. background: var(--bg);
  57. background-image: radial-gradient(900px 360px at 90% -8%, rgba(37, 99, 235, 0.045), transparent 60%);
  58. min-height: 100vh;
  59. }
  60. .num {
  61. font-family: "IBM Plex Mono", monospace;
  62. }
  63. h1,
  64. h2,
  65. .serif {
  66. font-family: "Noto Serif SC", serif;
  67. }
  68. a {
  69. color: var(--blue);
  70. }
  71. button {
  72. font-family: inherit;
  73. cursor: pointer;
  74. }
  75. /* ── 顶部 ── */
  76. header {
  77. display: flex;
  78. align-items: center;
  79. gap: 20px;
  80. padding: 0 30px;
  81. height: 60px;
  82. background: linear-gradient(135deg, #13243a, #1c3552);
  83. color: #eef2f8;
  84. position: sticky;
  85. top: 0;
  86. z-index: 40;
  87. box-shadow: 0 2px 14px rgba(19, 36, 58, 0.28);
  88. }
  89. .logo {
  90. display: flex;
  91. align-items: center;
  92. gap: 12px;
  93. }
  94. .logo .seal {
  95. width: 33px;
  96. height: 33px;
  97. background: var(--seal);
  98. color: #fff;
  99. display: grid;
  100. place-items: center;
  101. font-family: "Noto Serif SC", serif;
  102. font-weight: 900;
  103. font-size: 17px;
  104. border-radius: 7px;
  105. box-shadow:
  106. inset 0 0 0 2px rgba(255, 255, 255, 0.22),
  107. 0 3px 8px rgba(187, 58, 34, 0.35);
  108. transform: rotate(-4deg);
  109. }
  110. .logo b {
  111. font-family: "Noto Serif SC", serif;
  112. font-weight: 900;
  113. font-size: 16px;
  114. letter-spacing: 1px;
  115. }
  116. .logo small {
  117. display: block;
  118. font-size: 10px;
  119. color: #93a7c0;
  120. letter-spacing: 3px;
  121. }
  122. nav {
  123. display: flex;
  124. gap: 6px;
  125. margin-left: 26px;
  126. }
  127. nav a {
  128. display: flex;
  129. align-items: center;
  130. padding: 7px 18px;
  131. color: #a8b9cd;
  132. text-decoration: none;
  133. font-weight: 500;
  134. letter-spacing: 0.5px;
  135. border-radius: 99px;
  136. transition: 0.15s;
  137. font-size: 13px;
  138. }
  139. nav a:hover {
  140. color: #fff;
  141. background: rgba(255, 255, 255, 0.07);
  142. }
  143. nav a.on {
  144. color: #fff;
  145. background: rgba(255, 255, 255, 0.13);
  146. box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  147. }
  148. header .spacer {
  149. flex: 1;
  150. }
  151. header .hint {
  152. font-size: 11px;
  153. color: #6e83a0;
  154. letter-spacing: 2px;
  155. }
  156. main {
  157. display: none;
  158. padding: 24px 30px 80px;
  159. max-width: 1920px;
  160. margin: 0 auto;
  161. }
  162. main.on {
  163. display: block;
  164. }
  165. /* 聚类库:内嵌知识检索页,占满视口、无内边距 */
  166. #view-cluster {
  167. padding: 0;
  168. max-width: none;
  169. }
  170. #view-cluster.on {
  171. display: flex;
  172. }
  173. #cluster-frame {
  174. border: 0;
  175. width: 100%;
  176. height: calc(100vh - 60px);
  177. display: block;
  178. }
  179. /* ── 通用卡片/标签/按钮 ── */
  180. .card {
  181. background: var(--card);
  182. border: 1px solid var(--line);
  183. border-radius: 12px;
  184. box-shadow: var(--shadow);
  185. }
  186. .pill {
  187. display: inline-block;
  188. padding: 1px 9px;
  189. border-radius: 99px;
  190. font-size: 11px;
  191. font-weight: 500;
  192. border: 1px solid var(--line-dark);
  193. background: #f7f6f2;
  194. color: var(--ink-soft);
  195. white-space: nowrap;
  196. }
  197. .pill.navy {
  198. background: #e8eef6;
  199. border-color: #bccbde;
  200. color: var(--navy);
  201. }
  202. .pill.amber {
  203. background: var(--amber-bg);
  204. border-color: #ecc88a;
  205. color: var(--amber);
  206. }
  207. .pill.teal {
  208. background: var(--teal-bg);
  209. border-color: #a9d6c8;
  210. color: var(--teal);
  211. }
  212. .pill.red {
  213. background: #fbeae5;
  214. border-color: #e4ab9c;
  215. color: var(--seal);
  216. }
  217. .pill.green {
  218. background: var(--green-bg);
  219. border-color: #a7d9b4;
  220. color: var(--green);
  221. }
  222. .btn {
  223. border: 1px solid var(--line-dark);
  224. background: var(--card);
  225. color: var(--ink);
  226. padding: 6px 14px;
  227. border-radius: 8px;
  228. font-size: 13px;
  229. font-weight: 500;
  230. transition: 0.15s;
  231. }
  232. .btn:hover {
  233. border-color: var(--blue);
  234. color: var(--blue);
  235. box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
  236. }
  237. .btn.primary {
  238. background: var(--blue);
  239. border-color: var(--blue);
  240. color: #fff;
  241. }
  242. .btn.primary:hover {
  243. background: #1d4fc4;
  244. color: #fff;
  245. box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  246. }
  247. .btn.seal {
  248. background: var(--seal);
  249. border-color: var(--seal);
  250. color: #fff;
  251. }
  252. .btn.seal:hover {
  253. background: #a02f1a;
  254. color: #fff;
  255. box-shadow: 0 4px 12px rgba(187, 58, 34, 0.3);
  256. }
  257. .btn.sm {
  258. padding: 3px 11px;
  259. font-size: 12px;
  260. }
  261. .btn:disabled {
  262. opacity: 0.45;
  263. cursor: not-allowed;
  264. box-shadow: none;
  265. }
  266. select,
  267. input[type="text"],
  268. input[type="number"] {
  269. font-family: inherit;
  270. font-size: 13px;
  271. padding: 6px 10px;
  272. border: 1px solid var(--line-dark);
  273. border-radius: 8px;
  274. background: #fff;
  275. color: var(--ink);
  276. outline: none;
  277. transition: 0.15s;
  278. }
  279. select:focus,
  280. input:focus {
  281. border-color: var(--blue);
  282. box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  283. }
  284. .empty {
  285. text-align: center;
  286. color: var(--ink-faint);
  287. padding: 48px 20px;
  288. font-size: 13px;
  289. line-height: 2;
  290. }
  291. .empty .glyph {
  292. font-family: "Noto Serif SC", serif;
  293. font-size: 42px;
  294. color: var(--line-dark);
  295. display: block;
  296. }
  297. /* ── Dashboard ── */
  298. .dash-section {
  299. margin-bottom: 14px;
  300. display: flex;
  301. align-items: baseline;
  302. gap: 10px;
  303. }
  304. .dash-section h2 {
  305. font-size: 16px;
  306. font-weight: 900;
  307. letter-spacing: 2px;
  308. }
  309. .dash-section .rule {
  310. flex: 1;
  311. border-top: 1px dashed var(--line-dark);
  312. }
  313. .dash-section .tag {
  314. font-size: 10px;
  315. letter-spacing: 2px;
  316. color: var(--ink-faint);
  317. }
  318. .cards {
  319. display: grid;
  320. grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  321. gap: 14px;
  322. margin-bottom: 26px;
  323. }
  324. .stat {
  325. padding: 16px 18px 14px;
  326. position: relative;
  327. overflow: hidden;
  328. }
  329. .stat::after {
  330. content: "";
  331. position: absolute;
  332. left: 0;
  333. top: 0;
  334. bottom: 0;
  335. width: 3px;
  336. background: var(--navy);
  337. }
  338. .stat.a::after {
  339. background: var(--amber);
  340. }
  341. .stat.t::after {
  342. background: var(--teal);
  343. }
  344. .stat.r::after {
  345. background: var(--seal);
  346. }
  347. .stat .lbl {
  348. font-size: 11px;
  349. letter-spacing: 2px;
  350. color: var(--ink-soft);
  351. margin-bottom: 8px;
  352. }
  353. .stat .val {
  354. font-size: 30px;
  355. font-weight: 700;
  356. line-height: 1;
  357. }
  358. .stat .sub {
  359. font-size: 11px;
  360. color: var(--ink-faint);
  361. margin-top: 7px;
  362. }
  363. .stat .sub.plat-break {
  364. margin-top: 3px;
  365. color: var(--ink-soft);
  366. font-weight: 600;
  367. }
  368. .ring-row {
  369. display: flex;
  370. align-items: center;
  371. gap: 14px;
  372. }
  373. .ring {
  374. width: 64px;
  375. height: 64px;
  376. border-radius: 50%;
  377. display: grid;
  378. place-items: center;
  379. flex: none;
  380. background: conic-gradient(var(--teal) calc(var(--p) * 1%), #e9e7e0 0);
  381. }
  382. .ring > div {
  383. width: 48px;
  384. height: 48px;
  385. border-radius: 50%;
  386. background: var(--card);
  387. display: grid;
  388. place-items: center;
  389. font-size: 12px;
  390. font-weight: 700;
  391. }
  392. .charts {
  393. display: grid;
  394. grid-template-columns: repeat(12, 1fr);
  395. gap: 16px;
  396. }
  397. .chart-card {
  398. padding: 14px 16px 8px;
  399. }
  400. .chart-card h3 {
  401. font-size: 13px;
  402. font-weight: 700;
  403. letter-spacing: 1px;
  404. color: var(--ink-soft);
  405. margin-bottom: 4px;
  406. display: flex;
  407. align-items: baseline;
  408. gap: 8px;
  409. }
  410. .chart-card h3 .num {
  411. color: var(--seal);
  412. font-size: 12px;
  413. }
  414. .chart {
  415. width: 100%;
  416. }
  417. .span12 {
  418. grid-column: span 12;
  419. }
  420. .span6 {
  421. grid-column: span 6;
  422. }
  423. .span4 {
  424. grid-column: span 4;
  425. }
  426. @media (max-width: 1100px) {
  427. .span6,
  428. .span4 {
  429. grid-column: span 12;
  430. }
  431. }
  432. /* ── Dataset 三栏 ── */
  433. .ds-top {
  434. display: flex;
  435. align-items: center;
  436. gap: 12px;
  437. margin-bottom: 16px;
  438. }
  439. .mode-switch {
  440. display: flex;
  441. border: 1px solid var(--line-dark);
  442. border-radius: 10px;
  443. overflow: hidden;
  444. background: #fff;
  445. }
  446. .mode-switch button {
  447. border: 0;
  448. background: transparent;
  449. padding: 7px 24px;
  450. font-size: 13px;
  451. font-weight: 700;
  452. color: var(--ink-soft);
  453. transition: 0.15s;
  454. }
  455. .mode-switch button.on {
  456. background: var(--navy);
  457. color: #fff;
  458. }
  459. .ds-grid {
  460. display: grid;
  461. grid-template-columns: 235px 350px minmax(0, 1fr);
  462. gap: 16px;
  463. align-items: start;
  464. }
  465. @media (max-width: 1280px) {
  466. .ds-grid {
  467. grid-template-columns: 200px 320px minmax(0, 1fr);
  468. }
  469. }
  470. .col-head {
  471. display: flex;
  472. align-items: center;
  473. justify-content: space-between;
  474. padding: 11px 14px;
  475. border-bottom: 1px solid var(--line);
  476. font-weight: 700;
  477. font-size: 13px;
  478. letter-spacing: 1px;
  479. }
  480. .col-head .n {
  481. font-size: 11px;
  482. color: var(--ink-faint);
  483. font-weight: 500;
  484. }
  485. .qlist {
  486. max-height: 76vh;
  487. overflow: auto;
  488. }
  489. .qitem {
  490. padding: 12px 14px;
  491. border-bottom: 1px solid var(--line);
  492. cursor: pointer;
  493. transition: 0.12s;
  494. }
  495. .qitem:hover {
  496. background: #f8f8f4;
  497. }
  498. .qitem.on {
  499. background: var(--blue-bg);
  500. box-shadow: inset 3px 0 0 var(--blue);
  501. }
  502. .qitem .qid {
  503. font-size: 10px;
  504. letter-spacing: 1px;
  505. color: var(--ink-faint);
  506. display: flex;
  507. gap: 6px;
  508. align-items: center;
  509. }
  510. .qitem .qt {
  511. font-weight: 500;
  512. margin: 4px 0 7px;
  513. line-height: 1.45;
  514. }
  515. .qitem .qm {
  516. font-size: 11px;
  517. color: var(--ink-soft);
  518. display: flex;
  519. gap: 10px;
  520. flex-wrap: wrap;
  521. align-items: center;
  522. }
  523. .qitem .qm b.hit {
  524. color: var(--blue);
  525. font-size: 13px;
  526. }
  527. /* 渠道 tab */
  528. .plat-tabs {
  529. display: flex;
  530. gap: 4px;
  531. padding: 8px 10px;
  532. border-bottom: 1px solid var(--line);
  533. overflow-x: auto;
  534. background: #fbfbf8;
  535. border-radius: 0;
  536. }
  537. .plat-tabs button {
  538. border: 1px solid transparent;
  539. background: transparent;
  540. color: var(--ink-soft);
  541. padding: 3px 11px;
  542. border-radius: 99px;
  543. font-size: 12px;
  544. font-weight: 500;
  545. white-space: nowrap;
  546. transition: 0.15s;
  547. }
  548. .plat-tabs button:hover {
  549. background: #efeee8;
  550. color: var(--ink);
  551. }
  552. .plat-tabs button.on {
  553. background: var(--navy);
  554. color: #fff;
  555. font-weight: 700;
  556. }
  557. .plat-tabs button .c {
  558. font-size: 10px;
  559. opacity: 0.75;
  560. margin-left: 3px;
  561. }
  562. /* 已解构筛选按钮:靠右,激活态用 teal 呼应「已解构」 */
  563. .plat-tabs .done-filter {
  564. margin-left: auto;
  565. flex: none;
  566. border: 1px solid var(--line);
  567. display: inline-flex;
  568. align-items: center;
  569. gap: 4px;
  570. color: var(--ink-soft);
  571. }
  572. .plat-tabs .done-filter:hover {
  573. background: #efeee8;
  574. color: var(--ink);
  575. }
  576. .plat-tabs .done-filter.on {
  577. background: var(--teal-bg, #e3f1ec);
  578. border-color: #a9d6c8;
  579. color: var(--teal);
  580. font-weight: 700;
  581. }
  582. .plat-tabs .done-filter .dot {
  583. font-size: 8px;
  584. }
  585. .plist {
  586. max-height: 70vh;
  587. overflow: auto;
  588. }
  589. .post {
  590. padding: 12px 13px;
  591. border-bottom: 1px solid var(--line);
  592. cursor: pointer;
  593. display: flex;
  594. gap: 10px;
  595. transition: 0.12s;
  596. align-items: flex-start;
  597. }
  598. .post:hover {
  599. background: #f8f8f4;
  600. }
  601. .post.on {
  602. background: var(--blue-bg);
  603. box-shadow: inset 3px 0 0 var(--blue);
  604. }
  605. .post input {
  606. margin-top: 4px;
  607. accent-color: var(--blue);
  608. }
  609. .post .pt {
  610. font-weight: 500;
  611. line-height: 1.45;
  612. font-size: 13px;
  613. }
  614. .post .pm {
  615. display: flex;
  616. flex-wrap: wrap;
  617. gap: 5px;
  618. margin-top: 7px;
  619. align-items: center;
  620. }
  621. .plat {
  622. display: inline-block;
  623. padding: 1px 7px;
  624. border-radius: 4px;
  625. font-size: 10px;
  626. font-weight: 700;
  627. color: #fff;
  628. }
  629. .plat.xhs {
  630. background: #d63a2f;
  631. }
  632. .plat.gzh {
  633. background: #2e9939;
  634. }
  635. .plat.zhihu {
  636. background: #1772f6;
  637. }
  638. .plat.douyin {
  639. background: #170b1a;
  640. }
  641. .plat.sph {
  642. background: #fa6d20;
  643. }
  644. .plat.youtube {
  645. background: #c00;
  646. }
  647. .plat.x {
  648. background: #15202b;
  649. }
  650. .plat.other {
  651. background: #777;
  652. }
  653. .plat-logo {
  654. display: inline-flex;
  655. line-height: 0;
  656. flex: none;
  657. }
  658. .plat-logo svg {
  659. display: block;
  660. }
  661. .done-dot {
  662. font-size: 10px;
  663. color: var(--teal);
  664. font-weight: 700;
  665. }
  666. /* 评分徽章:大、亮、可点 */
  667. .score-badge {
  668. flex: none;
  669. position: relative;
  670. font-family: "IBM Plex Mono", monospace;
  671. font-weight: 700;
  672. font-size: 16.5px;
  673. line-height: 1;
  674. padding: 8px 10px;
  675. border-radius: 9px;
  676. cursor: pointer;
  677. transition: 0.15s;
  678. align-self: center;
  679. border: 1px solid transparent;
  680. }
  681. .score-badge.s9 {
  682. color: #fff;
  683. background: linear-gradient(135deg, #16a34a, #15803d);
  684. box-shadow: 0 3px 10px rgba(22, 163, 74, 0.35);
  685. }
  686. .score-badge.s8 {
  687. color: #fff;
  688. background: linear-gradient(135deg, #3b82f6, #2563eb);
  689. box-shadow: 0 3px 10px rgba(37, 99, 235, 0.35);
  690. }
  691. .score-badge.s6 {
  692. color: #fff;
  693. background: linear-gradient(135deg, #f59e0b, #d97706);
  694. box-shadow: 0 3px 10px rgba(217, 119, 6, 0.32);
  695. }
  696. .score-badge.s0 {
  697. color: var(--ink-soft);
  698. background: #eceae4;
  699. border-color: var(--line-dark);
  700. }
  701. .score-badge:hover {
  702. transform: translateY(-2px) scale(1.06);
  703. }
  704. .score-badge::after {
  705. content: "查看详情";
  706. position: absolute;
  707. left: 50%;
  708. bottom: calc(100% + 6px);
  709. transform: translateX(-50%) scale(0.92);
  710. background: var(--ink);
  711. color: #fff;
  712. font-family: "Noto Sans SC", sans-serif;
  713. font-size: 10px;
  714. font-weight: 500;
  715. padding: 3px 8px;
  716. border-radius: 5px;
  717. white-space: nowrap;
  718. opacity: 0;
  719. pointer-events: none;
  720. transition: 0.15s;
  721. z-index: 5;
  722. }
  723. .score-badge:hover::after {
  724. opacity: 1;
  725. transform: translateX(-50%) scale(1);
  726. }
  727. .xp {
  728. min-height: 60vh;
  729. }
  730. .xp-head {
  731. display: flex;
  732. align-items: center;
  733. gap: 10px;
  734. padding: 12px 16px;
  735. border-bottom: 1px solid var(--line);
  736. flex-wrap: wrap;
  737. }
  738. .xp-head .st {
  739. font-family: "Noto Serif SC", serif;
  740. font-weight: 900;
  741. font-size: 15px;
  742. }
  743. .xp-head .st em {
  744. color: var(--seal);
  745. font-style: normal;
  746. }
  747. .xp-head .spacer {
  748. flex: 1;
  749. }
  750. .xp-body {
  751. padding: 16px;
  752. }
  753. /* 工序卡 */
  754. .proc {
  755. border: 1px solid var(--line);
  756. border-radius: 10px;
  757. margin-bottom: 22px;
  758. overflow: hidden;
  759. background: #fff;
  760. box-shadow: var(--shadow);
  761. }
  762. .proc-head {
  763. padding: 14px 16px;
  764. border-bottom: 1px solid var(--line);
  765. background: #fafaf6;
  766. }
  767. .proc-head .nm {
  768. font-family: "Noto Serif SC", serif;
  769. font-weight: 900;
  770. font-size: 15px;
  771. }
  772. .proc-head .nm .pid {
  773. color: var(--seal);
  774. margin-right: 6px;
  775. font-size: 13px;
  776. }
  777. .proc-head .pp {
  778. font-size: 12px;
  779. color: var(--ink-soft);
  780. margin-top: 5px;
  781. line-height: 1.6;
  782. }
  783. .proc-head .meta {
  784. display: flex;
  785. gap: 6px;
  786. flex-wrap: wrap;
  787. margin-top: 8px;
  788. }
  789. .decl {
  790. display: grid;
  791. grid-template-columns: 1fr 1fr;
  792. gap: 0;
  793. border-bottom: 1px solid var(--line);
  794. }
  795. .decl > div {
  796. padding: 10px 16px;
  797. }
  798. .decl > div + div {
  799. border-left: 1px solid var(--line);
  800. }
  801. .decl .dl {
  802. font-size: 10px;
  803. letter-spacing: 2px;
  804. color: var(--ink-faint);
  805. margin-bottom: 6px;
  806. }
  807. .decl .di {
  808. font-size: 12px;
  809. line-height: 1.7;
  810. }
  811. .decl .di b {
  812. font-weight: 700;
  813. }
  814. /* 步骤表:固定列宽撑开,宿主容器 overflow-x 滚动 */
  815. .steps {
  816. width: 100%;
  817. min-width: 1760px;
  818. table-layout: fixed;
  819. border-collapse: collapse;
  820. font-size: 12px;
  821. }
  822. .steps th {
  823. padding: 6px 8px;
  824. font-size: 11px;
  825. font-weight: 700;
  826. letter-spacing: 1px;
  827. color: #fff;
  828. text-align: left;
  829. }
  830. .steps thead tr:first-child th {
  831. text-align: center;
  832. font-size: 12px;
  833. letter-spacing: 4px;
  834. padding: 7px 4px;
  835. }
  836. .steps .h-req {
  837. background: var(--navy);
  838. }
  839. .steps .h-req2 {
  840. background: #33547a;
  841. }
  842. .steps .h-in {
  843. background: var(--amber);
  844. }
  845. .steps .h-in2 {
  846. background: #cd7522;
  847. }
  848. .steps .h-im {
  849. background: var(--teal);
  850. }
  851. .steps .h-im2 {
  852. background: #2d8273;
  853. }
  854. .steps .h-out {
  855. background: var(--green);
  856. }
  857. .steps .h-out2 {
  858. background: #2e6b45;
  859. }
  860. .steps td {
  861. padding: 8px 9px;
  862. border: 1px solid var(--line);
  863. vertical-align: top;
  864. line-height: 1.6;
  865. }
  866. .steps tbody tr:nth-child(odd) td {
  867. background: #fdfdf9;
  868. }
  869. .steps td.c-in {
  870. background: var(--amber-bg) !important;
  871. }
  872. .steps td.c-out {
  873. background: var(--green-bg) !important;
  874. }
  875. .steps .sid {
  876. font-family: "IBM Plex Mono", monospace;
  877. font-weight: 700;
  878. color: var(--navy);
  879. white-space: nowrap;
  880. }
  881. .steps .vtxt {
  882. color: var(--ink-soft);
  883. font-size: 11.5px;
  884. word-break: break-all;
  885. }
  886. .inf {
  887. background: var(--infer) !important;
  888. position: relative;
  889. outline: 1px dashed var(--infer-edge);
  890. outline-offset: -2px;
  891. }
  892. .inf .ib {
  893. position: absolute;
  894. top: -1px;
  895. right: -1px;
  896. background: var(--infer-edge);
  897. color: #fff;
  898. font-size: 9px;
  899. padding: 0 4px;
  900. border-radius: 0 0 0 4px;
  901. font-weight: 700;
  902. }
  903. .anchor {
  904. font-family: "IBM Plex Mono", monospace;
  905. font-size: 10.5px;
  906. color: var(--ink-faint);
  907. word-break: break-all;
  908. }
  909. /* 工具表格(移植自 fixed_query_eval:案例逐行 rowspan + 限高展开) */
  910. .mw-ttwrap {
  911. overflow-x: auto;
  912. border: 1px solid var(--line);
  913. border-radius: 10px;
  914. box-shadow: var(--shadow);
  915. }
  916. .mw-tt {
  917. border-collapse: separate;
  918. border-spacing: 0;
  919. width: 100%;
  920. min-width: 1180px;
  921. background: #fff;
  922. font-size: 12.5px;
  923. }
  924. .mw-tt thead th {
  925. position: sticky;
  926. top: 0;
  927. z-index: 2;
  928. text-align: left;
  929. white-space: nowrap;
  930. background: linear-gradient(180deg, #2aa79b, #1c8076);
  931. color: #fff;
  932. font-weight: 700;
  933. padding: 10px 12px;
  934. letter-spacing: 0.3px;
  935. border-right: 1px solid rgba(255, 255, 255, 0.18);
  936. }
  937. .mw-tt thead th:last-child {
  938. border-right: none;
  939. }
  940. .mw-tt thead tr:first-child th {
  941. top: 0;
  942. }
  943. .mw-tt thead tr:nth-child(2) th {
  944. top: 38px;
  945. }
  946. .mw-tt .th-group {
  947. text-align: center;
  948. }
  949. .mw-tt .th-sub {
  950. background: linear-gradient(180deg, #36bdb0, #23897f);
  951. font-weight: 600;
  952. }
  953. .mw-tt tbody td {
  954. padding: 9px 12px;
  955. vertical-align: top;
  956. line-height: 1.6;
  957. border-bottom: 1px solid #f0eee8;
  958. border-right: 1px solid #f5f3ee;
  959. color: #3a3a3a;
  960. }
  961. .mw-tt tbody td:last-child {
  962. border-right: none;
  963. }
  964. .mw-tt td.col-case {
  965. background: #fafdfc;
  966. }
  967. .mw-tt tbody tr.tr-b td {
  968. background: #fbfaf6;
  969. }
  970. .mw-tt tbody tr.tr-b td.col-case {
  971. background: #f6fbfa;
  972. }
  973. .mw-tt tbody td.col-tool {
  974. font-weight: 700;
  975. color: #176d64;
  976. white-space: nowrap;
  977. border-left: 3px solid #2aa79b;
  978. background: #f3faf8;
  979. }
  980. .mw-tt tbody tr:hover td.col-tool {
  981. background: #e3f4f0;
  982. }
  983. .mw-tt ul {
  984. margin: 0;
  985. padding-left: 17px;
  986. }
  987. .mw-tt ul li {
  988. margin: 3px 0;
  989. }
  990. .mw-tt ul li::marker {
  991. color: #2aa79b;
  992. }
  993. .mw-tt .layer-badge {
  994. display: inline-block;
  995. font-weight: 700;
  996. font-size: 11px;
  997. padding: 2px 10px;
  998. border-radius: 20px;
  999. white-space: nowrap;
  1000. }
  1001. .mw-tt .layer-badge.make {
  1002. color: #0e7490;
  1003. background: #d6f0ee;
  1004. }
  1005. .mw-tt .layer-badge.create {
  1006. color: #b8731a;
  1007. background: #fef0db;
  1008. }
  1009. .mw-tt .dash {
  1010. color: #c9c2b6;
  1011. }
  1012. .mw-tt .tcell {
  1013. position: relative;
  1014. max-height: 7.8em;
  1015. overflow: hidden;
  1016. transition: max-height 0.15s;
  1017. }
  1018. .mw-tt .tcell.clamped {
  1019. cursor: zoom-in;
  1020. }
  1021. .mw-tt .tcell.clamped::after {
  1022. content: "▾ 展开";
  1023. position: absolute;
  1024. left: 0;
  1025. right: 0;
  1026. bottom: 0;
  1027. height: 2.6em;
  1028. display: flex;
  1029. align-items: flex-end;
  1030. justify-content: center;
  1031. padding-bottom: 2px;
  1032. font-size: 11px;
  1033. font-weight: 700;
  1034. color: #176d64;
  1035. background: linear-gradient(rgba(255, 255, 255, 0), #fff 72%);
  1036. pointer-events: none;
  1037. }
  1038. .mw-tt tbody tr.tr-b .tcell.clamped::after {
  1039. background: linear-gradient(rgba(251, 250, 246, 0), #fbfaf6 72%);
  1040. }
  1041. .mw-tt td.col-case .tcell.clamped::after {
  1042. background: linear-gradient(rgba(250, 253, 252, 0), #fafdfc 72%);
  1043. }
  1044. .mw-tt tbody tr.tr-b td.col-case .tcell.clamped::after {
  1045. background: linear-gradient(rgba(246, 251, 250, 0), #f6fbfa 72%);
  1046. }
  1047. .mw-tt .tcell.open {
  1048. max-height: none;
  1049. cursor: zoom-out;
  1050. }
  1051. .mw-tt .tcell.open::after {
  1052. content: "";
  1053. height: 0;
  1054. }
  1055. /* ── 帖子详情弹层 ── */
  1056. dialog#post-dialog {
  1057. width: min(1100px, 94vw);
  1058. max-height: calc(100vh - 40px);
  1059. border: none;
  1060. border-radius: 14px;
  1061. padding: 0;
  1062. box-shadow: var(--shadow-lg);
  1063. overflow: hidden;
  1064. margin: auto; /* 全局 reset 清掉了 dialog 默认 margin:auto,这里补回才能居中 */
  1065. }
  1066. dialog#post-dialog::backdrop {
  1067. background: rgba(19, 30, 46, 0.5);
  1068. backdrop-filter: blur(2px);
  1069. }
  1070. .pd-wrap {
  1071. display: flex;
  1072. flex-direction: column;
  1073. max-height: calc(100vh - 40px);
  1074. }
  1075. .pd-head {
  1076. display: flex;
  1077. justify-content: space-between;
  1078. gap: 14px;
  1079. align-items: flex-start;
  1080. padding: 16px 20px;
  1081. border-bottom: 1px solid var(--line);
  1082. background: #fff;
  1083. flex: none;
  1084. }
  1085. .pd-head h3 {
  1086. font-family: "Noto Serif SC", serif;
  1087. font-size: 18px;
  1088. line-height: 1.35;
  1089. margin-top: 6px;
  1090. }
  1091. .pd-meta {
  1092. display: flex;
  1093. gap: 8px;
  1094. flex-wrap: wrap;
  1095. align-items: center;
  1096. font-size: 12px;
  1097. color: var(--ink-soft);
  1098. }
  1099. .pd-close {
  1100. border: none;
  1101. background: #f1f0ea;
  1102. width: 30px;
  1103. height: 30px;
  1104. border-radius: 8px;
  1105. font-size: 14px;
  1106. color: var(--ink-soft);
  1107. flex: none;
  1108. transition: 0.15s;
  1109. }
  1110. .pd-close:hover {
  1111. background: var(--seal);
  1112. color: #fff;
  1113. }
  1114. .pd-body {
  1115. display: grid;
  1116. grid-template-columns: 1.05fr 0.95fr;
  1117. gap: 20px;
  1118. padding: 18px 20px;
  1119. overflow: auto;
  1120. }
  1121. @media (max-width: 920px) {
  1122. .pd-body {
  1123. grid-template-columns: 1fr;
  1124. }
  1125. }
  1126. .pd-body > section,
  1127. .pd-body > aside {
  1128. min-width: 0;
  1129. }
  1130. .pd-sec-title {
  1131. font-weight: 800;
  1132. margin: 16px 0 8px;
  1133. font-size: 13px;
  1134. }
  1135. .pd-sec-title:first-child {
  1136. margin-top: 0;
  1137. }
  1138. .pd-verdict {
  1139. background: #eaf6fb;
  1140. border-left: 4px solid #2c9ec7;
  1141. padding: 10px 12px;
  1142. color: #22566b;
  1143. border-radius: 6px;
  1144. font-size: 13px;
  1145. line-height: 1.6;
  1146. }
  1147. .pd-raw {
  1148. white-space: pre-wrap;
  1149. background: #faf9f5;
  1150. border: 1px solid var(--line);
  1151. border-radius: 10px;
  1152. padding: 12px;
  1153. max-height: 320px;
  1154. overflow: auto;
  1155. color: #3d3f44;
  1156. font-size: 13px;
  1157. line-height: 1.7;
  1158. }
  1159. .pd-images {
  1160. display: grid;
  1161. grid-template-columns: repeat(2, minmax(0, 1fr));
  1162. gap: 8px;
  1163. }
  1164. .pd-images img {
  1165. width: 100%;
  1166. max-height: 250px;
  1167. object-fit: contain;
  1168. border: 1px solid var(--line);
  1169. border-radius: 10px;
  1170. background: #f3f2ed;
  1171. cursor: zoom-in;
  1172. }
  1173. /* ── 图片预览灯箱 ── */
  1174. dialog.lightbox {
  1175. position: fixed;
  1176. inset: 0;
  1177. width: 100%;
  1178. height: 100%;
  1179. max-width: 100%;
  1180. max-height: 100%;
  1181. margin: 0;
  1182. padding: 40px 72px;
  1183. border: none;
  1184. gap: 18px;
  1185. align-items: center;
  1186. justify-content: center;
  1187. background: rgba(20, 20, 22, 0.86);
  1188. backdrop-filter: blur(2px);
  1189. overflow: hidden;
  1190. }
  1191. dialog.lightbox[open] {
  1192. display: flex;
  1193. }
  1194. dialog.lightbox::backdrop {
  1195. background: rgba(20, 20, 22, 0.5);
  1196. }
  1197. .lb-stage {
  1198. margin: 0;
  1199. max-width: 100%;
  1200. max-height: 100%;
  1201. display: flex;
  1202. flex-direction: column;
  1203. align-items: center;
  1204. gap: 12px;
  1205. }
  1206. .lb-stage img {
  1207. max-width: min(1100px, 86vw);
  1208. max-height: 82vh;
  1209. object-fit: contain;
  1210. border-radius: 8px;
  1211. box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
  1212. background: #2a2a2c;
  1213. }
  1214. .lb-stage figcaption {
  1215. color: rgba(255, 255, 255, 0.78);
  1216. font-size: 13px;
  1217. letter-spacing: 0.5px;
  1218. }
  1219. .lb-nav {
  1220. flex: 0 0 auto;
  1221. width: 46px;
  1222. height: 46px;
  1223. border-radius: 50%;
  1224. border: none;
  1225. background: rgba(255, 255, 255, 0.12);
  1226. color: #fff;
  1227. font-size: 28px;
  1228. line-height: 1;
  1229. cursor: pointer;
  1230. transition: 0.15s;
  1231. }
  1232. .lb-nav:hover {
  1233. background: rgba(255, 255, 255, 0.26);
  1234. }
  1235. .lb-close {
  1236. position: absolute;
  1237. top: 20px;
  1238. right: 24px;
  1239. width: 38px;
  1240. height: 38px;
  1241. border-radius: 50%;
  1242. border: none;
  1243. background: rgba(255, 255, 255, 0.12);
  1244. color: #fff;
  1245. font-size: 18px;
  1246. cursor: pointer;
  1247. transition: 0.15s;
  1248. }
  1249. .lb-close:hover {
  1250. background: rgba(255, 255, 255, 0.26);
  1251. }
  1252. /* ── 帖子列表缩略图 ── */
  1253. .post .thumb {
  1254. flex: 0 0 auto;
  1255. width: 44px;
  1256. height: 44px;
  1257. border-radius: 7px;
  1258. object-fit: cover;
  1259. background: #f0efe9;
  1260. border: 1px solid var(--line);
  1261. }
  1262. .post .thumb-ph {
  1263. flex: 0 0 auto;
  1264. width: 44px;
  1265. height: 44px;
  1266. border-radius: 7px;
  1267. background: #f0efe9;
  1268. border: 1px solid var(--line);
  1269. display: flex;
  1270. align-items: center;
  1271. justify-content: center;
  1272. color: var(--ink-faint);
  1273. font-size: 16px;
  1274. }
  1275. .pd-tags {
  1276. display: flex;
  1277. gap: 6px;
  1278. flex-wrap: wrap;
  1279. margin-top: 12px;
  1280. }
  1281. .pd-score-head {
  1282. display: flex;
  1283. justify-content: space-between;
  1284. align-items: center;
  1285. margin-bottom: 10px;
  1286. }
  1287. .pd-score-head .t {
  1288. font-weight: 800;
  1289. font-size: 14px;
  1290. }
  1291. .pd-overall {
  1292. display: flex;
  1293. align-items: center;
  1294. gap: 6px;
  1295. font-size: 12.5px;
  1296. font-weight: 700;
  1297. color: var(--ink-soft);
  1298. background: #faf9f5;
  1299. border: 1px solid var(--line);
  1300. padding: 4px 12px;
  1301. border-radius: 8px;
  1302. }
  1303. .pd-overall b {
  1304. font-size: 20px;
  1305. color: var(--blue);
  1306. font-weight: 900;
  1307. line-height: 1;
  1308. }
  1309. .sc-card {
  1310. border: 1px solid var(--line);
  1311. border-radius: 10px;
  1312. background: #fff;
  1313. overflow: hidden;
  1314. margin-bottom: 12px;
  1315. }
  1316. .sc-card-head {
  1317. display: flex;
  1318. justify-content: space-between;
  1319. align-items: center;
  1320. gap: 10px;
  1321. padding: 10px 12px;
  1322. background: #faf9f5;
  1323. border-bottom: 1px solid var(--line);
  1324. font-size: 13px;
  1325. font-weight: 800;
  1326. }
  1327. .sc-card-head .badge {
  1328. display: inline-grid;
  1329. place-items: center;
  1330. width: 20px;
  1331. height: 20px;
  1332. border-radius: 5px;
  1333. background: var(--navy);
  1334. color: #fff;
  1335. font-size: 10px;
  1336. font-weight: 700;
  1337. margin-right: 7px;
  1338. }
  1339. .sc-card-head .avg {
  1340. font-size: 12px;
  1341. color: var(--ink-faint);
  1342. font-weight: 600;
  1343. }
  1344. .sc-card-head .avg b {
  1345. font-size: 17px;
  1346. color: var(--blue);
  1347. font-weight: 900;
  1348. }
  1349. .sc-card-body {
  1350. display: grid;
  1351. gap: 8px;
  1352. padding: 11px 12px;
  1353. }
  1354. /* 维度分组小标题:参考 mode_procedure —— 一级虚线大写,二级点线常规 */
  1355. .sc-sub {
  1356. font-size: 11px;
  1357. font-weight: 800;
  1358. letter-spacing: 0.8px;
  1359. color: var(--ink-faint);
  1360. text-transform: uppercase;
  1361. margin: 14px 0 8px;
  1362. padding-bottom: 5px;
  1363. border-bottom: 1px dashed var(--line-dark);
  1364. }
  1365. .sc-card-body > .sc-sub:first-child {
  1366. margin-top: 2px;
  1367. }
  1368. .sc-sub.lv2 {
  1369. font-size: 11px;
  1370. font-weight: 700;
  1371. letter-spacing: 0.3px;
  1372. text-transform: none;
  1373. color: var(--ink-soft);
  1374. margin: 11px 0 6px;
  1375. padding-bottom: 4px;
  1376. border-bottom: 1px dotted var(--line);
  1377. }
  1378. .sc-row {
  1379. display: grid;
  1380. grid-template-columns: 118px 1fr 30px 16px;
  1381. gap: 9px;
  1382. align-items: center;
  1383. font-size: 12.5px;
  1384. }
  1385. .sc-row .meter {
  1386. height: 8px;
  1387. border-radius: 99px;
  1388. background: #edebe4;
  1389. overflow: hidden;
  1390. }
  1391. .sc-row .meter span {
  1392. display: block;
  1393. height: 100%;
  1394. border-radius: 99px;
  1395. background: linear-gradient(90deg, #60a5fa, #2563eb);
  1396. }
  1397. .sc-row b {
  1398. font-weight: 700;
  1399. text-align: right;
  1400. }
  1401. .sc-row .info {
  1402. color: var(--ink-faint);
  1403. cursor: pointer;
  1404. font-size: 12px;
  1405. opacity: 0.75;
  1406. user-select: none;
  1407. }
  1408. .sc-row .info:hover {
  1409. color: var(--blue);
  1410. opacity: 1;
  1411. }
  1412. /* 判定理由弹层:点击 ⓘ 时浮现,挂在 dialog 顶层 */
  1413. .score-pop {
  1414. position: fixed;
  1415. z-index: 90;
  1416. width: 288px;
  1417. max-width: calc(100vw - 24px);
  1418. background: var(--card);
  1419. border: 1px solid var(--line-dark);
  1420. border-radius: 10px;
  1421. box-shadow: var(--shadow-lg);
  1422. padding: 12px 14px;
  1423. font-size: 12.5px;
  1424. line-height: 1.65;
  1425. color: var(--ink-soft);
  1426. animation: popIn 0.12s ease;
  1427. }
  1428. .score-pop .sp-head {
  1429. display: flex;
  1430. align-items: center;
  1431. gap: 8px;
  1432. margin-bottom: 8px;
  1433. padding-bottom: 8px;
  1434. border-bottom: 1px solid var(--line);
  1435. }
  1436. .score-pop .sp-tag {
  1437. font-size: 9px;
  1438. letter-spacing: 1.5px;
  1439. color: var(--ink-faint);
  1440. font-weight: 700;
  1441. border: 1px solid var(--line-dark);
  1442. border-radius: 5px;
  1443. padding: 2px 6px;
  1444. white-space: nowrap;
  1445. }
  1446. .score-pop .sp-name {
  1447. font-weight: 800;
  1448. font-size: 13px;
  1449. color: var(--ink);
  1450. }
  1451. .score-pop .sp-score {
  1452. margin-left: auto;
  1453. font-size: 16px;
  1454. font-weight: 900;
  1455. color: var(--blue);
  1456. }
  1457. .score-pop .sp-body {
  1458. white-space: pre-wrap;
  1459. }
  1460. @keyframes popIn {
  1461. from {
  1462. opacity: 0;
  1463. transform: translateY(-4px);
  1464. }
  1465. to {
  1466. opacity: 1;
  1467. transform: none;
  1468. }
  1469. }
  1470. /* 任务面板 */
  1471. #task-panel {
  1472. position: fixed;
  1473. right: 22px;
  1474. bottom: 22px;
  1475. width: 440px;
  1476. max-height: 55vh;
  1477. z-index: 60;
  1478. display: flex;
  1479. flex-direction: column;
  1480. border: 1px solid var(--line-dark);
  1481. border-radius: 12px;
  1482. background: var(--card);
  1483. box-shadow: var(--shadow-lg);
  1484. overflow: hidden;
  1485. }
  1486. #task-panel header {
  1487. all: unset;
  1488. display: flex;
  1489. align-items: center;
  1490. gap: 9px;
  1491. padding: 11px 14px;
  1492. background: var(--navy-deep);
  1493. color: #fff;
  1494. font-size: 13px;
  1495. font-weight: 700;
  1496. }
  1497. #task-panel header .dot {
  1498. width: 8px;
  1499. height: 8px;
  1500. border-radius: 50%;
  1501. background: #f5b942;
  1502. animation: blink 1s infinite;
  1503. }
  1504. #task-panel header .dot.done {
  1505. background: #3fb27f;
  1506. animation: none;
  1507. }
  1508. #task-panel header .dot.failed {
  1509. background: #e0492f;
  1510. animation: none;
  1511. }
  1512. @keyframes blink {
  1513. 50% {
  1514. opacity: 0.3;
  1515. }
  1516. }
  1517. #task-panel header button {
  1518. margin-left: auto;
  1519. background: none;
  1520. border: 0;
  1521. color: #9eb0c5;
  1522. font-size: 15px;
  1523. }
  1524. #task-panel header button:hover {
  1525. color: #fff;
  1526. }
  1527. #task-log {
  1528. font-family: "IBM Plex Mono", monospace;
  1529. font-size: 11px;
  1530. line-height: 1.65;
  1531. color: var(--ink-soft);
  1532. white-space: pre-wrap;
  1533. overflow: auto;
  1534. padding: 12px 14px;
  1535. background: #fafaf6;
  1536. flex: 1;
  1537. }
  1538. /* 弹窗(新建搜索) */
  1539. .modal-bg {
  1540. position: fixed;
  1541. inset: 0;
  1542. background: rgba(19, 30, 46, 0.5);
  1543. z-index: 70;
  1544. display: grid;
  1545. place-items: center;
  1546. backdrop-filter: blur(2px);
  1547. }
  1548. /* 不能 overflow:hidden,否则渠道下拉面板会被裁掉 */
  1549. .modal {
  1550. width: 460px;
  1551. background: var(--card);
  1552. border-radius: 14px;
  1553. box-shadow: var(--shadow-lg);
  1554. }
  1555. .modal h2 {
  1556. padding: 14px 18px;
  1557. background: var(--navy-deep);
  1558. color: #fff;
  1559. font-size: 15px;
  1560. letter-spacing: 2px;
  1561. border-radius: 14px 14px 0 0;
  1562. }
  1563. .modal .mb {
  1564. padding: 18px;
  1565. display: grid;
  1566. gap: 12px;
  1567. }
  1568. .modal label {
  1569. font-size: 12px;
  1570. color: var(--ink-soft);
  1571. display: grid;
  1572. gap: 5px;
  1573. }
  1574. .modal .mf {
  1575. display: flex;
  1576. justify-content: flex-end;
  1577. gap: 10px;
  1578. padding: 0 18px 18px;
  1579. }
  1580. /* 渠道下拉多选 */
  1581. .dd {
  1582. position: relative;
  1583. }
  1584. .dd-btn {
  1585. width: 100%;
  1586. display: flex;
  1587. justify-content: space-between;
  1588. align-items: center;
  1589. gap: 8px;
  1590. text-align: left;
  1591. padding: 7px 10px;
  1592. border: 1px solid var(--line-dark);
  1593. border-radius: 8px;
  1594. background: #fff;
  1595. font-size: 13px;
  1596. color: var(--ink);
  1597. }
  1598. .dd-btn .dd-arrow {
  1599. color: var(--ink-faint);
  1600. flex: none;
  1601. }
  1602. .dd-btn:focus {
  1603. border-color: var(--blue);
  1604. }
  1605. .dd-panel {
  1606. position: absolute;
  1607. left: 0;
  1608. right: 0;
  1609. top: calc(100% + 4px);
  1610. z-index: 10;
  1611. background: #fff;
  1612. border: 1px solid var(--line-dark);
  1613. border-radius: 10px;
  1614. box-shadow: var(--shadow-lg);
  1615. padding: 6px;
  1616. max-height: 220px;
  1617. overflow: auto;
  1618. }
  1619. .modal label.dd-opt {
  1620. display: flex;
  1621. flex-direction: row;
  1622. align-items: center;
  1623. gap: 8px;
  1624. padding: 7px 9px;
  1625. border-radius: 6px;
  1626. font-size: 13px;
  1627. color: var(--ink);
  1628. cursor: pointer;
  1629. }
  1630. .dd-opt:hover {
  1631. background: #f4f3ee;
  1632. }
  1633. .dd-opt input {
  1634. accent-color: var(--blue);
  1635. margin: 0;
  1636. cursor: pointer;
  1637. }
  1638. .dd-opt.sel {
  1639. background: var(--blue-bg);
  1640. font-weight: 500;
  1641. }
  1642. /* 聚类库占位 */
  1643. .cluster-empty {
  1644. display: grid;
  1645. place-items: center;
  1646. min-height: 60vh;
  1647. }
  1648. .cluster-empty .inner {
  1649. text-align: center;
  1650. color: var(--ink-faint);
  1651. }
  1652. .cluster-empty .stamp {
  1653. width: 120px;
  1654. height: 120px;
  1655. margin: 0 auto 18px;
  1656. border: 3px solid var(--line-dark);
  1657. border-radius: 50%;
  1658. display: grid;
  1659. place-items: center;
  1660. font-family: "Noto Serif SC", serif;
  1661. font-size: 30px;
  1662. font-weight: 900;
  1663. color: var(--line-dark);
  1664. transform: rotate(-8deg);
  1665. letter-spacing: 4px;
  1666. }
  1667. [hidden] {
  1668. display: none !important;
  1669. }
  1670. </style>
  1671. </head>
  1672. <body>
  1673. <header>
  1674. <div class="logo">
  1675. <div class="seal">解</div>
  1676. <div><b>mode_workflow</b><small>解构工作台 · MODE WORKBENCH</small></div>
  1677. </div>
  1678. <nav id="nav">
  1679. <a
  1680. href="#dashboard"
  1681. data-tab="dashboard"
  1682. >Dashboard</a
  1683. >
  1684. <a
  1685. href="#dataset"
  1686. data-tab="dataset"
  1687. >Dataset</a
  1688. >
  1689. <a
  1690. href="#cluster"
  1691. data-tab="cluster"
  1692. >聚类库</a
  1693. >
  1694. </nav>
  1695. <div class="spacer"></div>
  1696. <div class="hint">SEARCH · EXTRACT · ARCHIVE</div>
  1697. </header>
  1698. <main id="view-dashboard"></main>
  1699. <main id="view-dataset">
  1700. <div class="ds-top">
  1701. <div class="mode-switch">
  1702. <button
  1703. id="m-process"
  1704. class="on"
  1705. >
  1706. 工序
  1707. </button>
  1708. <button id="m-tools">工具</button>
  1709. </div>
  1710. <div style="flex: 1"></div>
  1711. <button
  1712. class="btn seal"
  1713. id="btn-new-search"
  1714. >
  1715. + 新建搜索
  1716. </button>
  1717. </div>
  1718. <div class="ds-grid">
  1719. <div class="card">
  1720. <div class="col-head">
  1721. QUERY
  1722. <span
  1723. class="n"
  1724. id="q-count"
  1725. ></span>
  1726. </div>
  1727. <div
  1728. class="qlist"
  1729. id="query-list"
  1730. >
  1731. <div class="empty">暂无 query</div>
  1732. </div>
  1733. </div>
  1734. <div class="card">
  1735. <div class="col-head">
  1736. 帖子
  1737. <span style="display: flex; gap: 8px; align-items: center">
  1738. <span
  1739. class="n"
  1740. id="p-count"
  1741. ></span>
  1742. <button
  1743. class="btn sm"
  1744. id="btn-batch"
  1745. disabled
  1746. hidden
  1747. >
  1748. 批量解构
  1749. </button>
  1750. </span>
  1751. </div>
  1752. <div
  1753. class="plat-tabs"
  1754. id="plat-tabs"
  1755. hidden
  1756. ></div>
  1757. <div
  1758. class="plist"
  1759. id="post-list"
  1760. >
  1761. <div class="empty"><span class="glyph">←</span>先选择左侧 query</div>
  1762. </div>
  1763. </div>
  1764. <div class="card xp">
  1765. <div
  1766. class="xp-head"
  1767. id="xp-head"
  1768. >
  1769. <span class="st">解构结果</span>
  1770. </div>
  1771. <div
  1772. class="xp-body"
  1773. id="xp-body"
  1774. >
  1775. <div class="empty"><span class="glyph">←</span>选择一个帖子查看解构结果</div>
  1776. </div>
  1777. </div>
  1778. </div>
  1779. </main>
  1780. <main id="view-cluster">
  1781. <iframe
  1782. id="cluster-frame"
  1783. title="知识检索"
  1784. loading="lazy"
  1785. ></iframe>
  1786. </main>
  1787. <div
  1788. id="task-panel"
  1789. hidden
  1790. >
  1791. <header>
  1792. <span
  1793. class="dot"
  1794. id="task-dot"
  1795. ></span
  1796. ><span id="task-title">任务</span> <button onclick="hideTask()">✕</button>
  1797. </header>
  1798. <div id="task-log"></div>
  1799. </div>
  1800. <!-- 帖子详情弹层(评分详情参考 fixed_query_eval) -->
  1801. <dialog id="post-dialog">
  1802. <div class="pd-wrap">
  1803. <div class="pd-head">
  1804. <div style="min-width: 0">
  1805. <div
  1806. class="pd-meta"
  1807. id="pd-meta"
  1808. ></div>
  1809. <h3 id="pd-title"></h3>
  1810. </div>
  1811. <button
  1812. class="pd-close"
  1813. onclick="document.getElementById('post-dialog').close()"
  1814. >
  1815. </button>
  1816. </div>
  1817. <div class="pd-body">
  1818. <section>
  1819. <div id="pd-verdict"></div>
  1820. <div class="pd-sec-title">抓取文本节选</div>
  1821. <div
  1822. class="pd-raw"
  1823. id="pd-text"
  1824. ></div>
  1825. <div class="pd-sec-title">图片预览</div>
  1826. <div
  1827. class="pd-images"
  1828. id="pd-images"
  1829. ></div>
  1830. <div
  1831. class="pd-tags"
  1832. id="pd-tags"
  1833. ></div>
  1834. </section>
  1835. <aside>
  1836. <div class="pd-score-head">
  1837. <span class="t">评分详情</span>
  1838. <span class="pd-overall">综合评分 <b id="pd-overall">—</b></span>
  1839. </div>
  1840. <div id="pd-scores"></div>
  1841. </aside>
  1842. </div>
  1843. </div>
  1844. </dialog>
  1845. <!-- 图片预览灯箱(支持左右切换) -->
  1846. <dialog
  1847. class="lightbox"
  1848. id="lightbox"
  1849. onclick="if(event.target===this)closeLightbox()"
  1850. >
  1851. <button
  1852. class="lb-close"
  1853. onclick="closeLightbox()"
  1854. title="关闭 (Esc)"
  1855. >
  1856. </button>
  1857. <button
  1858. class="lb-nav lb-prev"
  1859. onclick="lbStep(-1)"
  1860. title="上一张 (←)"
  1861. >
  1862. </button>
  1863. <figure class="lb-stage">
  1864. <img
  1865. id="lb-img"
  1866. src=""
  1867. alt=""
  1868. />
  1869. <figcaption id="lb-count"></figcaption>
  1870. </figure>
  1871. <button
  1872. class="lb-nav lb-next"
  1873. onclick="lbStep(1)"
  1874. title="下一张 (→)"
  1875. >
  1876. </button>
  1877. </dialog>
  1878. <div
  1879. class="modal-bg"
  1880. id="search-modal"
  1881. hidden
  1882. >
  1883. <div class="modal">
  1884. <h2>新建搜索</h2>
  1885. <div class="mb">
  1886. <label
  1887. >Query(评估锚点,必填)<input
  1888. type="text"
  1889. id="s-query"
  1890. placeholder="如:AI 人像 图片 生成 怎么做"
  1891. /></label>
  1892. <label
  1893. >解构方向<select id="s-mode">
  1894. <option value="工序">工序</option>
  1895. <option value="工具">工具</option>
  1896. </select></label
  1897. >
  1898. <label
  1899. >同义措辞(可选,逗号分隔)<input
  1900. type="text"
  1901. id="s-syn"
  1902. placeholder="如:AI 人像生成 教程,AI 写真 怎么做"
  1903. /></label>
  1904. <label
  1905. >检索渠道(下拉多选)
  1906. <div
  1907. class="dd"
  1908. id="s-plat-dd"
  1909. >
  1910. <button
  1911. type="button"
  1912. class="dd-btn"
  1913. id="s-plat-btn"
  1914. >
  1915. 选择渠道 ▾
  1916. </button>
  1917. <div
  1918. class="dd-panel"
  1919. id="s-plat-panel"
  1920. hidden
  1921. ></div>
  1922. </div>
  1923. </label>
  1924. <label
  1925. >每措辞每渠道上限<input
  1926. type="number"
  1927. id="s-max"
  1928. value="10"
  1929. min="1"
  1930. max="50"
  1931. /></label>
  1932. </div>
  1933. <div class="mf">
  1934. <button
  1935. class="btn"
  1936. onclick="document.getElementById('search-modal').hidden = true"
  1937. >
  1938. 取消
  1939. </button>
  1940. <button
  1941. class="btn primary"
  1942. id="s-go"
  1943. >
  1944. 开始搜索
  1945. </button>
  1946. </div>
  1947. </div>
  1948. </div>
  1949. <script>
  1950. /* ════ 基础 ════ */
  1951. const $ = (s) => document.querySelector(s);
  1952. const api = (p, opt) =>
  1953. fetch(p, opt).then(async (r) => {
  1954. if (!r.ok)
  1955. throw Object.assign(new Error("api"), { status: r.status, body: await r.json().catch(() => ({})) });
  1956. return r.json();
  1957. });
  1958. const esc = (s) =>
  1959. String(s ?? "").replace(
  1960. /[&<>"']/g,
  1961. (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c],
  1962. );
  1963. /* 外链图片走本服务同源反代,绕过公众号(mmbiz.qpic.cn)等防盗链 */
  1964. const imgProxy = (u) => (/^https?:\/\//.test(u || "") ? "/api/img?u=" + encodeURIComponent(u) : u || "");
  1965. const state = {
  1966. tab: "dashboard",
  1967. mode: "process",
  1968. queryId: null,
  1969. caseId: null,
  1970. post: null,
  1971. version: null,
  1972. platFilter: "all",
  1973. doneFilter: true,
  1974. selected: new Set(),
  1975. queries: [],
  1976. posts: [],
  1977. };
  1978. const PLAT_CLS = (p) =>
  1979. ({ xhs: "xhs", gzh: "gzh", zhihu: "zhihu", douyin: "douyin", sph: "sph", youtube: "youtube", x: "x" })[p] ||
  1980. "other";
  1981. const PLAT_NAME = (p) =>
  1982. ({ xhs: "小红书", gzh: "公众号", zhihu: "知乎", douyin: "抖音", sph: "视频号", youtube: "YouTube", x: "X" })[
  1983. p
  1984. ] ||
  1985. p ||
  1986. "?";
  1987. /* 渠道 logo 徽标(品牌色圆角方块,hover 显示渠道名) */
  1988. const PLAT_LOGO = (p, size = 18) => {
  1989. const glyph = (bg, ch) => `<svg width="${size}" height="${size}" viewBox="0 0 24 24">
  1990. <rect width="24" height="24" rx="5.5" fill="${bg}"/>
  1991. <text x="12" y="16.6" font-size="12" font-weight="700" fill="#fff" text-anchor="middle"
  1992. font-family="'Noto Sans SC',sans-serif">${ch}</text></svg>`;
  1993. const svgs = {
  1994. xhs: glyph("#ff2442", "红"),
  1995. zhihu: glyph("#0084ff", "知"),
  1996. gzh: glyph("#07c160", "公"),
  1997. douyin: glyph("#161823", "抖"),
  1998. sph: glyph("#fa6d20", "视"),
  1999. x: glyph("#15202b", "X"),
  2000. youtube: `<svg width="${size}" height="${size}" viewBox="0 0 24 24">
  2001. <rect width="24" height="24" rx="5.5" fill="#f00"/>
  2002. <polygon points="9.8,7.8 17,12 9.8,16.2" fill="#fff"/></svg>`,
  2003. };
  2004. return svgs[p]
  2005. ? `<span class="plat-logo" title="${PLAT_NAME(p)}">${svgs[p]}</span>`
  2006. : `<span class="plat other">${esc(PLAT_NAME(p))}</span>`;
  2007. };
  2008. const MODELS_PROC = ["anthropic/claude-sonnet-4-6", "google/gemini-3.1-flash-lite"];
  2009. const MODELS_TOOL = ["google/gemini-3.1-flash-lite", "anthropic/claude-sonnet-4-6"];
  2010. const scoreCls = (v) => (v == null ? "s0" : v >= 9 ? "s9" : v >= 8 ? "s8" : v >= 6 ? "s6" : "s0");
  2011. /* ════ 路由 ════ */
  2012. function route() {
  2013. state.tab = (location.hash || "#dashboard").slice(1);
  2014. if (!["dashboard", "dataset", "cluster"].includes(state.tab)) state.tab = "dashboard";
  2015. document.querySelectorAll("nav a").forEach((a) => a.classList.toggle("on", a.dataset.tab === state.tab));
  2016. document.querySelectorAll("main").forEach((m) => m.classList.toggle("on", m.id === "view-" + state.tab));
  2017. if (state.tab === "dashboard") renderDashboard();
  2018. if (state.tab === "dataset" && !state.queries.length) loadQueries();
  2019. if (state.tab === "cluster") {
  2020. // 首次打开聚类库才加载内嵌检索页
  2021. const f = $("#cluster-frame");
  2022. if (f && !f.src) f.src = "/search.html";
  2023. }
  2024. }
  2025. window.addEventListener("hashchange", route);
  2026. /* ════ Dashboard ════ */
  2027. let chartRefs = [];
  2028. async function renderDashboard() {
  2029. const v = $("#view-dashboard");
  2030. let d;
  2031. try {
  2032. d = await api("/api/dashboard");
  2033. } catch (e) {
  2034. v.innerHTML = `<div class="card empty"><span class="glyph">!</span>Dashboard 加载失败:${esc(e.body?.error || e.status)}</div>`;
  2035. return;
  2036. }
  2037. const r = d.result,
  2038. p = d.process_data;
  2039. // 进度百分比向下取整:200/201=99.5% 显示 99%,未真正做完不会显示 100%
  2040. const pct = (a, b) => (b ? Math.floor((a / b) * 100) : 0);
  2041. const platBreak = (arr) => (arr || []).map(([k, n]) => `${PLAT_NAME(k)} ${n}`).join(" · ") || "—";
  2042. v.innerHTML = `
  2043. <div class="dash-section"><h2>结果数据</h2><div class="rule"></div><span class="tag">RESULTS</span></div>
  2044. <div class="cards">
  2045. <div class="card stat"><div class="lbl">采集帖子数量</div><div class="val num">${r.post_count}</div><div class="sub">${platBreak(r.collected_by_platform)}</div></div>
  2046. <div class="card stat t"><div class="lbl">解构帖子数量</div><div class="val num">${r.extracted_post_count}</div><div class="sub">${platBreak(r.extracted_by_platform)}</div></div>
  2047. <div class="card stat a"><div class="lbl">工具数量</div><div class="val num">${r.tool_count}</div><div class="sub">mode_tools 去重工具名</div></div>
  2048. <div class="card stat r"><div class="lbl">内容树覆盖节点</div><div class="val num">0</div>
  2049. <div class="sub">0%</div></div>
  2050. <div class="card stat"><div class="lbl">实质数量</div><div class="val num">${r.substance_count}</div><div class="sub">去重实质条目数</div></div>
  2051. <div class="card stat"><div class="lbl">形式数量</div><div class="val num">${r.form_count}</div><div class="sub">去重形式条目数</div></div>
  2052. </div>
  2053. <div class="dash-section"><h2>过程数据</h2><div class="rule"></div><span class="tag">PROCESS</span></div>
  2054. <div class="cards">
  2055. <div class="card stat a"><div class="lbl">解构成本</div><div class="val num">$${p.total_cost}</div><div class="sub">单条均值 $${p.avg_cost} · 共 ${p.run_count} 次</div></div>
  2056. <div class="card stat a"><div class="lbl">解构耗时</div><div class="val num">${(p.total_duration / 3600).toFixed(1)}<span style="font-size:14px">h</span></div><div class="sub">平均 ${p.avg_duration}s / 次</div></div>
  2057. <div class="card stat t"><div class="ring-row"><div class="ring" style="--p:${pct(p.process_progress.done, p.process_progress.total)}"><div>${pct(p.process_progress.done, p.process_progress.total)}%</div></div>
  2058. <div><div class="lbl">工序进度</div><div class="num" style="font-weight:700">${p.process_progress.done} / ${p.process_progress.total}</div><div class="sub">已解构 / 需解构</div></div></div></div>
  2059. <div class="card stat t"><div class="ring-row"><div class="ring" style="--p:${pct(p.tools_progress.done, p.tools_progress.total)}"><div>${pct(p.tools_progress.done, p.tools_progress.total)}%</div></div>
  2060. <div><div class="lbl">工具进度</div><div class="num" style="font-weight:700">${p.tools_progress.done} / ${p.tools_progress.total}</div><div class="sub">已解构 / 需解构</div></div></div></div>
  2061. </div>
  2062. <div class="charts">
  2063. <div class="card chart-card span6"><h3>工序提及工具 TOP10</h3><div class="chart" id="ch-via" style="height:300px"></div></div>
  2064. <div class="card chart-card span6"><h3>解构成本趋势</h3><div class="chart" id="ch-cost" style="height:300px"></div></div>
  2065. <div class="card chart-card span6"><h3>实质覆盖分布 <span class="num">${r.substance_count}</span></h3><div class="chart" id="ch-sub" style="height:320px"></div></div>
  2066. <div class="card chart-card span6"><h3>形式覆盖分布 <span class="num">${r.form_count}</span></h3><div class="chart" id="ch-form" style="height:320px"></div></div>
  2067. <div class="card chart-card span12"><h3>内容树覆盖热力图 <span class="num">${r.matrix_covered}/${r.matrix_valid}</span><span style="font-weight:400;color:var(--ink-faint)">· 27 动作 × 50 类型</span></h3><div class="chart" id="ch-matrix" style="height:560px"></div></div>
  2068. </div>`;
  2069. chartRefs.forEach((c) => c.dispose());
  2070. chartRefs = [];
  2071. const mk = (id, opt) => {
  2072. const c = echarts.init($(id));
  2073. c.setOption(opt);
  2074. chartRefs.push(c);
  2075. return c;
  2076. };
  2077. const ink = "#1c2433",
  2078. faint = "#9aa3b0",
  2079. grid = { left: 8, right: 16, top: 8, bottom: 8, containLabel: true };
  2080. /* 热力图 */
  2081. mk("#ch-matrix", {
  2082. tooltip: { formatter: (pr) => `${r.matrix_actions[pr.value[1]]} × ${r.matrix_types[pr.value[0]]}` },
  2083. grid: { left: 8, right: 16, top: 8, bottom: 60, containLabel: true },
  2084. xAxis: {
  2085. type: "category",
  2086. data: r.matrix_types,
  2087. axisLabel: { rotate: 60, fontSize: 9, color: faint },
  2088. splitArea: { show: true, areaStyle: { color: ["#fcfcf9", "#f5f4ef"] } },
  2089. },
  2090. yAxis: {
  2091. type: "category",
  2092. data: r.matrix_actions,
  2093. axisLabel: { fontSize: 10, color: ink },
  2094. splitArea: { show: true },
  2095. },
  2096. visualMap: { show: false, min: 0, max: 1, inRange: { color: ["#f0efe8", "#bb3a22"] } },
  2097. series: [
  2098. {
  2099. type: "heatmap",
  2100. data: r.matrix_cells.map(([a, t]) => [t, a, 1]),
  2101. itemStyle: { borderColor: "#fff", borderWidth: 1 },
  2102. },
  2103. ],
  2104. });
  2105. const bar = (data, color) => ({
  2106. tooltip: {},
  2107. grid,
  2108. xAxis: { type: "value", axisLabel: { color: faint } },
  2109. yAxis: {
  2110. type: "category",
  2111. data: data.map((x) => x[0]).reverse(),
  2112. axisLabel: { color: ink, fontSize: 11, width: 130, overflow: "truncate" },
  2113. },
  2114. series: [
  2115. {
  2116. type: "bar",
  2117. data: data.map((x) => x[1]).reverse(),
  2118. itemStyle: { color, borderRadius: [0, 3, 3, 0] },
  2119. barMaxWidth: 16,
  2120. label: { show: true, position: "right", color: faint, fontSize: 10 },
  2121. },
  2122. ],
  2123. });
  2124. mk("#ch-via", r.via_top10.length ? bar(r.via_top10, "#1e3a5f") : emptyOpt());
  2125. mk("#ch-sub", r.substance_top.length ? bar(r.substance_top, "#b45309") : emptyOpt());
  2126. mk("#ch-form", r.form_top.length ? bar(r.form_top, "#0f6b5c") : emptyOpt());
  2127. mk(
  2128. "#ch-cost",
  2129. p.cost_trend.length
  2130. ? {
  2131. tooltip: { trigger: "axis" },
  2132. grid,
  2133. xAxis: { type: "category", data: p.cost_trend.map((x) => x.date), axisLabel: { color: faint } },
  2134. yAxis: { type: "value", axisLabel: { color: faint, formatter: "${value}" } },
  2135. series: [
  2136. {
  2137. type: "line",
  2138. data: p.cost_trend.map((x) => x.cost),
  2139. smooth: true,
  2140. symbolSize: 7,
  2141. lineStyle: { color: "#bb3a22", width: 2.5 },
  2142. itemStyle: { color: "#bb3a22" },
  2143. areaStyle: { color: "rgba(187,58,34,.08)" },
  2144. },
  2145. ],
  2146. }
  2147. : emptyOpt(),
  2148. );
  2149. function emptyOpt() {
  2150. return {
  2151. title: {
  2152. text: "暂无数据",
  2153. left: "center",
  2154. top: "middle",
  2155. textStyle: { color: faint, fontSize: 12, fontWeight: 400 },
  2156. },
  2157. xAxis: { show: false },
  2158. yAxis: { show: false },
  2159. };
  2160. }
  2161. }
  2162. /* ════ Dataset:query 列表 ════ */
  2163. async function loadQueries() {
  2164. /* 工序/工具各自一张搜索表,query 列表按当前子模式拉取 */
  2165. try {
  2166. state.queries = await api("/api/queries?mode=" + state.mode);
  2167. } catch (e) {
  2168. state.queries = [];
  2169. }
  2170. renderQueries();
  2171. /* 进入/切换子模式时默认选中第一个 query(进而联动第一帖与解构结果) */
  2172. if (!state.queryId && state.queries.length) await selectQuery(state.queries[0].query_id);
  2173. }
  2174. function renderQueries() {
  2175. const list = state.queries;
  2176. $("#q-count").textContent = list.length ? list.length + " 组" : "";
  2177. if (!list.length) {
  2178. $("#query-list").innerHTML = '<div class="empty">暂无 query<br>点右上「新建搜索」开始</div>';
  2179. return;
  2180. }
  2181. $("#query-list").innerHTML = list
  2182. .map((q) => {
  2183. const done = state.mode === "process" ? q.process_done : q.tools_done;
  2184. return `<div class="qitem ${q.query_id === state.queryId ? "on" : ""}" onclick="selectQuery('${q.query_id}')">
  2185. <div class="qid">${q.query_id}</div>
  2186. <div class="qt">${esc(q.query_text || "(未命名)")}</div>
  2187. <div class="qm">
  2188. <span>采纳/命中 <b class="num hit">${q.hit_count ?? 0}</b></span>
  2189. <span>总帖数 <b class="num">${q.post_count}</b></span>
  2190. <span>已解构 <b class="num">${done}</b></span>
  2191. </div>
  2192. </div>`;
  2193. })
  2194. .join("");
  2195. }
  2196. async function selectQuery(qid) {
  2197. state.queryId = qid;
  2198. state.caseId = null;
  2199. state.post = null;
  2200. state.platFilter = "all";
  2201. state.selected.clear();
  2202. renderQueries();
  2203. renderExtractEmpty();
  2204. $("#post-list").innerHTML = '<div class="empty">加载中…</div>';
  2205. try {
  2206. state.posts = await api("/api/posts?mode=" + state.mode + "&query_id=" + encodeURIComponent(qid));
  2207. } catch (e) {
  2208. state.posts = [];
  2209. }
  2210. renderPosts();
  2211. /* 默认选中「可见列表」第一帖(已解构筛选下即第一个已解构帖),无可见帖则退回全部第一帖 */
  2212. if (state.posts.length) {
  2213. const vis = visiblePosts();
  2214. await selectPost((vis[0] || state.posts[0]).case_id);
  2215. }
  2216. }
  2217. /* ════ Dataset:帖子列表(按渠道分 tab)════ */
  2218. function setPlatFilter(p) {
  2219. state.platFilter = p;
  2220. renderPosts();
  2221. }
  2222. function toggleDoneFilter() {
  2223. state.doneFilter = !state.doneFilter;
  2224. renderPosts();
  2225. renderPostsAutoSelect();
  2226. }
  2227. /* 当前可见帖(渠道 + 已解构筛选后),供列表渲染与「默认选中」共用 */
  2228. function visiblePosts() {
  2229. const isDone = (p) => (state.mode === "process" ? p.has_process : p.has_tools);
  2230. let list =
  2231. state.platFilter === "all"
  2232. ? state.posts
  2233. : state.posts.filter((p) => (p.platform || "other") === state.platFilter);
  2234. if (state.doneFilter) list = list.filter(isDone);
  2235. return list;
  2236. }
  2237. /* 切换筛选后,若当前选中帖已被筛掉,则改选可见列表的第一帖 */
  2238. async function renderPostsAutoSelect() {
  2239. const vis = visiblePosts();
  2240. if (vis.length && !vis.some((p) => p.case_id === state.caseId)) await selectPost(vis[0].case_id);
  2241. }
  2242. function renderPosts() {
  2243. const all = state.posts;
  2244. updateBatchBtn();
  2245. /* 渠道 tab + 已解构筛选 */
  2246. const counts = {};
  2247. all.forEach((p) => {
  2248. const k = p.platform || "other";
  2249. counts[k] = (counts[k] || 0) + 1;
  2250. });
  2251. const plats = Object.keys(counts);
  2252. if (state.platFilter !== "all" && !counts[state.platFilter]) state.platFilter = "all";
  2253. const isDone = (p) => (state.mode === "process" ? p.has_process : p.has_tools);
  2254. const platScoped =
  2255. state.platFilter === "all" ? all : all.filter((p) => (p.platform || "other") === state.platFilter);
  2256. const doneN = platScoped.filter(isDone).length;
  2257. const tabs = $("#plat-tabs");
  2258. if (all.length) {
  2259. tabs.hidden = false;
  2260. const btns =
  2261. plats.length > 1
  2262. ? [
  2263. `<button class="${state.platFilter === "all" ? "on" : ""}" onclick="setPlatFilter('all')">全部<span class="c">${all.length}</span></button>`,
  2264. ].concat(
  2265. plats.map(
  2266. (k) =>
  2267. `<button class="${state.platFilter === k ? "on" : ""}" onclick="setPlatFilter('${esc(k)}')">${PLAT_NAME(k)}<span class="c">${counts[k]}</span></button>`,
  2268. ),
  2269. )
  2270. : [];
  2271. btns.push(`<button class="done-filter ${state.doneFilter ? "on" : ""}" onclick="toggleDoneFilter()"
  2272. title="${state.doneFilter ? "当前只看已解构,点击显示全部" : "点击只看已解构"}"><span class="dot">●</span>已解构<span class="c">${doneN}</span></button>`);
  2273. tabs.innerHTML = btns.join("");
  2274. } else {
  2275. tabs.hidden = true;
  2276. }
  2277. const list = visiblePosts();
  2278. $("#p-count").textContent = all.length
  2279. ? state.platFilter === "all" && !state.doneFilter
  2280. ? `${all.length} 帖`
  2281. : `${list.length} / ${all.length} 帖`
  2282. : "";
  2283. if (!all.length) {
  2284. $("#post-list").innerHTML = '<div class="empty">该 query 暂无帖子</div>';
  2285. return;
  2286. }
  2287. if (!list.length) {
  2288. $("#post-list").innerHTML =
  2289. `<div class="empty">${state.doneFilter ? "该筛选下暂无已解构帖子" : "该渠道暂无帖子"}</div>`;
  2290. return;
  2291. }
  2292. $("#post-list").innerHTML = list
  2293. .map((p) => {
  2294. const done = state.mode === "process" ? p.has_process : p.has_tools;
  2295. const kt = (p.knowledge_type || []).map((k) => `<span class="pill">${esc(k)}</span>`).join("");
  2296. const sb =
  2297. p.overall_score != null
  2298. ? `<span class="score-badge ${scoreCls(p.overall_score)} num"
  2299. onclick="event.stopPropagation();openPostDetail('${esc(p.case_id)}')">${p.overall_score}</span>`
  2300. : "";
  2301. const thumbSrc = (p.images || []).filter(Boolean)[0];
  2302. const thumb = thumbSrc
  2303. ? `<img class="thumb" src="${esc(imgProxy(thumbSrc))}" loading="lazy"
  2304. onerror="this.outerHTML='<div class=\\'thumb-ph\\'>🖼️</div>'">`
  2305. : `<div class="thumb-ph" title="暂无图片">🖼️</div>`;
  2306. return `<div class="post ${p.case_id === state.caseId ? "on" : ""}" onclick="selectPost('${esc(p.case_id)}')">
  2307. ${thumb}
  2308. <div style="flex:1;min-width:0">
  2309. <div class="pt">${esc(p.title || "(无标题)")}</div>
  2310. <div class="pm">
  2311. ${PLAT_LOGO(p.platform)}
  2312. ${p.adopted ? '<span class="pill green">采纳</span>' : ""}
  2313. ${kt}
  2314. ${done ? '<span class="done-dot">● 已解构</span>' : ""}
  2315. </div>
  2316. </div>
  2317. ${sb}
  2318. </div>`;
  2319. })
  2320. .join("");
  2321. }
  2322. function toggleSel(cid, on) {
  2323. on ? state.selected.add(cid) : state.selected.delete(cid);
  2324. updateBatchBtn();
  2325. }
  2326. function updateBatchBtn() {
  2327. const b = $("#btn-batch");
  2328. b.disabled = !state.selected.size;
  2329. b.textContent = state.selected.size ? `批量解构(${state.selected.size})` : "批量解构";
  2330. }
  2331. $("#btn-batch").onclick = () => state.selected.size && startExtract([...state.selected]);
  2332. /* ════ 帖子详情弹层 ════ */
  2333. /* 得分可能是字符串("1")或数字(10),统一解析;非数值返回 null */
  2334. const scoreNum = (v) => {
  2335. const n = typeof v === "number" || (typeof v === "string" && v.trim() !== "") ? Number(v) : NaN;
  2336. return Number.isFinite(n) ? n : null;
  2337. };
  2338. function collectScores(node) {
  2339. let out = [];
  2340. if (Array.isArray(node)) node.forEach((v) => (out = out.concat(collectScores(v))));
  2341. else if (node && typeof node === "object") {
  2342. for (const [k, v] of Object.entries(node)) {
  2343. if (k === "得分") {
  2344. const n = scoreNum(v);
  2345. if (n !== null) out.push(n);
  2346. } else out = out.concat(collectScores(v));
  2347. }
  2348. }
  2349. return out;
  2350. }
  2351. function scRow(label, v, reason) {
  2352. const n = scoreNum(v);
  2353. const has = n !== null;
  2354. return `<div class="sc-row">
  2355. <span style="color:${has ? "inherit" : "var(--ink-faint)"}">${esc(label)}</span>
  2356. <div class="meter"><span style="width:${has ? Math.min(n, 10) * 10 : 0}%"></span></div>
  2357. <b class="num">${has ? n : "—"}</b>
  2358. ${reason ? `<span class="info" data-label="${esc(label)}" data-reason="${esc(reason)}" data-score="${has ? n : ""}" onclick="showScorePop(this)">ⓘ</span>` : "<span></span>"}
  2359. </div>`;
  2360. }
  2361. /* 递归渲染评分;depth>0 的分组标题用二级样式,形成层级 */
  2362. function walkScores(node, depth) {
  2363. depth = depth || 0;
  2364. let html = "";
  2365. for (const [k, v] of Object.entries(node || {})) {
  2366. if (v && typeof v === "object" && !Array.isArray(v) && "得分" in v) {
  2367. html += scRow(k, v["得分"], v["理由"]);
  2368. } else if (scoreNum(v) !== null) {
  2369. html += scRow(k, v);
  2370. } else if (v && typeof v === "object" && !Array.isArray(v)) {
  2371. const inner = walkScores(v, depth + 1);
  2372. if (inner) html += `<div class="sc-sub${depth > 0 ? " lv2" : ""}">${esc(k)}</div>` + inner;
  2373. }
  2374. }
  2375. return html;
  2376. }
  2377. /* ── 质量评分:不跟随原始 JSON 嵌套,改用 mode_procedure 的规范分组与顺序 ──
  2378. 固定维度 → 用例 → 工序 → 能力 → 工具;丢弃「字段完整性」「动态维度」等中间表头 */
  2379. const QUALITY_ORDER = {
  2380. 工序: ["流程完整性", "输入完整性", "实现完整性", "输出完整性", "泛化性"],
  2381. 能力: ["输入完整性", "实现完整性", "输出完整性", "泛化性"],
  2382. 工具: ["能力边界覆盖", "有效比较", "参数/接口具体性", "实操示例", "版本&限制"],
  2383. };
  2384. /* DFS 找到名为 name 的容器节点(工序/能力/工具) */
  2385. function findScoreNode(n, name) {
  2386. if (!n || typeof n !== "object" || Array.isArray(n)) return null;
  2387. if (name in n && n[name] && typeof n[name] === "object" && !Array.isArray(n[name])) return n[name];
  2388. for (const v of Object.values(n)) {
  2389. if (v && typeof v === "object" && !Array.isArray(v)) {
  2390. const r = findScoreNode(v, name);
  2391. if (r) return r;
  2392. }
  2393. }
  2394. return null;
  2395. }
  2396. /* 递归收集子树叶子评分 [name,{得分,理由}],打平中间分组头 */
  2397. function collectLeaves(node) {
  2398. let out = [];
  2399. for (const [k, v] of Object.entries(node || {})) {
  2400. if (v && typeof v === "object" && !Array.isArray(v) && "得分" in v) out.push([k, v]);
  2401. else if (scoreNum(v) !== null) out.push([k, { 得分: v }]);
  2402. else if (v && typeof v === "object" && !Array.isArray(v)) out = out.concat(collectLeaves(v));
  2403. }
  2404. return out;
  2405. }
  2406. function renderQuality(qnode) {
  2407. /* 固定维度/用例 的维度名全局唯一,扁平索引即可取 */
  2408. const flat = {};
  2409. (function collect(n) {
  2410. for (const [k, v] of Object.entries(n || {})) {
  2411. if (v && typeof v === "object" && !Array.isArray(v)) {
  2412. if ("得分" in v) flat[k] = v;
  2413. else collect(v);
  2414. } else if (scoreNum(v) !== null) flat[k] = { 得分: v };
  2415. }
  2416. })(qnode);
  2417. const sub = (t) => `<div class="sc-sub">${esc(t)}</div>`;
  2418. const rows = (pairs) => pairs.map(([n, o]) => scRow(n, o["得分"], o["理由"])).join("");
  2419. const pick = (names) => names.filter((n) => flat[n]).map((n) => [n, flat[n]]);
  2420. let html = "";
  2421. let p = pick(["时效性", "热度性", "评论反馈"]); // ① 固定维度(置顶)
  2422. if (p.length) html += sub("固定维度") + rows(p);
  2423. p = pick(["真实感", "真实感 (非AI)", "真实感(非AI)", "表现力"]); // ② 用例
  2424. if (p.length) html += sub("用例") + rows(p);
  2425. for (const name of ["工序", "能力", "工具"]) {
  2426. // ③ 动态维度(按方向命名,内部规范排序)
  2427. const node = findScoreNode(qnode, name);
  2428. if (!node) continue;
  2429. const leaves = collectLeaves(node);
  2430. if (!leaves.length) continue;
  2431. const order = QUALITY_ORDER[name] || [];
  2432. leaves.sort((a, b) => (order.indexOf(a[0]) + 1 || 99) - (order.indexOf(b[0]) + 1 || 99));
  2433. html += sub(name) + rows(leaves);
  2434. }
  2435. return html || '<span style="color:var(--ink-faint)">无评分</span>';
  2436. }
  2437. /* ── 判定理由弹层:点击 ⓘ 浮现,符合当前页面样式 ── */
  2438. let _scorePop = null;
  2439. function closeScorePop() {
  2440. if (_scorePop) {
  2441. _scorePop.remove();
  2442. _scorePop = null;
  2443. }
  2444. document.removeEventListener("mousedown", _scorePopOutside, true);
  2445. }
  2446. function _scorePopOutside(e) {
  2447. if (_scorePop && !_scorePop.contains(e.target) && !e.target.classList.contains("info")) closeScorePop();
  2448. }
  2449. function showScorePop(el) {
  2450. const reopen = _scorePop && _scorePop._anchor === el;
  2451. closeScorePop();
  2452. if (reopen) return; // 再次点击同一图标 → 收起
  2453. const score = el.dataset.score;
  2454. const pop = document.createElement("div");
  2455. pop.className = "score-pop";
  2456. pop._anchor = el;
  2457. pop.innerHTML = `<div class="sp-head">
  2458. <span class="sp-tag">判定理由</span>
  2459. <span class="sp-name">${esc(el.dataset.label || "")}</span>
  2460. ${score !== "" && score != null ? `<span class="sp-score">${esc(score)}</span>` : ""}
  2461. </div>
  2462. <div class="sp-body">${esc(el.dataset.reason || "")}</div>`;
  2463. // 挂在 dialog 内,确保位于 showModal 顶层之上
  2464. (document.getElementById("post-dialog") || document.body).appendChild(pop);
  2465. _scorePop = pop;
  2466. // 定位:图标下方右对齐;越界则上翻 / 收边
  2467. const r = el.getBoundingClientRect();
  2468. let top = r.bottom + 8,
  2469. left = r.right - pop.offsetWidth;
  2470. if (left < 12) left = 12;
  2471. if (top + pop.offsetHeight > window.innerHeight - 12) top = r.top - pop.offsetHeight - 8;
  2472. if (top < 12) top = 12;
  2473. pop.style.top = top + "px";
  2474. pop.style.left = left + "px";
  2475. setTimeout(() => document.addEventListener("mousedown", _scorePopOutside, true), 0);
  2476. }
  2477. document.getElementById("post-dialog")?.addEventListener("close", closeScorePop);
  2478. /* ── 图片预览灯箱 ── */
  2479. const lb = { imgs: [], i: 0 };
  2480. function openLightbox(i) {
  2481. if (!lb.imgs.length) return;
  2482. lb.i = (i + lb.imgs.length) % lb.imgs.length;
  2483. renderLightbox();
  2484. const d = $("#lightbox");
  2485. if (!d.open) d.showModal();
  2486. }
  2487. function closeLightbox() {
  2488. const d = $("#lightbox");
  2489. if (d.open) d.close();
  2490. }
  2491. function lbStep(d) {
  2492. if (!lb.imgs.length) return;
  2493. lb.i = (lb.i + d + lb.imgs.length) % lb.imgs.length;
  2494. renderLightbox();
  2495. }
  2496. function renderLightbox() {
  2497. $("#lb-img").src = imgProxy(lb.imgs[lb.i]);
  2498. $("#lb-count").textContent = `${lb.i + 1} / ${lb.imgs.length}`;
  2499. const multi = lb.imgs.length > 1;
  2500. document.querySelector(".lb-prev").style.visibility = multi ? "visible" : "hidden";
  2501. document.querySelector(".lb-next").style.visibility = multi ? "visible" : "hidden";
  2502. }
  2503. document.addEventListener("keydown", (e) => {
  2504. if (!$("#lightbox").open) return;
  2505. if (e.key === "ArrowLeft") lbStep(-1);
  2506. else if (e.key === "ArrowRight") lbStep(1);
  2507. // Esc 由 <dialog> 原生处理(触发 close)
  2508. });
  2509. function openPostDetail(cid) {
  2510. const p = state.posts.find((x) => x.case_id === cid);
  2511. if (!p) return;
  2512. const e = p.llm_evaluation || {};
  2513. const meta = [];
  2514. meta.push(`${PLAT_LOGO(p.platform)}<span style="font-weight:600">${esc(PLAT_NAME(p.platform))}</span>`);
  2515. meta.push(p.adopted ? '<span class="pill green">采纳/命中</span>' : '<span class="pill">未采纳</span>');
  2516. if (p.publish_time) meta.push(`<span>${esc(String(p.publish_time).slice(0, 16))}</span>`);
  2517. if (p.like_count != null) meta.push(`<span>👍 ${p.like_count}</span>`);
  2518. if (p.quality_grade) meta.push(`<span>质量 ${esc(p.quality_grade)} ${p.quality_score ?? ""}</span>`);
  2519. if (p.url) meta.push(`<a href="${esc(p.url)}" target="_blank">原文 ↗</a>`);
  2520. $("#pd-meta").innerHTML = meta.join("");
  2521. $("#pd-title").textContent = p.title || "(无标题)";
  2522. const verdict = e["判定理由"] || e["理由"] || "";
  2523. $("#pd-verdict").innerHTML = verdict ? `<div class="pd-verdict">${esc(verdict)}</div>` : "";
  2524. $("#pd-text").textContent = p.body || "(无正文)";
  2525. const imgs = (p.images || []).filter(Boolean);
  2526. $("#pd-images").innerHTML = imgs.length
  2527. ? imgs
  2528. .map(
  2529. (s, i) => `<img src="${esc(imgProxy(s))}" loading="lazy"
  2530. onclick="openLightbox(${i})" onerror="this.style.opacity=.25">`,
  2531. )
  2532. .join("")
  2533. : '<p style="color:var(--ink-faint);font-size:12px">搜索详情未返回图片。</p>';
  2534. lb.imgs = imgs;
  2535. $("#pd-tags").innerHTML = [
  2536. ...(p.knowledge_type || []).map((t) => "类型:" + t),
  2537. ...(p.found_by || []).map((q) => "命中:" + q),
  2538. ]
  2539. .map((t) => `<span class="pill">${esc(t)}</span>`)
  2540. .join("");
  2541. $("#pd-overall").innerHTML =
  2542. p.overall_score != null
  2543. ? `${p.overall_score}<span style="font-size:11px;color:var(--ink-faint);font-weight:500"> /10</span>`
  2544. : "—";
  2545. /* 评分卡:相关性 + 质量(均分 + 各维度,ⓘ hover 看理由) */
  2546. $("#pd-scores").innerHTML =
  2547. [
  2548. ["01", "相关性"],
  2549. ["02", "质量"],
  2550. ]
  2551. .map(([no, key], i) => {
  2552. const node = e[key];
  2553. if (!node) return "";
  2554. const vs = collectScores(node);
  2555. const avg = vs.length ? (vs.reduce((a, b) => a + b, 0) / vs.length).toFixed(1) : "N/A";
  2556. return `<div class="sc-card">
  2557. <div class="sc-card-head">
  2558. <span><span class="badge">${no}</span>${esc(key)}</span>
  2559. <span class="avg">均分 <b>${avg}</b>/10</span>
  2560. </div>
  2561. <div class="sc-card-body">${(key === "质量" ? renderQuality(node) : walkScores(node)) || '<span style="color:var(--ink-faint)">无评分</span>'}</div>
  2562. </div>`;
  2563. })
  2564. .join("") || '<div class="empty">无评估数据</div>';
  2565. $("#post-dialog").showModal();
  2566. }
  2567. /* ════ Dataset:右栏解构结果 ════ */
  2568. function renderExtractEmpty() {
  2569. $("#xp-head").innerHTML = '<span class="st">解构结果</span>';
  2570. $("#xp-body").innerHTML = '<div class="empty"><span class="glyph">←</span>选择一个帖子查看解构结果</div>';
  2571. }
  2572. async function selectPost(cid) {
  2573. state.caseId = cid;
  2574. state.version = null;
  2575. state.post = state.posts.find((p) => p.case_id === cid) || null;
  2576. renderPosts();
  2577. await loadExtract();
  2578. }
  2579. async function loadExtract() {
  2580. if (!state.caseId) return renderExtractEmpty();
  2581. const isProc = state.mode === "process";
  2582. const vURL = `/api/${isProc ? "process" : "tools"}_versions?case_id=` + encodeURIComponent(state.caseId);
  2583. const dURL =
  2584. `/api/${isProc ? "process" : "tools"}?case_id=` +
  2585. encodeURIComponent(state.caseId) +
  2586. (state.version ? "&version=" + encodeURIComponent(state.version) : "");
  2587. let versions = [],
  2588. data = null,
  2589. missing = false;
  2590. try {
  2591. versions = await api(vURL);
  2592. } catch (e) {}
  2593. try {
  2594. data = await api(dURL);
  2595. } catch (e) {
  2596. if (e.status === 404) missing = true;
  2597. else throw e;
  2598. }
  2599. renderExtractHead(versions, data, missing);
  2600. const body = $("#xp-body");
  2601. if (missing || !data) {
  2602. body.innerHTML = `<div class="empty">该帖暂无${isProc ? "工序" : "工具"}解构<br><br>
  2603. <button class="btn primary" onclick="startExtract(['${esc(state.caseId)}'])">开始解构</button></div>`;
  2604. return;
  2605. }
  2606. state.version = data.version;
  2607. syncVersionSelect();
  2608. body.innerHTML = isProc ? renderProcedures(data) : renderTools(data);
  2609. if (!isProc) requestAnimationFrame(markClampedCells);
  2610. }
  2611. function renderExtractHead(versions, data, missing) {
  2612. const isProc = state.mode === "process";
  2613. const title = state.post ? esc(state.post.title || state.caseId) : esc(state.caseId || "");
  2614. const opts = versions
  2615. .map(
  2616. (v, i) =>
  2617. `<option value="${esc(v.version)}">${esc(v.version)}${i === 0 ? " (最新)" : ""} · ${v.n}${isProc ? "工序" : "工具"}</option>`,
  2618. )
  2619. .join("");
  2620. const models = (isProc ? MODELS_PROC : MODELS_TOOL).map((m) => `<option>${m}</option>`).join("");
  2621. $("#xp-head").innerHTML = `
  2622. <span class="st">大模型${isProc ? "工序" : "工具"}:<em>${missing ? "未提取" : "已提取"}</em></span>
  2623. <span style="font-size:12px;color:var(--ink-faint);max-width:330px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap" title="${title}">${title}</span>
  2624. <span class="spacer"></span>
  2625. ${versions.length ? `<select id="ver-sel">${opts}</select>` : ""}
  2626. <select id="model-sel" title="解构模型">${models}</select>
  2627. <button class="btn sm primary" onclick="startExtract(['${esc(state.caseId || "")}'])">${missing ? "提取" : "♻ 重新生成"}</button>
  2628. <button class="btn sm" onclick="showTaskPanel()" title="重新打开任务日志面板">📋 操作日志</button>`;
  2629. const vs = $("#ver-sel");
  2630. if (vs)
  2631. vs.onchange = () => {
  2632. state.version = vs.value;
  2633. loadExtract();
  2634. };
  2635. }
  2636. function syncVersionSelect() {
  2637. const vs = $("#ver-sel");
  2638. if (vs && state.version) vs.value = state.version;
  2639. }
  2640. /* ── 工序渲染 ── */
  2641. function renderProcedures(data) {
  2642. const src = data.source || {};
  2643. const srcCid = src.case_id || state.caseId;
  2644. const srcLine = src.title
  2645. ? `<div class="pill" style="margin-bottom:14px;cursor:pointer" title="查看原帖详情"
  2646. onclick="openPostDetail('${esc(srcCid)}')">▸ 原文:${esc(src.title)}</div>`
  2647. : "";
  2648. return (
  2649. srcLine +
  2650. (data.procedures || [])
  2651. .map((p) => {
  2652. const d = p.declarations || {};
  2653. const ins =
  2654. (d.inputs || [])
  2655. .map(
  2656. (x) =>
  2657. `<span class="pill amber">${esc(x.type || "")}</span> ${x.name ? `<b>${esc(x.name)}</b>` : ""} ${x.desc ? `<span style="color:var(--ink-faint)">— ${esc(x.desc)}</span>` : ""}`,
  2658. )
  2659. .join("<br>") || '<span style="color:var(--ink-faint)">无</span>';
  2660. const ret = d.returns
  2661. ? `<span class="pill teal">${esc(d.returns.type || "")}</span>`
  2662. : '<span style="color:var(--ink-faint)">无</span>';
  2663. return `<div class="proc">
  2664. <div class="proc-head">
  2665. <div class="nm"><span class="pid">工序 ${esc(p.id || "")}</span>${esc(p.name || "")}</div>
  2666. ${p.purpose ? `<div class="pp">#目的:${esc(p.purpose)}</div>` : ""}
  2667. <div class="meta">
  2668. ${p.category ? `<span class="pill red">类别:${esc(p.category)}</span>` : ""}
  2669. ${src.platform ? `<span class="pill">#平台:${esc(src.platform)}</span>` : ""}
  2670. ${src.author ? `<span class="pill">#作者:${esc(src.author)}</span>` : ""}
  2671. <span class="pill">case:${esc(data.case_id)}</span>
  2672. ${(p.tools_used || []).map((t) => `<span class="pill teal">${esc(t)}</span>`).join("")}
  2673. </div>
  2674. </div>
  2675. <div class="decl">
  2676. <div><div class="dl">输入</div><div class="di">${ins}</div></div>
  2677. <div><div class="dl">返回</div><div class="di">${ret}</div></div>
  2678. </div>
  2679. ${renderSteps(p.steps || [])}
  2680. </div>`;
  2681. })
  2682. .join("") || '<div class="empty">本版本无工序</div>'
  2683. );
  2684. }
  2685. function renderSteps(steps) {
  2686. if (!steps.length) return '<div class="empty">无步骤</div>';
  2687. let rows = "";
  2688. for (const s of steps) {
  2689. const ins = s.inputs && s.inputs.length ? s.inputs : [null];
  2690. const outs = s.outputs && s.outputs.length ? s.outputs : [null];
  2691. const n = Math.max(ins.length, outs.length);
  2692. for (let i = 0; i < n; i++) {
  2693. rows += "<tr>";
  2694. if (i === 0) {
  2695. rows += `<td rowspan="${n}" class="sid">${esc(s.id || "")}</td>
  2696. <td rowspan="${n}">${esc(s.directive || s.intent || "")}</td>
  2697. <td rowspan="${n}">${s.effect ? `<span class="pill navy">${esc(s.effect)}</span>` : ""}</td>
  2698. <td rowspan="${n}">${esc(fmtSF(s.substance))}</td>
  2699. <td rowspan="${n}">${esc(fmtSF(s.form))}</td>`;
  2700. }
  2701. rows += ioCell(ins[i], "in");
  2702. if (i === 0) {
  2703. rows += `<td rowspan="${n}">${s.via ? `<span class="pill teal">${esc(s.via)}</span>` : ""}</td>
  2704. <td rowspan="${n}" class="vtxt">${esc(s.action || "")}</td>`;
  2705. }
  2706. rows += ioCell(outs[i], "out");
  2707. rows += "</tr>";
  2708. }
  2709. }
  2710. return `<div style="overflow-x:auto"><table class="steps">
  2711. <colgroup>
  2712. <col style="width:44px"><col style="width:200px"><col style="width:92px">
  2713. <col style="width:112px"><col style="width:100px">
  2714. <col style="width:112px"><col style="width:330px"><col style="width:92px">
  2715. <col style="width:118px"><col style="width:130px">
  2716. <col style="width:112px"><col style="width:360px"><col style="width:110px">
  2717. </colgroup>
  2718. <thead>
  2719. <tr><th class="h-req" colspan="5">需 求</th><th class="h-in" colspan="3">输 入</th><th class="h-im" colspan="2">实 现</th><th class="h-out" colspan="3">输 出</th></tr>
  2720. <tr>
  2721. <th class="h-req2">#</th><th class="h-req2">目的</th><th class="h-req2">作用</th><th class="h-req2">实质</th><th class="h-req2">形式</th>
  2722. <th class="h-in2">类型</th><th class="h-in2">值</th><th class="h-in2">来源</th>
  2723. <th class="h-im2">外部工具</th><th class="h-im2">动作</th>
  2724. <th class="h-out2">类型</th><th class="h-out2">值</th><th class="h-out2">去处</th>
  2725. </tr>
  2726. </thead><tbody>${rows}</tbody></table></div>`;
  2727. }
  2728. function fmtSF(v) {
  2729. return v == null ? "" : Array.isArray(v) ? v.join("、") : v;
  2730. }
  2731. function ioCell(x, kind) {
  2732. const cls = kind === "in" ? "c-in" : "c-out";
  2733. if (!x) return `<td class="${cls}"></td><td class="${cls}"></td><td class="${cls}"></td>`;
  2734. const inf = x.inferred ? ` inf" title="推断理由:${esc(x.inferred_reason || "模型推断补全")}` : "";
  2735. const badge = x.inferred ? '<span class="ib">推</span>' : "";
  2736. return `<td class="${cls}"><span class="pill ${kind === "in" ? "amber" : "teal"}">${esc(x.type || "")}</span></td>
  2737. <td class="${cls}${inf}">${badge}<span class="vtxt">${esc(x.value || "")}</span></td>
  2738. <td class="${cls}"><span class="anchor">${esc(x.anchor || "")}</span></td>`;
  2739. }
  2740. /* ── 工具渲染(表格,移植自 fixed_query_eval renderToolTable)── */
  2741. const DASH = '<span class="dash">—</span>';
  2742. function _toolCell(v) {
  2743. if (v === null || v === undefined || v === "" || (Array.isArray(v) && !v.length)) return DASH;
  2744. if (Array.isArray(v)) return "<ul>" + v.map((x) => `<li>${esc(String(x))}</li>`).join("") + "</ul>";
  2745. return esc(String(v));
  2746. }
  2747. function _scopeCell(v) {
  2748. /* 作用域是 JSON 数组:按「、」拼接成短语,不出列表 */
  2749. if (v === null || v === undefined || (Array.isArray(v) && !v.length) || v === "") return DASH;
  2750. return esc(Array.isArray(v) ? v.join("、") : String(v));
  2751. }
  2752. function _ttCell(inner, clampable) {
  2753. return clampable ? `<div class="tcell" onclick="this.classList.toggle('open')">${inner}</div>` : inner;
  2754. }
  2755. function _toolCellContent(c, t) {
  2756. let inner,
  2757. cls = "",
  2758. clampable = true,
  2759. style = "";
  2760. if (c === "工具名称") {
  2761. cls = "col-tool";
  2762. clampable = false;
  2763. inner = `🔧 ${esc(t[c] || "(未命名)")}`;
  2764. } else if (c === "来源链接") {
  2765. clampable = false;
  2766. inner = t[c]
  2767. ? `<a href="${esc(t[c])}" target="_blank" style="color:#176d64;font-weight:600;">🔗 打开</a>`
  2768. : DASH;
  2769. } else if (c === "创作层级") {
  2770. clampable = false;
  2771. inner = t[c]
  2772. ? `<span class="layer-badge ${t[c] === "制作层" ? "make" : "create"}">${esc(t[c])}</span>`
  2773. : DASH;
  2774. } else if (c === "实质作用域" || c === "形式作用域") {
  2775. inner = _scopeCell(t[c]);
  2776. } else {
  2777. inner = _toolCell(t[c]);
  2778. }
  2779. if (["输入", "输出", "用法", "缺点"].includes(c)) style = "max-width:240px;";
  2780. else if (c === "实质作用域" || c === "形式作用域") style = "max-width:170px;";
  2781. else if (!clampable) style = "white-space:nowrap;";
  2782. return { inner, cls, clampable, style };
  2783. }
  2784. function _td(c, t, rowspan) {
  2785. const { inner, cls, clampable, style } = _toolCellContent(c, t);
  2786. const rs = rowspan > 1 ? ` rowspan="${rowspan}"` : "";
  2787. return `<td class="${cls}" style="${style}"${rs}>${_ttCell(inner, clampable)}</td>`;
  2788. }
  2789. function _caseTd(cse, key) {
  2790. const v = cse && cse[key] != null && cse[key] !== "" ? esc(String(cse[key])) : DASH;
  2791. return `<td class="col-case" style="max-width:210px;">${_ttCell(v, true)}</td>`;
  2792. }
  2793. function renderTools(data) {
  2794. const tools = data.tools || [];
  2795. if (!tools.length) return '<div class="empty">本版本无工具</div>';
  2796. /* 案例 group(输入/输出/效果)放在 用法 后、缺点 前;用 colspan/rowspan 做两层表头 */
  2797. const before = ["工具名称", "创作层级", "实质作用域", "形式作用域", "输入", "输出", "用法"];
  2798. const after = ["缺点", "来源链接", "最新更新时间"];
  2799. const thead = `<thead>
  2800. <tr>
  2801. ${before.map((c) => `<th rowspan="2">${c}</th>`).join("")}
  2802. <th colspan="3" class="th-group">案例</th>
  2803. ${after.map((c) => `<th rowspan="2">${c}</th>`).join("")}
  2804. </tr>
  2805. <tr>${["输入", "输出", "效果"].map((c) => `<th class="th-sub">${c}</th>`).join("")}</tr>
  2806. </thead>`;
  2807. const rows = tools
  2808. .map((t, ti) => {
  2809. const cases = Array.isArray(t["案例"]) && t["案例"].length ? t["案例"] : [null];
  2810. const K = cases.length;
  2811. const par = ti % 2 ? "tr-b" : "tr-a";
  2812. return cases
  2813. .map((cse, i) => {
  2814. const caseTds = `${_caseTd(cse, "输入")}${_caseTd(cse, "输出")}${_caseTd(cse, "效果")}`;
  2815. if (i === 0) {
  2816. return `<tr class="${par}">${before.map((c) => _td(c, t, K)).join("")}${caseTds}${after.map((c) => _td(c, t, K)).join("")}</tr>`;
  2817. }
  2818. return `<tr class="${par}">${caseTds}</tr>`;
  2819. })
  2820. .join("");
  2821. })
  2822. .join("");
  2823. return `<div class="mw-ttwrap"><table class="mw-tt">${thead}<tbody>${rows}</tbody></table></div>`;
  2824. }
  2825. /* 渲染后标记真正溢出的单元格(才显示蒙版+可点击) */
  2826. function markClampedCells() {
  2827. document.querySelectorAll("#xp-body .mw-tt .tcell").forEach((el) => {
  2828. if (!el.classList.contains("open") && el.scrollHeight > el.clientHeight + 2) el.classList.add("clamped");
  2829. else if (el.scrollHeight <= el.clientHeight + 2) el.classList.remove("clamped");
  2830. });
  2831. }
  2832. /* ════ 解构任务 ════ */
  2833. async function startExtract(caseIds) {
  2834. if (!state.queryId || !caseIds.length) return;
  2835. const isProc = state.mode === "process";
  2836. const model = $("#model-sel")?.value || (isProc ? MODELS_PROC[0] : MODELS_TOOL[0]);
  2837. try {
  2838. const r = await api(`/api/extract_${isProc ? "process" : "tools"}`, {
  2839. method: "POST",
  2840. body: JSON.stringify({ query_id: state.queryId, case_ids: caseIds, model }),
  2841. });
  2842. showTask(`${isProc ? "工序" : "工具"}解构 · ${caseIds.length} 帖`, r.task_id, async () => {
  2843. state.selected.clear();
  2844. await selectQuery(state.queryId);
  2845. if (caseIds.includes(state.caseId)) {
  2846. /* selectQuery 清了 caseId,恢复选中 */
  2847. }
  2848. if (caseIds.length === 1) {
  2849. state.caseId = caseIds[0];
  2850. state.version = null;
  2851. renderPosts();
  2852. await loadExtract();
  2853. }
  2854. });
  2855. } catch (e) {
  2856. alert("任务启动失败:" + (e.body?.error || e.status));
  2857. }
  2858. }
  2859. /* ════ 任务面板(✕ 只隐藏;「操作日志」按钮可随时唤回)════ */
  2860. let pollTimer = null,
  2861. hasTask = false;
  2862. function showTask(title, taskId, onDone) {
  2863. hasTask = true;
  2864. $("#task-panel").hidden = false;
  2865. $("#task-title").textContent = title;
  2866. $("#task-dot").className = "dot";
  2867. $("#task-log").textContent = "启动中…";
  2868. clearTimeout(pollTimer);
  2869. const poll = async () => {
  2870. let t;
  2871. try {
  2872. t = await api("/api/task_status?task_id=" + encodeURIComponent(taskId));
  2873. } catch (e) {
  2874. $("#task-log").textContent = "状态查询失败";
  2875. return;
  2876. }
  2877. const log = $("#task-log");
  2878. log.textContent = t.log_tail || "(暂无日志)";
  2879. log.scrollTop = log.scrollHeight;
  2880. if (t.status === "running") {
  2881. pollTimer = setTimeout(poll, 2000);
  2882. return;
  2883. }
  2884. $("#task-dot").className = "dot " + t.status;
  2885. $("#task-title").textContent = title + (t.status === "done" ? " · 完成" : " · 失败");
  2886. if (t.status === "done" && onDone) onDone();
  2887. };
  2888. poll();
  2889. }
  2890. /* ✕ 只隐藏面板,轮询照跑(任务完成后回调依然触发) */
  2891. function hideTask() {
  2892. $("#task-panel").hidden = true;
  2893. }
  2894. function showTaskPanel() {
  2895. if (!hasTask) return alert("本次会话还没有任务日志");
  2896. $("#task-panel").hidden = false;
  2897. const log = $("#task-log");
  2898. log.scrollTop = log.scrollHeight;
  2899. }
  2900. /* ════ 新建搜索 ════ */
  2901. /* 渠道下拉多选(选项同 search_eval:小红书/知乎/公众号/抖音/视频号/YouTube) */
  2902. const CHANNELS = [
  2903. { key: "xhs", name: "小红书", on: true },
  2904. { key: "zhihu", name: "知乎", on: true },
  2905. { key: "gzh", name: "公众号" },
  2906. { key: "douyin", name: "抖音" },
  2907. { key: "sph", name: "视频号" },
  2908. { key: "youtube", name: "YouTube" },
  2909. ];
  2910. $("#s-plat-panel").innerHTML = CHANNELS.map(
  2911. (c) => `
  2912. <label class="dd-opt ${c.on ? "sel" : ""}">
  2913. <input type="checkbox" value="${c.key}" ${c.on ? "checked" : ""}>${c.name}
  2914. </label>`,
  2915. ).join("");
  2916. function selectedPlatforms() {
  2917. return [...document.querySelectorAll("#s-plat-panel input:checked")].map((x) => x.value);
  2918. }
  2919. function syncPlatBtn() {
  2920. const names = [...document.querySelectorAll("#s-plat-panel input:checked")].map(
  2921. (x) => CHANNELS.find((c) => c.key === x.value).name,
  2922. );
  2923. $("#s-plat-btn").innerHTML =
  2924. `<span>${names.length ? esc(names.join("、")) : "选择渠道"}</span><span class="dd-arrow">▾</span>`;
  2925. }
  2926. $("#s-plat-btn").onclick = (e) => {
  2927. e.stopPropagation();
  2928. $("#s-plat-panel").hidden = !$("#s-plat-panel").hidden;
  2929. };
  2930. $("#s-plat-panel").onclick = (e) => e.stopPropagation();
  2931. $("#s-plat-panel").addEventListener("change", (e) => {
  2932. e.target.closest(".dd-opt").classList.toggle("sel", e.target.checked);
  2933. syncPlatBtn();
  2934. });
  2935. document.addEventListener("click", () => {
  2936. $("#s-plat-panel").hidden = true;
  2937. });
  2938. syncPlatBtn();
  2939. $("#btn-new-search").onclick = () => {
  2940. $("#s-mode").value = state.mode === "process" ? "工序" : "工具"; // 默认跟随当前子模式
  2941. $("#search-modal").hidden = false;
  2942. $("#s-query").focus();
  2943. };
  2944. $("#search-modal").onclick = (e) => {
  2945. if (e.target === $("#search-modal")) $("#search-modal").hidden = true;
  2946. };
  2947. $("#s-go").onclick = async () => {
  2948. const query = $("#s-query").value.trim();
  2949. if (!query) return alert("请填写 query");
  2950. const plats = selectedPlatforms();
  2951. if (!plats.length) return alert("请至少选择一个检索渠道");
  2952. const body = {
  2953. query,
  2954. synonyms: $("#s-syn").value.trim(),
  2955. mode_type: $("#s-mode").value,
  2956. platforms: plats.join(","),
  2957. max_count: parseInt($("#s-max").value) || 10,
  2958. };
  2959. try {
  2960. const r = await api("/api/run_search", { method: "POST", body: JSON.stringify(body) });
  2961. $("#search-modal").hidden = true;
  2962. showTask(`搜索 · ${r.query_id} ${query}`, r.task_id, async () => {
  2963. /* 搜索结果落在 s-mode 对应的表,完成后切到对应子模式再选中 */
  2964. const m = body.mode_type === "工具" ? "tools" : "process";
  2965. if (state.mode !== m) {
  2966. state.mode = m;
  2967. $("#m-process").classList.toggle("on", m === "process");
  2968. $("#m-tools").classList.toggle("on", m === "tools");
  2969. }
  2970. await loadQueries();
  2971. selectQuery(r.query_id);
  2972. });
  2973. } catch (e) {
  2974. alert("搜索启动失败:" + (e.body?.error || e.status));
  2975. }
  2976. };
  2977. /* ════ 工序/工具子模式 ════ */
  2978. $("#m-process").onclick = () => setMode("process");
  2979. $("#m-tools").onclick = () => setMode("tools");
  2980. function setMode(m) {
  2981. if (state.mode === m) return;
  2982. state.mode = m;
  2983. state.version = null;
  2984. /* 工序/工具是两张独立搜索表,切换时整体重置三栏 */
  2985. state.queryId = null;
  2986. state.caseId = null;
  2987. state.post = null;
  2988. state.posts = [];
  2989. state.selected.clear();
  2990. state.platFilter = "all";
  2991. $("#m-process").classList.toggle("on", m === "process");
  2992. $("#m-tools").classList.toggle("on", m === "tools");
  2993. $("#plat-tabs").hidden = true;
  2994. $("#p-count").textContent = "";
  2995. $("#post-list").innerHTML = '<div class="empty"><span class="glyph">←</span>先选择左侧 query</div>';
  2996. renderExtractEmpty();
  2997. loadQueries();
  2998. }
  2999. window.addEventListener("resize", () => chartRefs.forEach((c) => c.resize()));
  3000. route();
  3001. </script>
  3002. </body>
  3003. </html>