index.html 108 KB

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