-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmongroq.html
More file actions
1387 lines (1223 loc) · 56.7 KB
/
mongroq.html
File metadata and controls
1387 lines (1223 loc) · 56.7 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="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>IA</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🤖</text></svg>">
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Fira+Code:wght@300;400;500&display=swap" rel="stylesheet">
<style>
:root {
--bg: #080b0f;
--surface: #0e1117;
--surface2: #141920;
--border: #1c2330;
--border2: #263040;
--accent: #00d4aa;
--accent2: #00a8ff;
--accent-dim: rgba(0,212,170,0.08);
--text: #d8e8f0;
--muted: #3d5060;
--muted2: #607080;
--red: #ff4f6a;
--yellow: #ffcc44;
--radius: 10px;
--sidebar-w: 258px;
--topbar-h: 50px;
--tap-min: 44px; /* taille minimale cible tactile */
}
* { margin:0; padding:0; box-sizing:border-box; }
html,body { height:100%; overflow:hidden; background:var(--bg); color:var(--text); font-family:'Outfit',sans-serif; }
/* ── LAYOUT DESKTOP (défaut) ── */
.app {
display:grid;
grid-template-columns:var(--sidebar-w) 1fr;
height:100vh;
transition:grid-template-columns .25s ease;
}
.app.sidebar-hidden { grid-template-columns:0 1fr; }
/* ── SIDEBAR — desktop ── */
.sidebar {
background:var(--surface); border-right:1px solid var(--border);
display:flex; flex-direction:column; overflow:hidden;
transition:opacity .25s ease, transform .25s ease;
z-index:50;
}
.app.sidebar-hidden .sidebar { opacity:0; pointer-events:none; }
/* ── SIDEBAR OVERLAY — mobile ── */
.sidebar-backdrop {
display:none; position:fixed; inset:0; background:rgba(0,0,0,.6);
backdrop-filter:blur(2px); z-index:49;
opacity:0; pointer-events:none; transition:opacity .25s ease;
}
.sidebar-backdrop.visible { opacity:1; pointer-events:all; }
@media (max-width:768px) {
.app {
display:flex; flex-direction:column;
grid-template-columns:unset;
}
.app.sidebar-hidden { grid-template-columns:unset; }
.sidebar {
position:fixed; left:0; top:0; bottom:0;
width:min(var(--sidebar-w), 85vw);
transform:translateX(-100%);
border-right:1px solid var(--border2);
box-shadow:4px 0 24px rgba(0,0,0,.6);
}
.app:not(.sidebar-hidden) .sidebar {
transform:translateX(0); opacity:1; pointer-events:all;
}
.app.sidebar-hidden .sidebar {
transform:translateX(-100%); opacity:1; pointer-events:none;
}
.sidebar-backdrop { display:block; }
.app:not(.sidebar-hidden) .sidebar-backdrop { opacity:1; pointer-events:all; }
}
.logo-wrap {
padding:16px 14px 12px; border-bottom:1px solid var(--border);
display:flex; align-items:center; gap:10px;
}
.logo-icon {
width:34px; height:34px; border-radius:10px; flex-shrink:0;
background:linear-gradient(135deg,#00d4aa,#00a8ff);
display:flex; align-items:center; justify-content:center;
font-size:18px; font-weight:700; color:#080b0f;
font-family:'Fira Code',monospace;
}
.logo-name { font-size:15px; font-weight:600; }
.logo-sub { font-size:10px; color:var(--muted2); font-family:'Fira Code',monospace; letter-spacing:.3px; }
.new-btn {
margin:10px 10px 6px; padding:9px 14px;
background:var(--accent-dim); border:1px solid rgba(0,212,170,0.2);
border-radius:var(--radius); color:var(--accent);
font-family:'Fira Code',monospace; font-size:12px;
cursor:pointer; display:flex; align-items:center; gap:8px;
transition:all .15s;
}
.new-btn:hover { background:rgba(0,212,170,0.13); border-color:rgba(0,212,170,0.4); }
.speed-badge {
margin:0 10px 6px; padding:7px 10px;
background:rgba(0,168,255,0.07); border:1px solid rgba(0,168,255,0.18);
border-radius:8px; font-size:11px; color:#60c8ff;
font-family:'Fira Code',monospace;
display:flex; align-items:center; gap:6px;
}
.hist-label {
padding:8px 14px 4px; font-size:10px; letter-spacing:1.5px;
text-transform:uppercase; color:var(--muted); font-family:'Fira Code',monospace;
}
.hist-list { flex:1; overflow-y:auto; padding:2px 6px; }
.hist-list::-webkit-scrollbar { width:3px; }
.hist-list::-webkit-scrollbar-thumb { background:var(--border2); border-radius:4px; }
.hist-item {
padding:8px 10px; border-radius:8px; font-size:12px; color:var(--muted2);
cursor:pointer; display:flex; align-items:center; gap:8px;
transition:all .12s; white-space:nowrap; overflow:hidden;
text-overflow:ellipsis; border:1px solid transparent; margin-bottom:2px;
}
.hist-item:hover { background:var(--surface2); color:var(--text); }
.hist-item.active { background:var(--accent-dim); border-color:rgba(0,212,170,0.2); color:var(--accent); }
.hist-item .lbl { overflow:hidden; text-overflow:ellipsis; flex:1; }
.hist-item .del { margin-left:auto; opacity:0; font-size:13px; flex-shrink:0; }
.hist-item:hover .del { opacity:.5; }
.hist-item .del:hover { opacity:1 !important; color:var(--red); }
.sidebar-foot { padding:8px 10px 12px; border-top:1px solid var(--border); display:flex; flex-direction:column; gap:6px; }
.sfoot-btn {
padding:9px 12px; border:1px solid var(--border); border-radius:var(--radius);
background:transparent; color:var(--muted2);
font-family:'Fira Code',monospace; font-size:11px;
cursor:pointer; display:flex; align-items:center; gap:8px; transition:all .15s;
}
.sfoot-btn:hover { border-color:var(--border2); color:var(--text); background:var(--surface2); }
/* ── MAIN ── */
.main { display:flex; flex-direction:column; height:100vh; overflow:hidden; }
.topbar {
height:var(--topbar-h); padding:0 22px; border-bottom:1px solid var(--border);
display:flex; align-items:center; justify-content:space-between;
background:var(--bg); flex-shrink:0;
}
.topbar-left { display:flex; align-items:center; gap:10px; }
.model-pill {
background:var(--surface2); border:1px solid var(--border2);
border-radius:20px; padding:4px 12px 4px 8px;
font-family:'Fira Code',monospace; font-size:11px; color:var(--muted2);
display:flex; align-items:center; gap:7px;
max-width:180px; overflow:hidden;
}
.model-pill span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sdot {
width:7px; height:7px; border-radius:50%;
background:var(--accent); box-shadow:0 0 7px var(--accent); flex-shrink:0;
}
.sdot.off { background:var(--red); box-shadow:0 0 7px var(--red); }
.top-btns { display:flex; gap:6px; }
.iBtn {
width:30px; height:30px; border-radius:7px; border:1px solid transparent;
background:transparent; color:var(--muted); cursor:pointer; font-size:13px;
display:flex; align-items:center; justify-content:center; transition:all .15s;
min-width:var(--tap-min); min-height:var(--tap-min); /* zone tactile étendue */
}
.iBtn:hover { background:var(--surface2); border-color:var(--border); color:var(--text); }
.iBtn.active { background:var(--accent-dim); border-color:rgba(0,212,170,0.25); color:var(--accent); }
/* ── MESSAGES ── */
.msgs-wrap { flex:1; overflow-y:auto; -webkit-overflow-scrolling:touch; }
.msgs-wrap::-webkit-scrollbar { width:4px; }
.msgs-wrap::-webkit-scrollbar-thumb { background:var(--border2); border-radius:4px; }
.msgs-inner { max-width:740px; margin:0 auto; padding:28px 22px 12px; }
.empty {
display:flex; flex-direction:column; align-items:center; justify-content:center;
min-height:60vh; gap:14px; text-align:center; opacity:.55; padding:40px;
}
.empty-icon {
width:58px; height:58px; border-radius:16px;
background:linear-gradient(135deg,rgba(0,212,170,.15),rgba(0,168,255,.15));
border:1px solid rgba(0,212,170,.2);
display:flex; align-items:center; justify-content:center; font-size:26px;
}
.empty-title { font-size:17px; font-weight:600; color:var(--text); }
.empty-sub { font-size:13px; color:var(--muted2); max-width:380px; line-height:1.65; }
.message { display:flex; gap:12px; margin-bottom:22px; animation:msgIn .18s ease; }
@keyframes msgIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }
.av {
width:26px; height:26px; border-radius:7px; flex-shrink:0;
display:flex; align-items:center; justify-content:center;
font-size:11px; font-weight:600; margin-top:2px;
}
.av.user {
background:linear-gradient(135deg,var(--accent),var(--accent2));
color:#080b0f; font-family:'Fira Code',monospace;
}
.av.ai {
background:linear-gradient(135deg,rgba(0,212,170,.12),rgba(0,168,255,.12));
border:1px solid rgba(0,212,170,.25); color:var(--accent); font-size:14px;
}
.msg-body { flex:1; min-width:0; }
.msg-head { display:flex; align-items:baseline; gap:8px; margin-bottom:5px; }
.msg-name { font-size:13px; font-weight:600; }
.msg-time { font-size:11px; color:var(--muted); font-family:'Fira Code',monospace; }
.msg-content { font-size:14px; line-height:1.8; color:#b8ccd8; word-break:break-word; }
.msg-content p { margin-bottom:9px; }
.msg-content p:last-child { margin-bottom:0; }
.msg-content pre {
background:#060810; border:1px solid var(--border2); border-radius:8px;
padding:13px 15px; overflow-x:auto; margin:10px 0;
font-family:'Fira Code',monospace; font-size:12px; line-height:1.6; color:#90b8c8;
}
.msg-content code {
background:rgba(0,212,170,.08); color:#00d4aa; padding:2px 5px;
border-radius:4px; font-family:'Fira Code',monospace; font-size:12.5px;
}
.msg-content pre code { background:none; color:inherit; padding:0; }
.msg-content ul,.msg-content ol { padding-left:20px; margin-bottom:9px; }
.msg-content li { margin-bottom:4px; }
.msg-content strong { color:var(--text); font-weight:600; }
.msg-content em { color:#90a8b8; }
.msg-content blockquote {
border-left:3px solid var(--accent); padding:8px 14px; margin:10px 0;
background:rgba(0,212,170,.04); border-radius:0 6px 6px 0;
color:var(--muted2); font-style:italic;
}
.msg-content h1 { font-size:18px; color:var(--text); margin:14px 0 6px; font-weight:600; }
.msg-content h2 { font-size:16px; color:var(--text); margin:12px 0 5px; font-weight:600; }
.msg-content h3 { font-size:14px; color:var(--text); margin:10px 0 4px; font-weight:600; }
.msg-actions { display:flex; gap:5px; margin-top:7px; opacity:0; transition:opacity .15s; }
.message:hover .msg-actions { opacity:1; }
/* Sur mobile : toujours visible (pas de hover) */
@media (hover:none) { .msg-actions { opacity:.6; } }
.act-btn {
font-size:11px; padding:3px 8px; background:var(--surface2);
border:1px solid var(--border); border-radius:5px; color:var(--muted);
cursor:pointer; font-family:'Fira Code',monospace; transition:all .12s;
}
.act-btn:hover { color:var(--text); border-color:var(--border2); }
.typing { display:flex; gap:5px; padding:4px 0; align-items:center; }
.typing span {
width:7px; height:7px; border-radius:50%; background:var(--accent);
opacity:.4; animation:tp 1s ease infinite;
}
.typing span:nth-child(2) { animation-delay:.18s; }
.typing span:nth-child(3) { animation-delay:.36s; }
@keyframes tp { 0%,80%,100%{transform:scale(.8);opacity:.3} 40%{transform:scale(1.2);opacity:1} }
.cur {
display:inline-block; width:2px; height:13px; background:var(--accent);
margin-left:1px; vertical-align:text-bottom;
animation:blink .85s ease infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }
/* ── INPUT ── */
.input-area {
flex-shrink:0; padding:10px 22px 18px;
background:var(--bg); border-top:1px solid var(--border);
padding-bottom:max(18px, env(safe-area-inset-bottom));
}
.input-inner { max-width:740px; margin:0 auto; }
.input-box {
background:var(--surface); border:1px solid var(--border2);
border-radius:12px; display:flex; align-items:flex-end; gap:8px;
padding:9px 10px; transition:border-color .2s, box-shadow .2s;
}
.input-box:focus-within {
border-color:rgba(0,212,170,.4);
box-shadow:0 0 0 3px rgba(0,212,170,.06);
}
#userInput {
flex:1; background:transparent; border:none; outline:none;
color:var(--text); font-family:'Outfit',sans-serif; font-size:14px;
resize:none; min-height:24px; max-height:160px;
line-height:1.6; padding:2px 0; scrollbar-width:thin;
}
#userInput::placeholder { color:var(--muted); }
.send-btn {
width:34px; height:34px; border-radius:8px; flex-shrink:0;
background:linear-gradient(135deg,var(--accent),var(--accent2));
border:none; color:#080b0f; font-size:15px;
cursor:pointer; display:flex; align-items:center; justify-content:center;
transition:all .15s; box-shadow:0 2px 10px rgba(0,212,170,.25);
min-width:var(--tap-min); min-height:var(--tap-min);
}
.send-btn:hover { transform:scale(1.05); box-shadow:0 4px 14px rgba(0,212,170,.35); }
.send-btn:disabled { background:var(--border2); box-shadow:none; color:var(--muted); cursor:not-allowed; transform:none; }
.input-foot { display:flex; justify-content:space-between; padding:6px 3px 0; }
.input-hint { font-size:11px; color:var(--muted); font-family:'Fira Code',monospace; }
/* ── MEDIA QUERIES MOBILE ── */
@media (max-width:768px) {
.main { height:100dvh; } /* dvh = dynamic viewport height, gère la barre d'adresse mobile */
.topbar { padding:0 12px; height:48px; }
.model-pill { max-width:120px; font-size:10px; padding:3px 8px 3px 6px; }
.model-pill .model-full { display:none; } /* nom court sur mobile */
.model-pill .model-short { display:inline; }
.input-area { padding:8px 12px max(12px,env(safe-area-inset-bottom)); }
#userInput { font-size:16px; } /* empêche le zoom automatique sur iOS */
.msgs-inner { padding:16px 14px 8px; }
.message { gap:8px; margin-bottom:16px; }
.msg-content { font-size:13.5px; }
.quota-wrap { min-width:unset; }
.quota-label { display:none; } /* juste la barre sur petit écran */
.input-hint { display:none; } /* raccourcis clavier inutiles sur mobile */
.send-btn { width:38px; height:38px; }
}
/* ── DESKTOP : modal plus large ── */
@media (min-width:769px) {
.modal { width:560px; }
.model-pill .model-short { display:none; }
.model-pill .model-full { display:inline; }
}
/* ── MODAL ── */
.overlay {
position:fixed; inset:0; background:rgba(0,0,0,.78); backdrop-filter:blur(5px);
z-index:100; display:flex; align-items:center; justify-content:center;
opacity:0; pointer-events:none; transition:opacity .2s;
}
.overlay.open { opacity:1; pointer-events:all; }
.modal {
background:var(--surface); border:1px solid var(--border2);
border-radius:16px; width:500px; max-width:95vw; max-height:90vh;
overflow-y:auto; transform:scale(.96) translateY(8px);
transition:transform .2s; box-shadow:0 24px 60px rgba(0,0,0,.7);
}
.overlay.open .modal { transform:scale(1) translateY(0); }
.modal::-webkit-scrollbar { width:4px; }
.modal::-webkit-scrollbar-thumb { background:var(--border2); border-radius:4px; }
.mhead {
padding:18px 20px 14px; border-bottom:1px solid var(--border);
display:flex; align-items:center; justify-content:space-between;
}
.mtitle { font-size:15px; font-weight:600; display:flex; align-items:center; gap:8px; }
.mclose {
width:26px; height:26px; background:var(--surface2); border:1px solid var(--border);
border-radius:6px; color:var(--muted2); cursor:pointer; font-size:14px;
display:flex; align-items:center; justify-content:center; transition:all .15s;
}
.mclose:hover { color:var(--text); }
.mbody { padding:18px 20px; }
.free-info {
background:rgba(0,212,170,.05); border:1px solid rgba(0,212,170,.18);
border-radius:8px; padding:12px 14px; margin-bottom:18px;
font-size:12px; color:#70d8b8; line-height:1.65; font-family:'Fira Code',monospace;
}
.free-info strong { color:var(--accent); }
.free-info a { color:var(--accent2); text-decoration:none; }
.free-info a:hover { text-decoration:underline; }
.fg { margin-bottom:16px; }
.flabel { display:flex; align-items:center; justify-content:space-between; margin-bottom:6px; }
.flabel-t { font-size:12px; font-weight:500; color:var(--text); }
.flabel-h { font-size:11px; color:var(--muted); font-family:'Fira Code',monospace; }
.fi {
width:100%; background:var(--surface2); border:1px solid var(--border2);
border-radius:8px; color:var(--text); font-family:'Fira Code',monospace;
font-size:12.5px; padding:9px 12px; outline:none; transition:border-color .2s;
}
.fi:focus { border-color:rgba(0,212,170,.5); }
.fi::placeholder { color:var(--muted); }
.fs {
width:100%; background:var(--surface2); border:1px solid var(--border2);
border-radius:8px; color:var(--text); font-family:'Fira Code',monospace;
font-size:12.5px; padding:9px 12px; outline:none; cursor:pointer; appearance:none;
background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%233d5060' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
background-repeat:no-repeat; background-position:right 12px center; padding-right:30px;
}
.fs option { background:var(--surface2); }
.fta {
width:100%; background:var(--surface2); border:1px solid var(--border2);
border-radius:8px; color:var(--text); font-family:'Fira Code',monospace;
font-size:12px; padding:9px 12px; outline:none; resize:vertical;
min-height:85px; line-height:1.6; transition:border-color .2s;
}
.fta:focus { border-color:rgba(0,212,170,.5); }
.frw { display:flex; align-items:center; gap:12px; }
input[type="range"] { flex:1; -webkit-appearance:none; height:3px; border-radius:4px; background:var(--border2); outline:none; }
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance:none; width:15px; height:15px; border-radius:50%;
background:var(--accent); cursor:pointer; border:2px solid var(--surface);
box-shadow:0 0 6px rgba(0,212,170,.5);
}
.frv { font-family:'Fira Code',monospace; font-size:12px; color:var(--accent); min-width:28px; text-align:right; }
.fdiv { height:1px; background:var(--border); margin:2px 0 16px; }
.fsect { font-size:10px; letter-spacing:1.5px; text-transform:uppercase; color:var(--muted); font-family:'Fira Code',monospace; margin-bottom:12px; }
.kst { display:flex; align-items:center; gap:6px; margin-top:5px; font-size:11px; font-family:'Fira Code',monospace; }
.kst .kd { width:6px; height:6px; border-radius:50%; }
.kst.ok .kd { background:var(--accent); }
.kst.bad .kd { background:var(--red); }
.kst.ok { color:var(--accent); }
.kst.bad { color:var(--red); }
.mfoot {
padding:12px 20px; border-top:1px solid var(--border);
display:flex; justify-content:space-between; align-items:center; gap:8px;
}
.btn-p {
background:linear-gradient(135deg,var(--accent),var(--accent2));
color:#080b0f; border:none; border-radius:8px;
padding:8px 18px; font-family:'Fira Code',monospace; font-size:12px;
font-weight:500; cursor:pointer; transition:all .15s;
box-shadow:0 2px 10px rgba(0,212,170,.2);
}
.btn-p:hover { box-shadow:0 4px 14px rgba(0,212,170,.3); transform:translateY(-1px); }
.btn-g {
background:transparent; color:var(--muted2); border:1px solid var(--border2);
border-radius:8px; padding:8px 14px; font-family:'Fira Code',monospace;
font-size:12px; cursor:pointer; transition:all .15s;
}
.btn-g:hover { color:var(--text); background:var(--surface2); }
.btn-d {
background:transparent; color:var(--red); border:1px solid rgba(255,79,106,.25);
border-radius:8px; padding:8px 14px; font-family:'Fira Code',monospace;
font-size:12px; cursor:pointer; transition:all .15s;
}
.btn-d:hover { background:rgba(255,79,106,.07); }
.no-key {
background:rgba(255,79,106,.06); border:1px solid rgba(255,79,106,.2);
border-radius:10px; padding:14px 16px; margin-bottom:20px;
display:flex; align-items:center; gap:12px; font-size:13px; color:#f09090;
}
.no-key button {
margin-left:auto; background:var(--red); color:white; border:none;
border-radius:6px; padding:5px 11px; font-size:11px;
font-family:'Fira Code',monospace; cursor:pointer; white-space:nowrap;
}
.toast {
position:fixed; bottom:22px; right:22px;
background:var(--surface2); border:1px solid var(--border2);
border-radius:10px; padding:11px 16px; font-size:13px; color:var(--text);
display:flex; align-items:center; gap:8px; z-index:200;
transform:translateY(16px); opacity:0; transition:all .22s;
pointer-events:none; box-shadow:0 8px 28px rgba(0,0,0,.5); max-width:300px;
}
.toast.show { transform:translateY(0); opacity:1; }
.toast.ok { border-left:3px solid var(--accent); }
.toast.err { border-left:3px solid var(--red); }
/* ── QUOTA BAR ── */
.quota-wrap {
display:flex; align-items:center; gap:8px;
background:var(--surface2); border:1px solid var(--border2);
border-radius:20px; padding:4px 10px 4px 8px;
font-family:'Fira Code',monospace; font-size:10px; color:var(--muted2);
cursor:default; user-select:none; min-width:130px;
transition:border-color .2s;
}
.quota-wrap:hover { border-color:var(--border2); color:var(--text); }
.quota-track {
flex:1; height:4px; background:var(--border); border-radius:4px; overflow:hidden; min-width:60px;
}
.quota-fill {
height:100%; border-radius:4px;
background:var(--accent);
transition:width .4s ease, background .4s ease;
}
.quota-fill.warn { background:var(--yellow); }
.quota-fill.danger { background:var(--red); box-shadow:0 0 6px rgba(255,79,106,.5); }
.quota-label { white-space:nowrap; font-size:10px; }
/* ── MODEL LIMITS TABLE ── */
.limits-table { width:100%; border-collapse:collapse; font-family:'Fira Code',monospace; font-size:11px; }
.limits-table th {
text-align:left; color:var(--muted); padding:5px 6px;
border-bottom:1px solid var(--border); font-weight:400; letter-spacing:.5px;
}
.limits-table th:not(:first-child) { text-align:center; }
.limits-table td { padding:4px 6px; border-bottom:1px solid rgba(28,35,48,.6); vertical-align:middle; }
.limits-table tr:last-child td { border-bottom:none; }
.limits-table td:first-child { color:var(--muted2); font-size:10px; }
.limits-table td.usage-cell { text-align:center; }
.lim-input {
width:72px; background:var(--surface); border:1px solid var(--border2);
border-radius:5px; color:var(--text); font-family:'Fira Code',monospace;
font-size:11px; padding:3px 6px; outline:none; text-align:center;
transition:border-color .15s;
}
.lim-input:focus { border-color:rgba(0,212,170,.5); }
.usage-bar-wrap { display:flex; align-items:center; gap:5px; justify-content:center; }
.usage-mini { height:3px; width:40px; background:var(--border); border-radius:4px; overflow:hidden; flex-shrink:0; }
.usage-mini-fill { height:100%; border-radius:4px; background:var(--accent); transition:width .3s ease, background .3s ease; }
.usage-mini-fill.warn { background:var(--yellow); }
.usage-mini-fill.danger { background:var(--red); }
.usage-pct { font-size:10px; color:var(--muted2); min-width:28px; text-align:right; }
</style>
</head>
<body>
<div class="app" id="app">
<!-- SIDEBAR BACKDROP (mobile) -->
<div class="sidebar-backdrop" id="sidebarBackdrop"></div>
<!-- SIDEBAR -->
<aside class="sidebar">
<div class="logo-wrap">
<div class="logo-icon">G</div>
<div>
<div class="logo-name">Mon Groq</div>
<div class="logo-sub">groq · gratuit · rapide</div>
</div>
</div>
<button class="new-btn" id="newChatBtn">+ Nouvelle conversation</button>
<div class="speed-badge">⚡ Inférence ultra-rapide</div>
<div class="hist-label">Historique</div>
<div class="hist-list" id="histList"></div>
<div class="sidebar-foot">
<button class="sfoot-btn" id="settingsBtn">⚙ Paramètres & Clé API</button>
<button class="sfoot-btn" id="exportBtn">⬇ Exporter la conversation</button>
</div>
</aside>
<!-- MAIN -->
<main class="main">
<div class="topbar">
<div class="topbar-left">
<button class="iBtn" id="sidebarToggle" title="Afficher/masquer le menu">☰</button>
<div class="model-pill">
<div class="sdot" id="sdot"></div>
<span class="model-full" id="modelLabel">gpt-oss-120b</span>
<span class="model-short" id="modelLabelShort">GPT-OSS</span>
</div>
</div>
<div style="display:flex;align-items:center;gap:8px;">
<div class="quota-wrap" id="quotaWrap" title="Tokens utilisés aujourd'hui">
<div class="quota-track"><div class="quota-fill" id="quotaFill" style="width:0%"></div></div>
<span class="quota-label" id="quotaLabel">0 tok</span>
</div>
<div class="top-btns">
<button class="iBtn" id="clearBtn">🗑</button>
<button class="iBtn" id="topSettingsBtn">⚙</button>
</div>
</div>
</div>
<div class="msgs-wrap" id="msgsWrap">
<div class="msgs-inner" id="msgsInner"></div>
</div>
<div class="input-area">
<div class="input-inner">
<div class="input-box">
<textarea id="userInput" placeholder="Écrivez votre message…" rows="1"></textarea>
<button class="send-btn" id="sendBtn">➤</button>
</div>
<div class="input-foot">
<span class="input-hint">⏎ Envoyer · ⇧⏎ Nouvelle ligne</span>
</div>
</div>
</div>
</main>
</div>
<!-- MODAL -->
<div class="overlay" id="modal">
<div class="modal">
<div class="mhead">
<div class="mtitle">⚙ Paramètres</div>
<button class="mclose" id="closeModalBtn">✕</button>
</div>
<div class="mbody">
<div class="free-info">
<strong>✓ API 100% gratuite</strong><br>
Obtenez votre clé sur <a href="https://console.groq.com/keys" target="_blank">console.groq.com/keys</a> — aucune carte bancaire. Disponible partout, y compris en Europe.
</div>
<div class="fsect">🔑 Authentification</div>
<div class="fg">
<div class="flabel">
<span class="flabel-t">Clé API Groq</span>
<span class="flabel-h">stockée uniquement en local</span>
</div>
<input type="password" class="fi" id="apiKey" placeholder="gsk_..." autocomplete="off">
<div class="kst bad" id="keyStatus">
<div class="kd"></div>
<span id="keyTxt">Aucune clé configurée</span>
</div>
</div>
<div class="fdiv"></div>
<div class="fsect">🤖 Modèle</div>
<div class="fg">
<div class="flabel"><span class="flabel-t">Modèle</span></div>
<select class="fs" id="modelSel">
<optgroup label="── Ultra-puissants (Recommandés) ──">
<option value="openai/gpt-oss-120b">GPT-OSS 120B — OpenAI open-source, dépasse o4-mini ⭐</option>
<option value="moonshotai/kimi-k2-instruct">Kimi K2 — ~1T MoE, meilleur pour le code 🏆</option>
<option value="openai/gpt-oss-20b">GPT-OSS 20B — MoE rapide, 1000+ tokens/sec</option>
<option value="meta-llama/llama-4-maverick-17b-128e-instruct">Llama 4 Maverick — 17Bx128 MoE, multimodal</option>
<option value="meta-llama/llama-4-scout-17b-16e-instruct">Llama 4 Scout — Contexte 10M tokens 🔥</option>
</optgroup>
<optgroup label="── Raisonnement ──">
<option value="qwen/qwen3-32b">Qwen3 32B — Raisonnement, très polyvalent</option>
<option value="deepseek-r1-distill-llama-70b">DeepSeek R1 70B — Chaîne de pensée visible</option>
</optgroup>
<optgroup label="── Rapides & Efficaces ──">
<option value="llama-3.3-70b-versatile">Llama 3.3 70B — Valeur sûre, rapide</option>
<option value="llama-3.1-8b-instant">Llama 3.1 8B — Ultra-rapide, usage léger</option>
<option value="gemma2-9b-it">Gemma 2 9B — Modèle Google</option>
<option value="mixtral-8x7b-32768">Mixtral 8x7B — Contexte 32k</option>
</optgroup>
<optgroup label="── Vision & Images ──">
<option value="llama-3.2-11b-vision-preview">Llama 3.2 11B Vision — Analyse d'images</option>
</optgroup>
</select>
</div>
<div class="fg">
<div class="flabel">
<span class="flabel-t">Température</span>
<span class="flabel-h">0 = précis · 2 = créatif</span>
</div>
<div class="frw">
<input type="range" id="tempR" min="0" max="2" step="0.1" value="0.7">
<span class="frv" id="tempV">0.7</span>
</div>
</div>
<div class="fg">
<div class="flabel"><span class="flabel-t">Tokens max</span></div>
<select class="fs" id="maxTok">
<option value="512">512 — Court</option>
<option value="1024">1 024 — Standard</option>
<option value="2048" selected>2 048 — Normal</option>
<option value="4096">4 096 — Long</option>
<option value="8192">8 192 — Très long</option>
</select>
</div>
<div class="fdiv"></div>
<div class="fsect">🎭 Personnalité</div>
<div class="fg">
<div class="flabel"><span class="flabel-t">System Prompt</span></div>
<textarea class="fta" id="sysPrompt">Tu es un assistant utile et précis. Réponds en français sauf si on te parle dans une autre langue.</textarea>
</div>
<div class="fg">
<div class="flabel"><span class="flabel-t">Votre prénom (optionnel)</span></div>
<input type="text" class="fi" id="uname" placeholder="ex: Alex">
</div>
<div class="fdiv"></div>
<div class="fsect">📊 Limites Groq — tier gratuit</div>
<div class="free-info" style="margin-bottom:14px;">
Valeurs pré-remplies depuis la <a href="https://console.groq.com/docs/rate-limits" target="_blank">doc officielle Groq</a>. Modifiez-les si les plafonds changent. <strong>0 = pas de limite.</strong><br>
<span style="color:var(--muted2)">RPD = requêtes/jour · TPD = tokens/jour</span>
</div>
<div style="overflow-x:auto;margin-bottom:16px;">
<table class="limits-table" id="modelLimitsTable">
<thead>
<tr>
<th>Modèle</th>
<th>RPD</th>
<th>TPD</th>
<th>Aujourd'hui</th>
</tr>
</thead>
<tbody id="limitsBody"></tbody>
</table>
</div>
<div class="fg">
<div class="flabel">
<span class="flabel-t">Seuil d'alerte</span>
<span class="flabel-h">% avant avertissement</span>
</div>
<div class="frw">
<input type="range" id="quotaWarnR" min="50" max="95" step="5" value="80">
<span class="frv" id="quotaWarnV">80%</span>
</div>
</div>
<div class="fg">
<div class="flabel"><span class="flabel-t">Bloquer à la limite</span></div>
<select class="fs" id="quotaBlock">
<option value="no" selected>Non — Avertir seulement</option>
<option value="yes">Oui — Bloquer l'envoi</option>
</select>
</div>
<div class="fg" style="background:rgba(0,212,170,.04);border:1px solid rgba(0,212,170,.12);border-radius:8px;padding:10px 12px;">
<div style="font-size:10px;letter-spacing:1px;text-transform:uppercase;color:var(--muted);font-family:'Fira Code',monospace;margin-bottom:8px;">Modèle actif — aujourd'hui</div>
<div style="display:flex;gap:20px;flex-wrap:wrap;font-family:'Fira Code',monospace;font-size:12px;">
<div><span style="color:var(--muted2)">Tokens :</span> <span id="statTokens" style="color:var(--accent)">0</span></div>
<div><span style="color:var(--muted2)">Requêtes :</span> <span id="statReqs" style="color:var(--accent)">0</span></div>
<div><span style="color:var(--muted2)">Reset :</span> <span id="statReset" style="color:var(--muted2)">minuit</span></div>
</div>
</div>
<div class="fdiv"></div>
<div class="fsect">💾 Stockage</div>
<div class="fg">
<div class="flabel"><span class="flabel-t">Sauvegarder l'historique</span></div>
<select class="fs" id="saveHist">
<option value="yes" selected>Oui — Conservé entre les sessions</option>
<option value="no">Non — Effacé à la fermeture</option>
</select>
</div>
</div>
<div class="mfoot">
<button class="btn-d" id="wipeBtn">🗑 Tout effacer</button>
<div style="display:flex;gap:8px">
<button class="btn-g" id="cancelSettingsBtn">Annuler</button>
<button class="btn-p" id="saveSettingsBtn">✓ Sauvegarder</button>
</div>
</div>
</div>
</div>
<div class="toast" id="toast"></div>
<script>
// ── DEVICE DETECTION ──
const isMobile = (() => {
const ua = navigator.userAgent || navigator.vendor || window.opera;
const mobileUA = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(ua);
const smallScreen = window.innerWidth <= 768;
const touchOnly = window.matchMedia('(hover:none) and (pointer:coarse)').matches;
return mobileUA || (smallScreen && touchOnly);
})();
// ── STATE ──
let sessions = {}, sid = null, streaming = false;
let sidebarOpen = !isMobile; // fermé par défaut sur mobile, ouvert sur desktop
// Plafonds officiels Groq — tier gratuit (modifiables dans les Paramètres)
const DEFAULT_MODEL_LIMITS = {
'openai/gpt-oss-120b': { rpd: 250, tpd: 0 },
'moonshotai/kimi-k2-instruct': { rpd: 250, tpd: 0 },
'openai/gpt-oss-20b': { rpd: 250, tpd: 0 },
'meta-llama/llama-4-maverick-17b-128e-instruct': { rpd: 1000, tpd: 500000 },
'meta-llama/llama-4-scout-17b-16e-instruct': { rpd: 1000, tpd: 500000 },
'qwen/qwen3-32b': { rpd: 1000, tpd: 100000 },
'deepseek-r1-distill-llama-70b': { rpd: 1000, tpd: 100000 },
'llama-3.3-70b-versatile': { rpd: 1000, tpd: 100000 },
'llama-3.1-8b-instant': { rpd: 14400, tpd: 500000 },
'gemma2-9b-it': { rpd: 14400, tpd: 500000 },
'mixtral-8x7b-32768': { rpd: 14400, tpd: 500000 },
'llama-3.2-11b-vision-preview': { rpd: 1000, tpd: 500000 },
};
// Noms courts pour l'affichage
const MODEL_SHORT = {
'openai/gpt-oss-120b': 'GPT-OSS 120B',
'moonshotai/kimi-k2-instruct': 'Kimi K2',
'openai/gpt-oss-20b': 'GPT-OSS 20B',
'meta-llama/llama-4-maverick-17b-128e-instruct': 'Llama 4 Maverick',
'meta-llama/llama-4-scout-17b-16e-instruct': 'Llama 4 Scout',
'qwen/qwen3-32b': 'Qwen3 32B',
'deepseek-r1-distill-llama-70b': 'DeepSeek R1 70B',
'llama-3.3-70b-versatile': 'Llama 3.3 70B',
'llama-3.1-8b-instant': 'Llama 3.1 8B',
'gemma2-9b-it': 'Gemma 2 9B',
'mixtral-8x7b-32768': 'Mixtral 8x7B',
'llama-3.2-11b-vision-preview': 'Llama 3.2 Vision',
};
const DEFAULT_CFG = {
apiKey: '', model: 'openai/gpt-oss-120b',
temp: 0.7, maxTok: 2048,
sysPrompt: 'Tu es un assistant utile et précis. Réponds en français sauf si on te parle dans une autre langue.',
uname: '', saveHist: 'yes',
quotaWarn: 80, quotaBlock: 'no',
modelLimits: { ...DEFAULT_MODEL_LIMITS }
};
let cfg = { ...DEFAULT_CFG };
// ── DOM REFS ──
const app = document.getElementById('app');
const histList = document.getElementById('histList');
const msgsInner = document.getElementById('msgsInner');
const msgsWrap = document.getElementById('msgsWrap');
const userInput = document.getElementById('userInput');
const sendBtn = document.getElementById('sendBtn');
const sdot = document.getElementById('sdot');
const modelLabel = document.getElementById('modelLabel');
const modal = document.getElementById('modal');
const toastEl = document.getElementById('toast');
const sidebarToggle = document.getElementById('sidebarToggle');
// ── INIT ──
window.onload = () => {
loadStorage();
resetQuotaIfNewDay();
// Appliquer l'état initial de la sidebar selon le terminal
app.classList.toggle('sidebar-hidden', !sidebarOpen);
sidebarToggle.classList.toggle('active', !sidebarOpen);
renderHist();
syncDot();
renderQuota();
if (!Object.keys(sessions).length) {
newChat();
} else {
const last = Object.keys(sessions).sort((a, b) => sessions[b].ts - sessions[a].ts)[0];
loadSess(last);
}
if (!cfg.apiKey) setTimeout(openSettings, 400);
// Event listeners
document.getElementById('newChatBtn').addEventListener('click', newChat);
document.getElementById('settingsBtn').addEventListener('click', openSettings);
document.getElementById('exportBtn').addEventListener('click', exportChat);
document.getElementById('clearBtn').addEventListener('click', clearMsgs);
document.getElementById('topSettingsBtn').addEventListener('click', openSettings);
sendBtn.addEventListener('click', sendMsg);
sidebarToggle.addEventListener('click', toggleSidebar);
document.getElementById('closeModalBtn').addEventListener('click', closeSettings);
document.getElementById('cancelSettingsBtn').addEventListener('click', closeSettings);
document.getElementById('saveSettingsBtn').addEventListener('click', saveSettings);
document.getElementById('wipeBtn').addEventListener('click', wipeAll);
document.getElementById('apiKey').addEventListener('input', checkKey);
document.getElementById('tempR').addEventListener('input', e => {
document.getElementById('tempV').textContent = e.target.value;
});
userInput.addEventListener('keydown', handleKey);
userInput.addEventListener('input', () => resizeTA(userInput));
// Masquer la sidebar dès que le champ de saisie est activé
userInput.addEventListener('focus', hideSidebar);
document.getElementById('quotaWarnR').addEventListener('input', e => {
document.getElementById('quotaWarnV').textContent = e.target.value + '%';
});
modal.addEventListener('click', e => { if (e.target === modal) closeSettings(); });
// Backdrop mobile : ferme la sidebar au tap
document.getElementById('sidebarBackdrop').addEventListener('click', hideSidebar);
// Resize : re-évaluer l'état si l'orientation change
window.addEventListener('resize', () => {
if (window.innerWidth > 768 && !sidebarOpen) {
// Ré-ouverture auto sur desktop si on agrandit la fenêtre
sidebarOpen = true;
app.classList.remove('sidebar-hidden');
sidebarToggle.classList.remove('active');
}
});
};
// ── SIDEBAR ──
function toggleSidebar() {
sidebarOpen = !sidebarOpen;
app.classList.toggle('sidebar-hidden', !sidebarOpen);
sidebarToggle.classList.toggle('active', !sidebarOpen);
}
function hideSidebar() {
if (sidebarOpen) {
sidebarOpen = false;
app.classList.add('sidebar-hidden');
sidebarToggle.classList.add('active');
}
}
// ── STORAGE ──
function loadStorage() {
try {
const c = localStorage.getItem('groq_cfg');
if (c) {
const saved = JSON.parse(c);
cfg = { ...DEFAULT_CFG, ...saved };
// Fusionner les limites sauvegardées avec les défauts (nouveaux modèles éventuels)
cfg.modelLimits = { ...DEFAULT_MODEL_LIMITS, ...(saved.modelLimits || {}) };
}
const s = localStorage.getItem('groq_sess');
if (s) sessions = JSON.parse(s);
} catch(e) {}
}
function save() {
localStorage.setItem('groq_cfg', JSON.stringify(cfg));
if (cfg.saveHist === 'yes') localStorage.setItem('groq_sess', JSON.stringify(sessions));
}
// ── QUOTA — PAR MODÈLE ──
function loadQuota() {
try {
const q = localStorage.getItem('groq_quota');
return q ? JSON.parse(q) : { date: today(), models: {} };
} catch(e) { return { date: today(), models: {} }; }
}
function saveQuota(q) { localStorage.setItem('groq_quota', JSON.stringify(q)); }
function today() { return new Date().toISOString().slice(0, 10); }
function resetQuotaIfNewDay() {
const q = loadQuota();
if (q.date !== today()) saveQuota({ date: today(), models: {} });
}
function getModelUsage(q, modelId) {
return q.models[modelId] || { tokens: 0, reqs: 0 };
}
function addUsage(tokens) {
const q = loadQuota();
if (!q.models[cfg.model]) q.models[cfg.model] = { tokens: 0, reqs: 0 };
q.models[cfg.model].tokens += tokens;
q.models[cfg.model].reqs += 1;
saveQuota(q);
renderQuota();
checkQuotaWarning(q, cfg.model);
}
// Retourne le % de la contrainte la plus sévère pour un modèle donné (0–100)
function worstPct(q, modelId) {
const usage = getModelUsage(q, modelId);
const limits = cfg.modelLimits?.[modelId] || DEFAULT_MODEL_LIMITS[modelId] || { rpd: 0, tpd: 0 };
const pctReq = limits.rpd > 0 ? (usage.reqs / limits.rpd) * 100 : 0;
const pctTok = limits.tpd > 0 ? (usage.tokens / limits.tpd) * 100 : 0;
return { pct: Math.min(Math.max(pctReq, pctTok), 100), pctReq, pctTok, usage, limits };
}
function renderQuota() {
const q = loadQuota();
const fill = document.getElementById('quotaFill');
const label = document.getElementById('quotaLabel');
const warn = parseInt(cfg.quotaWarn) || 80;
const { pct, pctReq, pctTok, usage, limits } = worstPct(q, cfg.model);
const hasLimit = limits.rpd > 0 || limits.tpd > 0;
if (!hasLimit) {
fill.style.width = '0%';
fill.className = 'quota-fill';
label.textContent = usage.reqs + ' req · ' + fmtTok(usage.tokens);
document.getElementById('quotaWrap').title =
`${usage.reqs} requête(s) · ${usage.tokens.toLocaleString('fr-FR')} tokens aujourd'hui (limites non configurées)`;
return;
}
fill.style.width = pct.toFixed(1) + '%';
fill.className = 'quota-fill' + (pct >= 100 ? ' danger' : pct >= warn ? ' warn' : '');
// Label : afficher la contrainte la plus sévère