-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.html
More file actions
1495 lines (1423 loc) · 74.2 KB
/
Copy pathadmin.html
File metadata and controls
1495 lines (1423 loc) · 74.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Thalamus · 模型调度中枢</title>
<style>
/* ═══════════════════════════════════
1. Design Tokens(Soft UI Evolution)
═══════════════════════════════════ */
:root {
--bg: #07080a;
--bg-surface: #0d0f13;
--bg-card: rgba(16, 18, 24, 0.75);
--bg-glass: rgba(255, 255, 255, 0.03);
--bg-glass-hover: rgba(255, 255, 255, 0.06);
--brd: rgba(255, 255, 255, 0.06);
--brd-hover: rgba(255, 255, 255, 0.12);
--text: #e8e9ed;
--text-2: #8b8fa3;
--text-3: #5c5f73;
--accent: #7c8aff;
--accent-glow: rgba(124, 138, 255, 0.15);
--green: #34d399;
--green-bg: rgba(52, 211, 153, 0.12);
--yellow: #fbbf24;
--yellow-bg: rgba(251, 191, 36, 0.12);
--red: #f87171;
--red-bg: rgba(248, 113, 113, 0.12);
--purple: #a78bfa;
--purple-bg: rgba(167, 139, 250, 0.12);
--radius-sm: 8px;
--radius: 12px;
--radius-lg: 16px;
--shadow: 0 2px 12px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.04);
--shadow-lg: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.05);
--font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
--mono: 'JetBrains Mono', 'SF Mono', SFMono-Regular, Consolas, monospace;
--sidebar-w: 68px;
}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body {
background: var(--bg);
color: var(--text);
font-family: var(--font);
line-height: 1.5;
min-height: 100vh;
overflow-x: hidden;
}
/* ═══════════════════════════════════
2. Background Ambient
═══════════════════════════════════ */
body::before {
content: '';
position: fixed;
inset: 0;
background:
radial-gradient(ellipse 600px 400px at 15% 20%, rgba(124,138,255,0.05) 0%, transparent 70%),
radial-gradient(ellipse 500px 500px at 85% 80%, rgba(167,139,250,0.04) 0%, transparent 70%),
radial-gradient(ellipse 300px 300px at 50% 50%, rgba(52,211,153,0.02) 0%, transparent 70%);
pointer-events: none;
z-index: 0;
}
input, select, textarea, button { font: inherit; color: inherit; }
/* ═══════════════════════════════════
3. Login
═══════════════════════════════════ */
.login-wrap {
display: flex; align-items: center; justify-content: center;
min-height: 100vh; padding: 20px;
background: radial-gradient(ellipse 700px 500px at 30% 40%, rgba(124,138,255,.06) 0%, var(--bg) 70%);
}
.login-card {
background: var(--bg-card); backdrop-filter: blur(24px);
border: 1px solid var(--brd); border-radius: var(--radius-lg);
padding: 44px 36px 36px;
width: 380px; max-width: 90vw;
box-shadow: var(--shadow-lg);
animation: loginIn 0.5s ease-out;
}
@keyframes loginIn {
from { opacity: 0; transform: translateY(16px) scale(0.97); }
to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-card .logo {
width: 40px; height: 40px;
background: linear-gradient(135deg, var(--accent), var(--purple));
border-radius: 10px;
display: flex; align-items: center; justify-content: center;
font-size: 18px; margin-bottom: 16px;
}
.login-card h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.3px; }
.login-card .subtitle { color: var(--text-2); font-size: 13px; margin-bottom: 28px; margin-top: 4px; }
.login-card input {
display: block; width: 100%;
background: rgba(0,0,0,0.3); border: 1px solid var(--brd);
border-radius: var(--radius-sm); padding: 11px 14px;
font-size: 14px; outline: none; transition: all .15s;
}
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.login-card button {
display: block; width: 100%; margin-top: 14px;
background: linear-gradient(135deg, var(--accent), #6b7aff);
border: none; border-radius: var(--radius-sm); padding: 11px;
font-size: 14px; font-weight: 500; color: #fff;
cursor: pointer; transition: opacity .15s, transform .1s;
}
.login-card button:hover { opacity: .9; }
.login-card button:active { transform: scale(0.98); }
.login-card button:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.login-error { color: var(--red); font-size: 12px; margin-top: 10px; text-align: center; }
/* ═══════════════════════════════════
4. App Layout — Sidebar
═══════════════════════════════════ */
.app { display: none; }
.app.show { display: flex; min-height: 100vh; }
.sidebar {
position: fixed; left: 0; top: 0; bottom: 0;
width: var(--sidebar-w);
background: var(--bg-surface);
border-right: 1px solid var(--brd);
display: flex; flex-direction: column;
align-items: center; padding: 16px 0;
z-index: 50;
animation: sidebarIn 0.4s ease-out;
}
@keyframes sidebarIn { from { transform: translateX(-20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.sidebar .s-logo {
width: 36px; height: 36px;
background: linear-gradient(135deg, var(--accent), var(--purple));
border-radius: 10px;
display: flex; align-items: center; justify-content: center;
font-size: 15px; margin-bottom: 20px; cursor: pointer;
transition: transform .15s, box-shadow .15s;
}
.sidebar .s-logo:hover { transform: scale(1.05); box-shadow: 0 0 20px var(--accent-glow); }
.s-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.s-nav button {
width: 44px; height: 44px; border: none; border-radius: 10px;
background: transparent; color: var(--text-2); font-size: 18px;
cursor: pointer; transition: all .15s; display: flex;
align-items: center; justify-content: center; position: relative;
}
.s-nav button:hover { background: var(--bg-glass); color: var(--text); }
.s-nav button.active {
background: var(--accent-glow); color: var(--accent);
box-shadow: 0 0 12px rgba(124,138,255,0.1);
}
.s-nav button::after {
content: attr(data-tip);
position: absolute; left: 56px;
background: var(--bg-surface); border: 1px solid var(--brd);
padding: 4px 10px; border-radius: 6px; font-size: 12px;
font-weight: 500; white-space: nowrap;
opacity: 0; pointer-events: none; transition: all .15s;
color: var(--text);
}
.s-nav button:hover::after { opacity: 1; }
.s-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.s-bottom button {
width: 44px; height: 44px; border: none; border-radius: 10px;
background: transparent; color: var(--text-2); font-size: 16px;
cursor: pointer; transition: all .15s;
display: flex; align-items: center; justify-content: center;
}
.s-bottom button:hover { background: var(--bg-glass); color: var(--text); }
.s-bottom .s-logout:hover { color: var(--red); }
/* ═══════════════════════════════════
5. Main Content
═══════════════════════════════════ */
.main {
margin-left: var(--sidebar-w);
flex: 1; padding: 28px 32px 40px;
max-width: 1360px;
animation: mainIn 0.4s ease-out;
}
@keyframes mainIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.main-header {
display: flex; align-items: center; justify-content: space-between;
margin-bottom: 28px;
}
.main-header .left h1 {
font-size: 22px; font-weight: 600; letter-spacing: -0.4px;
display: flex; align-items: center; gap: 10px;
}
.main-header .left h1 span { color: var(--accent); }
.main-header .left .sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.main-header .actions {
display: flex; gap: 6px;
animation: actionsIn 0.5s ease-out 0.2s both;
}
@keyframes actionsIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.main-header .actions button {
background: var(--bg-glass); border: 1px solid var(--brd);
border-radius: var(--radius-sm); padding: 7px 14px;
font-size: 12px; cursor: pointer; transition: all .15s;
color: var(--text-2); display: flex; align-items: center; gap: 5px;
}
.main-header .actions button:hover {
background: var(--bg-glass-hover); color: var(--text);
border-color: var(--brd-hover);
}
.main-header .actions .btn-restart { color: var(--yellow); }
.main-header .actions .btn-restart:hover { background: var(--yellow-bg); border-color: rgba(251,191,36,.3); }
.main-header .actions .btn-logout { color: var(--red); }
.main-header .actions .btn-logout:hover { background: var(--red-bg); border-color: rgba(248,113,113,.3); }
/* ═══════════════════════════════════
6. Tab Panes (keep for JS)
═══════════════════════════════════ */
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: paneIn 0.3s ease-out; }
@keyframes paneIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
/* ═══════════════════════════════════
7. Stats Cards (Bento Grid)
═══════════════════════════════════ */
.cards {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 12px;
margin-bottom: 28px;
justify-items: center;
}
.card {
background: var(--bg-card);
backdrop-filter: blur(12px);
border: 1px solid var(--brd);
border-radius: var(--radius);
padding: 18px 20px;
transition: all .2s;
position: relative;
overflow: hidden;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
}
.card::before {
content: '';
position: absolute; top: 0; left: 0; right: 0; height: 2px;
background: linear-gradient(90deg, transparent, var(--accent), transparent);
opacity: 0; transition: opacity .2s;
}
.card:hover { transform: translateY(-2px); border-color: var(--brd-hover); box-shadow: var(--shadow); }
.card:hover::before { opacity: 0.6; }
.card .icon {
font-size: 24px;
margin-bottom: 8px;
opacity: 0.8;
transition: all .2s;
}
.card:hover .icon { opacity: 1; transform: scale(1.1); }
.card .label {
font-size: 10px;
text-transform: uppercase;
letter-spacing: .8px;
color: var(--text-2);
margin-bottom: 4px;
}
.card .value {
font-size: 26px;
font-weight: 600;
letter-spacing: -.5px;
}
.card .sub {
font-size: 10px;
color: var(--text-3);
margin-top: 2px;
}
.card .value.green { color: var(--green); }
.card .value.yellow { color: var(--yellow); }
.card .value.red { color: var(--red); }
.card .value.blue { color: var(--accent); }
.card .value.purple { color: var(--purple); }
@media(max-width: 800px) {
.cards { grid-template-columns: repeat(2, 1fr); }
}
/* ═══════════════════════════════════
8. Routes Table (Card)
═══════════════════════════════════ */
.route-wrap {
background: var(--bg-card); backdrop-filter: blur(12px);
border: 1px solid var(--brd); border-radius: var(--radius-lg);
overflow: hidden;
transition: box-shadow .2s;
}
.route-wrap:hover { box-shadow: var(--shadow); }
.route-wrap .top-actions {
display: flex; align-items: center; justify-content: space-between;
padding: 16px 20px;
border-bottom: 1px solid var(--brd);
}
.route-wrap .top-actions .left { display: flex; align-items: center; gap: 12px; }
.route-wrap .top-actions .left h3 { font-size: 14px; font-weight: 600; }
.route-wrap .top-actions .left .count {
font-size: 11px; color: var(--text-2);
background: var(--bg); padding: 2px 10px; border-radius: 20px;
}
.route-wrap .top-actions button {
background: linear-gradient(135deg, var(--accent), #6b7aff);
border: none; border-radius: var(--radius-sm);
padding: 7px 16px; font-size: 12px; color: #fff;
cursor: pointer; transition: all .15s;
}
.route-wrap .top-actions button:hover { opacity: .88; transform: translateY(-1px); }
.route-wrap .top-actions button:active { transform: translateY(0); }
table { width: 100%; border-collapse: collapse; }
thead th {
text-align: left; padding: 12px 16px;
font-size: 10px; font-weight: 600;
text-transform: uppercase; letter-spacing: .8px;
color: var(--text-3);
border-bottom: 1px solid var(--brd);
white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--brd); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-glass); }
tbody td { padding: 12px 16px; font-size: 13px; vertical-align: middle; }
.tag {
display: inline-flex; align-items: center; gap: 4px;
padding: 3px 10px; border-radius: 20px;
font-size: 11px; font-weight: 500;
}
.tag.code { background: var(--green-bg); color: var(--green); }
.tag.reason { background: var(--accent-glow); color: var(--accent); }
.tag.vision { background: var(--purple-bg); color: var(--purple); }
.tag.daily { background: rgba(110,118,129,.15); color: var(--text-2); }
.mono { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
td[contenteditable] {
outline: none; cursor: text;
border-radius: 4px; padding: 2px 6px;
transition: all .1s;
}
td[contenteditable]:focus {
background: var(--accent-glow);
box-shadow: 0 0 0 1px var(--accent);
}
.e-btn {
background: var(--bg-glass); border: 1px solid var(--brd);
border-radius: 6px; padding: 5px 12px; font-size: 11px;
cursor: pointer; color: var(--text-2);
transition: all .12s; white-space: nowrap;
}
.e-btn:hover { background: var(--bg-glass-hover); color: var(--text); border-color: var(--brd-hover); }
.e-btn.danger { color: var(--red); border-color: rgba(248,113,113,.25); }
.e-btn.danger:hover { background: var(--red-bg); border-color: var(--red); }
.proxy-toggle {
cursor: pointer; display: inline-flex;
align-items: center; justify-content: center;
width: 32px; height: 28px;
border-radius: 6px; transition: background .1s;
}
.proxy-toggle:hover { background: var(--bg-glass); }
/* ═══════════════════════════════════
9. Key Section
═══════════════════════════════════ */
.key-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.key-section {
background: var(--bg-card); backdrop-filter: blur(12px);
border: 1px solid var(--brd); border-radius: var(--radius-lg);
padding: 20px 24px;
}
.key-section .head {
display: flex; align-items: center; justify-content: space-between;
margin-bottom: 16px;
}
.key-section .head h3 { font-size: 14px; font-weight: 600; }
.key-section .head button {
background: linear-gradient(135deg, var(--accent), #6b7aff);
border: none; border-radius: var(--radius-sm);
padding: 6px 14px; font-size: 12px; color: #fff;
cursor: pointer; transition: all .12s;
}
.key-section .head button:hover { opacity: .88; }
.key-row {
display: flex; align-items: center; justify-content: space-between;
padding: 12px 0; border-bottom: 1px solid var(--brd); gap: 10px;
}
.key-row:last-child { border-bottom: none; }
.key-row .k-main { flex: 1; min-width: 0; }
.key-row .k-name { font-family: var(--mono); font-size: 12px; font-weight: 500; }
.key-row .k-ep { font-size: 11px; color: var(--text-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.key-row .k-val { font-size: 11px; color: var(--text-2); margin-top: 1px; font-family: var(--mono); }
.key-row .k-actions { display: flex; gap: 6px; flex-shrink: 0; }
.key-row .k-actions button {
background: var(--bg-glass); border: 1px solid var(--brd);
border-radius: 6px; padding: 4px 10px; font-size: 11px;
cursor: pointer; color: var(--text-2); transition: all .1s;
}
.key-row .k-actions button:hover { background: var(--bg-glass-hover); color: var(--text); }
.key-row .k-actions .del { color: var(--red); }
.key-row .k-actions .del:hover { background: var(--red-bg); }
.k-badge { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 10px; font-weight: 500; }
.k-badge.env { background: rgba(110,118,129,.15); color: var(--text-2); }
@media(max-width: 900px) { .key-grid { grid-template-columns: 1fr; } }
/* ═══════════════════════════════════
10. Config — Chain Visualization
═══════════════════════════════════ */
.chain-wrap {
background: var(--bg-card); backdrop-filter: blur(12px);
border: 1px solid var(--brd); border-radius: var(--radius-lg);
padding: 24px; margin-bottom: 20px;
}
.chain-title { font-size: 14px; font-weight: 600; margin-bottom: 20px; }
.chain-flow { display: flex; flex-direction: column; align-items: center; gap: 0; }
.chain-node {
width: 100%; max-width: 420px;
border-radius: var(--radius); padding: 16px 20px;
transition: all .15s;
}
.chain-start {
background: var(--accent-glow);
border: 1px dashed rgba(124,138,255,0.25);
text-align: center; font-size: 13px; font-weight: 500;
color: var(--accent); cursor: default;
}
.chain-card {
background: rgba(0,0,0,0.2);
border: 1px solid var(--brd); cursor: pointer;
}
.chain-card:hover { border-color: var(--accent); background: var(--accent-glow); }
.chain-card[data-open="true"] { border-color: var(--accent); }
.chain-info { background: rgba(0,0,0,0.2); border: 1px solid var(--brd); cursor: default; opacity: .7; }
.cn-row { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.cn-icon { font-size: 16px; flex-shrink: 0; }
.cn-label { font-size: 13px; font-weight: 600; }
.cn-badge {
font-size: 10px; padding: 2px 10px; border-radius: 20px;
background: var(--green-bg); color: var(--green);
margin-left: auto; flex-shrink: 0;
}
.cn-model {
font-size: 12px; font-family: var(--mono);
color: var(--accent); margin-left: 26px;
}
.cn-meta { font-size: 11px; color: var(--text-2); margin-left: 26px; margin-top: 2px; }
.chain-arr { text-align: center; font-size: 10px; color: var(--text-3); padding: 6px 0; position: relative; width: 100%; }
.arr-label { font-size: 10px; color: var(--text-3); margin-left: 8px; }
/* Inline config panels */
.cfg-panel {
background: var(--bg-card); backdrop-filter: blur(12px);
border: 1px solid var(--brd); border-radius: var(--radius-lg);
overflow: hidden; margin-bottom: 12px;
}
.cp-head {
display: flex; align-items: center; justify-content: space-between;
padding: 14px 20px; cursor: pointer; font-size: 13px; font-weight: 600;
transition: background .1s; user-select: none;
}
.cp-head:hover { background: var(--bg-glass); }
.cp-toggle { font-size: 10px; color: var(--text-2); }
.cp-body { padding: 18px 20px; border-top: 1px solid var(--brd); }
.cp-hint {
font-size: 12px; color: var(--text-2); margin-bottom: 16px;
padding: 10px 14px; background: rgba(0,0,0,0.3);
border-radius: var(--radius-sm); line-height: 1.5;
}
.cp-row { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.cp-switch { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; }
.cp-switch input { opacity: 0; width: 0; height: 0; }
.cp-slider {
position: absolute; cursor: pointer; inset: 0;
background: rgba(110,118,129,.3); border-radius: 20px;
transition: background .2s;
}
.cp-slider:before {
content: ''; position: absolute; height: 14px; width: 14px;
left: 3px; bottom: 3px; background: #fff;
border-radius: 50%; transition: transform .2s;
}
.cp-switch input:checked + .cp-slider { background: var(--green); }
.cp-switch input:checked + .cp-slider:before { transform: translateX(16px); }
/* ═══════════════════════════════════
11. Logs
═══════════════════════════════════ */
.logs-wrap {
background: var(--bg-card); backdrop-filter: blur(12px);
border: 1px solid var(--brd); border-radius: var(--radius-lg);
overflow: hidden;
}
.logs-header {
display: flex; align-items: center; justify-content: space-between;
padding: 14px 20px; border-bottom: 1px solid var(--brd);
}
.logs-header .left { display: flex; align-items: center; gap: 12px; }
.logs-header .left h3 { font-size: 14px; font-weight: 600; }
.logs-header .left .filter-group { display: flex; gap: 4px; }
.logs-header .left .filter-group button {
background: transparent; border: 1px solid var(--brd);
border-radius: 6px; padding: 4px 12px; font-size: 11px;
cursor: pointer; color: var(--text-2); transition: all .12s;
}
.logs-header .left .filter-group button:hover { border-color: var(--brd-hover); color: var(--text); }
.logs-header .left .filter-group button.active {
background: var(--accent-glow); border-color: var(--accent); color: var(--accent);
}
.logs-body {
background: #06080b; padding: 0;
max-height: 420px; overflow-y: auto;
font-family: var(--mono); font-size: 11px; line-height: 1.7;
}
.logs-body .line {
padding: 3px 16px; color: #6b7089;
transition: background .1s; white-space: pre-wrap; word-break: break-all;
}
.logs-body .line:hover { background: rgba(255,255,255,.02); }
.logs-body .line.err { color: var(--red); }
.logs-body .line.fbk { color: var(--yellow); }
.logs-body .line.route { color: var(--accent); }
.logs-body .line.ok { color: var(--green); }
.logs-footer {
display: flex; align-items: center; justify-content: space-between;
padding: 10px 16px; border-top: 1px solid var(--brd);
font-size: 11px; color: var(--text-2);
}
.logs-footer .auto-scroll { display: flex; align-items: center; gap: 6px; }
.logs-footer .auto-scroll label { font-size: 11px; cursor: pointer; }
/* ═══════════════════════════════════
12. Modal
═══════════════════════════════════ */
.modal-overlay {
position: fixed; inset: 0;
background: rgba(0,0,0,.7);
backdrop-filter: blur(4px);
display: none; align-items: center; justify-content: center;
z-index: 100;
animation: overlayIn .15s ease-out;
}
.modal-overlay.show { display: flex; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
background: var(--bg-card); backdrop-filter: blur(24px);
border: 1px solid var(--brd);
border-radius: var(--radius-lg);
width: 540px; max-width: 92vw; max-height: 90vh;
overflow-y: auto;
box-shadow: var(--shadow-lg);
animation: modalIn .2s ease-out;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal .m-h { padding: 20px 24px; border-bottom: 1px solid var(--brd); font-size: 15px; font-weight: 600; }
.modal .m-b { padding: 20px 24px; }
.modal .m-footer {
padding: 14px 24px; border-top: 1px solid var(--brd);
display: flex; justify-content: flex-end; gap: 8px;
}
.modal .m-footer button {
background: var(--bg-glass); border: 1px solid var(--brd);
border-radius: var(--radius-sm); padding: 8px 18px;
font-size: 12px; cursor: pointer; transition: all .12s;
}
.modal .m-footer button:hover { background: var(--bg-glass-hover); }
.modal .m-footer .btn-primary {
background: linear-gradient(135deg, var(--accent), #6b7aff);
border-color: transparent; color: #fff;
}
.modal .m-footer .btn-primary:hover { opacity: .88; }
.modal .m-footer .btn-danger { color: var(--red); }
.modal .m-footer .btn-danger:hover { background: var(--red-bg); }
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label {
display: block; font-size: 11px; font-weight: 600;
text-transform: uppercase; letter-spacing: .5px;
color: var(--text-2); margin-bottom: 5px;
}
.field input, .field select, .field textarea {
display: block; width: 100%;
background: rgba(0,0,0,0.3); border: 1px solid var(--brd);
border-radius: var(--radius-sm); padding: 9px 13px;
font-size: 13px; outline: none; transition: all .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}
.field .hint { font-size: 11px; color: var(--text-2); margin-top: 4px; }
.field-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
/* ═══════════════════════════════════
13. Probe / Misc
═══════════════════════════════════ */
.probe-group { display: flex; gap: 8px; align-items: flex-end; }
.probe-group select { flex: 1; }
.probe-group button {
background: var(--accent); border: none;
border-radius: var(--radius-sm); padding: 6px 14px;
font-size: 11px; color: #fff; cursor: pointer;
white-space: nowrap; transition: opacity .15s;
height: 36px; align-self: flex-end;
}
.probe-group button:hover { opacity: .85; }
.probe-group button:disabled { opacity: .4; cursor: not-allowed; }
.probe-btn {
background: var(--bg-glass); border: 1px solid var(--brd);
border-radius: var(--radius-sm); padding: 6px 14px;
font-size: 11px; cursor: pointer; color: var(--text-2);
transition: all .12s; white-space: nowrap;
}
.probe-btn:hover { background: var(--bg-glass-hover); color: var(--text); }
.probe-btn:disabled { opacity: .4; cursor: not-allowed; }
.probe-models {
font-size: 11px; color: var(--text-2); margin-top: 4px;
max-height: 160px; overflow-y: auto;
background: rgba(0,0,0,0.3); border-radius: var(--radius-sm);
padding: 8px;
}
.probe-models .m {
display: inline-block; padding: 3px 10px; margin: 2px;
border-radius: 6px; background: var(--accent-glow);
color: var(--text); cursor: default; font-size: 11px;
font-family: var(--mono);
}
.probe-models .m-card {
display: flex; align-items: center; justify-content: space-between;
padding: 8px 12px; margin: 4px 0;
border: 1px solid var(--brd); border-radius: var(--radius-sm);
background: rgba(0,0,0,0.2); cursor: pointer;
transition: all .12s;
}
.probe-models .m-card:hover { border-color: var(--accent); background: var(--accent-glow); }
.probe-models .m-card.sel { border-color: var(--accent); background: var(--accent-glow); }
.probe-models .m-card .m-id { font-family: var(--mono); font-size: 12px; }
.probe-models .m-card .m-tags { display: flex; gap: 2px; flex-wrap: wrap; }
.empty-state { padding: 40px 20px; text-align: center; color: var(--text-2); font-size: 13px; }
.empty-state-small { padding: 20px; text-align: center; color: var(--text-2); font-size: 12px; }
.match-result { margin-top: 4px; font-size: 11px; padding: 6px 10px; border-radius: 6px; }
.match-result.yes { background: var(--green-bg); color: var(--green); }
.match-result.no { background: var(--red-bg); color: var(--red); }
.cascade-warn {
background: var(--red-bg); border: 1px solid rgba(248,113,113,.25);
border-radius: var(--radius-sm); padding: 10px 14px;
margin-bottom: 16px; font-size: 12px; color: var(--red); line-height: 1.6;
}
/* ═══════════════════════════════════
14. Toast
═══════════════════════════════════ */
.toast {
position: fixed; bottom: 28px; right: 28px;
background: var(--bg-card); backdrop-filter: blur(24px);
border: 1px solid var(--brd); border-radius: 10px;
padding: 13px 22px; font-size: 13px; z-index: 200;
box-shadow: var(--shadow-lg);
opacity: 0; transform: translateY(12px);
transition: all .25s cubic-bezier(.22,.61,.36,1);
pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { border-color: rgba(52,211,153,.4); }
.toast.err { border-color: rgba(248,113,113,.4); }
/* ═══════════════════════════════════
15. Responsive
═══════════════════════════════════ */
@media(max-width: 700px) {
.main { padding: 20px 16px 40px; }
.sidebar { width: 56px; }
.sidebar .s-nav button, .sidebar .s-bottom button { width: 36px; height: 36px; font-size: 15px; }
.main { margin-left: 56px; }
}
/* ═══════════════════════════════════
16. Scrollbar
═══════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }
</style>
</head>
<body>
<!-- ═══ LOGIN ═══ -->
<div class="login-wrap" id="loginWrap">
<div class="login-card">
<div class="logo">✦</div>
<h1>Thalamus</h1>
<p class="subtitle">v4.0.0 · 模型调度中枢</p>
<input type="password" id="pwdInput" placeholder="输入密码" autocomplete="off" onkeydown="if(event.key==='Enter')doLogin()">
<button id="loginBtn" onclick="doLogin()">登录</button>
<div class="login-error" id="loginErr"></div>
</div>
</div>
<!-- ═══ APP ═══ -->
<div class="app" id="app">
<!-- Sidebar -->
<div class="sidebar">
<div class="s-logo">✦</div>
<div class="s-nav">
<button class="active" data-tab="routes" data-tip="路由规则">🔀</button>
<button data-tab="keys" data-tip="API 密钥">🔑</button>
<button data-tab="config" data-tip="系统配置">⚙️</button>
<button data-tab="logs" data-tip="运行日志">📋</button>
</div>
<div class="s-bottom">
<button onclick="reloadRoutes()" data-tip="重载配置" style="font-size:14px">🔄</button>
<button onclick="restartService()" data-tip="重启服务" style="color:var(--yellow);font-size:14px">🔁</button>
<button class="s-logout" onclick="doLogout()" data-tip="退出">🚪</button>
</div>
</div>
<!-- Main -->
<div class="main">
<div class="main-header">
<div class="left">
<h1>✦ <span>Thalamus</span></h1>
<div class="sub">模型调度中枢 · v4.0.0</div>
</div>
<div class="actions">
<button onclick="fetchAll()">🔄 刷新</button>
<button onclick="resetTokenStats()" style="margin-left:6px;background:var(--red);color:#fff;border:none;padding:6px 12px;border-radius:6px;cursor:pointer">🔄 重置计数</button>
</div>
</div>
<!-- Stats Cards -->
<div class="cards" id="cardsBox"></div>
<!-- Tab Panes -->
<div class="tab-pane active" id="pane-routes">
<div class="route-wrap">
<div class="top-actions">
<div class="left"><h3>路由规则</h3><span class="count" id="routeCount">0</span></div>
<button onclick="openRoute()">+ 新建</button>
</div>
<div style="overflow-x:auto"><table>
<thead><tr>
<th style="width:70px">用途</th>
<th style="min-width:120px">名称</th>
<th style="min-width:140px">模型</th>
<th>Provider</th>
<th>密钥</th>
<th>端点</th>
<th style="width:50px">代理</th>
<th style="width:80px">操作</th>
</tr></thead>
<tbody id="routesBody"></tbody>
</table></div>
<div class="empty-state" id="routesEmpty" style="display:none">暂无路由规则</div>
</div>
</div>
<div class="tab-pane" id="pane-keys">
<div class="key-grid">
<div class="key-section">
<div class="head"><h3>🔑 自定义密钥</h3><button onclick="openKeyAddModal()">+ 添加</button></div>
<div id="keysBody"></div>
<div class="empty-state-small" id="keysEmpty" style="display:none">暂无自定义密钥</div>
</div>
<div class="key-section">
<div class="head"><h3>🌐 环境变量密钥</h3></div>
<div id="envKeysBody"></div>
<div class="empty-state-small" id="envKeysEmpty" style="display:none">无环境变量密钥</div>
<div class="hint" style="margin-top:14px;font-size:11px;color:var(--text-2)">环境变量密钥仅供读取</div>
</div>
</div>
</div>
<div class="tab-pane" id="pane-config">
<div class="chain-wrap">
<div class="chain-title">🎯 调度链路 <span style="font-weight:400;font-size:11px;color:var(--text-2);margin-left:8px">点击卡片展开编辑</span></div>
<div class="chain-flow">
<div class="chain-node chain-start">💬 用户请求</div>
<div class="chain-arr">▾</div>
<div class="chain-node chain-card" tabindex="0" onclick="toggleCfgPanel('pc')" data-open="false">
<div class="cn-row">
<span class="cn-icon" id="pc_icon">🟢</span>
<span class="cn-label">智能预检</span>
<span class="cn-badge" id="pc_badge">已启用</span>
</div>
<div class="cn-model" id="pc_model_show">deepseek-v4-flash</div>
<div class="cn-meta">先判断消息类型,再决定走哪条路由</div>
</div>
<div class="chain-arr">▾<span class="arr-label">命中路由 → 直达该模型</span></div>
<div class="chain-node chain-info">
<div class="cn-row">
<span class="cn-icon">🔀</span>
<span class="cn-label">路由匹配</span>
<span class="cn-badge" id="route_badge" style="background:var(--accent-glow);color:var(--accent)">3 条</span>
</div>
<div class="cn-model" id="route_names_show">glm · claude · KLING</div>
<div class="cn-meta">切换到「路由规则」Tab 管理</div>
</div>
<div class="chain-arr">▾<span class="arr-label">未匹配 → 走默认</span></div>
<div class="chain-node chain-card" tabindex="0" onclick="toggleCfgPanel('def')" data-open="false">
<div class="cn-row"><span class="cn-icon">🔵</span><span class="cn-label">默认模型</span></div>
<div class="cn-model" id="def_model_show">-</div>
<div class="cn-meta">无路由匹配时的兜底模型</div>
</div>
<div class="chain-arr">▾<span class="arr-label">失败时</span></div>
<div class="chain-node chain-card" tabindex="0" onclick="toggleCfgPanel('fb')" data-open="false">
<div class="cn-row"><span class="cn-icon">🟡</span><span class="cn-label">降级兜底</span></div>
<div class="cn-model" id="fb_model_show">-</div>
<div class="cn-meta">默认模型不可用时的最后防线</div>
</div>
</div>
</div>
<div id="cfgInlineArea">
<div class="cfg-panel" id="cfg-pc" style="display:none">
<div class="cp-head" onclick="toggleCfgPanel('pc')"><span>🟢 智能预检</span><span class="cp-toggle">▲</span></div>
<div class="cp-body">
<div class="cp-row">
<label class="cp-switch"><input type="checkbox" id="pc_enabled" onchange="onCfgChange('pc')"><span class="cp-slider"></span></label>
<span style="font-size:13px">启用预检</span>
<span style="font-size:11px;color:var(--text-2);margin-left:8px">关闭后所有请求直接走路由/默认</span>
</div>
<div class="field-row-3">
<div class="field"><label>模型</label><input id="pc_model" placeholder="deepseek-v4-flash" onchange="onCfgChange('pc')" oninput="updateChain()"></div>
<div class="field"><label>Provider</label><input id="pc_provider" placeholder="deepseek" onchange="onCfgChange('pc')"></div>
<div class="field"><label>密钥</label><select id="pc_key" onchange="onKeySelect('pc'); onCfgChange('pc'); updateChain()"></select></div>
</div>
<div class="field-row-2">
<div class="field"><label>端点</label><input id="pc_ep" placeholder="选择密钥后自动填充" readonly style="background:rgba(0,0,0,.4)"></div>
<div class="field" style="display:flex;align-items:flex-end"><button class="probe-btn" id="pc_probeBtn" onclick="probeModels('pc')" disabled>🔍 探测</button></div>
</div>
<div id="pc_probeResult" class="probe-models" style="display:none;margin-top:6px"></div>
</div>
</div>
<div class="cfg-panel" id="cfg-def" style="display:none">
<div class="cp-head" onclick="toggleCfgPanel('def')"><span>🔵 默认模型</span><span class="cp-toggle">▲</span></div>
<div class="cp-body">
<div class="field-row-3">
<div class="field"><label>模型</label><input id="def_model" placeholder="deepseek-v4-flash" onchange="onCfgChange('def')" oninput="updateChain()"></div>
<div class="field"><label>Provider</label><input id="def_provider" placeholder="deepseek" onchange="onCfgChange('def')"></div>
<div class="field"><label>密钥</label><select id="def_key" onchange="onKeySelect('def'); onCfgChange('def'); updateChain()"></select></div>
</div>
<div class="field-row-2">
<div class="field probe-group">
<label>端点</label>
<input id="def_ep" placeholder="选择密钥后自动填充" readonly style="background:rgba(0,0,0,.4)">
<button class="probe-btn" id="def_probeBtn" onclick="probeModels('def')" disabled>🔍 探测</button>
</div>
</div>
<div id="def_probeResult" class="probe-models" style="display:none;margin-top:6px"></div>
</div>
</div>
<div class="cfg-panel" id="cfg-fb" style="display:none">
<div class="cp-head" onclick="toggleCfgPanel('fb')"><span>🟡 降级兜底</span><span class="cp-toggle">▲</span></div>
<div class="cp-body">
<div class="cp-hint">当默认模型请求失败(如429超限、网络错误)时自动切换到降级模型</div>
<div class="field-row-3">
<div class="field"><label>模型</label><input id="fb_model" placeholder="glm-4.7" onchange="onCfgChange('fb')" oninput="updateChain()"></div>
<div class="field"><label>Provider</label><input id="fb_provider" placeholder="glm" onchange="onCfgChange('fb')"></div>
<div class="field"><label>密钥</label><select id="fb_key" onchange="onKeySelect('fb'); onCfgChange('fb'); updateChain()"></select></div>
</div>
<div class="field-row-2">
<div class="field probe-group">
<label>端点</label>
<input id="fb_ep" placeholder="选择密钥后自动填充" readonly style="background:rgba(0,0,0,.4)">
<button class="probe-btn" id="fb_probeBtn" onclick="probeModels('fb')" disabled>🔍 探测</button>
</div>
</div>
<div id="fb_probeResult" class="probe-models" style="display:none;margin-top:6px"></div>
</div>
</div>
<div style="display:flex;gap:12px;margin-top:16px;padding:0 16px 16px" id="cfgSaveBar">
<button class="btn-primary" onclick="saveConfigFull()" style="flex:1;padding:10px;font-size:13px">💾 保存设置</button>
<button onclick="fetchAll()" style="padding:10px 16px;font-size:13px;background:var(--bg-glass);border:1px solid var(--border);border-radius:6px;color:var(--text);cursor:pointer">↻ 撤销更改</button>
</div>
</div>
</div>
<div class="tab-pane" id="pane-logs">
<div class="logs-wrap">
<div class="logs-header">
<div class="left"><h3>运行日志</h3><div class="filter-group" id="logFilters"><button class="active" data-filter="all">全部</button><button data-filter="error">错误</button><button data-filter="fallback">降级</button><button data-filter="route">路由</button><button data-filter="call">调用</button></div></div>
</div>
<div class="logs-body" id="logsBody"></div>
<div class="logs-footer">
<span id="logMeta"></span>
<div class="auto-scroll"><input type="checkbox" id="autoScroll" checked><label for="autoScroll">自动滚动</label></div>
</div>
</div>
</div>
</div>
</div>
<!-- ═══ MODALS ═══ -->
<div class="modal-overlay" id="routeModal">
<div class="modal">
<div class="m-h" id="routeModalTitle">新建路由</div>
<div class="m-b">
<div class="field"><label>名称</label><input id="rm_name" placeholder="MiMo 2.5 Pro"></div>
<div class="field">
<label>用途分类</label>
<select id="rm_usage" onchange="onUsageChange()">
<option value="code">代码/运维</option>
<option value="reason">推理/分析</option>
<option value="vision">图片/视觉</option>
<option value="daily">日常/兜底</option>
</select>
</div>
<div class="field">
<label>匹配关键词(正则,逗号分隔)</label>
<textarea id="rm_pattern" rows="2" placeholder="代码,编程,部署,debug,git" style="resize:vertical"></textarea>
<div class="hint">输入文本测试匹配:<input type="text" id="rm_testInput" placeholder="输入测试文本..." style="display:inline-block;width:auto;font-size:11px;padding:3px 8px;margin-left:4px;background:rgba(0,0,0,0.3);border:1px solid var(--brd);border-radius:4px" onkeydown="if(event.key==='Enter')testRouteMatch()"></div>
<div id="rm_testResult" style="display:none;font-size:11px;margin-top:4px;padding:4px 8px;border-radius:4px"></div>
</div>
<div class="field-row-2">
<div class="field"><label>模型</label><input id="rm_model" placeholder="mimo-v2.5-pro"></div>
<div class="field"><label>Provider</label><input id="rm_provider" placeholder="xiaomi"></div>
</div>
<div class="field-row-2" style="margin-top:14px">
<div class="field"><label>选择密钥</label><select id="rm_key" onchange="onRouteKeySelect()"></select></div>
<div class="field"><label>端点</label><input id="rm_ep" placeholder="选择密钥后自动填充" readonly style="background:rgba(0,0,0,.4)"></div>
</div>
<div class="field">
<div class="probe-group"><button id="rm_probeBtn" onclick="probeModels('rm')" disabled>🔍 探测可用模型</button></div>
<div id="rm_probeResult" class="probe-models" style="display:none;margin-top:4px"></div>
</div>
</div>
<div class="m-footer">
<button onclick="closeModal('routeModal')">取消</button>
<button class="btn-danger" id="rm_deleteBtn" onclick="deleteRoute()" style="display:none">删除</button>
<button class="btn-primary" onclick="saveRoute()">保存</button>
</div>
</div>
</div>
<div class="modal-overlay" id="keyModal">
<div class="modal">
<div class="m-h" id="keyModalTitle">添加自定义密钥</div>
<div class="m-b">
<div id="keyCascadeWarn" class="cascade-warn" style="display:none"></div>
<div class="field"><label>别名</label><input id="km_name" placeholder="deepseek, openrouter, xiaomi"><div class="hint">小写英文+下划线</div></div>
<div class="field"><label>API 密钥</label><input id="km_val" placeholder="sk-..." type="password"></div>
<div class="field"><label>端点 URL</label><input id="km_ep" placeholder="https://api.deepseek.com/v1/chat/completions"></div>
<div class="field" style="margin-top:4px">
<button id="km_probeBtn" onclick="probeModels('km')" class="probe-btn">🔍 测试连接并探测模型</button>
<div id="km_probeResult" class="probe-models" style="display:none;margin-top:6px"></div>
</div>
</div>
<div class="m-footer">
<button onclick="closeModal('keyModal')">取消</button>
<button class="btn-danger" id="km_deleteBtn" onclick="deleteCurrentKey()" style="display:none">删除</button>
<button class="btn-primary" onclick="saveKey()">保存</button>
</div>
</div>
</div>
<div class="modal-overlay" id="delKeyConfirmModal">
<div class="modal">
<div class="m-h">确认删除密钥</div>
<div class="m-b">
<p id="delKeyMsg" style="font-size:13px;margin-bottom:14px"></p>
<div id="delKeyAffected" style="display:none;margin-top:8px">
<p style="font-size:12px;color:var(--text-2);margin-bottom:6px">以下配置正在使用此密钥:</p>
<ul id="delKeyAffectedList" style="font-size:12px;color:var(--red);margin-left:18px;line-height:1.8"></ul>
<p style="font-size:11px;color:var(--text-2);margin-top:8px">删除后这些配置将失效</p>
</div>
</div>
<div class="m-footer">
<button onclick="closeModal('delKeyConfirmModal')">取消</button>
<button class="btn-danger" onclick="confirmDeleteKey()">确认删除</button>
</div>
</div>
</div>
<div class="toast" id="toast"></div>
<script>
// ═══ STATE ═══
var TOKEN = null, cfg = null, st = null, routeEditIdx = -1, keyEditName = null, pendingDeleteKey = null
var allLogs = [], logFilter = 'all'
var KEYS_SELECTOR = {}
var PROBE_CACHE = {}
var USAGE_KEYWORDS = {
code: '代码,编程,写程序,重构,部署,deploy,运维,server,nginx,docker,systemctl,ssh,git,commit,PR,config,shell,bash,脚本,修复,报错,error,exception,traceback,日志分析,调试,debug,cron,备份,安装,apt,pip,npm,编译,make,测试,test,pytest',
reason: '分析,对比,比较,推理,为什么,原因,根因,深度,论证,评估,策略,方案,设计架构,优缺点,权衡,决策,审查,审计,review,评审',