index.html 93 KB

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