index.html 119 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115
  1. <!doctype html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title>搜索评估 · 案例总览</title>
  7. <style>
  8. :root {
  9. --ink: #24211d;
  10. --muted: #6f6961;
  11. --line: #ded8ce;
  12. --paper: #fbfaf7;
  13. --panel: #ffffff;
  14. --mint: #1f8a70;
  15. --rose: #b24b63;
  16. --amber: #b87918;
  17. --cyan: #2a6f8f;
  18. --soft-mint: #e9f5f0;
  19. --soft-rose: #f8e9ee;
  20. --soft-amber: #fff2d9;
  21. --soft-cyan: #e7f2f7;
  22. --shadow: 0 18px 45px rgba(41, 35, 28, .08);
  23. }
  24. * {
  25. box-sizing: border-box;
  26. }
  27. body {
  28. margin: 0;
  29. color: var(--ink);
  30. background: var(--paper);
  31. font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  32. line-height: 1.55;
  33. }
  34. header {
  35. padding: 40px 32px 22px;
  36. border-bottom: 1px solid var(--line);
  37. background: linear-gradient(180deg, #fff 0%, #fbfaf7 100%);
  38. }
  39. .wrap {
  40. max-width: 1220px;
  41. margin: 0 auto;
  42. }
  43. .eyebrow {
  44. display: flex;
  45. gap: 8px;
  46. align-items: center;
  47. color: var(--mint);
  48. font-size: 13px;
  49. font-weight: 700;
  50. text-transform: uppercase;
  51. letter-spacing: 0;
  52. }
  53. h1 {
  54. margin: 10px 0 10px;
  55. font-size: clamp(32px, 5vw, 58px);
  56. line-height: 1.06;
  57. letter-spacing: 0;
  58. }
  59. .lede {
  60. max-width: 860px;
  61. margin: 0;
  62. color: var(--muted);
  63. font-size: 17px;
  64. }
  65. .stats {
  66. display: grid;
  67. grid-template-columns: repeat(4, minmax(0, 1fr));
  68. gap: 12px;
  69. margin-top: 24px;
  70. }
  71. .stat {
  72. background: var(--panel);
  73. border: 1px solid var(--line);
  74. border-radius: 8px;
  75. padding: 14px;
  76. box-shadow: var(--shadow);
  77. min-height: 86px;
  78. }
  79. .stat strong {
  80. display: block;
  81. font-size: 26px;
  82. line-height: 1.1;
  83. }
  84. .stat span {
  85. color: var(--muted);
  86. font-size: 13px;
  87. }
  88. main {
  89. padding: 24px 32px 48px;
  90. }
  91. .toolbar {
  92. display: flex;
  93. gap: 10px;
  94. align-items: center;
  95. justify-content: space-between;
  96. margin-bottom: 18px;
  97. flex-wrap: wrap;
  98. }
  99. .filters {
  100. display: flex;
  101. gap: 8px;
  102. flex-wrap: wrap;
  103. }
  104. button,
  105. select {
  106. border: 1px solid var(--line);
  107. background: #fff;
  108. color: var(--ink);
  109. border-radius: 8px;
  110. padding: 9px 12px;
  111. font: inherit;
  112. }
  113. button {
  114. cursor: pointer;
  115. }
  116. button.active {
  117. color: #fff;
  118. background: var(--ink);
  119. border-color: var(--ink);
  120. }
  121. select {
  122. min-width: 190px;
  123. }
  124. .grid {
  125. display: grid;
  126. grid-template-columns: repeat(3, minmax(0, 1fr));
  127. gap: 16px;
  128. }
  129. .result {
  130. min-height: 500px;
  131. background: var(--panel);
  132. border: 1px solid var(--line);
  133. border-radius: 8px;
  134. overflow: hidden;
  135. box-shadow: var(--shadow);
  136. display: flex;
  137. flex-direction: column;
  138. position: relative;
  139. transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.25s ease;
  140. }
  141. .result:hover {
  142. transform: translateY(-2px);
  143. box-shadow: 0 22px 50px rgba(41, 35, 28, .12);
  144. }
  145. .result.discard {
  146. border-color: rgba(178, 75, 99, 0.15);
  147. }
  148. .discard-overlay {
  149. position: absolute;
  150. top: 0;
  151. left: 0;
  152. right: 0;
  153. bottom: 0;
  154. background: rgba(251, 250, 247, 0.85);
  155. backdrop-filter: blur(5px);
  156. -webkit-backdrop-filter: blur(5px);
  157. display: flex;
  158. flex-direction: column;
  159. align-items: center;
  160. justify-content: center;
  161. padding: 20px;
  162. text-align: center;
  163. z-index: 5;
  164. opacity: 1;
  165. transition: opacity 0.25s ease;
  166. pointer-events: none;
  167. }
  168. .result.discard:hover .discard-overlay {
  169. opacity: 0;
  170. }
  171. .discard-badge {
  172. background: var(--soft-rose);
  173. color: var(--rose);
  174. border: 1px solid rgba(178, 75, 99, 0.25);
  175. padding: 6px 16px;
  176. border-radius: 999px;
  177. font-size: 13px;
  178. font-weight: 700;
  179. text-transform: uppercase;
  180. letter-spacing: 1px;
  181. margin-bottom: 12px;
  182. box-shadow: 0 2px 8px rgba(178, 75, 99, 0.1);
  183. }
  184. .discard-reason {
  185. color: var(--muted);
  186. font-size: 13px;
  187. line-height: 1.6;
  188. max-width: 90%;
  189. margin: 0 auto;
  190. display: -webkit-box;
  191. -webkit-line-clamp: 6;
  192. -webkit-box-orient: vertical;
  193. overflow: hidden;
  194. font-weight: 500;
  195. }
  196. .thumbs {
  197. display: grid;
  198. grid-template-columns: repeat(3, 1fr);
  199. gap: 2px;
  200. height: 150px;
  201. background: #eee7dc;
  202. overflow: hidden;
  203. }
  204. .thumbs img {
  205. width: 100%;
  206. height: 100%;
  207. object-fit: cover;
  208. display: block;
  209. background: #eee7dc;
  210. }
  211. .thumbs img:first-child:nth-last-child(1) {
  212. grid-column: 1 / -1;
  213. }
  214. .body {
  215. padding: 15px;
  216. flex: 1;
  217. display: flex;
  218. flex-direction: column;
  219. }
  220. .meta {
  221. display: flex;
  222. justify-content: space-between;
  223. gap: 10px;
  224. color: var(--muted);
  225. font-size: 12px;
  226. margin-bottom: 8px;
  227. }
  228. .platform {
  229. color: #fff;
  230. border-radius: 999px;
  231. padding: 2px 8px;
  232. font-weight: 700;
  233. white-space: nowrap;
  234. }
  235. .p-xhs {
  236. background: var(--rose);
  237. }
  238. .p-gzh {
  239. background: var(--mint);
  240. }
  241. .p-x {
  242. background: var(--cyan);
  243. }
  244. h2 {
  245. margin: 0 0 8px;
  246. font-size: 18px;
  247. line-height: 1.25;
  248. letter-spacing: 0;
  249. }
  250. .excerpt {
  251. color: var(--muted);
  252. font-size: 13px;
  253. display: -webkit-box;
  254. -webkit-line-clamp: 5;
  255. -webkit-box-orient: vertical;
  256. overflow: hidden;
  257. }
  258. .tags {
  259. display: flex;
  260. flex-wrap: wrap;
  261. gap: 6px;
  262. margin: 12px 0;
  263. }
  264. .tag {
  265. background: #f2eee7;
  266. border-radius: 999px;
  267. padding: 3px 8px;
  268. font-size: 12px;
  269. color: #514a42;
  270. }
  271. .scorebar {
  272. margin-top: auto;
  273. }
  274. .overall {
  275. display: flex;
  276. align-items: end;
  277. justify-content: space-between;
  278. border-top: 1px solid var(--line);
  279. padding-top: 12px;
  280. }
  281. .score {
  282. font-size: 36px;
  283. line-height: .9;
  284. font-weight: 800;
  285. }
  286. .decision {
  287. color: var(--mint);
  288. font-weight: 800;
  289. }
  290. .decision.discard {
  291. color: var(--amber);
  292. }
  293. .mini-bars {
  294. display: grid;
  295. grid-template-columns: repeat(5, 1fr);
  296. gap: 4px;
  297. margin-top: 10px;
  298. }
  299. .mini-bars span {
  300. height: 7px;
  301. border-radius: 999px;
  302. background: #eee;
  303. overflow: hidden;
  304. position: relative;
  305. }
  306. .mini-bars span .fill {
  307. display: block;
  308. height: 100%;
  309. background: var(--mint);
  310. border-radius: 999px;
  311. }
  312. .group-snapshot {
  313. display: grid;
  314. grid-template-columns: repeat(4, minmax(0, 1fr));
  315. gap: 5px;
  316. margin-top: 10px;
  317. }
  318. .mini-bars.new-schema {
  319. grid-template-columns: repeat(2, 1fr) !important;
  320. }
  321. .group-snapshot.new-schema {
  322. grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  323. }
  324. .group-pill {
  325. border: 1px solid var(--line);
  326. border-radius: 8px;
  327. padding: 5px 6px;
  328. background: #fff;
  329. min-width: 0;
  330. }
  331. .group-pill span {
  332. display: block;
  333. color: var(--muted);
  334. font-size: 11px;
  335. white-space: nowrap;
  336. overflow: hidden;
  337. text-overflow: ellipsis;
  338. }
  339. .group-pill strong {
  340. display: block;
  341. font-size: 14px;
  342. line-height: 1.1;
  343. }
  344. .actions {
  345. display: flex;
  346. gap: 8px;
  347. margin-top: 12px;
  348. }
  349. .actions a,
  350. .actions button {
  351. flex: 1;
  352. text-align: center;
  353. text-decoration: none;
  354. color: var(--ink);
  355. background: #fff;
  356. border: 1px solid var(--line);
  357. border-radius: 8px;
  358. padding: 8px 10px;
  359. font-size: 13px;
  360. }
  361. dialog {
  362. width: min(980px, calc(100vw - 28px));
  363. max-height: calc(100vh - 32px);
  364. border: 1px solid var(--line);
  365. border-radius: 8px;
  366. padding: 0;
  367. box-shadow: 0 28px 90px rgba(0, 0, 0, .25);
  368. }
  369. dialog::backdrop {
  370. background: rgba(38, 33, 27, .42);
  371. }
  372. .modal-head {
  373. position: sticky;
  374. top: 0;
  375. background: #fff;
  376. border-bottom: 1px solid var(--line);
  377. padding: 16px;
  378. z-index: 2;
  379. display: flex;
  380. justify-content: space-between;
  381. gap: 14px;
  382. align-items: start;
  383. }
  384. .modal-head h3 {
  385. margin: 0;
  386. font-size: 20px;
  387. line-height: 1.25;
  388. }
  389. .modal-content {
  390. display: grid;
  391. grid-template-columns: 1.1fr .9fr;
  392. gap: 18px;
  393. padding: 16px;
  394. }
  395. .modal-content > section,
  396. .modal-content > aside {
  397. min-width: 0;
  398. }
  399. .section-title {
  400. margin: 18px 0 8px;
  401. font-weight: 800;
  402. }
  403. .raw {
  404. white-space: pre-wrap;
  405. background: #faf7f1;
  406. border: 1px solid var(--line);
  407. border-radius: 8px;
  408. padding: 12px;
  409. max-height: 330px;
  410. overflow: auto;
  411. color: #3d3831;
  412. font-size: 13px;
  413. }
  414. .images {
  415. display: grid;
  416. grid-template-columns: repeat(2, minmax(0, 1fr));
  417. gap: 8px;
  418. }
  419. .images img {
  420. width: 100%;
  421. max-height: 260px;
  422. object-fit: contain;
  423. border: 1px solid var(--line);
  424. border-radius: 8px;
  425. background: #f1ece4;
  426. }
  427. .scores {
  428. display: grid;
  429. gap: 12px;
  430. }
  431. .score-group {
  432. border: 1px solid var(--line);
  433. border-radius: 8px;
  434. background: #fff;
  435. overflow: hidden;
  436. }
  437. .score-group-head {
  438. display: flex;
  439. justify-content: space-between;
  440. gap: 10px;
  441. align-items: center;
  442. padding: 10px 11px;
  443. background: #faf7f1;
  444. border-bottom: 1px solid var(--line);
  445. font-size: 13px;
  446. font-weight: 800;
  447. }
  448. .score-group-head small {
  449. color: var(--muted);
  450. font-weight: 700;
  451. white-space: nowrap;
  452. }
  453. .score-group-body {
  454. display: grid;
  455. gap: 8px;
  456. padding: 10px;
  457. }
  458. .score-row {
  459. display: grid;
  460. grid-template-columns: 128px 1fr 34px;
  461. gap: 10px;
  462. align-items: center;
  463. font-size: 13px;
  464. }
  465. .score-row.missing {
  466. color: #a39b91;
  467. }
  468. .score-row.missing .meter span {
  469. display: none;
  470. }
  471. .meter {
  472. height: 9px;
  473. border-radius: 999px;
  474. background: #eee7dc;
  475. overflow: hidden;
  476. }
  477. .meter span {
  478. display: block;
  479. height: 100%;
  480. width: calc(var(--v) * 20%);
  481. background: var(--rose);
  482. }
  483. .rubric-note {
  484. background: var(--soft-cyan);
  485. border-left: 4px solid var(--cyan);
  486. padding: 10px 12px;
  487. color: #254c5d;
  488. border-radius: 4px;
  489. font-size: 13px;
  490. }
  491. @media (max-width: 980px) {
  492. .grid {
  493. grid-template-columns: repeat(2, minmax(0, 1fr));
  494. }
  495. .stats {
  496. grid-template-columns: repeat(2, minmax(0, 1fr));
  497. }
  498. .modal-content {
  499. grid-template-columns: 1fr;
  500. }
  501. }
  502. @media (max-width: 640px) {
  503. header,
  504. main {
  505. padding-left: 16px;
  506. padding-right: 16px;
  507. }
  508. .grid,
  509. .stats {
  510. grid-template-columns: 1fr;
  511. }
  512. .toolbar {
  513. align-items: stretch;
  514. }
  515. select {
  516. width: 100%;
  517. }
  518. .result {
  519. min-height: auto;
  520. }
  521. .group-snapshot {
  522. grid-template-columns: repeat(2, minmax(0, 1fr));
  523. }
  524. }
  525. /* Extra styles for interactive navigation & matrix */
  526. .stats {
  527. display: grid;
  528. grid-template-columns: repeat(5, 1fr);
  529. gap: 12px;
  530. }
  531. .stats .stat {
  532. min-width: 0;
  533. }
  534. .p-zhihu {
  535. background: #2a6f8f;
  536. }
  537. .p-x {
  538. background: #2a6f8f;
  539. }
  540. .p-bili {
  541. background: #b24b63;
  542. }
  543. .p-douyin {
  544. background: #24211d;
  545. }
  546. .p-sph {
  547. background: #07c160;
  548. }
  549. .p-youtube {
  550. background: #c4302b;
  551. }
  552. .p-github {
  553. background: #24292e;
  554. }
  555. .p-toutiao {
  556. background: #f04142;
  557. }
  558. .p-weibo {
  559. background: #e6162d;
  560. }
  561. .nav {
  562. display: flex;
  563. flex-direction: column;
  564. gap: 8px;
  565. margin-bottom: 14px;
  566. }
  567. .navrow {
  568. display: flex;
  569. gap: 8px;
  570. align-items: center;
  571. flex-wrap: wrap;
  572. }
  573. .navlab {
  574. width: 54px;
  575. flex: 0 0 54px;
  576. color: var(--muted);
  577. font-size: 12px;
  578. font-weight: 700;
  579. text-transform: uppercase;
  580. }
  581. .navrow .tab {
  582. border: 1px solid var(--line);
  583. background: #fff;
  584. color: var(--ink);
  585. border-radius: 999px;
  586. padding: 6px 14px;
  587. font-size: 13px;
  588. cursor: pointer;
  589. }
  590. .navrow .tab.on {
  591. background: var(--ink);
  592. color: #fff;
  593. border-color: var(--ink);
  594. }
  595. .navrow .tab .q {
  596. font-family: ui-monospace, Menlo, monospace;
  597. }
  598. .navrow .tab small {
  599. color: var(--muted);
  600. margin-left: 4px;
  601. }
  602. .navrow .tab.on small {
  603. color: #cfd8dc;
  604. }
  605. #navQ .qtab {
  606. max-width: 100%;
  607. white-space: normal;
  608. text-align: left;
  609. line-height: 1.4;
  610. }
  611. .navrow .tab {
  612. white-space: normal;
  613. }
  614. #refresh {
  615. cursor: pointer;
  616. }
  617. /* 1:1 Morandi Matrix Replicated Style Rules */
  618. .btn {
  619. padding: 3px 10px;
  620. border-radius: 14px;
  621. border: 1px solid #d1d5db;
  622. background: #fff;
  623. cursor: pointer;
  624. font-size: .74rem;
  625. color: #444;
  626. }
  627. .g-form .btn.on {
  628. background: #4f46e5;
  629. border-color: #4f46e5;
  630. color: #fff;
  631. }
  632. .g-lens .btn.on {
  633. background: #be185d;
  634. border-color: #be185d;
  635. color: #fff;
  636. }
  637. .g-mod .btn.on {
  638. background: #2e7d32;
  639. border-color: #2e7d32;
  640. color: #fff;
  641. }
  642. .g-tool .btn.on {
  643. background: #c2410c;
  644. border-color: #c2410c;
  645. color: #fff;
  646. }
  647. .g-tier .btn.on {
  648. background: #374151;
  649. border-color: #374151;
  650. color: #fff;
  651. }
  652. .g-mxview .btn.on {
  653. background: var(--mint);
  654. border-color: var(--mint);
  655. color: #fff;
  656. }
  657. .mxwrap {
  658. max-height: 55vh;
  659. overflow: auto;
  660. border: 1px solid var(--line);
  661. border-radius: 0 0 8px 8px;
  662. margin-bottom: 12px;
  663. background: #fff;
  664. position: relative;
  665. }
  666. table#comboMx {
  667. border-collapse: separate;
  668. border-spacing: 0;
  669. background: #fff;
  670. font-size: .65rem;
  671. width: 100%;
  672. }
  673. table#comboMx th,
  674. table#comboMx td {
  675. border-right: 1px solid #f0f1f5;
  676. border-bottom: 1px solid #f0f1f5;
  677. text-align: center;
  678. }
  679. table#comboMx thead th {
  680. position: sticky;
  681. background: #fff;
  682. }
  683. table#comboMx thead tr.l1 th {
  684. top: 0;
  685. z-index: 11;
  686. background: #eef2ff;
  687. color: #4338ca;
  688. font-weight: 700;
  689. font-size: .72rem;
  690. height: 20px;
  691. border-bottom: 1px solid #c7d2fe;
  692. }
  693. table#comboMx thead tr.l2 th {
  694. top: 20px;
  695. z-index: 11;
  696. background: #f5f7ff;
  697. color: #6366f1;
  698. font-weight: 600;
  699. font-size: .66rem;
  700. height: 18px;
  701. border-bottom: 1px solid #e0e7ff;
  702. }
  703. table#comboMx thead tr.leaf th {
  704. top: 38px;
  705. z-index: 9;
  706. background: #fff;
  707. color: #1f2937;
  708. font-size: .66rem;
  709. min-width: 120px;
  710. max-width: 120px;
  711. height: 24px;
  712. padding: 3px;
  713. }
  714. table#comboMx thead .corner {
  715. left: 0;
  716. top: 0;
  717. z-index: 13;
  718. background: #fff;
  719. min-width: 96px;
  720. }
  721. .l1div {
  722. border-left: 3px solid #818cf8 !important;
  723. }
  724. .l2div {
  725. border-left: 1.5px solid #cbd5e8 !important;
  726. }
  727. table#comboMx tbody th.rh {
  728. position: sticky;
  729. left: 0;
  730. z-index: 8;
  731. background: #fffaf0;
  732. color: #92580c;
  733. text-align: left;
  734. padding: 4px 8px;
  735. font-weight: 600;
  736. white-space: nowrap;
  737. min-width: 96px;
  738. border-right: 1px solid #e6e8ef;
  739. }
  740. table#comboMx tbody tr.l1row td {
  741. background: #eef2ff;
  742. color: #4338ca;
  743. font-weight: 700;
  744. font-size: .7rem;
  745. text-align: left;
  746. padding: 3px 8px;
  747. position: sticky;
  748. left: 0;
  749. }
  750. td.cell {
  751. min-width: 120px;
  752. max-width: 120px;
  753. height: 30px;
  754. padding: 2px 5px;
  755. cursor: pointer;
  756. font-family: ui-monospace, Menlo, monospace;
  757. font-size: .65rem;
  758. color: #1f2937;
  759. text-align: left;
  760. line-height: 1.25;
  761. border-left: 4px solid transparent;
  762. overflow: hidden;
  763. position: relative;
  764. }
  765. td.cell:hover {
  766. box-shadow: inset 0 0 0 2px #f59e0b;
  767. }
  768. td.cell.t0 {
  769. border-left-color: #e5e7eb;
  770. background: #fbfbfc;
  771. color: #aeb3bd;
  772. }
  773. td.cell.t1 {
  774. border-left-color: #bbf7d0;
  775. }
  776. td.cell.t2 {
  777. border-left-color: #4ade80;
  778. background: #f3fdf6;
  779. }
  780. td.cell.t3 {
  781. border-left-color: #15803d;
  782. background: #ecfdf3;
  783. }
  784. td.cell.tNA {
  785. border-left-color: #fcd34d;
  786. background: repeating-linear-gradient(45deg, #fff, #fff 4px, #fef9ec 4px, #fef9ec 8px);
  787. color: #b6bac4;
  788. }
  789. td.cell.gq-cell {
  790. color: #15803d;
  791. font-weight: 600;
  792. }
  793. td.cell.rowdim {
  794. opacity: .26;
  795. }
  796. td.cell.hide {
  797. visibility: hidden;
  798. }
  799. td.cell.sel {
  800. outline: 2px solid var(--ink);
  801. outline-offset: -2px;
  802. font-weight: bold;
  803. }
  804. td.cell.rowsel,
  805. td.cell.colsel {
  806. box-shadow: inset 0 0 0 999px rgba(255, 193, 7, .12);
  807. }
  808. td.cell.rowsel.colsel {
  809. box-shadow: inset 0 0 0 999px rgba(255, 193, 7, .22);
  810. }
  811. th.rh.rowsel {
  812. background: rgba(255, 193, 7, .22);
  813. color: var(--ink);
  814. font-weight: 700;
  815. }
  816. thead th.colsel {
  817. background: rgba(255, 193, 7, .22);
  818. color: var(--ink);
  819. font-weight: 700;
  820. }
  821. /* Database hit badge inside matrix cells */
  822. td.cell .hit-badge {
  823. position: absolute;
  824. right: 2px;
  825. top: 2px;
  826. background: #10b981;
  827. color: #fff;
  828. font-size: 9px;
  829. font-weight: bold;
  830. border-radius: 3px;
  831. padding: 0 3px;
  832. line-height: 1.2;
  833. box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  834. }
  835. /* Pop-up floating panel styling */
  836. .pop {
  837. position: fixed;
  838. background: #fff;
  839. border: 1px solid #d1d5db;
  840. border-radius: 9px;
  841. box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
  842. padding: 13px 15px;
  843. max-width: 450px;
  844. z-index: 200;
  845. display: none;
  846. font-size: .82rem;
  847. line-height: 1.5;
  848. }
  849. .pop .pt {
  850. font-weight: 700;
  851. color: #1f2937;
  852. margin-bottom: 7px;
  853. display: flex;
  854. gap: 6px;
  855. align-items: center;
  856. flex-wrap: wrap;
  857. padding-right: 18px;
  858. }
  859. .pop .path {
  860. font-size: .66rem;
  861. padding: 1px 6px;
  862. border-radius: 3px;
  863. }
  864. .pop .path.a {
  865. background: #eef2ff;
  866. color: #4338ca;
  867. }
  868. .pop .path.t {
  869. background: #fef3c7;
  870. color: #92400e;
  871. }
  872. .pop .tier {
  873. font-size: .64rem;
  874. padding: 1px 7px;
  875. border-radius: 3px;
  876. font-weight: 600;
  877. }
  878. .tb0 {
  879. background: #e5e7eb;
  880. color: #6b7280;
  881. }
  882. .tb1 {
  883. background: #dcfce7;
  884. color: #166534;
  885. }
  886. .tb2 {
  887. background: #bbf7d0;
  888. color: #14532d;
  889. }
  890. .tb3 {
  891. background: #15803d;
  892. color: #fff;
  893. }
  894. .tbNA {
  895. background: #fef3c7;
  896. color: #92400e;
  897. }
  898. .pop .reason {
  899. background: #fffbeb;
  900. border-left: 3px solid #f59e0b;
  901. padding: 7px 11px;
  902. border-radius: 3px;
  903. color: #78350f;
  904. margin: 7px 0;
  905. font-size: .8rem;
  906. }
  907. .pop .reason.inv {
  908. background: #fef2f2;
  909. border-left-color: #ef4444;
  910. color: #991b1b;
  911. }
  912. .pop .gq {
  913. background: #ecfdf3;
  914. border: 1px solid #a7f3d0;
  915. border-radius: 6px;
  916. padding: 7px 11px;
  917. margin: 7px 0;
  918. font-family: ui-monospace, Menlo, monospace;
  919. font-size: .84rem;
  920. color: #15803d;
  921. }
  922. .pop .gq .t {
  923. font-family: inherit;
  924. font-size: .64rem;
  925. color: #6b7280;
  926. display: block;
  927. margin-bottom: 2px;
  928. }
  929. .pop .small {
  930. font-size: .7rem;
  931. color: #9aa0ad;
  932. margin: 4px 0;
  933. }
  934. .pop .lbl {
  935. font-size: .66rem;
  936. color: #6b7280;
  937. font-weight: 600;
  938. margin: 9px 0 3px;
  939. }
  940. .pop ul {
  941. margin: 0;
  942. padding: 0;
  943. list-style: none;
  944. }
  945. .pop li {
  946. padding: 3px 8px;
  947. background: #f9fafb;
  948. border-radius: 4px;
  949. margin-bottom: 3px;
  950. font-family: ui-monospace, Menlo, monospace;
  951. font-size: .78rem;
  952. color: #1f2937;
  953. }
  954. .pop li.gen {
  955. background: #eef0ff;
  956. color: #3730a3;
  957. }
  958. .pop li.cur {
  959. box-shadow: inset 0 0 0 2px #818cf8;
  960. }
  961. .pop li .fm {
  962. font-size: .62rem;
  963. color: #4f46e5;
  964. margin-right: 6px;
  965. }
  966. .pop .note {
  967. font-size: .7rem;
  968. color: #2e7d32;
  969. margin-top: 6px;
  970. }
  971. .pop .close {
  972. position: absolute;
  973. top: 6px;
  974. right: 9px;
  975. cursor: pointer;
  976. color: #9ca3af;
  977. font-size: 1.15rem;
  978. }
  979. .fac {
  980. border: 1px solid var(--line);
  981. background: #fff;
  982. border-radius: 999px;
  983. padding: 4px 11px;
  984. font-size: 12px;
  985. cursor: pointer;
  986. color: var(--ink);
  987. }
  988. .fac.on {
  989. background: var(--mint);
  990. color: #fff;
  991. border-color: var(--mint);
  992. }
  993. .fac small {
  994. opacity: .65;
  995. margin-left: 3px;
  996. }
  997. #navQ .qtab .hit {
  998. display: inline-block;
  999. margin-left: 7px;
  1000. background: var(--soft-mint);
  1001. color: var(--mint);
  1002. border-radius: 999px;
  1003. padding: 0 8px;
  1004. font-size: 11px;
  1005. font-weight: 700;
  1006. }
  1007. #navQ .qtab.on .hit {
  1008. background: rgba(255, 255, 255, .22);
  1009. color: #fff;
  1010. }
  1011. .modal-tabs {
  1012. display: flex;
  1013. gap: 4px;
  1014. padding: 0 16px;
  1015. border-bottom: 1px solid var(--line);
  1016. background: #faf7f1;
  1017. }
  1018. .modal-tab {
  1019. background: transparent;
  1020. border: none;
  1021. border-bottom: 3px solid transparent;
  1022. border-radius: 0;
  1023. padding: 10px 16px;
  1024. font-size: 14px;
  1025. font-weight: 600;
  1026. color: var(--muted);
  1027. cursor: pointer;
  1028. transition: all 0.2s ease;
  1029. }
  1030. .modal-tab:hover {
  1031. color: var(--ink);
  1032. background: rgba(0, 0, 0, 0.02);
  1033. }
  1034. .modal-tab.active {
  1035. color: var(--mint);
  1036. border-bottom-color: var(--mint);
  1037. }
  1038. /* 新版评估分数卡片可视化样式 */
  1039. .sc-card {
  1040. background: #fff;
  1041. border: 1px solid var(--line);
  1042. border-radius: 12px;
  1043. padding: 16px 20px;
  1044. margin-bottom: 16px;
  1045. box-shadow: 0 4px 15px rgba(0,0,0,0.02);
  1046. }
  1047. .sc-card-head {
  1048. display: flex;
  1049. justify-content: space-between;
  1050. align-items: center;
  1051. margin-bottom: 14px;
  1052. border-bottom: 1px solid #f3f0ea;
  1053. padding-bottom: 10px;
  1054. }
  1055. .sc-card-head .title {
  1056. font-size: 16px;
  1057. font-weight: 700;
  1058. display: flex;
  1059. align-items: center;
  1060. gap: 8px;
  1061. }
  1062. .sc-card-head .badge {
  1063. background: #eef2ff;
  1064. color: #2563eb;
  1065. font-size: 11px;
  1066. padding: 2px 6px;
  1067. border-radius: 4px;
  1068. font-weight: 700;
  1069. }
  1070. .sc-card-head .avg-score {
  1071. font-size: 14px;
  1072. color: var(--muted);
  1073. font-weight: 600;
  1074. }
  1075. .sc-card-head .avg-score strong {
  1076. font-size: 26px;
  1077. color: #2563eb;
  1078. font-weight: 800;
  1079. margin-left: 6px;
  1080. }
  1081. .sc-sub-header {
  1082. font-size: 12px;
  1083. color: var(--muted);
  1084. font-weight: 700;
  1085. margin: 14px 0 8px;
  1086. border-bottom: 1px dashed #f0ebd8;
  1087. padding-bottom: 4px;
  1088. text-transform: uppercase;
  1089. letter-spacing: 0.5px;
  1090. }
  1091. .sc-row {
  1092. display: flex;
  1093. justify-content: space-between;
  1094. align-items: center;
  1095. padding: 6px 0;
  1096. font-size: 13.5px;
  1097. gap: 10px;
  1098. }
  1099. .sc-row .label {
  1100. color: var(--ink);
  1101. font-weight: 500;
  1102. flex: 1;
  1103. min-width: 100px;
  1104. word-break: break-all;
  1105. }
  1106. .sc-row .bar-wrap {
  1107. display: flex;
  1108. align-items: center;
  1109. gap: 10px;
  1110. width: 170px;
  1111. flex-shrink: 0;
  1112. }
  1113. .sc-row .bar {
  1114. height: 6px;
  1115. background: #eee7dc;
  1116. border-radius: 999px;
  1117. flex: 1;
  1118. overflow: hidden;
  1119. }
  1120. .sc-row .bar-fill {
  1121. height: 100%;
  1122. background: #2563eb;
  1123. border-radius: 999px;
  1124. width: calc(var(--v) * 10%);
  1125. }
  1126. .sc-row .value {
  1127. font-weight: 700;
  1128. font-size: 13.5px;
  1129. width: 20px;
  1130. text-align: right;
  1131. }
  1132. .sc-row .info-icon {
  1133. cursor: pointer;
  1134. color: #9ca3af;
  1135. transition: color 0.15s ease;
  1136. font-size: 13px;
  1137. user-select: none;
  1138. }
  1139. .sc-row .info-icon:hover {
  1140. color: #3b82f6;
  1141. }
  1142. #reevalBtn {
  1143. background: #faf7f1;
  1144. color: var(--amber);
  1145. border-color: rgba(184, 121, 24, 0.3);
  1146. height: 38px;
  1147. padding: 0 16px;
  1148. font-size: 13px;
  1149. font-weight: 600;
  1150. border-radius: 8px;
  1151. box-shadow: var(--shadow);
  1152. }
  1153. #reevalBtn:hover {
  1154. background: var(--soft-amber);
  1155. color: var(--amber);
  1156. border-color: var(--amber);
  1157. }
  1158. #editSpecBtn {
  1159. background: #f0f7f6;
  1160. color: var(--cyan);
  1161. border-color: rgba(42, 111, 143, 0.3);
  1162. height: 38px;
  1163. padding: 0 16px;
  1164. font-size: 13px;
  1165. font-weight: 600;
  1166. border-radius: 8px;
  1167. box-shadow: var(--shadow);
  1168. }
  1169. #editSpecBtn:hover {
  1170. background: var(--soft-cyan);
  1171. color: var(--cyan);
  1172. border-color: var(--cyan);
  1173. }
  1174. </style>
  1175. </head>
  1176. <body>
  1177. <header>
  1178. <div class="wrap">
  1179. <div class="eyebrow">Content Search · runs/ 实时 · query → 形式 → 渠道</div>
  1180. <h1>搜索评估 · 案例总览</h1>
  1181. <p class="lede" id="lede" style="margin:0">加载中…</p>
  1182. <div class="stats" id="stats"></div>
  1183. </div>
  1184. </header>
  1185. <main>
  1186. <div class="wrap">
  1187. <div class="nav">
  1188. <div class="navrow" style="margin-bottom:4px;">
  1189. <span class="navlab">组合矩阵</span>
  1190. <span style="color:var(--muted);font-size:12px;flex:1">行=类型 列=动作 格子色=评分,角标=帖子数/工序数。点击选组合且弹出详情。</span>
  1191. <span class="g-mxview" style="display:inline-flex;gap:4px;margin-right:12px;align-items:center;">
  1192. <button class="btn on" id="btnMxFull" onclick="setMatrixView('full')">完整矩阵</button>
  1193. <button class="btn" id="btnMxHits" onclick="setMatrixView('hits')">只看帖子命中</button>
  1194. <button class="btn" id="btnMxProcedures" onclick="setMatrixView('procedures')">只看工序</button>
  1195. </span>
  1196. <button id="refresh" onclick="loadData(true)">↻ 刷新 runs</button>
  1197. </div>
  1198. <div class="mx-header"
  1199. style="background:#fff; border: 1px solid var(--line); border-radius: 8px 8px 0 0; padding:12px 16px 8px; border-bottom: none;">
  1200. <h4
  1201. style="margin:0 0 4px; font-size:13px; color:#1f2937; display:flex; justify-content:space-between; align-items:center; font-weight:700;">
  1202. <span>动作 × 类型 · 组合矩阵 <span style="font-weight:400;font-size:11px;color:#9aa0ad">基于 <b
  1203. id="gm">gemini-3.1-flash-lite</b></span></span>
  1204. <span class="legend" style="display:flex;gap:9px;align-items:center;color:#6b7280;font-size:11px;">
  1205. <span><span class="sw"
  1206. style="display:inline-block;width:10px;height:10px;border-radius:2px;background:#15803d;vertical-align:middle;margin-right:3px;"></span>高
  1207. · <b id="s3" style="color:#15803d;">0</b></span>
  1208. <span><span class="sw"
  1209. style="display:inline-block;width:10px;height:10px;border-radius:2px;background:#4ade80;vertical-align:middle;margin-right:3px;"></span>中
  1210. · <b id="s2" style="color:#4ade80;">0</b></span>
  1211. <span><span class="sw"
  1212. style="display:inline-block;width:10px;height:10px;border-radius:2px;background:#bbf7d0;vertical-align:middle;margin-right:3px;"></span>低
  1213. · <b id="s1" style="color:#10b981;">0</b></span>
  1214. <span><span class="sw"
  1215. style="display:inline-block;width:10px;height:10px;border-radius:2px;background:#e5e7eb;vertical-align:middle;margin-right:3px;"></span>无效
  1216. · <b id="s0" style="color:#9ca3af;">0</b></span>
  1217. <span><span class="sw"
  1218. style="display:inline-block;width:10px;height:10px;border-radius:2px;background:#fcd34d;vertical-align:middle;margin-right:3px;"></span>未判
  1219. · <b id="sna" style="color:#b87918;">0</b></span>
  1220. </span>
  1221. </h4>
  1222. <div class="sub" style="font-size:11px;color:#6b7280;margin-bottom:8px;">
  1223. 共 1350 格 · 形式①原词不替换 · ②句子套模板 · ③同义池替换。
  1224. </div>
  1225. <div class="ctl"
  1226. style="display:flex;gap:6px;flex-wrap:wrap;align-items:center;font-size:11px;border-top:1px solid #f3f4f6;padding-top:8px;">
  1227. <span class="lab" style="color:#9aa0ad;font-weight:600;">query生成方式</span>
  1228. <span class="g-form">
  1229. <button class="btn on" data-k="form" data-v="A">①原词</button>
  1230. <button class="btn" data-k="form" data-v="B">②句子</button>
  1231. <button class="btn" data-k="form" data-v="C">③同义</button>
  1232. </span>
  1233. <span class="lab" style="color:#9aa0ad;font-weight:600;margin-left:8px;">知识类型</span>
  1234. <span class="g-lens">
  1235. <button class="btn on" data-k="lens" data-v="工序">工序</button>
  1236. <button class="btn" data-k="lens" data-v="工具">工具</button>
  1237. <button class="btn" data-k="lens" data-v="能力">能力</button>
  1238. </span>
  1239. <span class="lab" style="color:#9aa0ad;font-weight:600;margin-left:8px;">约束·工具类型</span>
  1240. <span class="g-tool">
  1241. <button class="btn on" data-k="tool" data-v="">无</button>
  1242. <span id="toolBtns"></span>
  1243. </span>
  1244. <span class="lab" style="color:#9aa0ad;font-weight:600;margin-left:8px;">搜索优先级</span>
  1245. <span class="g-tier">
  1246. <button class="btn on" data-k="tier" data-v="0">全部</button>
  1247. <button class="btn" data-k="tier" data-v="2">≥中</button>
  1248. <button class="btn" data-k="tier" data-v="3">仅高</button>
  1249. </span>
  1250. </div>
  1251. </div>
  1252. <div class="mxwrap"
  1253. style="max-height:55vh; overflow:auto; border:1px solid var(--line); border-radius: 0 0 8px 8px; margin-bottom:12px; background:#fff; position:relative;">
  1254. <table id="comboMx"></table>
  1255. </div>
  1256. <div class="pop" id="pop"></div>
  1257. <div class="navrow"><span class="navlab">渠道</span>
  1258. <div id="navC" style="display:flex;gap:8px;flex-wrap:wrap"></div>
  1259. </div>
  1260. </div>
  1261. <div class="toolbar">
  1262. <div class="filters"></div>
  1263. <!-- 动态相关性过滤阈值 -->
  1264. <div class="threshold-control" style="display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 4px 12px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow);">
  1265. <span style="color: var(--muted); font-size: 12px; font-weight: 700;">相关性过滤阈值:</span>
  1266. <input type="number" id="relThreshold" min="0" max="10" step="0.5" value="4.0"
  1267. oninput="renderGrid(); renderHead();"
  1268. style="width: 55px; border: 1px solid #d1d5db; border-radius: 4px; padding: 2px 6px; font-weight: 700; text-align: center; color: #2563eb; outline: none; transition: border-color 0.2s;"
  1269. onfocus="this.style.borderColor='#2563eb'" onblur="this.style.borderColor='#d1d5db'">
  1270. </div>
  1271. <button id="reevalBtn" onclick="reevalCurrentQuery()" title="只对当前 query 的所有 form/帖子复评(不重新搜索)">♻️ 重评当前 query</button>
  1272. <button id="editSpecBtn" onclick="openSpecEditor()" title="查看或修改 spec/ 提示词规范文件">📝 编辑 Spec 提示词</button>
  1273. <select id="sort">
  1274. <option value="score">按综合分排序</option>
  1275. <option value="date">按发布时间排序</option>
  1276. <option value="platform">按平台排序</option>
  1277. </select>
  1278. </div>
  1279. <div class="grid" id="grid"></div>
  1280. </div>
  1281. </main>
  1282. <dialog id="detailDialog">
  1283. <div class="modal-head">
  1284. <div>
  1285. <div id="modalMeta" class="meta"></div>
  1286. <h3 id="modalTitle"></h3>
  1287. </div>
  1288. <button onclick="detailDialog.close()">关闭</button>
  1289. </div>
  1290. <div class="modal-tabs" id="modalTabs" style="display: none;">
  1291. <button class="modal-tab active" onclick="switchModalTab('detail')" id="tabDetailBtn">帖子详情</button>
  1292. <button class="modal-tab" onclick="switchModalTab('procedure')" id="tabProcedureBtn">对应工序</button>
  1293. </div>
  1294. <div class="modal-content" id="modalContentDetail">
  1295. <section>
  1296. <div class="rubric-note" id="modalReason"></div>
  1297. <div class="section-title">抓取文本节选</div>
  1298. <div class="raw" id="modalText"></div>
  1299. <div class="section-title">图片预览</div>
  1300. <div class="images" id="modalImages"></div>
  1301. </section>
  1302. <aside>
  1303. <div class="section-title" style="display: flex; justify-content: space-between; align-items: center;">
  1304. <span>评分详情</span>
  1305. <span id="modalOverallScore" style="font-size: 13.5px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 4px; background: #faf7f1; border: 1px solid var(--line); padding: 3px 10px; border-radius: 6px; box-shadow: 0 2px 6px rgba(0,0,0,0.01);">
  1306. 综合评分 <strong style="font-size: 19px; color: #2563eb; font-weight: 900; line-height: 1;" id="modalOverallScoreVal">—</strong>
  1307. </span>
  1308. </div>
  1309. <div class="scores" id="modalScores"></div>
  1310. <div class="section-title">类型 / 命中 query</div>
  1311. <div class="tags" id="modalTags"></div>
  1312. </aside>
  1313. </div>
  1314. <div id="modalContentProcedure" style="display: none; min-height: 500px; height: calc(100vh - 180px); max-height: 700px; padding: 16px; box-sizing: border-box; flex-direction: column;">
  1315. <!-- Top Action Bar (inside tab) -->
  1316. <div id="procActionBar" style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); flex-shrink: 0;">
  1317. <div style="font-size: 14px; font-weight: bold; color: var(--ink);" id="procStatusText">工序状态: 检测中...</div>
  1318. <div style="display: flex; gap: 8px;" id="procActionBtns">
  1319. <!-- Dynamically populated buttons (Regenerate, View Logs, etc) -->
  1320. </div>
  1321. </div>
  1322. <!-- Main view container -->
  1323. <div style="flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column;">
  1324. <!-- Configuration / Setup panel (when not generated) -->
  1325. <div id="procSetupPanel" style="display: none; flex-direction: column; align-items: center; justify-content: center; text-align: center; height: 100%; padding: 40px 20px;">
  1326. <div style="font-size: 36px; margin-bottom: 16px;">✨</div>
  1327. <h4 style="margin: 0 0 10px; font-size: 18px;">提取本帖工序</h4>
  1328. <p style="color: var(--muted); font-size: 14px; max-width: 500px; margin: 0 0 24px;">该帖子目前尚未生成对应的结构化工序。请在下方选择提取引擎和模型,点击开始提取。</p>
  1329. <div style="display: flex; gap: 16px; margin-bottom: 24px; text-align: left; background: #fff; border: 1px solid var(--line); padding: 16px; border-radius: 8px; box-shadow: var(--shadow);">
  1330. <div>
  1331. <label style="display: block; font-size: 12px; font-weight: bold; margin-bottom: 6px; color: var(--muted);">提取引擎 (Engine)</label>
  1332. <select id="procEngineSelect" style="min-width: 180px; padding: 6px 10px;" onchange="onProcEngineChange()">
  1333. <option value="cyber_runner">Cyber Runner (自研/OpenRouter)</option>
  1334. <option value="claude_sdk">Claude SDK (OAuth)</option>
  1335. </select>
  1336. </div>
  1337. <div>
  1338. <label style="display: block; font-size: 12px; font-weight: bold; margin-bottom: 6px; color: var(--muted);">AI 模型 (Model)</label>
  1339. <select id="procModelSelect" style="min-width: 240px; padding: 6px 10px;">
  1340. <!-- Dynamically populated options -->
  1341. </select>
  1342. </div>
  1343. </div>
  1344. <button id="startProcBtn" onclick="startProcedureExtraction()" style="background: var(--mint); color: #fff; border-color: var(--mint); padding: 10px 24px; font-size: 15px; font-weight: bold; border-radius: 8px; cursor: pointer; transition: all 0.2s;">开始提取工序</button>
  1345. </div>
  1346. <!-- Live Log Terminal View -->
  1347. <div id="procConsolePanel" style="display: none; flex-direction: column; height: 100%; min-height: 0; background: #1e1b18; border: 1px solid #3d352e; border-radius: 8px; overflow: hidden; box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);">
  1348. <!-- Console header -->
  1349. <div style="background: #2b2520; padding: 6px 12px; border-bottom: 1px solid #3d352e; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; font-family: monospace; font-size: 12px; color: #a3968d;">
  1350. <span>TERMINAL CONSOLE</span>
  1351. <span id="procConsoleStatus">idle</span>
  1352. </div>
  1353. <!-- Console log output -->
  1354. <pre id="procConsoleOutput" style="flex: 1; margin: 0; padding: 12px; overflow: auto; font-family: ui-monospace, Menlo, Monaco, Consolas, monospace; font-size: 13px; line-height: 1.45; color: #cbbba9; background: #1e1b18; white-space: pre-wrap; word-break: break-all;"></pre>
  1355. </div>
  1356. <!-- Iframe Panel for completed HTML -->
  1357. <iframe id="procedureIframe" style="display: none; width: 100%; height: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff;" referrerpolicy="no-referrer"></iframe>
  1358. </div>
  1359. </div>
  1360. </dialog>
  1361. <!-- Spec Editor Dialog -->
  1362. <dialog id="specEditorDialog" style="width: 850px; max-width: 95%; border: 1px solid var(--line); border-radius: 12px; padding: 0; box-shadow: var(--shadow); background: var(--panel);">
  1363. <div style="display: flex; justify-content: space-between; align-items: center; background: #faf7f1; border-bottom: 1px solid var(--line); padding: 16px 20px;">
  1364. <h3 style="margin: 0; font-size: 18px; color: var(--ink); font-weight: 800;">📝 编辑 Spec 提示词规范</h3>
  1365. <button onclick="document.getElementById('specEditorDialog').close()" style="background: none; border: 1px solid var(--line); padding: 5px 14px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 12px;">关闭</button>
  1366. </div>
  1367. <div style="padding: 20px;">
  1368. <div style="margin-bottom: 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;">
  1369. <span style="font-size: 13.5px; font-weight: 700; color: var(--ink);">选择提示词文件:</span>
  1370. <select id="specFileSelect" onchange="loadSpecFileContent()" style="padding: 6px 12px; border-radius: 8px; border: 1px solid #d1d5db; outline: none; min-width: 320px; font-family: monospace; font-size: 13px; font-weight: 600;">
  1371. <!-- Spec files options will be populated -->
  1372. </select>
  1373. <span id="specLoadStatus" style="font-size: 13px; font-weight: 600;"></span>
  1374. </div>
  1375. <div style="position: relative; margin-bottom: 20px;">
  1376. <textarea id="specContentTextarea" style="width: 100%; height: 500px; font-family: ui-monospace, Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 13.5px; line-height: 1.55; padding: 14px; border: 1px solid #d1d5db; border-radius: 8px; box-sizing: border-box; outline: none; background: #fafaf9; color: #1f2937; resize: vertical; border-left: 4px solid var(--cyan); box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);"></textarea>
  1377. </div>
  1378. <div style="display: flex; justify-content: flex-end; gap: 12px; align-items: center; border-top: 1px solid var(--line); padding-top: 16px;">
  1379. <span id="specSaveStatus" style="font-size: 13.5px; font-weight: 700; margin-right: auto;"></span>
  1380. <button onclick="document.getElementById('specEditorDialog').close()" class="btn" style="background: #f3f4f6; height: 38px; padding: 0 18px; border-radius: 8px; font-weight: 600;">取消</button>
  1381. <button onclick="saveSpecFileContent()" class="btn" style="background: var(--mint); color: #fff; border-color: var(--mint); font-weight: bold; height: 38px; padding: 0 20px; border-radius: 8px; box-shadow: var(--shadow);">💾 保存修改</button>
  1382. </div>
  1383. </div>
  1384. </dialog>
  1385. <script>
  1386. let DATA = { queries: [], actions: [], types: [], matrix: [] }, st = { form: 'A', lens: '工序', tools: [], tier: 0, qi: 0, fi: 0, channel: "all", matrixView: 'full' }, VIEW = [];
  1387. let currentProcTask = null;
  1388. let procPollInterval = null;
  1389. let isLogViewActive = false;
  1390. let reevalPollIntervals = {};
  1391. function startReevalPolling(q) {
  1392. if (reevalPollIntervals[q]) return;
  1393. const btn = document.getElementById('reevalBtn');
  1394. const poll = () => {
  1395. fetch(`/api/reeval_status?q=${q}`)
  1396. .then(r => r.json())
  1397. .then(d => {
  1398. const isCurrent = DATA.queries[st.qi] && DATA.queries[st.qi].key === q;
  1399. if (d.status === "success") {
  1400. clearInterval(reevalPollIntervals[q]);
  1401. delete reevalPollIntervals[q];
  1402. if (isCurrent) {
  1403. btn.disabled = false;
  1404. btn.textContent = '♻️ 重评当前 query';
  1405. }
  1406. // Mark local status as finished
  1407. if (DATA.active_reevals) {
  1408. delete DATA.active_reevals[q];
  1409. }
  1410. loadData(true);
  1411. alert(`Query ${q} 重评完成!已自动重新扫描并更新数据。`);
  1412. } else if (d.status === "failed") {
  1413. clearInterval(reevalPollIntervals[q]);
  1414. delete reevalPollIntervals[q];
  1415. if (isCurrent) {
  1416. btn.disabled = false;
  1417. btn.textContent = '♻️ 重评当前 query';
  1418. }
  1419. if (DATA.active_reevals) {
  1420. delete DATA.active_reevals[q];
  1421. }
  1422. alert(`Query ${q} 重评失败:${d.error}`);
  1423. } else if (d.status === "running") {
  1424. if (isCurrent) {
  1425. btn.disabled = true;
  1426. btn.textContent = `♻️ 重评中 ${q}...`;
  1427. }
  1428. }
  1429. })
  1430. .catch(err => console.error("Poll error:", err));
  1431. };
  1432. poll();
  1433. reevalPollIntervals[q] = setInterval(poll, 3000);
  1434. }
  1435. // Spec Prompt Editor Functions
  1436. const ALLOWED_SPEC_FILES = [
  1437. "README.md",
  1438. "tools.md",
  1439. "extraction/phase1-skeleton.md",
  1440. "extraction/phase2-normalize.md",
  1441. "extraction/phase3-finalize.md",
  1442. "taxonomy/type_suggestions.md"
  1443. ];
  1444. function openSpecEditor() {
  1445. const select = document.getElementById("specFileSelect");
  1446. select.innerHTML = ALLOWED_SPEC_FILES.map(f => `<option value="${esc(f)}">${esc(f)}</option>`).join("");
  1447. document.getElementById("specLoadStatus").textContent = "";
  1448. document.getElementById("specSaveStatus").textContent = "";
  1449. document.getElementById("specContentTextarea").value = "";
  1450. const dialog = document.getElementById("specEditorDialog");
  1451. dialog.showModal();
  1452. loadSpecFileContent();
  1453. }
  1454. function loadSpecFileContent() {
  1455. const file = document.getElementById("specFileSelect").value;
  1456. const status = document.getElementById("specLoadStatus");
  1457. const textarea = document.getElementById("specContentTextarea");
  1458. status.textContent = "⏳ 正在读取...";
  1459. status.style.color = "var(--amber)";
  1460. textarea.disabled = true;
  1461. fetch(`/api/spec_content?file=${encodeURIComponent(file)}`)
  1462. .then(r => r.json().then(d => ({ ok: r.ok, d })))
  1463. .then(({ ok, d }) => {
  1464. textarea.disabled = false;
  1465. if (ok) {
  1466. textarea.value = d.content || "";
  1467. status.textContent = "✓ 读取成功";
  1468. status.style.color = "var(--mint)";
  1469. } else {
  1470. status.textContent = "❌ 读取失败: " + (d.error || "未知错误");
  1471. status.style.color = "var(--rose)";
  1472. }
  1473. })
  1474. .catch(err => {
  1475. textarea.disabled = false;
  1476. status.textContent = "❌ 读取失败: " + err;
  1477. status.style.color = "var(--rose)";
  1478. });
  1479. }
  1480. function saveSpecFileContent() {
  1481. const file = document.getElementById("specFileSelect").value;
  1482. const content = document.getElementById("specContentTextarea").value;
  1483. const status = document.getElementById("specSaveStatus");
  1484. status.textContent = "⏳ 正在保存到磁盘...";
  1485. status.style.color = "var(--amber)";
  1486. fetch("/api/save_spec", {
  1487. method: "POST",
  1488. headers: { "Content-Type": "application/json" },
  1489. body: JSON.stringify({ file, content })
  1490. })
  1491. .then(r => r.json().then(d => ({ ok: r.ok, d })))
  1492. .then(({ ok, d }) => {
  1493. if (ok) {
  1494. status.textContent = "✅ 保存成功!新的 Prompt 规则已在本地生效。";
  1495. status.style.color = "var(--mint)";
  1496. setTimeout(() => {
  1497. if (status.textContent.includes("保存成功")) {
  1498. status.textContent = "";
  1499. }
  1500. }, 4000);
  1501. } else {
  1502. status.textContent = "❌ 保存失败: " + (d.error || "未知错误");
  1503. status.style.color = "var(--rose)";
  1504. }
  1505. })
  1506. .catch(err => {
  1507. status.textContent = "❌ 网络错误: " + err;
  1508. status.style.color = "var(--rose)";
  1509. });
  1510. }
  1511. function esc(s) { return (s === undefined || s === null ? "" : String(s)).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;"); }
  1512. const ACTIONS = [{ "name": "检索", "l1": "获取", "l2": "搜索" }, { "name": "下载", "l1": "获取", "l2": "搜索" }, { "name": "调取", "l1": "获取", "l2": "查询" }, { "name": "上传", "l1": "获取", "l2": "录入" }, { "name": "拍摄", "l1": "获取", "l2": "录入" }, { "name": "录音", "l1": "获取", "l2": "录入" }, { "name": "键入", "l1": "获取", "l2": "录入" }, { "name": "选取", "l1": "获取", "l2": "引用" }, { "name": "裁切", "l1": "提取", "l2": "物理提取" }, { "name": "抠取", "l1": "提取", "l2": "物理提取" }, { "name": "抽帧", "l1": "提取", "l2": "物理提取" }, { "name": "识别", "l1": "提取", "l2": "化学提取" }, { "name": "反推", "l1": "提取", "l2": "化学提取" }, { "name": "解构", "l1": "提取", "l2": "化学提取" }, { "name": "元素生成", "l1": "生成", "l2": "元素生成" }, { "name": "数组生成", "l1": "生成", "l2": "关系生成" }, { "name": "结构生成", "l1": "生成", "l2": "关系生成" }, { "name": "添加", "l1": "修改", "l2": "增" }, { "name": "叠加", "l1": "修改", "l2": "增" }, { "name": "抹除", "l1": "修改", "l2": "删" }, { "name": "剪除", "l1": "修改", "l2": "删" }, { "name": "重述", "l1": "修改", "l2": "变" }, { "name": "风格化", "l1": "修改", "l2": "变" }, { "name": "转换", "l1": "修改", "l2": "变" }, { "name": "替换", "l1": "修改", "l2": "变" }, { "name": "调整", "l1": "修改", "l2": "变" }, { "name": "增强", "l1": "修改", "l2": "变" }];
  1513. const TYPES = [{ "name": "提示词", "l1": "程序控制类型", "l2": "指令" }, { "name": "负向提示词", "l1": "程序控制类型", "l2": "指令" }, { "name": "描述", "l1": "程序控制类型", "l2": "指令" }, { "name": "生成参数", "l1": "程序控制类型", "l2": "参数" }, { "name": "规格参数", "l1": "程序控制类型", "l2": "参数" }, { "name": "模型权重", "l1": "程序控制类型", "l2": "参数" }, { "name": "评分", "l1": "程序控制类型", "l2": "评估" }, { "name": "评语", "l1": "程序控制类型", "l2": "评估" }, { "name": "工作流", "l1": "程序控制类型", "l2": "流程" }, { "name": "批处理", "l1": "程序控制类型", "l2": "流程" }, { "name": "数字人", "l1": "数据复用类型", "l2": "原子" }, { "name": "版式", "l1": "数据复用类型", "l2": "原子" }, { "name": "模板", "l1": "数据复用类型", "l2": "序列" }, { "name": "参考图", "l1": "内容类型", "l2": "素材/化学变化" }, { "name": "参考视频", "l1": "内容类型", "l2": "素材/化学变化" }, { "name": "参考音频", "l1": "内容类型", "l2": "素材/化学变化" }, { "name": "对标内容", "l1": "内容类型", "l2": "素材/化学变化" }, { "name": "分镜图", "l1": "内容类型", "l2": "素材/化学变化" }, { "name": "转场", "l1": "内容类型", "l2": "素材/化学变化" }, { "name": "蒙版", "l1": "内容类型", "l2": "素材/化学变化" }, { "name": "控制图", "l1": "内容类型", "l2": "素材/化学变化" }, { "name": "运动轨迹", "l1": "内容类型", "l2": "素材/化学变化" }, { "name": "滤镜", "l1": "内容类型", "l2": "素材/化学变化" }, { "name": "构图布局", "l1": "内容类型", "l2": "素材/化学变化" }, { "name": "截图", "l1": "内容类型", "l2": "素材/物理变化" }, { "name": "视频片段", "l1": "内容类型", "l2": "素材/物理变化" }, { "name": "转场片段", "l1": "内容类型", "l2": "素材/物理变化" }, { "name": "关键帧", "l1": "内容类型", "l2": "素材/物理变化" }, { "name": "音效", "l1": "内容类型", "l2": "素材/物理变化" }, { "name": "特效", "l1": "内容类型", "l2": "素材/物理变化" }, { "name": "大纲", "l1": "内容类型", "l2": "半成品/序列" }, { "name": "脚本", "l1": "内容类型", "l2": "半成品/序列" }, { "name": "分镜脚本", "l1": "内容类型", "l2": "半成品/序列" }, { "name": "剪辑脚本", "l1": "内容类型", "l2": "半成品/序列" }, { "name": "配音文案", "l1": "内容类型", "l2": "半成品/序列" }, { "name": "底图", "l1": "内容类型", "l2": "半成品/原子" }, { "name": "样图", "l1": "内容类型", "l2": "半成品/原子" }, { "name": "分镜视频", "l1": "内容类型", "l2": "半成品/原子" }, { "name": "图层组合", "l1": "内容类型", "l2": "半成品/组合" }, { "name": "拼图", "l1": "内容类型", "l2": "半成品/组合" }, { "name": "歌词", "l1": "内容类型", "l2": "准成品" }, { "name": "配音", "l1": "内容类型", "l2": "准成品" }, { "name": "BGM", "l1": "内容类型", "l2": "准成品" }, { "name": "字幕", "l1": "内容类型", "l2": "准成品" }, { "name": "标题", "l1": "内容类型", "l2": "准成品" }, { "name": "正文", "l1": "内容类型", "l2": "准成品" }, { "name": "成品图", "l1": "内容类型", "l2": "成品" }, { "name": "视频成品", "l1": "内容类型", "l2": "成品" }, { "name": "合成图", "l1": "内容类型", "l2": "成品" }, { "name": "知识库", "l1": "知识类型", "l2": "知识库" }];
  1514. const POOLS = { "action_leaves": { "检索": ["找", "搜", "哪里找", "在哪找", "搜索"], "下载": ["下载", "怎么下载", "获取", "导入"], "调取": ["复用", "调用", "套用", "加载"], "上传": ["上传", "导入", "怎么导入", "用自己的"], "拍摄": ["拍", "拍摄", "录制", "录屏", "怎么拍"], "录音": ["录音", "录", "怎么录", "录制"], "键入": ["写", "输入", "怎么写", "编写"], "选取": ["挑选", "怎么选", "筛选", "选"], "裁切": ["裁剪", "截取", "怎么裁", "切片"], "抠取": ["抠图", "抠", "分割", "怎么抠"], "抽帧": ["抽帧", "提取帧", "怎么抽帧", "导出帧"], "识别": ["识别", "检测", "OCR", "提取文字", "转录"], "反推": ["反推", "分析", "推断", "怎么反推"], "解构": ["拆解", "解构", "分析结构"], "元素生成": ["生成", "制作", "怎么做", "做", "创作"], "数组生成": ["批量生成", "生成多张", "怎么批量", "批量做"], "结构生成": ["生成", "搭建", "怎么生成", "构建"], "添加": ["添加", "加", "怎么加", "加上"], "叠加": ["叠加", "合成", "叠", "加"], "抹除": ["去除", "去掉", "怎么去掉", "抹除", "消除"], "剪除": ["剪掉", "删掉", "怎么剪", "截短"], "重述": ["改写", "润色", "怎么改", "重写"], "风格化": ["风格化", "转风格", "风格迁移", "怎么转风格"], "转换": ["转换", "转", "怎么转", "转格式"], "替换": ["替换", "换", "怎么换", "替换成"], "调整": ["调整", "调", "怎么调", "优化"], "增强": ["增强", "提升画质", "怎么增强", "修复", "超分"] }, "types": { "提示词": ["提示词", "prompt", "咒语"], "负向提示词": ["负向提示词", "反向提示词", "negative prompt"], "描述": ["描述", "描述词", "提示描述"], "生成参数": ["参数", "出图参数", "生成参数", "seed"], "规格参数": ["尺寸", "分辨率", "画幅", "规格"], "模型权重": ["模型", "LoRA", "底模", "checkpoint"], "评分": ["评分", "打分", "评级"], "评语": ["评语", "点评", "反馈", "修改意见"], "工作流": ["工作流", "workflow", "流程图", "节点"], "批处理": ["批处理", "批量", "batch"], "数字人": ["数字人", "虚拟人", "数字分身", "AI分身"], "版式": ["版式", "排版", "版面", "layout"], "模板": ["模板", "template", "套版"], "参考图": ["参考图", "参考", "垫图", "ref"], "参考视频": ["参考视频", "参考片", "参考素材"], "参考音频": ["参考音频", "参考音色", "音色样本"], "对标内容": ["对标", "爆款参考", "竞品", "标杆案例"], "分镜图": ["分镜图", "分镜", "故事板", "storyboard"], "转场": ["转场", "转场效果", "transition"], "蒙版": ["蒙版", "抠像", "遮罩", "mask"], "控制图": ["控制图", "ControlNet", "结构图", "线稿"], "运动轨迹": ["运镜", "运动轨迹", "运动笔刷", "motion brush"], "滤镜": ["滤镜", "filter", "调色", "LUT"], "构图布局": ["构图", "布局", "构图布局"], "截图": ["截图", "屏幕截图", "截屏"], "视频片段": ["视频片段", "片段", "素材", "clip"], "转场片段": ["转场片段", "转场素材"], "关键帧": ["关键帧", "帧", "视频帧"], "音效": ["音效", "声音", "SFX", "音效素材"], "特效": ["特效", "视频特效", "VFX", "effect"], "大纲": ["大纲", "内容大纲", "提纲"], "脚本": ["脚本", "文案脚本", "剧本"], "分镜脚本": ["分镜脚本", "分镜表", "分镜"], "剪辑脚本": ["剪辑脚本", "剪辑表", "卡点表", "时间轴"], "配音文案": ["配音文案", "口播文案", "旁白文案"], "底图": ["底图", "背景图", "打底图"], "样图": ["样图", "效果图", "候选图", "draft"], "分镜视频": ["分镜视频", "分镜片段"], "图层组合": ["图层组合", "图层", "图层合成"], "拼图": ["拼图", "九宫格", "长图", "对比图"], "歌词": ["歌词", "词", "lyrics"], "配音": ["配音", "旁白", "解说", "人声"], "BGM": ["BGM", "背景音乐", "配乐"], "字幕": ["字幕", "视频字幕", "字幕条"], "标题": ["标题", "文案标题", "爆款标题"], "正文": ["正文", "文案", "内容正文"], "成品图": ["成品图", "出图", "图", "海报"], "视频成品": ["视频成品", "成片", "视频"], "合成图": ["合成图", "拼合图", "融合图", "合成"], "知识库": ["知识库", "资料库", "knowledge base"] }, "knowledge": { "工序": { "单步": ["教程", "流程", "步骤", "怎么做", "方法", "教学"], "全程": ["完整流程", "全流程", "pipeline", "SOP"] }, "能力": { "标记": ["一键", "自动", "直出", "秒出"], "达成": ["同款", "复刻", "效果"], "载体": ["提示词", "参数", "预设", "公式"] }, "工具": { "发现": ["用什么软件", "用什么工具", "工具推荐", "哪个好用", "有哪些工具"] } }, "tool_type": { "AI 模型": ["AI"], "桌面 APP": ["软件", "电脑端"], "云端 Web": ["在线", "网页版"], "API·CLI": ["代码", "命令行"], "插件扩展": ["插件"] } };
  1515. const TOOL_TYPES = ["AI 模型", "桌面 APP", "云端 Web", "API·CLI", "插件扩展"];
  1516. const GMODEL = "gemini-3.1-flash-lite";
  1517. const AL = POOLS.action_leaves, TP = POOLS.types, KN = POOLS.knowledge, TQ = POOLS.tool_type;
  1518. function aPool(a) { return AL[a] || [a]; }
  1519. function tPool(t) { return TP[t] || [t]; }
  1520. function pick(arr, i) { return arr[Math.min(i, arr.length - 1)]; }
  1521. function toolPrefix(lens) { return (st.tools.length && lens !== '工具') ? st.tools.map(t => TQ[t][0]).join('/') + ' ' : ''; }
  1522. function genForms(leaf, ty, lens, tq) {
  1523. tq = tq || ''; const aP = aPool(leaf), tP = tPool(ty);
  1524. const aNat = aP[0], tNat = tP[0], aSyn = pick(aP, 1), tSyn = pick(tP, 1), K = KN[lens];
  1525. if (lens === '工序') {
  1526. const s = K['单步'];
  1527. return [['①原词', `${tq}${leaf} ${ty} 流程`], ['②句子', `${tq}怎么${aNat}${tNat}`], ['③同义', `${tq}${aSyn} ${tSyn} ${pick(s, 2)}`]];
  1528. }
  1529. if (lens === '能力') {
  1530. const mk = K['标记'];
  1531. return [['①原词', `${tq}${leaf} ${ty} 技巧`], ['②句子', `${tq}有没有能${mk[0]}${aNat}${tNat}的功能`], ['③同义', `${tq}${pick(mk, 1)} ${aSyn}${tSyn}`]];
  1532. }
  1533. const fd = K['发现'];
  1534. return [['①原词', `${leaf} ${ty} 工具`], ['②句子', `${aNat}${tNat}用什么软件好`], ['③同义', `${aSyn} ${tSyn} ${pick(fd, 2)}`]];
  1535. }
  1536. const FIDX = { A: 0, B: 1, C: 2 };
  1537. function genQ(leaf, ty) { return genForms(leaf, ty, st.lens, toolPrefix(st.lens))[FIDX[st.form]][1]; }
  1538. // 兼容老版 1-5 维度的英文和中文对应标签
  1539. const commonLabels = { relevance: "相关性", result_quality: "成品质量", credibility: "可信度", novelty_coverage: "新增覆盖", concrete_use_case: "具体用例", completeness: "流程完整", step_structure: "步骤结构", step_reproducibility: "可复现性", capability_definition: "能力定义", implementation_depth: "实现深度", boundary_failure_eval: "边界/踩坑", generality: "通用性", capability_coverage: "工具覆盖", effective_comparison: "有效对比", param_specificity: "参数具体", worked_example: "示例完整", version_limits: "限制说明" };
  1540. const filterLabels = { production_relevance: "制作相关性", recency_hard: "发布时效", overall: "综合均分" };
  1541. const filterMax = { production_relevance: 3, recency_hard: 3, overall: 5 };
  1542. // 新版 0-10 分数维度的中文标签
  1543. const newLabels = {
  1544. relevance_production: "和内容制作知识相关",
  1545. relevance_query: "和 query 相关",
  1546. recency: "时效性",
  1547. popularity: "热度性",
  1548. feedback: "评论反馈",
  1549. realism: "真实感 (非AI)",
  1550. expressiveness: "表现力",
  1551. procedure_completeness: "流程完整性",
  1552. procedure_input: "输入完整性",
  1553. procedure_implementation: "实现完整性",
  1554. procedure_output: "输出完整性",
  1555. procedure_generality: "泛化性",
  1556. step_input: "输入完整性",
  1557. step_implementation: "实现完整性",
  1558. step_output: "输出完整性",
  1559. step_generality: "泛化性",
  1560. tool_boundary: "能力边界覆盖",
  1561. tool_comparison: "有效比较",
  1562. tool_specificity: "参数/接口具体性",
  1563. tool_example: "实操示例",
  1564. tool_limits: "版本&限制"
  1565. };
  1566. const scoreGroupsOld = [
  1567. { id: "filter", title: "过滤指标", short: "过滤", hint: "独立于通用维度·过滤逻辑待定", topLevelKeys: ["production_relevance", "recency_hard", "overall"] },
  1568. { id: "common", title: "通用维度", short: "通用", keys: ["relevance", "result_quality", "credibility", "novelty_coverage", "concrete_use_case"] },
  1569. { id: "procedure", title: "工序维度", short: "工序", keys: ["completeness", "step_structure", "step_reproducibility"] },
  1570. { id: "step", title: "步骤维度", short: "步骤", keys: ["capability_definition", "implementation_depth", "boundary_failure_eval", "generality"] },
  1571. { id: "tool", title: "工具维度", short: "工具", keys: ["capability_coverage", "effective_comparison", "param_specificity", "worked_example", "version_limits"] }
  1572. ];
  1573. const scoreGroupsNew = [
  1574. { id: "relevance", title: "相关性", short: "相关", keys: ["relevance_production", "relevance_query"] },
  1575. { id: "fixed", title: "固定维度", short: "固定", keys: ["recency", "popularity", "feedback"] },
  1576. { id: "usecase", title: "用例维度", short: "用例", keys: ["realism", "expressiveness"] },
  1577. { id: "dynamic", title: "动态维度", short: "动态", keys: [] }
  1578. ];
  1579. function makeRow(label, scoreKey, it) {
  1580. const rawV = it.scores[scoreKey];
  1581. const v = (rawV !== undefined && rawV !== null) ? parseFloat(rawV) : NaN;
  1582. const hasScore = !isNaN(v);
  1583. const valStr = hasScore ? (Number.isInteger(v) ? v : v.toFixed(1)) : '-';
  1584. const barV = hasScore ? v : 0;
  1585. const reason = it.score_reasons ? it.score_reasons[scoreKey] : '';
  1586. const infoIcon = reason ? `<span class="info-icon" onclick="pinScoreReason(this, '${esc(label)}', '${esc(scoreKey)}')" title="点击定格查看评判理由" style="margin-left: 5px; cursor: pointer; color: var(--muted); opacity: 0.7; font-size: 13px; font-weight: normal; user-select: none;">ⓘ</span>` : '';
  1587. return `
  1588. <div class="sc-row ${!hasScore ? 'missing' : ''}">
  1589. <span class="label">${esc(label)}</span>
  1590. <div class="bar-wrap">
  1591. <div class="bar">
  1592. <div class="bar-fill" style="--v: ${barV}"></div>
  1593. </div>
  1594. <span class="value">${valStr}</span>
  1595. ${infoIcon}
  1596. </div>
  1597. </div>
  1598. `;
  1599. }
  1600. function getQualityAverage(it) {
  1601. if (!it.scores) return null;
  1602. const keys = ["recency", "popularity", "feedback", "realism", "expressiveness"];
  1603. if (it.knowledge_type && (it.knowledge_type.includes("procedure") || it.knowledge_type.includes("工序"))) {
  1604. keys.push("procedure_completeness", "procedure_input", "procedure_implementation", "procedure_output", "procedure_generality");
  1605. }
  1606. if (it.knowledge_type && (it.knowledge_type.includes("step") || it.knowledge_type.includes("能力") || it.knowledge_type.includes("步骤"))) {
  1607. keys.push("step_input", "step_implementation", "step_output", "step_generality");
  1608. }
  1609. if (it.knowledge_type && (it.knowledge_type.includes("tool") || it.knowledge_type.includes("工具"))) {
  1610. keys.push("tool_boundary", "tool_comparison", "tool_specificity", "tool_example", "tool_limits");
  1611. }
  1612. const vs = keys.map(k => parseFloat(it.scores[k])).filter(v => !isNaN(v));
  1613. return vs.length ? vs.reduce((a, b) => a + b, 0) / vs.length : null;
  1614. }
  1615. function renderNewScores(it) {
  1616. // 1. Relevance Card
  1617. const relAvg = groupAverage(it, scoreGroupsNew[0], true);
  1618. const relAvgStr = relAvg !== null ? relAvg.toFixed(1) : 'N/A';
  1619. let relevanceHtml = `
  1620. <div class="sc-card">
  1621. <div class="sc-card-head">
  1622. <div class="title"><span class="badge">01</span>相关性</div>
  1623. <div class="avg-score">avg <strong>${relAvgStr}</strong><span style="font-size: 13px; color: #9ca3af; font-weight: 500;">/10</span></div>
  1624. </div>
  1625. <div class="sc-card-body">
  1626. ${makeRow("和内容制作知识相关", "relevance_production", it)}
  1627. ${makeRow("和 query 相关", "relevance_query", it)}
  1628. </div>
  1629. </div>
  1630. `;
  1631. // 2. Quality Card
  1632. const qualAvg = getQualityAverage(it);
  1633. const qualAvgStr = qualAvg !== null ? qualAvg.toFixed(1) : 'N/A';
  1634. let qualityHtml = `
  1635. <div class="sc-card">
  1636. <div class="sc-card-head">
  1637. <div class="title"><span class="badge">02</span>质量</div>
  1638. <div class="avg-score">avg <strong>${qualAvgStr}</strong><span style="font-size: 13px; color: #9ca3af; font-weight: 500;">/10</span></div>
  1639. </div>
  1640. <div class="sc-card-body">
  1641. <div class="sc-sub-header">固定维度</div>
  1642. ${makeRow("时效性", "recency", it)}
  1643. ${makeRow("热度性", "popularity", it)}
  1644. ${makeRow("评论反馈", "feedback", it)}
  1645. <div class="sc-sub-header">用例</div>
  1646. ${makeRow("真实感 (非AI)", "realism", it)}
  1647. ${makeRow("表现力", "expressiveness", it)}
  1648. `;
  1649. // Dynamic Dimensions
  1650. let dynamicHtml = '';
  1651. if (it.knowledge_type && (it.knowledge_type.includes("procedure") || it.knowledge_type.includes("工序"))) {
  1652. dynamicHtml += `
  1653. <div class="sc-sub-header">工序</div>
  1654. ${makeRow("流程完整性", "procedure_completeness", it)}
  1655. ${makeRow("输入完整性", "procedure_input", it)}
  1656. ${makeRow("实现完整性", "procedure_implementation", it)}
  1657. ${makeRow("输出完整性", "procedure_output", it)}
  1658. ${makeRow("泛化性", "procedure_generality", it)}
  1659. `;
  1660. }
  1661. if (it.knowledge_type && (it.knowledge_type.includes("step") || it.knowledge_type.includes("能力") || it.knowledge_type.includes("步骤"))) {
  1662. dynamicHtml += `
  1663. <div class="sc-sub-header">能力</div>
  1664. ${makeRow("输入完整性", "step_input", it)}
  1665. ${makeRow("实现完整性", "step_implementation", it)}
  1666. ${makeRow("输出完整性", "step_output", it)}
  1667. ${makeRow("泛化性", "step_generality", it)}
  1668. `;
  1669. }
  1670. if (it.knowledge_type && (it.knowledge_type.includes("tool") || it.knowledge_type.includes("工具"))) {
  1671. dynamicHtml += `
  1672. <div class="sc-sub-header">工具</div>
  1673. ${makeRow("能力边界覆盖", "tool_boundary", it)}
  1674. ${makeRow("有效比较", "tool_comparison", it)}
  1675. ${makeRow("参数/接口具体性", "tool_specificity", it)}
  1676. ${makeRow("实操示例", "tool_example", it)}
  1677. ${makeRow("版本&限制", "tool_limits", it)}
  1678. `;
  1679. }
  1680. qualityHtml += dynamicHtml + `
  1681. </div>
  1682. </div>
  1683. `;
  1684. return relevanceHtml + qualityHtml;
  1685. }
  1686. function isItemDiscarded(it) {
  1687. if (it.anomaly) return false;
  1688. const input = document.getElementById("relThreshold");
  1689. const userThreshold = input ? parseFloat(input.value) : NaN;
  1690. const isNewSchema = it.scores && (it.scores.relevance_production !== undefined || it.scores.relevance_query !== undefined);
  1691. let isDiscard = false;
  1692. // 1. Relevance check
  1693. const relVal = it.production_relevance !== null && it.production_relevance !== undefined ? parseFloat(it.production_relevance) : null;
  1694. if (relVal !== null && !isNaN(relVal)) {
  1695. const activeThreshold = !isNaN(userThreshold) ? userThreshold : (isNewSchema ? 4.0 : 2.0);
  1696. if (relVal < activeThreshold) {
  1697. isDiscard = true;
  1698. }
  1699. }
  1700. // 2. Recency check
  1701. if (it.recency_hard !== null && it.recency_hard !== undefined && it.recency_hard < 2) {
  1702. isDiscard = true;
  1703. }
  1704. // 3. Overall average check
  1705. if (it.overall !== null && it.overall !== undefined) {
  1706. const threshold_ov = isNewSchema ? 6.0 : 3.0;
  1707. if (it.overall < threshold_ov) {
  1708. isDiscard = true;
  1709. }
  1710. }
  1711. return isDiscard;
  1712. }
  1713. function updateThresholdLimits() {
  1714. const f = curForm();
  1715. const input = document.getElementById("relThreshold");
  1716. if (!f || !f.results || f.results.length === 0 || !input) return;
  1717. const isNew = f.results.some(r => r.scores && (r.scores.relevance_production !== undefined || r.scores.relevance_query !== undefined));
  1718. const schemaKey = isNew ? "new" : "old";
  1719. if (input.dataset.schema !== schemaKey) {
  1720. input.dataset.schema = schemaKey;
  1721. input.max = isNew ? "10" : "5";
  1722. input.value = isNew ? "4.0" : "2.0";
  1723. input.step = isNew ? "0.5" : "1";
  1724. }
  1725. }
  1726. const PLATC = { xhs: "小红书", gzh: "公众号", zhihu: "知乎", x: "X", bili: "B站", douyin: "抖音", sph: "视频号", youtube: "YouTube", github: "GitHub", toutiao: "头条", weibo: "微博" };
  1727. const FN = { A: "原词", B: "句子", C: "同义" };
  1728. const NOIMG = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='400'%3E%3Crect width='600' height='400' fill='%23eee7dc'/%3E%3Ctext x='50%25' y='50%25' dominant-baseline='middle' text-anchor='middle' fill='%236f6961' font-size='28'%3ENo image%3C/text%3E%3C/svg%3E";
  1729. function curForm() { return st.qi === -1 ? null : (DATA.queries[st.qi] ? DATA.queries[st.qi].forms[st.fi] : null); }
  1730. function groupAverage(it, g, isNewSchema) {
  1731. if (!it.scores) return null;
  1732. let keys = g.keys;
  1733. if (isNewSchema && g.id === "dynamic") {
  1734. keys = [];
  1735. if (it.knowledge_type && (it.knowledge_type.includes("procedure") || it.knowledge_type.includes("工序"))) {
  1736. keys.push("procedure_completeness", "procedure_input", "procedure_implementation", "procedure_output", "procedure_generality");
  1737. }
  1738. if (it.knowledge_type && (it.knowledge_type.includes("step") || it.knowledge_type.includes("能力") || it.knowledge_type.includes("步骤"))) {
  1739. keys.push("step_input", "step_implementation", "step_output", "step_generality");
  1740. }
  1741. if (it.knowledge_type && (it.knowledge_type.includes("tool") || it.knowledge_type.includes("工具"))) {
  1742. keys.push("tool_boundary", "tool_comparison", "tool_specificity", "tool_example", "tool_limits");
  1743. }
  1744. }
  1745. const vs = keys.map(k => parseFloat(it.scores[k])).filter(v => !isNaN(v));
  1746. return vs.length ? vs.reduce((a, b) => a + b, 0) / vs.length : null;
  1747. }
  1748. function fmt(v) { return v === null ? "N/A" : v.toFixed(1); }
  1749. function groupSnapshot(it) {
  1750. const isNewSchema = it.scores && (it.scores.relevance_production !== undefined || it.scores.relevance_query !== undefined);
  1751. if (isNewSchema) {
  1752. const relAvg = groupAverage(it, scoreGroupsNew[0], true);
  1753. const qualAvg = getQualityAverage(it);
  1754. return `
  1755. <div class="group-pill"><span>相关</span><strong>${fmt(relAvg)}</strong></div>
  1756. <div class="group-pill"><span>质量</span><strong>${fmt(qualAvg)}</strong></div>
  1757. `;
  1758. }
  1759. const groups = scoreGroupsOld;
  1760. return groups.map(g => {
  1761. if (!isNewSchema && g.id === 'filter') {
  1762. const pr = it.production_relevance, rh = it.recency_hard, ov = it.overall;
  1763. const f = (v, max) => (v == null || !Number.isFinite(v)) ? '-' : (max === 5 ? (typeof v === 'number' ? v.toFixed(1) : v) : v);
  1764. return `<div class="group-pill" title="${g.hint || ''}"><span>${g.short}</span><strong style="font-size:12px;">${f(pr, 3)}·${f(rh, 3)}·${f(ov, 5)}</strong></div>`;
  1765. }
  1766. const a = groupAverage(it, g, isNewSchema);
  1767. return `<div class="group-pill"><span>${g.short}</span><strong>${fmt(a)}</strong></div>`;
  1768. }).join("");
  1769. }
  1770. // filter 组:数据从 it 顶层、量程按 filterMax 归一化到 5 量程(meter 的 --v*20% 公式不动)
  1771. function renderScoreGroup(it, g) {
  1772. const isFilter = g.id === 'filter';
  1773. const keys = g.topLevelKeys || g.keys;
  1774. const src = isFilter ? it : it.scores;
  1775. if (!src) return '';
  1776. const labels = isFilter ? filterLabels : commonLabels;
  1777. const rows = keys.map(k => {
  1778. const v = src[k];
  1779. const m = !Number.isFinite(v);
  1780. const max = isFilter ? (filterMax[k] || 5) : 5;
  1781. const meterV = m ? 0 : (v * 5 / max);
  1782. const suffix = isFilter && max !== 5 ? `/${max}` : '';
  1783. const valStr = m ? '-' : (typeof v === 'number' ? (Number.isInteger(v) ? v : v.toFixed(1)) : v);
  1784. const reason = (it.score_reasons) ? it.score_reasons[k] : '';
  1785. const infoIcon = reason ? `<span class="info-icon" onclick="pinScoreReason(this, '${esc(labels[k] || k)}', '${esc(k)}')" title="点击定格查看评判理由" style="margin-left: 5px; cursor: pointer; color: var(--muted); opacity: 0.7; font-size: 11px; font-weight: normal; user-select: none;">ⓘ</span>` : '';
  1786. return `<div class="score-row ${m ? 'missing' : ''}"><span>${labels[k] || k}</span><div class="meter" style="--v:${meterV}"><span></span></div><strong style="display: inline-flex; align-items: center;">${valStr}${suffix}${infoIcon}</strong></div>`;
  1787. }).join("");
  1788. const headRight = isFilter ? (g.hint ? `<small>${g.hint}</small>` : '') : `<small>均分 ${fmt(groupAverage(it, g))}</small>`;
  1789. return `<section class="score-group"><div class="score-group-head"><span>${g.title}</span>${headRight}</div><div class="score-group-body">${rows}</div></section>`;
  1790. }
  1791. function curDims() {
  1792. if (st.qi === -1) { if (openCell) { const ai = +openCell.dataset.ai, ti = +openCell.dataset.ti; return { type: TYPES[ti].name, action: ACTIONS[ai].name }; } return {}; }
  1793. const q = DATA.queries[st.qi]; return (q && q.dims) ? q.dims : {};
  1794. }
  1795. function spans(arr, key) { const o = []; let cur = null, s = 0; arr.forEach((x, i) => { if (x[key] !== cur) { if (cur !== null) o.push([cur, s, i - s]); cur = x[key]; s = i; } }); o.push([cur, s, arr.length - s]); return o; }
  1796. const l1sp = spans(ACTIONS, 'l1'), l2sp = spans(ACTIONS, 'l2');
  1797. const l1Start = new Set(l1sp.map(s => s[1])), l2Start = new Set(l2sp.map(s => s[1]));
  1798. function detectLens(q) {
  1799. const text = (q.original_q || (q.forms && q.forms[0] && q.forms[0].query) || "").toLowerCase();
  1800. if (/流程|步骤|教程|方法|教学|SOP|pipeline|工序/.test(text)) return '工序';
  1801. if (/一键|自动|直出|秒出|同款|复刻|效果|技巧|能力/.test(text)) return '能力';
  1802. if (/用什么|软件|工具|推荐|哪个好用|有哪些/.test(text)) return '工具';
  1803. return '工序';
  1804. }
  1805. function findQuery(aName, tName, lens, tool) {
  1806. const matches = DATA.queries.filter(q => {
  1807. if (!q.dims || q.dims.action !== aName || q.dims.type !== tName) return false;
  1808. const qLens = detectLens(q);
  1809. if (qLens !== lens) return false;
  1810. const hasToolConstraint = q.dims.constraint && q.dims.constraint.kind === "工具类型";
  1811. if (tool) {
  1812. if (!hasToolConstraint || q.dims.constraint.value !== tool) return false;
  1813. }
  1814. return true;
  1815. });
  1816. if (matches.length > 0) {
  1817. matches.sort((x, y) => {
  1818. if (!tool) {
  1819. const hasX = x.dims.constraint && x.dims.constraint.kind === "工具类型";
  1820. const hasY = y.dims.constraint && y.dims.constraint.kind === "工具类型";
  1821. if (hasX !== hasY) return hasX ? 1 : -1;
  1822. }
  1823. return (y.hits || 0) - (x.hits || 0);
  1824. });
  1825. return matches[0];
  1826. }
  1827. return null;
  1828. }
  1829. function selectQueryByActiveCellAndControls(aName, tName) {
  1830. const activeTool = st.tools[0] || null;
  1831. let match = findQuery(aName, tName, st.lens, activeTool);
  1832. const isProcedureView = st.matrixView === 'procedures';
  1833. const isHitsView = st.matrixView === 'hits';
  1834. const hasContent = q => {
  1835. if (isProcedureView) return getFormProcedureCount(q) > 0;
  1836. if (isHitsView) return getFormReportCount(q) > 0;
  1837. return q.hits > 0;
  1838. };
  1839. if (match) {
  1840. st.qi = DATA.queries.indexOf(match);
  1841. const fi = match.forms.findIndex(f => f.form === st.form);
  1842. st.fi = fi >= 0 ? fi : 0;
  1843. st.selectedAction = aName;
  1844. st.selectedType = tName;
  1845. } else {
  1846. // Fallback: search for any query matching active lens & tool constraint with hits
  1847. const matches = DATA.queries.filter(q => {
  1848. if (!q.dims || !q.dims.action || !q.dims.type) return false;
  1849. const qLens = detectLens(q);
  1850. if (qLens !== st.lens) return false;
  1851. const hasToolConstraint = q.dims.constraint && q.dims.constraint.kind === "工具类型";
  1852. if (activeTool) {
  1853. if (!hasToolConstraint || q.dims.constraint.value !== activeTool) return false;
  1854. } else {
  1855. if (hasToolConstraint) return false;
  1856. }
  1857. return hasContent(q);
  1858. });
  1859. if (matches.length > 0) {
  1860. matches.sort((x, y) => {
  1861. if (!activeTool) {
  1862. const hasX = x.dims.constraint && x.dims.constraint.kind === "工具类型";
  1863. const hasY = y.dims.constraint && y.dims.constraint.kind === "工具类型";
  1864. if (hasX !== hasY) return hasX ? 1 : -1;
  1865. }
  1866. const countX = isProcedureView ? getFormProcedureCount(x) : (isHitsView ? getFormReportCount(x) : x.hits);
  1867. const countY = isProcedureView ? getFormProcedureCount(y) : (isHitsView ? getFormReportCount(y) : y.hits);
  1868. return countY - countX;
  1869. });
  1870. const anyMatch = matches[0];
  1871. st.qi = DATA.queries.indexOf(anyMatch);
  1872. const fi = anyMatch.forms.findIndex(f => f.form === st.form);
  1873. st.fi = fi >= 0 ? fi : 0;
  1874. st.selectedAction = anyMatch.dims.action;
  1875. st.selectedType = anyMatch.dims.type;
  1876. } else {
  1877. st.qi = -1;
  1878. st.fi = 0;
  1879. }
  1880. }
  1881. }
  1882. function getFormReportCount(q) {
  1883. const f = q.forms && q.forms.find(x => x.form === st.form);
  1884. if (!f || !f.results) return 0;
  1885. return f.results.filter(r => !r.anomaly && !isItemDiscarded(r)).length;
  1886. }
  1887. function getFormProcedureCount(q) {
  1888. const f = q.forms && q.forms.find(x => x.form === st.form);
  1889. if (!f || !f.results) return 0;
  1890. return f.results.filter(r => !r.anomaly && !isItemDiscarded(r) && r.procedure_html).length;
  1891. }
  1892. function getFilteredHitsMap() {
  1893. const cm = {};
  1894. const activeTool = st.tools[0] || null;
  1895. const isProcedureView = st.matrixView === 'procedures';
  1896. DATA.queries.forEach((q, i) => {
  1897. const d = q.dims;
  1898. if (!d || !d.type || !d.action) return;
  1899. // Filter by lens
  1900. if (detectLens(q) !== st.lens) return;
  1901. // Filter by active tool constraint
  1902. const hasToolConstraint = d.constraint && d.constraint.kind === "工具类型";
  1903. if (activeTool) {
  1904. if (!hasToolConstraint || d.constraint.value !== activeTool) return;
  1905. } else {
  1906. if (hasToolConstraint) return;
  1907. }
  1908. const k = d.type + '|' + d.action;
  1909. const h = isProcedureView ? getFormProcedureCount(q) : getFormReportCount(q);
  1910. if (!cm[k] || h > cm[k].hits) {
  1911. cm[k] = { i, hits: h };
  1912. }
  1913. });
  1914. return cm;
  1915. }
  1916. function renderMatrix() {
  1917. const viewMode = st.matrixView || 'full';
  1918. const showFull = viewMode === 'full';
  1919. const cm = getFilteredHitsMap();
  1920. const activeActions = showFull ? ACTIONS : ACTIONS.filter(a => TYPES.some(t => {
  1921. const c = cm[t.name + '|' + a.name];
  1922. return c && c.hits > 0;
  1923. }));
  1924. const activeTypes = showFull ? TYPES : TYPES.filter(t => ACTIONS.some(a => {
  1925. const c = cm[t.name + '|' + a.name];
  1926. return c && c.hits > 0;
  1927. }));
  1928. const displayActions = activeActions.length ? activeActions : ACTIONS;
  1929. const displayTypes = activeTypes.length ? activeTypes : TYPES;
  1930. const l1sp = spans(displayActions, 'l1'), l2sp = spans(displayActions, 'l2');
  1931. const l1Start = new Set(l1sp.map(s => s[1])), l2Start = new Set(l2sp.map(s => s[1]));
  1932. let h = '<thead><tr class="l1"><th class="corner" rowspan="3">类型 \ 动作</th>' + l1sp.map(([v, s, c]) => `<th colspan="${c}" class="l1div">${v}</th>`).join('') + '</tr>';
  1933. h += '<tr class="l2">' + l2sp.map(([v, s, c]) => `<th colspan="${c}" class="${l1Start.has(s) ? 'l1div' : 'l2div'}">${v}</th>`).join('') + '</tr>';
  1934. h += '<tr class="leaf">' + displayActions.map((a, i) => `<th data-ai="${ACTIONS.indexOf(a)}" class="${l1Start.has(i) ? 'l1div' : (l2Start.has(i) ? 'l2div' : '')}">${a.name}</th>`).join('') + '</tr></thead><tbody>';
  1935. const typeCategories = ['程序控制类型', '数据复用类型', '内容类型', '知识类型'];
  1936. typeCategories.forEach(l1 => {
  1937. const catTypes = displayTypes.filter(t => t.l1 === l1);
  1938. if (catTypes.length === 0) return;
  1939. h += `<tr class="l1row"><td colspan="${displayActions.length + 1}">${l1}</td></tr>`;
  1940. catTypes.forEach((t) => {
  1941. h += `<tr data-type="${t.name}"><th class="rh" data-ti="${TYPES.indexOf(t)}">${t.name}</th>` + displayActions.map((a) => {
  1942. const ai = ACTIONS.indexOf(a);
  1943. const ti = TYPES.indexOf(t);
  1944. const cell = (DATA.matrix && DATA.matrix[ai]) ? (DATA.matrix[ai][ti] || {}) : {};
  1945. const s = cell.tier !== undefined ? cell.tier : cell.s;
  1946. const cls = (s === null || s === undefined) ? 'tNA' : ('t' + s);
  1947. const isSel = (st.selectedAction === a.name && st.selectedType === t.name) ? ' sel' : '';
  1948. return `<td class="cell ${cls}${isSel}" data-ai="${ai}" data-ti="${ti}"></td>`;
  1949. }).join('') + '</tr>';
  1950. });
  1951. });
  1952. document.getElementById('comboMx').innerHTML = h + '</tbody>';
  1953. refresh();
  1954. applyCrosshair();
  1955. }
  1956. // 点中 cell 时浅高亮整行整列(含 row/col 表头),方便定位
  1957. function applyCrosshair() {
  1958. document.querySelectorAll('.rowsel,.colsel').forEach(el => el.classList.remove('rowsel', 'colsel'));
  1959. const ai = st.selectedAction ? ACTIONS.findIndex(a => a.name === st.selectedAction) : -1;
  1960. const ti = st.selectedType ? TYPES.findIndex(t => t.name === st.selectedType) : -1;
  1961. if (ai < 0 && ti < 0) return;
  1962. document.querySelectorAll(`#comboMx [data-ai="${ai}"]`).forEach(el => el.classList.add('colsel'));
  1963. document.querySelectorAll(`#comboMx [data-ti="${ti}"]`).forEach(el => el.classList.add('rowsel'));
  1964. }
  1965. function refresh() {
  1966. const cm = getFilteredHitsMap();
  1967. document.querySelectorAll('tr[data-type]').forEach(tr => {
  1968. const ty = tr.dataset.type;
  1969. tr.querySelectorAll('td.cell').forEach(td => {
  1970. const ai = +td.dataset.ai, ti = +td.dataset.ti, a = ACTIONS[ai];
  1971. const cell = (DATA.matrix && DATA.matrix[ai]) ? (DATA.matrix[ai][ti] || {}) : {};
  1972. const s = cell.tier !== undefined ? cell.tier : cell.s;
  1973. const c = cm[ty + '|' + a.name];
  1974. const hits = c ? c.hits : 0;
  1975. td.textContent = genQ(a.name, ty);
  1976. if (hits > 0) {
  1977. const badge = document.createElement('span');
  1978. badge.className = 'hit-badge';
  1979. badge.textContent = hits;
  1980. td.appendChild(badge);
  1981. }
  1982. td.classList.toggle('hide', (s == null ? 0 : s) < (+st.tier));
  1983. const hitsLabel = st.matrixView === 'procedures' ? '有工序' : '命中';
  1984. td.title = `${ty} × ${a.name}\nGemini评分: ${(s === null || s === undefined) ? '未判' : ['无效', '低', '中', '高'][s]}\n当前 form(${st.form}) ${hitsLabel}: ${hits} 篇`;
  1985. });
  1986. });
  1987. }
  1988. const pop = document.getElementById('pop'); let openCell = null;
  1989. function showPop(td, x, y) {
  1990. openCell = td;
  1991. const ai = +td.dataset.ai, ti = +td.dataset.ti, a = ACTIONS[ai], t = TYPES[ti];
  1992. const cell = (DATA.matrix && DATA.matrix[ai]) ? (DATA.matrix[ai][ti] || {}) : {};
  1993. const s = cell.tier !== undefined ? cell.tier : cell.s;
  1994. const tn = (s == null) ? '未判' : ['无效', '低', '中', '高'][s], tb = (s == null) ? 'NA' : s;
  1995. const gen = genForms(a.name, t.name, st.lens, toolPrefix(st.lens));
  1996. // Find matching query in database for this cell
  1997. const activeTool = st.tools[0] || null;
  1998. const matches = DATA.queries.filter(q => {
  1999. if (!q.dims || q.dims.action !== a.name || q.dims.type !== t.name) return false;
  2000. const qLens = detectLens(q);
  2001. if (qLens !== st.lens) return false;
  2002. const hasToolConstraint = q.dims.constraint && q.dims.constraint.kind === "工具类型";
  2003. if (activeTool) {
  2004. if (!hasToolConstraint || q.dims.constraint.value !== activeTool) return false;
  2005. } else {
  2006. if (hasToolConstraint) return false;
  2007. }
  2008. return true;
  2009. });
  2010. let dbQuery = null;
  2011. if (matches.length > 0) {
  2012. matches.sort((x, y) => (y.hits || 0) - (x.hits || 0));
  2013. dbQuery = matches[0];
  2014. }
  2015. const dbFormMap = {};
  2016. if (dbQuery) {
  2017. dbQuery.forms.forEach(f => {
  2018. dbFormMap[f.form] = f.query;
  2019. });
  2020. }
  2021. const formKeys = ['A', 'B', 'C'];
  2022. let html = `<span class="close">×</span>
  2023. <div class="pt">
  2024. <span class="path a">${a.l1}›${a.l2}›${a.name}</span>
  2025. <span class="path t">${t.l1}›${t.name}</span>
  2026. <span class="path" style="background: var(--soft-amber); color: var(--amber); font-family: monospace; font-weight: bold; border: 1px solid rgba(184, 121, 24, 0.2);">${dbQuery ? dbQuery.key : '未匹配'}</span>
  2027. <span class="tier tb${tb}">gemini·${tn}</span>
  2028. </div>
  2029. <div class="reason${s === 0 ? ' inv' : ''}">${esc(cell.r || '(模型未给该格评分)')}</div>
  2030. <div class="lbl">系统生成 · 知识类型=${st.lens}${st.tools.length ? ' · 工具类型=' + st.tools.join('/') : ''}</div>
  2031. <ul>` + gen.map(([fName, genQStr], idx) => {
  2032. const formKey = formKeys[idx];
  2033. const actualQ = dbFormMap[formKey];
  2034. const isCurrent = formKey === st.form;
  2035. let content = `<span class="fm">${fName}</span>${esc(genQStr)}`;
  2036. if (actualQ) {
  2037. if (actualQ !== genQStr) {
  2038. content += `<div style="font-size: 13px; margin-top: 6px; color: #047857; font-weight: 600; font-family: ui-monospace, Menlo, Monaco, Consolas, monospace; line-height: 1.45; background: #ecfdf5; border: 1px dashed #34d399; padding: 6px 10px; border-radius: 6px; width: 100%; box-sizing: border-box; display: flex; align-items: center; gap: 4px; box-shadow: inset 0 1px 2px rgba(4, 120, 87, 0.04);">
  2039. <span style="background: #10b981; padding: 2px 6px; border-radius: 4px; font-size: 11px; color: #fff; font-weight: bold; font-family: -apple-system, sans-serif; white-space: nowrap;">实际搜索</span>
  2040. <span style="word-break: break-all; font-family: inherit;">${esc(actualQ)}</span>
  2041. </div>`;
  2042. } else {
  2043. content += `<div style="font-size: 13px; margin-top: 6px; color: #374151; font-weight: 600; font-family: ui-monospace, Menlo, Monaco, Consolas, monospace; line-height: 1.45; background: #f9fafb; border: 1px dashed #d1d5db; padding: 6px 10px; border-radius: 6px; width: 100%; box-sizing: border-box; display: flex; align-items: center; gap: 4px; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);">
  2044. <span style="background: #9ca3af; padding: 2px 6px; border-radius: 4px; font-size: 11px; color: #fff; font-weight: bold; font-family: -apple-system, sans-serif; white-space: nowrap;">实际搜索</span>
  2045. <span style="font-style: italic; font-family: inherit; color: #6b7280;">(同上)</span>
  2046. </div>`;
  2047. }
  2048. }
  2049. return `<li class="gen${isCurrent ? ' cur' : ''}" style="display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 6px 8px;">${content}</li>`;
  2050. }).join('') + '</ul>';
  2051. pop.innerHTML = html;
  2052. pop.style.display = 'block';
  2053. pop.style.left = Math.max(8, Math.min(x, window.innerWidth - 466)) + 'px';
  2054. pop.style.top = Math.max(8, Math.min(y, window.innerHeight - pop.offsetHeight - 12)) + 'px';
  2055. pop.querySelector('.close').onclick = () => {
  2056. pop.style.display = 'none';
  2057. openCell = null;
  2058. };
  2059. }
  2060. function computeStats() {
  2061. const stat = { "0": 0, "1": 0, "2": 0, "3": 0, "na": 0 };
  2062. if (DATA.matrix) {
  2063. DATA.matrix.forEach(row => row.forEach(cell => {
  2064. const s = cell ? (cell.tier !== undefined ? cell.tier : cell.s) : null;
  2065. if (s === null || s === undefined) stat["na"]++;
  2066. else if (stat[s] !== undefined) stat[s]++;
  2067. }));
  2068. }
  2069. document.getElementById('s3').textContent = stat['3'];
  2070. document.getElementById('s2').textContent = stat['2'];
  2071. document.getElementById('s1').textContent = stat['1'];
  2072. document.getElementById('s0').textContent = stat['0'];
  2073. document.getElementById('sna').textContent = stat['na'];
  2074. }
  2075. function renderFormsChan() {
  2076. const q = st.qi === -1 ? null : DATA.queries[st.qi];
  2077. if (!q) {
  2078. document.getElementById("navC").innerHTML = '';
  2079. return;
  2080. }
  2081. const f = curForm();
  2082. if (!f) {
  2083. document.getElementById("navC").innerHTML = '';
  2084. return;
  2085. }
  2086. const isProcedureView = st.matrixView === 'procedures';
  2087. const resultsFilter = r => {
  2088. if (isProcedureView) {
  2089. return r.procedure_html && r.procedure_html !== "";
  2090. }
  2091. return true;
  2092. };
  2093. const filteredResults = f.results.filter(resultsFilter);
  2094. const chans = ["all", ...f.platforms];
  2095. document.getElementById("navC").innerHTML = chans.map(c => {
  2096. const n = c === "all" ? filteredResults.length : filteredResults.filter(r => r.platformKey === c).length;
  2097. return `<span class="tab ${c === st.channel ? 'on' : ''}" data-c="${c}">${c === "all" ? "全部" : (PLATC[c] || c)} <small>${n}</small></span>`;
  2098. }).join("");
  2099. }
  2100. function renderNav() { renderMatrix(); renderFormsChan(); }
  2101. function renderHead() {
  2102. const f = curForm();
  2103. if (!f) return;
  2104. const q = DATA.queries[st.qi];
  2105. if (q) {
  2106. document.getElementById("lede").innerHTML = `当前选中 Query ID: <span style="font-family: monospace; font-weight: 700; background: var(--soft-amber); color: var(--amber); padding: 2px 8px; border-radius: 4px; font-size: 15px; border: 1px solid rgba(184, 121, 24, 0.2);">${esc(q.key)}</span> · 检索语句: <span style="font-weight: 600; color: var(--ink);">${esc(q.original_q)}</span>`;
  2107. } else {
  2108. document.getElementById("lede").textContent = "";
  2109. }
  2110. let it = f.results;
  2111. if (st.matrixView === 'procedures') {
  2112. it = it.filter(r => r.procedure_html && r.procedure_html !== "");
  2113. }
  2114. if (st.channel !== "all") it = it.filter(r => r.platformKey === st.channel);
  2115. const valid = it.filter(r => !r.anomaly);
  2116. const rep = valid.filter(r => !isItemDiscarded(r)).length;
  2117. const dis = valid.filter(r => isItemDiscarded(r)).length;
  2118. const anom = it.filter(r => r.anomaly).length;
  2119. const avg = (valid.reduce((s, r) => s + r.overall, 0) / (valid.length || 1)).toFixed(1);
  2120. const lab = st.channel === "all" ? "该形式结果数" : (PLATC[st.channel] || st.channel) + " 结果数";
  2121. document.getElementById("stats").innerHTML = [[it.length, lab], [rep, "建议上报"], [avg, "平均综合分 / 5"], [dis, "丢弃"], [anom, "异常"]].map(([n, l]) => `<div class="stat"><strong>${n}</strong><span>${l}</span></div>`).join("");
  2122. }
  2123. // POST /api/reeval —— 后台只对当前 query 的所有 form 文件复评(不重新搜索);
  2124. // server.py 立即返回 {status:'started', pid, log},前端开启轮询自动扫描刷新。
  2125. function reevalCurrentQuery() {
  2126. if (st.qi === -1 || !DATA.queries[st.qi]) { alert('请先选一个 query 再重评'); return; }
  2127. const q = DATA.queries[st.qi].key;
  2128. if (!confirm(`重评 ${q} 的所有帖子(A/B/C 三种 form)?\n约 1-3 分钟(视帖子数),过程中页面可继续浏览。\n完成后会自动重新扫描并更新页面。`)) return;
  2129. const btn = document.getElementById('reevalBtn');
  2130. btn.disabled = true; btn.textContent = '♻️ 提交中…';
  2131. fetch('/api/reeval', {
  2132. method: 'POST', headers: { 'Content-Type': 'application/json' },
  2133. body: JSON.stringify({ q }),
  2134. }).then(r => r.json().then(d => ({ ok: r.ok, d }))).then(({ ok, d }) => {
  2135. if (ok && d.status === 'started') {
  2136. if (!DATA.active_reevals) DATA.active_reevals = {};
  2137. DATA.active_reevals[q] = "running";
  2138. btn.textContent = `♻️ 重评中 ${q}...`;
  2139. startReevalPolling(q);
  2140. } else {
  2141. btn.disabled = false; btn.textContent = '♻️ 重评当前 query';
  2142. alert('启动失败:' + (d.error || JSON.stringify(d)));
  2143. }
  2144. }).catch(e => {
  2145. btn.disabled = false; btn.textContent = '♻️ 重评当前 query';
  2146. alert('请求失败:' + e);
  2147. });
  2148. }
  2149. function sortedItems() {
  2150. const f = curForm();
  2151. if (!f) return [];
  2152. let it = f.results.slice();
  2153. if (st.matrixView === 'procedures') {
  2154. it = it.filter(r => r.procedure_html && r.procedure_html !== "");
  2155. }
  2156. if (st.channel !== "all") it = it.filter(r => r.platformKey === st.channel);
  2157. const s = document.getElementById("sort").value;
  2158. const decWeight = r => (r.anomaly ? 2 : (isItemDiscarded(r) ? 1 : 0));
  2159. it.sort((a, b) => {
  2160. const wA = decWeight(a), wB = decWeight(b);
  2161. if (wA !== wB) return wA - wB;
  2162. if (s === "score") return b.overall - a.overall;
  2163. if (s === "date") return (b.date || "").localeCompare(b.date || "");
  2164. if (s === "platform") return (a.platform || "").localeCompare(b.platform || "", "zh-Hans") || b.overall - a.overall;
  2165. return 0;
  2166. });
  2167. return it;
  2168. }
  2169. function renderGrid() {
  2170. VIEW = sortedItems();
  2171. document.getElementById("grid").innerHTML = VIEW.map((it, idx) => {
  2172. const imgs = it.images.length ? it.images.slice(0, 3).map(s => `<img src="${esc(s)}" referrerpolicy="no-referrer" loading="lazy" onerror="this.src='${NOIMG}'">`).join("") : `<img src="${NOIMG}">`;
  2173. const isNewSchema = it.scores && (it.scores.relevance_production !== undefined || it.scores.relevance_query !== undefined);
  2174. let bars = "";
  2175. if (isNewSchema) {
  2176. const relAvg = groupAverage(it, scoreGroupsNew[0], true) || 0;
  2177. const qualAvg = getQualityAverage(it) || 0;
  2178. const newBars = [
  2179. { label: "相关性评分 (均分)", v: relAvg },
  2180. { label: "质量评分 (均分)", v: qualAvg }
  2181. ];
  2182. bars = newBars.map(b => {
  2183. const w = b.v * 10;
  2184. return `<span title="${esc(b.label)} ${b.v.toFixed(1)}"><span class="fill" style="width:${w}%; background: #2563eb;"></span></span>`;
  2185. }).join("");
  2186. } else {
  2187. const oldKeys = ["relevance", "result_quality", "credibility", "novelty_coverage", "concrete_use_case"];
  2188. bars = oldKeys.map(k => {
  2189. const val = it.scores[k] !== undefined ? parseFloat(it.scores[k]) : 0;
  2190. const w = val * 20;
  2191. return `<span title="${esc(commonLabels[k] || k)} ${val}"><span class="fill" style="width:${w}%;"></span></span>`;
  2192. }).join("");
  2193. }
  2194. const isDiscard = isItemDiscarded(it);
  2195. let discardReason = it.reason || '未提供过滤原因';
  2196. if (it.production_relevance !== null && it.production_relevance !== undefined) {
  2197. const input = document.getElementById("relThreshold");
  2198. const threshold = input ? parseFloat(input.value) : (isNewSchema ? 4.0 : 2.0);
  2199. const relVal = parseFloat(it.production_relevance);
  2200. if (!isNaN(relVal) && relVal < threshold) {
  2201. discardReason = `相关性得分 (${relVal}) 低于过滤阈值 (${threshold})`;
  2202. }
  2203. }
  2204. const discardOverlayHtml = isDiscard ? `
  2205. <div class="discard-overlay">
  2206. <div class="discard-badge">Discarded</div>
  2207. <div class="discard-reason">${esc(discardReason)}</div>
  2208. </div>
  2209. ` : '';
  2210. return `<article class="result ${isDiscard ? 'discard' : ''}">
  2211. ${discardOverlayHtml}
  2212. <div class="thumbs">${imgs}</div>
  2213. <div class="body">
  2214. <div class="meta"><span class="platform p-${esc(it.platformKey)}">${esc(it.platform)}</span><span>${esc(it.date)} · ${esc(it.engagement)}</span></div>
  2215. <h2>${esc(it.title)}</h2>
  2216. <div class="excerpt">${esc(it.text)}</div>
  2217. <div class="tags">${it.tools.slice(0, 4).map(t => `<span class="tag">${esc(t)}</span>`).join("")}</div>
  2218. <div class="scorebar">
  2219. <div class="overall">
  2220. <div>
  2221. <div class="score">${it.anomaly ? '—' : it.overall.toFixed(1)}</div>
  2222. <small>综合分</small>
  2223. </div>
  2224. <div class="decision ${it.anomaly ? '' : it.decision}">${it.anomaly ? '异常' : esc(it.decision)}</div>
  2225. </div>
  2226. <div class="mini-bars ${isNewSchema ? 'new-schema' : ''}">${bars}</div>
  2227. <div class="group-snapshot ${isNewSchema ? 'new-schema' : ''}">${groupSnapshot(it)}</div>
  2228. <div class="actions">
  2229. <button onclick="openDetail(${idx})">查看详情</button>
  2230. <a href="${esc(it.url)}" target="_blank" rel="noreferrer">原链接</a>
  2231. </div>
  2232. </div>
  2233. </div>
  2234. </article>`;
  2235. }).join("") || (st.qi === -1 ? '<p style="color:var(--muted);padding: 20px 0;text-align:center;grid-column: 1 / -1;">该组合暂无数据库扫描结果。</p>' : '<p style="color:var(--muted);grid-column: 1 / -1;">该渠道无结果</p>');
  2236. }
  2237. const ENGINE_MODELS = {
  2238. cyber_runner: [
  2239. { value: "google/gemini-3.1-flash-lite", text: "google/gemini-3.1-flash-lite (默认)" },
  2240. { value: "google/gemini-2.5-flash", text: "google/gemini-2.5-flash" },
  2241. { value: "openai/gpt-4o", text: "openai/gpt-4o" },
  2242. { value: "anthropic/claude-3.5-sonnet", text: "anthropic/claude-3.5-sonnet" }
  2243. ],
  2244. claude_sdk: [
  2245. { value: "claude-sonnet-4-6", text: "claude-sonnet-4-6 (默认)" },
  2246. { value: "claude-haiku-4-6", text: "claude-haiku-4-6" }
  2247. ]
  2248. };
  2249. function onProcEngineChange() {
  2250. const engine = document.getElementById("procEngineSelect").value;
  2251. const modelSelect = document.getElementById("procModelSelect");
  2252. modelSelect.innerHTML = ENGINE_MODELS[engine].map(m => `<option value="${m.value}">${m.text}</option>`).join("");
  2253. }
  2254. function getShortCaseFolder(form, case_id) {
  2255. const match = case_id.match(/^([a-z]+)_([0-9a-f]{8})/i);
  2256. const short = match ? `${match[1]}_${match[2]}` : case_id.substring(0, 20);
  2257. return `${form}_${short}`;
  2258. }
  2259. function checkProcedureState(it) {
  2260. if (procPollInterval) {
  2261. clearInterval(procPollInterval);
  2262. procPollInterval = null;
  2263. }
  2264. currentProcTask = {
  2265. q: it.run,
  2266. form: st.form,
  2267. case_id: it.case_id,
  2268. procedure_html: it.procedure_html
  2269. };
  2270. isLogViewActive = false;
  2271. document.getElementById("procStatusText").textContent = "正在检测工序状态...";
  2272. document.getElementById("procActionBtns").innerHTML = "";
  2273. document.getElementById("procSetupPanel").style.display = "none";
  2274. document.getElementById("procConsolePanel").style.display = "none";
  2275. document.getElementById("procedureIframe").style.display = "none";
  2276. const url = `/api/procedure_status?q=${it.run}&form=${st.form}&case_id=${it.case_id}`;
  2277. fetch(url)
  2278. .then(r => r.json())
  2279. .then(d => {
  2280. if (d.status === "running") {
  2281. showProcConsole("running");
  2282. pollProcLogs();
  2283. } else if (d.status === "success") {
  2284. showProcIframe(it.procedure_html);
  2285. } else if (d.status === "failed") {
  2286. showProcSetup(d.error);
  2287. } else {
  2288. showProcSetup();
  2289. }
  2290. })
  2291. .catch(err => {
  2292. showProcSetup("检查状态失败: " + err);
  2293. });
  2294. }
  2295. function showProcSetup(errorMsg) {
  2296. document.getElementById("procSetupPanel").style.display = "flex";
  2297. document.getElementById("procConsolePanel").style.display = "none";
  2298. document.getElementById("procedureIframe").style.display = "none";
  2299. const statusText = document.getElementById("procStatusText");
  2300. if (errorMsg) {
  2301. statusText.innerHTML = `<span style="color:var(--rose)">提取失败: ${esc(errorMsg)}</span>`;
  2302. } else {
  2303. statusText.textContent = "未生成工序";
  2304. }
  2305. document.getElementById("procActionBtns").innerHTML = "";
  2306. document.getElementById("startProcBtn").disabled = false;
  2307. document.getElementById("startProcBtn").textContent = "开始提取工序";
  2308. onProcEngineChange();
  2309. }
  2310. function showProcConsole(status) {
  2311. document.getElementById("procSetupPanel").style.display = "none";
  2312. document.getElementById("procConsolePanel").style.display = "flex";
  2313. document.getElementById("procedureIframe").style.display = "none";
  2314. const statusText = document.getElementById("procStatusText");
  2315. const consoleStatus = document.getElementById("procConsoleStatus");
  2316. if (status === "running") {
  2317. statusText.innerHTML = `<span>⏳ 正在提取工序中...</span>`;
  2318. consoleStatus.textContent = "running";
  2319. document.getElementById("procActionBtns").innerHTML = `<button class="btn" style="background:#f3f4f6" disabled>正在生成...</button>`;
  2320. } else if (status === "failed") {
  2321. statusText.innerHTML = `<span style="color:var(--rose)">❌ 提取失败</span>`;
  2322. consoleStatus.textContent = "failed";
  2323. document.getElementById("procActionBtns").innerHTML = `
  2324. <button class="btn" onclick="toggleCompletedLogs()">查看日志</button>
  2325. <button class="btn" style="background:var(--rose); color:#fff; border-color:var(--rose)" onclick="resetToSetup()">重试提取</button>
  2326. `;
  2327. }
  2328. }
  2329. function resetToSetup() {
  2330. showProcSetup();
  2331. }
  2332. function showProcIframe(htmlPath) {
  2333. document.getElementById("procSetupPanel").style.display = "none";
  2334. document.getElementById("procConsolePanel").style.display = "none";
  2335. const iframe = document.getElementById("procedureIframe");
  2336. iframe.style.display = "block";
  2337. iframe.src = "/" + htmlPath;
  2338. document.getElementById("procStatusText").innerHTML = `<span style="color:var(--mint)">✓ 工序已生成</span>`;
  2339. document.getElementById("procActionBtns").innerHTML = `
  2340. <button class="btn" id="btnToggleLogs" onclick="toggleCompletedLogs()">📋 查看提取日志</button>
  2341. <button class="btn" style="background:var(--rose); color:#fff; border-color:var(--rose);" onclick="regenerateProcedureConfirm()">♻️ 重新生成</button>
  2342. `;
  2343. }
  2344. function toggleCompletedLogs() {
  2345. const iframe = document.getElementById("procedureIframe");
  2346. const consolePanel = document.getElementById("procConsolePanel");
  2347. const toggleBtn = document.getElementById("btnToggleLogs");
  2348. if (isLogViewActive) {
  2349. consolePanel.style.display = "none";
  2350. iframe.style.display = "block";
  2351. if (toggleBtn) toggleBtn.textContent = "📋 查看提取日志";
  2352. isLogViewActive = false;
  2353. } else {
  2354. iframe.style.display = "none";
  2355. consolePanel.style.display = "flex";
  2356. if (toggleBtn) toggleBtn.textContent = "👁️ 返回工序效果";
  2357. isLogViewActive = true;
  2358. fetchLogsOnce();
  2359. }
  2360. }
  2361. function fetchLogsOnce() {
  2362. const consoleOutput = document.getElementById("procConsoleOutput");
  2363. consoleOutput.textContent = "正在加载日志...";
  2364. const url = `/api/procedure_log?q=${currentProcTask.q}&form=${currentProcTask.form}&case_id=${currentProcTask.case_id}`;
  2365. fetch(url)
  2366. .then(r => r.json())
  2367. .then(d => {
  2368. consoleOutput.textContent = d.log || "没有提取日志。";
  2369. consoleOutput.scrollTop = consoleOutput.scrollHeight;
  2370. })
  2371. .catch(err => {
  2372. consoleOutput.textContent = "加载日志失败: " + err;
  2373. });
  2374. }
  2375. function startProcedureExtraction() {
  2376. const engine = document.getElementById("procEngineSelect").value;
  2377. const model = document.getElementById("procModelSelect").value;
  2378. const startBtn = document.getElementById("startProcBtn");
  2379. startBtn.disabled = true;
  2380. startBtn.textContent = "正在启动...";
  2381. const payload = {
  2382. q: currentProcTask.q,
  2383. form: currentProcTask.form,
  2384. case_id: currentProcTask.case_id,
  2385. engine: engine,
  2386. model: model
  2387. };
  2388. fetch("/api/generate_procedure", {
  2389. method: "POST",
  2390. headers: { "Content-Type": "application/json" },
  2391. body: JSON.stringify(payload)
  2392. })
  2393. .then(r => r.json().then(d => ({ ok: r.ok, d })))
  2394. .then(({ ok, d }) => {
  2395. if (ok && d.status === "started") {
  2396. showProcConsole("running");
  2397. pollProcLogs();
  2398. } else {
  2399. showProcSetup(d.error || "启动失败");
  2400. }
  2401. })
  2402. .catch(err => {
  2403. showProcSetup("网络请求错误: " + err);
  2404. });
  2405. }
  2406. function regenerateProcedureConfirm() {
  2407. if (confirm("确定要重新提取并生成工序吗?这会覆盖原有的工序文件和修改记录。")) {
  2408. showProcSetup();
  2409. }
  2410. }
  2411. function pollProcLogs() {
  2412. if (procPollInterval) {
  2413. clearInterval(procPollInterval);
  2414. }
  2415. const consoleOutput = document.getElementById("procConsoleOutput");
  2416. consoleOutput.textContent = "正在连接后台提取进程...\n";
  2417. procPollInterval = setInterval(() => {
  2418. const statusUrl = `/api/procedure_status?q=${currentProcTask.q}&form=${currentProcTask.form}&case_id=${currentProcTask.case_id}`;
  2419. fetch(statusUrl)
  2420. .then(r => r.json())
  2421. .then(d => {
  2422. if (d.status === "success") {
  2423. clearInterval(procPollInterval);
  2424. procPollInterval = null;
  2425. loadData(true);
  2426. if (d.procedure_html) {
  2427. showProcIframe(d.procedure_html);
  2428. } else {
  2429. const folder = getShortCaseFolder(currentProcTask.form, currentProcTask.case_id);
  2430. showProcIframe(`runs_full/${currentProcTask.q}/procedures/${folder}/case-${currentProcTask.case_id}.html`);
  2431. }
  2432. } else if (d.status === "failed") {
  2433. clearInterval(procPollInterval);
  2434. procPollInterval = null;
  2435. showProcConsole("failed");
  2436. }
  2437. });
  2438. const logUrl = `/api/procedure_log?q=${currentProcTask.q}&form=${currentProcTask.form}&case_id=${currentProcTask.case_id}`;
  2439. fetch(logUrl)
  2440. .then(r => r.json())
  2441. .then(d => {
  2442. if (d.log) {
  2443. const scrollAtBottom = consoleOutput.scrollTop + consoleOutput.clientHeight >= consoleOutput.scrollHeight - 50;
  2444. consoleOutput.textContent = d.log;
  2445. if (scrollAtBottom) {
  2446. consoleOutput.scrollTop = consoleOutput.scrollHeight;
  2447. }
  2448. }
  2449. });
  2450. }, 2000);
  2451. }
  2452. function switchModalTab(tabName) {
  2453. const detailTab = document.getElementById("tabDetailBtn");
  2454. const procTab = document.getElementById("tabProcedureBtn");
  2455. const detailContent = document.getElementById("modalContentDetail");
  2456. const procContent = document.getElementById("modalContentProcedure");
  2457. if (tabName === 'detail') {
  2458. detailTab.classList.add("active");
  2459. procTab.classList.remove("active");
  2460. detailContent.style.display = "grid";
  2461. procContent.style.display = "none";
  2462. } else {
  2463. detailTab.classList.remove("active");
  2464. procTab.classList.add("active");
  2465. detailContent.style.display = "none";
  2466. procContent.style.display = "flex";
  2467. }
  2468. }
  2469. function openDetail(i) {
  2470. const it = VIEW[i];
  2471. detailDialog.dataset.activeIdx = i;
  2472. currentPinnedScoreEl = null;
  2473. document.getElementById("modalMeta").innerHTML = `<span class="platform p-${esc(it.platformKey)}">${esc(it.platform)}</span><span>Query ID: <b style="font-family: monospace; color: var(--amber); background: var(--soft-amber); border: 1px solid rgba(184, 121, 24, 0.2); padding: 1px 6px; border-radius: 3px; font-size: 11px; margin-right: 8px;">${esc(it.run)}</b></span><span>${esc(it.date)} · ${esc(it.engagement)} · 质量 ${esc(it.grade)} ${esc(it.qscore)}</span>`;
  2474. document.getElementById("modalTitle").textContent = it.title;
  2475. document.getElementById("modalReason").textContent = it.reason;
  2476. document.getElementById("modalText").textContent = it.text || "(无正文)";
  2477. document.getElementById("modalImages").innerHTML = it.images.length ? it.images.map(s => `<img src="${esc(s)}" referrerpolicy="no-referrer" loading="lazy" onerror="this.style.opacity=.3">`).join("") : "<p>搜索详情未返回图片。</p>";
  2478. document.getElementById("modalTags").innerHTML = [...(it.knowledge_type || []).map(t => "类型:" + (KTM[t] || t)), ...(it.found_by || []).map(q => "命中:" + q)].map(t => `<span class="tag">${esc(t)}</span>`).join("");
  2479. const isNewSchema = it.scores && (it.scores.relevance_production !== undefined || it.scores.relevance_query !== undefined);
  2480. const maxScore = isNewSchema ? '10' : '5';
  2481. const overallVal = it.anomaly ? '—' : it.overall.toFixed(1);
  2482. const scoreColor = isNewSchema ? '#2563eb' : 'var(--mint)';
  2483. const scoreStrong = document.getElementById("modalOverallScoreVal");
  2484. if (scoreStrong) {
  2485. scoreStrong.style.color = scoreColor;
  2486. scoreStrong.innerHTML = `${overallVal}<span style="font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 2px;">/${maxScore}</span>`;
  2487. }
  2488. if (isNewSchema) {
  2489. document.getElementById("modalScores").innerHTML = renderNewScores(it);
  2490. } else {
  2491. document.getElementById("modalScores").innerHTML = scoreGroupsOld.map(g => renderScoreGroup(it, g)).join("");
  2492. }
  2493. const tabs = document.getElementById("modalTabs");
  2494. tabs.style.display = "flex";
  2495. checkProcedureState(it);
  2496. switchModalTab('detail');
  2497. detailDialog.showModal();
  2498. }
  2499. let currentPinnedScoreEl = null;
  2500. function pinScoreReason(el, label, k) {
  2501. const activeIdx = detailDialog.dataset.activeIdx;
  2502. const it = VIEW[activeIdx];
  2503. if (!it || !it.score_reasons) return;
  2504. const reason = it.score_reasons[k] || '';
  2505. let tip = document.getElementById('scoreTip');
  2506. if (!tip) {
  2507. tip = document.createElement('div');
  2508. tip.id = 'scoreTip';
  2509. tip.style.cssText = 'position: fixed; background: #ffffff; border: 1px solid #ded8ce; border-radius: 8px; box-shadow: 0 10px 25px rgba(41, 35, 28, 0.15); padding: 12px 14px; max-width: 320px; z-index: 99999; font-size: 13px; line-height: 1.5; color: #4b5563; word-break: break-all; border-left: 4px solid var(--amber); transition: opacity 0.15s ease;';
  2510. detailDialog.appendChild(tip);
  2511. }
  2512. if (currentPinnedScoreEl === el && tip.style.display === 'block') {
  2513. tip.style.display = 'none';
  2514. el.style.color = '';
  2515. currentPinnedScoreEl = null;
  2516. } else {
  2517. if (currentPinnedScoreEl) {
  2518. currentPinnedScoreEl.style.color = '';
  2519. }
  2520. tip.innerHTML = `<strong style="display:block;margin-bottom:6px;color:#b87918;">【指标判定 - ${label}】</strong>${esc(reason)}`;
  2521. tip.style.display = 'block';
  2522. el.style.color = 'var(--amber)';
  2523. currentPinnedScoreEl = el;
  2524. const elRect = el.getBoundingClientRect();
  2525. const tipWidth = tip.offsetWidth || 280;
  2526. const tipHeight = tip.offsetHeight || 80;
  2527. let left = elRect.left + elRect.width / 2 - tipWidth / 2;
  2528. let top = elRect.bottom + 8;
  2529. if (left < 10) left = 10;
  2530. if (left + tipWidth > window.innerWidth - 10) {
  2531. left = window.innerWidth - tipWidth - 10;
  2532. }
  2533. if (top + tipHeight > window.innerHeight - 10) {
  2534. top = elRect.top - tipHeight - 8;
  2535. }
  2536. tip.style.left = left + 'px';
  2537. tip.style.top = top + 'px';
  2538. }
  2539. }
  2540. // Automatically close tooltip and clear interval when modal is closed
  2541. document.getElementById('detailDialog').addEventListener('close', () => {
  2542. const tip = document.getElementById('scoreTip');
  2543. if (tip) {
  2544. tip.style.display = 'none';
  2545. }
  2546. if (currentPinnedScoreEl) {
  2547. currentPinnedScoreEl.style.color = '';
  2548. currentPinnedScoreEl = null;
  2549. }
  2550. if (procPollInterval) {
  2551. clearInterval(procPollInterval);
  2552. procPollInterval = null;
  2553. }
  2554. });
  2555. // Close tooltip when dialog scrolls
  2556. document.getElementById('detailDialog').addEventListener('scroll', () => {
  2557. const tip = document.getElementById('scoreTip');
  2558. if (tip) {
  2559. tip.style.display = 'none';
  2560. }
  2561. if (currentPinnedScoreEl) {
  2562. currentPinnedScoreEl.style.color = '';
  2563. currentPinnedScoreEl = null;
  2564. }
  2565. }, true);
  2566. const KTM = { procedure: "工序", step: "步骤", tool: "工具" };
  2567. function rerender(mxClick) {
  2568. updateThresholdLimits();
  2569. if (st.qi === -1) {
  2570. document.getElementById("stats").innerHTML = "";
  2571. document.getElementById("lede").textContent = "未找到对应的数据库 Query,请尝试切换筛选组合。";
  2572. renderFormsChan();
  2573. renderGrid();
  2574. if (!mxClick) {
  2575. document.querySelectorAll('td.cell.sel').forEach(x => x.classList.remove('sel'));
  2576. }
  2577. return;
  2578. }
  2579. if (st.qi >= DATA.queries.length) st.qi = 0;
  2580. if (st.fi >= DATA.queries[st.qi].forms.length) st.fi = 0;
  2581. if (!mxClick) {
  2582. renderMatrix();
  2583. }
  2584. renderFormsChan();
  2585. renderHead();
  2586. renderGrid();
  2587. // Sync reevalBtn state
  2588. const reevalBtn = document.getElementById('reevalBtn');
  2589. if (reevalBtn && DATA.queries[st.qi]) {
  2590. const q = DATA.queries[st.qi].key;
  2591. const status = DATA.active_reevals && DATA.active_reevals[q];
  2592. if (status === "running") {
  2593. reevalBtn.disabled = true;
  2594. reevalBtn.textContent = `♻️ 重评中 ${q}...`;
  2595. startReevalPolling(q);
  2596. } else {
  2597. reevalBtn.disabled = false;
  2598. reevalBtn.textContent = '♻️ 重评当前 query';
  2599. }
  2600. }
  2601. }
  2602. function setMatrixView(mode) {
  2603. st.matrixView = mode;
  2604. document.querySelectorAll('.g-mxview .btn').forEach(btn => {
  2605. btn.classList.remove('on');
  2606. });
  2607. if (mode === 'full') document.getElementById('btnMxFull').classList.add('on');
  2608. else if (mode === 'hits') document.getElementById('btnMxHits').classList.add('on');
  2609. else if (mode === 'procedures') document.getElementById('btnMxProcedures').classList.add('on');
  2610. if (st.selectedAction && st.selectedType) {
  2611. selectQueryByActiveCellAndControls(st.selectedAction, st.selectedType);
  2612. }
  2613. renderMatrix();
  2614. if (openCell) {
  2615. const ai = +openCell.dataset.ai, ti = +openCell.dataset.ti;
  2616. const newCell = document.querySelector(`td.cell[data-ai="${ai}"][data-ti="${ti}"]`);
  2617. if (newCell) {
  2618. showPop(newCell, parseInt(pop.style.left), parseInt(pop.style.top));
  2619. }
  2620. }
  2621. rerender(true);
  2622. }
  2623. function loadData(keep) {
  2624. fetch("/api/data").then(r => r.json()).then(d => {
  2625. DATA = d;
  2626. if (!keep) {
  2627. st = { form: 'A', lens: '工序', tools: [], tier: 0, qi: 0, fi: 0, channel: "all", matrixView: 'full', selectedAction: null, selectedType: null };
  2628. if (DATA.queries.length > 0) {
  2629. const firstQ = DATA.queries[0];
  2630. if (firstQ.dims) {
  2631. st.selectedAction = firstQ.dims.action;
  2632. st.selectedType = firstQ.dims.type;
  2633. st.lens = detectLens(firstQ);
  2634. }
  2635. }
  2636. }
  2637. // Dynamically populate tool type buttons
  2638. document.getElementById('toolBtns').innerHTML = TOOL_TYPES.map(t => `<button class="btn" data-k="tool" data-v="${t}">${t}</button>`).join('');
  2639. // Synchronize buttons states to st
  2640. document.querySelectorAll('.ctl .btn').forEach(btn => {
  2641. const k = btn.dataset.k, v = btn.dataset.v;
  2642. if (MULTI[k]) {
  2643. const ak = MULTI[k];
  2644. btn.classList.toggle('on', v === '' ? st[ak].length === 0 : st[ak].includes(v));
  2645. } else {
  2646. btn.classList.toggle('on', st[k] === v);
  2647. }
  2648. });
  2649. document.querySelectorAll('.g-mxview .btn').forEach(btn => {
  2650. btn.classList.remove('on');
  2651. });
  2652. const mv = st.matrixView || 'full';
  2653. if (mv === 'full') document.getElementById('btnMxFull').classList.add('on');
  2654. else if (mv === 'hits') document.getElementById('btnMxHits').classList.add('on');
  2655. else if (mv === 'procedures') document.getElementById('btnMxProcedures').classList.add('on');
  2656. computeStats();
  2657. if (st.selectedAction && st.selectedType) {
  2658. selectQueryByActiveCellAndControls(st.selectedAction, st.selectedType);
  2659. }
  2660. rerender();
  2661. });
  2662. }
  2663. // Matrix click listener (links matrix select to database select + opens pop-up)
  2664. document.getElementById("comboMx").addEventListener("click", e => {
  2665. const td = e.target.closest("td.cell");
  2666. if (!td) return;
  2667. const ai = +td.dataset.ai, ti = +td.dataset.ti, a = ACTIONS[ai], t = TYPES[ti];
  2668. st.selectedAction = a.name;
  2669. st.selectedType = t.name;
  2670. showPop(td, e.clientX, e.clientY);
  2671. // Select the query
  2672. selectQueryByActiveCellAndControls(a.name, t.name);
  2673. document.querySelectorAll('td.cell.sel').forEach(x => x.classList.remove('sel'));
  2674. td.classList.add('sel');
  2675. applyCrosshair();
  2676. rerender(true); // mxClick = true, updates results without redrawing full table
  2677. });
  2678. // Header controls event delegation
  2679. const MULTI = { tool: 'tools' };
  2680. document.querySelector('.ctl').addEventListener('click', e => {
  2681. const b = e.target.closest('.btn');
  2682. if (!b) return;
  2683. const k = b.dataset.k, v = b.dataset.v, grp = document.querySelectorAll(`.ctl .btn[data-k="${k}"]`);
  2684. if (MULTI[k]) {
  2685. const ak = MULTI[k];
  2686. if (v === '') {
  2687. st[ak] = [];
  2688. } else {
  2689. if (st[ak].includes(v)) {
  2690. st[ak] = [];
  2691. } else {
  2692. st[ak] = [v];
  2693. }
  2694. }
  2695. grp.forEach(x => {
  2696. const xv = x.dataset.v;
  2697. x.classList.toggle('on', xv === '' ? st[ak].length === 0 : st[ak].includes(xv));
  2698. });
  2699. } else {
  2700. grp.forEach(x => x.classList.remove('on'));
  2701. b.classList.add('on');
  2702. st[k] = v;
  2703. }
  2704. if (st.selectedAction && st.selectedType) {
  2705. selectQueryByActiveCellAndControls(st.selectedAction, st.selectedType);
  2706. }
  2707. renderMatrix();
  2708. if (openCell) {
  2709. const ai = +openCell.dataset.ai, ti = +openCell.dataset.ti;
  2710. const newCell = document.querySelector(`td.cell[data-ai="${ai}"][data-ti="${ti}"]`);
  2711. if (newCell) {
  2712. showPop(newCell, parseInt(pop.style.left), parseInt(pop.style.top));
  2713. }
  2714. }
  2715. rerender(true);
  2716. });
  2717. // Close popups on clicking outside
  2718. document.addEventListener('click', e => {
  2719. if (!e.target.closest('td.cell') && !e.target.closest('.pop') && !e.target.closest('.btn')) {
  2720. pop.style.display = 'none';
  2721. openCell = null;
  2722. }
  2723. const tip = document.getElementById('scoreTip');
  2724. if (tip && !e.target.closest('.info-icon') && !e.target.closest('#scoreTip')) {
  2725. tip.style.display = 'none';
  2726. if (currentPinnedScoreEl) {
  2727. currentPinnedScoreEl.style.color = '';
  2728. currentPinnedScoreEl = null;
  2729. }
  2730. }
  2731. });
  2732. document.getElementById("navC").addEventListener("click", e => { const t = e.target.closest(".tab"); if (!t) return; st.channel = t.dataset.c; renderNav(); renderHead(); renderGrid(); });
  2733. document.getElementById("sort").addEventListener("change", renderGrid);
  2734. loadData();
  2735. </script>
  2736. </body>
  2737. </html>