-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
4702 lines (4239 loc) · 175 KB
/
index.html
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="en" data-theme="light">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Pastel Inference Client UI</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@sira-ui/tailwind/dist/css/styles.css" />
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/xterm.css" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/xterm.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.6.0/jszip.min.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;700&display=swap" rel="stylesheet" />
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/styles/default.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/languages/json.min.js"></script>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/browser-image-compression.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-sha3/0.9.3/sha3.min.js"></script>
<script>
// Function to check if running in Electron
function isRunningInElectron() {
if (navigator.userAgent.toLowerCase().indexOf(' electron/') > -1) {
return true;
}
if (window.process && process.type === 'renderer') {
return true;
}
if (typeof window !== 'undefined' && typeof window.electron !== 'undefined') {
return true;
}
if (location.hash === '#wallet') {
return true;
}
return false;
}
if (isRunningInElectron()) {
const eleHtml = document.querySelector('html');
const toggle = document.querySelector("#theme-toggle");
if (eleHtml) {
eleHtml.setAttribute("data-theme", "dark");
}
if (toggle) {
toggle.checked = true
}
}
</script>
<style>
/* Base Styles */
body {
font-family: Montserrat, sans-serif;
}
* {
scroll-margin-top: 72px;
}
/* Theme Styles */
:root {
--bg-color: #ffffff;
--text-color: #121212;
--border-color: #ccc;
--hover-bg: #4caf50;
--hover-text: #ffffff;
}
[data-theme="dark"] {
--bg-color: #121212;
--text-color: #e0e0e0;
--border-color: #444444;
--hover-bg: #45a049;
--hover-text: #121212;
}
body {
background-color: var(--bg-color);
color: var(--text-color);
}
/* Button Styles */
.btn.success.outline {
border-color: #4caf50;
color: #4caf50;
}
.btn.success.outline:hover {
background-color: var(--hover-bg);
color: var(--hover-text);
}
.btn.success.outline:active {
background-color: #388e3c;
border-color: #388e3c;
color: #ffffff;
}
.btn.is-loading:before {
display: inline-block;
vertical-align: middle;
}
/* Table Styles */
.table-container {
overflow-x: auto;
}
.table {
width: 100%;
table-layout: fixed;
}
.table th,
.table td {
padding: 0.5rem;
border: 1px solid var(--border-color);
}
.table th:last-child,
.table td:last-child {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 170px;
}
.table td:last-child:hover {
white-space: normal;
}
.table.bordered tbody tr:last-child td:first-child {
border-bottom-left-radius: 12px;
}
.table.bordered tbody tr:last-child td:last-child {
border-bottom-right-radius: 12px;
}
/* Credit Pack Table Styles */
.credit-pack-table {
width: 100%;
border-collapse: collapse;
}
.credit-pack-table th,
.credit-pack-table td {
padding: 0.5rem;
border: 1px solid var(--border-color);
}
.credit-pack-table th {
background-color: #f8fafc;
font-weight: 600;
}
/* Dark Mode Specific Styles */
[data-theme="dark"] .credit-pack-table {
background-color: #2a2a2a;
color: #e0e0e0;
}
[data-theme="dark"] .credit-pack-table th {
background-color: #333333;
color: #ffffff;
}
[data-theme="dark"] .credit-pack-table td {
border-color: #444444;
}
[data-theme="dark"] .credit-pack-table tbody tr:nth-child(even) {
background-color: #333333;
}
[data-theme="dark"] .credit-pack-table tbody tr:hover {
background-color: #3a3a3a;
}
/* New Ticket Table Styles */
.new-ticket-table {
width: 100%;
table-layout: auto;
}
.new-ticket-table th,
.new-ticket-table td {
padding: 8px;
text-align: left;
word-wrap: break-word;
overflow-wrap: break-word;
}
.new-ticket-table th {
width: 25%;
}
/* Inference Styles */
.inference-result,
.previous-inference {
border-radius: 8px;
padding: 16px;
margin-bottom: 16px;
}
.inference-table {
width: 100%;
border-collapse: separate;
border-spacing: 0 8px;
}
.inference-table th,
.inference-table td {
padding: 8px;
text-align: left;
}
/* Prompt Styles */
.prompt.success.xs {
display: inline-block;
flex-grow: 1;
max-width: calc(100% - 2rem);
word-wrap: break-word;
height: 333px;
overflow-y: auto;
padding: 0.5rem;
border: 1px solid var(--border-color);
border-radius: 0.5rem;
}
.prompt.success.xs .content {
overflow-wrap: break-word;
}
/* Utility Classes */
.ground-glass {
background-color: rgba(255, 255, 255, 0.8);
backdrop-filter: blur(10px);
}
.icon-large {
font-size: 1.5rem;
}
.truncate {
max-width: 150px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.flex {
display: flex;
}
.items-center {
align-items: center;
}
.gap-4 {
gap: 1rem;
}
.hidden {
display: none;
}
.align-middle {
vertical-align: middle;
}
/* Terminal Styles */
.xterm {
width: 100% !important;
border-radius: 0.5rem;
}
.terminal-container {
width: 100%;
overflow-x: auto;
}
#terminal {
font-size: inherit;
}
/* Modal Styles */
#importModal {
display: none;
position: fixed;
z-index: 1000;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.4);
}
#importModal>div {
background-color: var(--bg-color);
margin: 15% auto;
padding: 20px;
border: 1px solid var(--border-color);
width: 80%;
max-width: 500px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
#modalTitle {
margin-top: 0;
color: var(--text-color);
}
#modalMessage {
color: var(--text-color);
}
#modalCloseButton {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
float: right;
}
#modalCloseButton:hover {
background-color: #45a049;
}
/* Specific Element Styles */
#previousRequestsList {
background-color: #f9f9f9;
border: 1px solid #e5e7eb;
border-radius: 0.5rem;
padding: 1rem;
max-height: 1200px;
overflow-y: auto;
}
#requestPreview {
background-color: var(--bg-color);
border: 1px solid #e5e7eb;
border-radius: 0.5rem;
padding: 1.5rem;
}
.delete-btn {
background: none;
border: none;
font-size: 1.25rem;
cursor: pointer;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
border-radius: 50%;
transition: box-shadow 0.3s;
}
.delete-btn:hover {
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}
#exportRequestsButton {
display: flex;
align-items: center;
gap: 0.5rem;
margin-top: auto;
}
.credit-pack-details-container {
width: 100%;
}
.tooltip-icon {
margin-left: 5px;
font-size: 14px;
color: #6b7280;
}
#credit-pack-tooltip {
background-color: var(--bg-color);
color: var(--text-color);
border: 1px solid var(--border-color);
padding: 10px;
border-radius: 4px;
font-size: 12px;
max-width: 400px;
/* Increased from 300px */
width: auto;
/* Allow the tooltip to adjust its width based on content */
word-wrap: break-word;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
z-index: 1000;
}
#credit-pack-tooltip .tooltip-content {
display: flex;
flex-direction: column;
}
#credit-pack-tooltip .tooltip-row {
display: flex;
justify-content: space-between;
margin-bottom: 5px;
}
#credit-pack-tooltip .tooltip-label {
font-weight: bold;
margin-right: 10px;
white-space: nowrap;
}
#credit-pack-tooltip .tooltip-value {
text-align: right;
word-break: break-all;
}
[data-theme="dark"] #credit-pack-tooltip {
background-color: rgba(42, 42, 42, 0.95);
color: #e0e0e0;
border: 1px solid #555555;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] #credit-pack-tooltip .tooltip-label {
color: #4db6ac;
}
[data-theme="dark"] #creditPackTicketTableBody tr {
background-color: #2a2a2a;
color: #e0e0e0;
}
[data-theme="dark"] #creditPackTicketTableBody tr:hover {
background-color: #3a3a3a;
}
[data-theme="dark"] #creditPackTicketTableBody tr.selected-row {
background-color: #4a4a4a;
}
/* Dark Mode Specific Styles */
[data-theme="dark"] .bg-white,
[data-theme="dark"] .bg-bw-50 {
background-color: #1e1e1e;
}
[data-theme="dark"] .text-bw-50,
[data-theme="dark"] .text-bw-600,
[data-theme="dark"] .text-bw-700,
[data-theme="dark"] .text-bw-800 {
color: #ffffff;
}
[data-theme="dark"] .bg-bw-800 {
background-color: #111827;
}
[data-theme="dark"] .btn.outline.bw {
border-color: #ffffff;
color: #ffffff;
}
[data-theme="dark"] .btn.outline.bw:hover {
background-color: #ffffff;
color: #000000;
}
[data-theme="dark"] .table .bg-gray-200.selected-row {
color: #000000;
}
[data-theme="dark"] .input,
[data-theme="dark"] .select {
background-color: #2a2a2a;
border-color: #555555;
}
[data-theme="dark"] .input::placeholder,
[data-theme="dark"] .input::-ms-input-placeholder {
color: #888888;
opacity: 1;
}
[data-theme="dark"] .select option {
background-color: #2a2a2a;
color: #e0e0e0;
}
[data-theme="dark"] .delete-btn {
color: #ff6b6b;
}
[data-theme="dark"] .inference-result,
[data-theme="dark"] .previous-inference,
[data-theme="dark"] #previousRequestsList,
[data-theme="dark"] #receivedMessages {
background-color: #2a2a2a;
}
[data-theme="dark"] .inference-table th {
background-color: #3a3a3a;
}
[data-theme="dark"] .inference-table td {
background-color: #2f2f2f;
}
[data-theme="dark"] github-md,
[data-theme="dark"] pre,
[data-theme="dark"] code,
[data-theme="dark"] .hljs {
background-color: #2a2a2a;
color: #e0e0e0;
}
[data-theme="dark"] .prompt.success.xs code {
font-family: 'Courier New', Courier, monospace;
}
[data-theme="dark"] .hljs-attr {
color: #9cdcfe;
}
[data-theme="dark"] .hljs-string {
color: #ce9178;
}
[data-theme="dark"] .hljs-number {
color: #b5cea8;
}
[data-theme="dark"] .hljs-literal,
[data-theme="dark"] .hljs-keyword {
color: #569cd6;
}
[data-theme="dark"] a {
color: #4db6ac;
}
[data-theme="dark"] a:hover {
color: #80cbc4;
}
[data-theme="dark"] #terminal {
background-color: #1a1a1a;
color: #f0f0f0;
}
[data-theme="dark"] .notification {
background-color: #333333;
color: #ffffff;
border-color: #555555;
}
[data-theme="dark"] #credit-pack-tooltip .font-semibold {
color: #4db6ac;
}
[data-theme="dark"] #credit-pack-tooltip .text-gray-700 {
color: #e0e0e0;
}
/* Media Queries */
@media (max-width: 1200px) {
.credit-pack-table {
font-size: 0.875rem;
}
.credit-pack-table th {
white-space: normal;
height: auto;
vertical-align: top;
}
#terminal {
font-size: 0.65em;
}
}
@media (max-width: 768px) {
.credit-pack-table {
font-size: 0.75rem;
}
}
</style>
</head>
<body class="flex flex-col gap-6 transition-all duration-300 bg-bw-50">
<div class="max-w-7xl mx-auto w-full px-4 sm:px-6 lg:px-8">
<div class="flex gap-6 items-center sticky top-0 p-4 bg-bw-50 z-10 ground-glass shadow-md" id="title">
<h1 class="text-4xl font-bold text-bw-600">
Pastel Inference Client
<span id="networkName" class="text-xl font-normal align-middle"></span>
</h1>
<input id="theme-toggle" class="switch success lg" data-content="☀" type="checkbox" onchange="toggleDarkMode()" />
<button id="openInBrowserButton" class="btn success outline">Open New Window in Browser</button>
<form id="openInBrowserForm" class="hidden"></form>
</div>
<div class="grid grid-cols-5 gap-4 p-4 has-border rounded-xl bg-white shadow-md">
<h2 class="text-2xl col-span-full text-bw-800">User Information</h2>
<!-- Promotional Pack Import Section -->
<div class="col-span-full mt-2">
<details class="bg-bw-100 p-3 rounded-lg">
<summary class="text-bw-700 font-semibold cursor-pointer">
Import Promotional Pack
</summary>
<div class="mt-2">
<p class="text-bw-600 text-sm mb-2">
Have a promotional pack file? Import it here to set up your
account quickly.
</p>
<div class="flex flex-wrap items-center gap-2">
<input type="file" id="promotionalPackFile" accept=".json" class="hidden" onchange="updateFileLabel()" />
<label for="promotionalPackFile" class="btn outline secondary text-sm py-1 px-3 cursor-pointer">
Choose File
</label>
<span id="fileLabel" class="text-bw-600 text-sm break-all max-w-lg">No file chosen</span>
<button onclick="importPromotionalPack()" class="btn success outline text-sm py-1 px-3 mt-2 sm:mt-0">
Import Pack
</button>
</div>
</div>
</details>
</div>
<div id="importModal" class="fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full hidden">
<div class="relative top-20 mx-auto p-5 border w-96 shadow-lg rounded-md bg-white">
<div class="mt-3 text-center">
<div class="mx-auto flex items-center justify-center h-12 w-12 rounded-full bg-green-100">
<svg class="h-6 w-6 text-green-600 animate-spin" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
</path>
</svg>
</div>
<h3 class="text-lg leading-6 font-medium text-gray-900 mt-5" id="modalTitle">
Importing Promotional Pack
</h3>
<div class="mt-2 px-7 py-3">
<p class="text-sm text-gray-500" id="modalMessage">
Please be patient while the information from your promo pack is imported into Pastel... this may take a
few minutes.
</p>
</div>
<div class="items-center px-4 py-3">
<button id="modalCloseButton"
class="px-4 py-2 bg-green-500 text-white text-base font-medium rounded-md shadow-sm hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-green-300">
Close
</button>
</div>
</div>
</div>
</div>
<div class="col-span-full">
<div id="noPastelIDContainer" class="hidden">
<p class="text-bw-700">
No PastelID found. Would you like to create a new one for 1,000
PSL?
</p>
<form id="createPastelIDForm" class="mt-4">
<label class="block text-bw-700 font-bold mb-2" for="newPastelIDPassphrase">
Enter Passphrase (min 6 characters):
</label>
<input id="newPastelIDPassphrase" class="input w-full" type="password" placeholder="Enter passphrase"
minlength="6" required />
<div class="flex items-center gap-3">
<button type="submit" class="btn success outline mt-4">
Create PastelID
</button>
<div id="createPastelIDLoading"></div>
</div>
<div id="createPastelIDMessageContainer" class="my-4"></div>
<!-- Container for messages -->
</form>
<p class="mt-4">
Already have an existing PastelID? Import the file here:
</p>
<input id="importPastelIDFile" class="input w-full" type="file" />
<div class="flex items-center gap-2 m-2 ml-0">
<button id="importPastelIDButton" class="btn outline success">
Import PastelID
</button>
<div class="hidden" id="importPastelIDBLoading"></div>
</div>
</div>
<button id="changePastelIDButton" class="btn outline success" onclick="togglePastelIDDropdown()">
Switch to a Different PastelID
</button>
<div id="pastelIDDropdownContainer" class="mt-4 hidden">
<label class="block text-bw-700 font-bold mb-2">Select Existing PastelID to Use:</label>
<select id="pastelIDDropdown" class="select w-full">
<!-- Options will be dynamically populated -->
</select>
</div>
<div class="mt-4 hidden" id="passphraseContainer">
<label class="block text-bw-700 font-bold mb-2" for="pastelIDPassphrase">Enter Passphrase:</label>
<input id="pastelIDPassphrase" class="input w-full" type="password" placeholder="Enter passphrase"
minlength="6" required />
<div class="mt-2">
<input type="checkbox" id="rememberPassphrase" />
<label for="rememberPassphrase" class="text-bw-700">Remember password?</label>
</div>
<button id="submitPassphraseButton" class="btn success outline mt-4">
Submit
</button>
<div id="messageContainer" class="my-4"></div>
<!-- Container for messages -->
</div>
<div class="mt-4">
<label class="block text-bw-700 font-bold mb-2">Your Currently Selected PastelID:</label>
<span id="userPastelID" class="text-bw-700">Loading...</span>
</div>
<div class="mt-4">
<label class="block text-bw-700 font-bold mb-2">Wallet Balance (PSL):</label>
<span id="walletBalance" class="text-bw-700">
Loading...
<script>
document.addEventListener("DOMContentLoaded", async () => {
try {
const walletInfoResponse = await axios.get(
"/get-wallet-info"
);
const walletInfo = walletInfoResponse.data.result;
const formattedWalletBalance =
walletInfo.balance.toLocaleString(undefined, {
minimumFractionDigits: 1,
maximumFractionDigits: 1,
});
document.getElementById(
"walletBalance"
).textContent = `${formattedWalletBalance} PSL`;
} catch (error) {
console.error("Error retrieving wallet info:", error);
document.getElementById("walletBalance").textContent =
"Failed to load balance";
}
});
</script>
</span>
</div>
<div class="mt-4 flex items-center">
<label class="block text-bw-700 font-bold mb-2">My PSL Address:</label>
<span id="myPslAddress" class="text-bw-700 ml-2"></span>
<button id="copyAddressButton" class="ml-2 tooltip" data-tooltip="Copy address to clipboard">
📋
</button>
</div>
<button id="createPastelIDButton" class="btn success outline m-4 hidden">
Create a PastelID so you can make inference requests? (Costs 1,000
PSL)
</button>
</div>
</div>
<div class="grid grid-cols-1 gap-4 p-4 has-border rounded-xl bg-white shadow-md">
<h2 class="text-2xl text-bw-800">Create New Credit Pack Ticket</h2>
<form id="createTicketForm" class="grid grid-cols-2 gap-4">
<div>
<label class="block text-bw-700 font-bold mb-2" for="numCredits">Number of Credits</label>
<input class="input w-full" id="numCredits" type="text" placeholder="Enter number of credits" value="1500"
data-raw-value="1500" required />
</div>
<div>
<label class="block text-bw-700 font-bold mb-2" for="maxTotalPrice">Maximum Total Price (PSL)</label>
<input class="input w-full" id="maxTotalPrice" type="text" placeholder="Enter maximum total price"
value="150000" data-raw-value="150000" required />
</div>
<div>
<label class="block text-bw-700 font-bold mb-2" for="maxPerCreditPrice">Maximum Per Credit Price (PSL)</label>
<input class="input w-full" id="maxPerCreditPrice" type="text" placeholder="Enter maximum per credit price"
value="100.0" data-raw-value="100.0" required />
</div>
<div class="col-span-full flex justify-between">
<div class="flex gap-4 items-center" style="width: 100%">
<button class="btn success outline" type="submit" id="createCreditPackButton">
Create Credit Pack
</button>
<div id="loaderContainer"></div>
<!-- Add this div for the loader -->
<div class="prompt success xs" id="createTicketStatusContainer">
<label class="text-bw-800 font-bold mb-4" for="createTicketStatus">Current Status:</label>
<div class="content p-2" id="createTicketStatus"></div>
</div>
</div>
</div>
</form>
<div class="credit-pack-details-container" id="newCreditPackTicketDetailsContainer" style="display: none">
<h3 class="text-xl text-bw-800">New Credit Pack Ticket Details</h3>
<div class="table-responsive">
<table class="table bordered bw new-ticket-table">
<thead>
<tr>
<th>Registration TXID</th>
<th>SHA3-256 Hash of Credit Pack Purchase Request Fields</th>
<th>Responding Supernode PastelID</th>
<th>Outcome</th>
</tr>
</thead>
<tbody id="newCreditPackTicketDetails">
<!-- New ticket details will be dynamically populated here -->
</tbody>
</table>
</div>
</div>
</div>
<div class="grid grid-cols-1 gap-4 p-4 has-border rounded-xl shadow-md">
<h2 class="text-2xl text-bw-800">Select Existing Credit Pack Ticket</h2>
<div class="relative text-bw-700 overflow-x-auto">
<table class="credit-pack-table table bordered bw">
<thead>
<tr>
<th class="select-column">Select</th>
<th class="initial-credits-column">Initial Credits in Pack</th>
<th class="current-credit-balance-column">Current Credit Balance</th>
<th class="tracking-address-column">Tracking Address</th>
<th>Blockheight Registered</th>
<th>Credit Pack Registration TXID</th>
</tr>
</thead>
<tbody id="creditPackTicketTableBody">
<!-- Rows will be dynamically populated here -->
</tbody>
</table>
<div class="flex items-center gap-4 mt-4">
<button id="refreshButton" class="btn success outline p-4 relative">
Manually Refresh Credit Pack Tickets
<span class="loader hidden absolute inset-0 flex items-center justify-center">
<div class="is-loading"></div>
</span>
</button>
<div class="btn is-loading hidden" id="loadingMessage">Loading...</div>
</div>
</div>
</div>
<div class="grid grid-cols-1 gap-4 p-4 has-border rounded-xl bg-white shadow-md">
<h2 class="text-2xl text-bw-800">Create New Inference Request</h2>
<form id="inferenceRequestForm" class="grid grid-cols-2 gap-4">
<div>
<label class="block text-bw-700 font-bold mb-2" for="inferenceType">Inference Type</label>
<div class="relative text-bw-700">
<select id="inferenceType" class="select w-full">
<option value="">Select an inference type</option>
<option value="text_completion">Text Completion</option>
<option value="ask_question_about_an_image">
Ask a Question About an Image
</option>
<option value="text_to_image">Image Generation</option>
<option value="embedding_document">Embedding Document</option>
<option value="embedding_audio">
Audio Transcript and Embedding
</option>
</select>
</div>
</div>
<div>
<label class="block text-bw-700 font-bold mb-2" for="model">Model/Service</label>
<div class="relative text-bw-700">
<select id="model" class="select w-full">
<option value="">Select a model/service</option>
<option value="groq-llama3-70b-8192" selected></option>
<option value="claude3-opus">Claude3-Opus</option>
</select>
</div>
</div>
<div id="textCompletionSettings" class="col-span-full">
<div class="mb-4">
<label class="block text-bw-700 font-bold mb-2" for="prompt">Prompt</label>
<textarea class="input w-full" id="prompt" rows="5" placeholder="Enter your prompt">
Write me a Shakespeare-style sonnet about Pastel Network and how it's really decentralized and powerful. </textarea>
</div>
</div>
<div class="hidden col-span-full" id="modelAdvancedSettingsSection">
<div>
<button type="button" class="btn success outline" id="advancedSettingsButton">
Show advanced settings
</button>
</div>
<div id="modelAdvancedSettingsContent" class="hidden mt-4">
<div id="modelParametersContainer" class="col-span-full"></div>
</div>
</div>
<div id="imageGenerationSettings" class="col-span-full" style="display: none">
<div class="mb-4">
<label class="block text-bw-700 font-bold mb-2" for="imagePrompt">Image Prompt</label>
<textarea class="input w-full" id="imagePrompt" rows="5" placeholder="Enter your image prompt">
A picture of a clown holding a sign that says PASTEL</textarea>
</div>
</div>
<div id="embeddingDocumentSettings" class="col-span-full" style="display: none">
<div class="mb-4">
<label class="block text-bw-700 font-bold mb-2" for="embeddingDocumentFile">Document to Embed</label>
<input type="file" class="input w-full" id="embeddingDocumentFile" accept=".pdf,.doc,.docx,.txt" />
</div>
<div class="mb-4">
<label class="block text-bw-700 font-bold mb-2" for="document_semantic_query_string">Semantic Query String
(Optional):</label>
<input class="input w-full" id="document_semantic_query_string" type="text"
placeholder="Enter your query" />
</div>
</div>
<div id="embeddingAudioSettings" class="col-span-full" style="display: none">
<div class="mb-4">
<label class="block text-bw-700 font-bold mb-2" for="embeddingAudioFile">Audio File to Transcribe and
Embed</label>
<input type="file" class="input w-full" id="embeddingAudioFile" accept="audio/*" />
</div>
<div class="mb-4">
<label class="block text-bw-700 font-bold mb-2" for="audio_semantic_query_string">Semantic Query String
(Optional):</label>
<input class="input w-full" id="audio_semantic_query_string" type="text" placeholder="Enter your query" />
</div>
</div>
<div id="askQuestionAboutImageSettings" class="col-span-full" style="display: none">
<div class="mb-4">
<label class="block text-bw-700 font-bold mb-2" for="imageFile">Image File</label>
<input type="file" class="input w-full" id="imageFile" accept="image/*" />
</div>
<div class="mb-4">
<label class="block text-bw-700 font-bold mb-2" for="question">Question</label>
<input class="input w-full" id="question" type="text" placeholder="Enter your question" />
</div>
</div>
<div class="mb-4">
<label class="block text-bw-700 font-bold mb-2" for="maxCost">Maximum Cost (Credits)</label>
<input class="input w-full" id="maxCost" type="text" placeholder="Enter maximum cost" value="200"
data-raw-value="200" />
<span id="maxCostFormatted" class="text-bw-700"></span>
</div>
<div class="col-span-full flex justify-between">
<div class="flex gap-4 items-center" style="width: 100%">
<div class="flex items-center gap-2">
<button class="btn success outline" type="submit" style="width: 180px">
Create Inference Request
</button>
</div>
<div class="prompt success xs" id="currentStatusContainer">
<label class="text-bw-800 font-bold mb-4" for="currentStatus">Current Status:</label>
<div class="content p-2" id="currentStatus"></div>
</div>
</div>
</div>
<div id="inferenceRequestResult"></div>
</form>
</div>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8 p-4 has-border rounded-xl bg-white shadow-md"
style="height: 1000px; overflow-y: auto">
<div class="lg:col-span-1 flex flex-col">
<h2 class="text-2xl mb-4 text-bw-800">
View Previous Inference Requests
</h2>
<div id="previousRequestsList" class="bg-gray-100 p-4 rounded-lg overflow-y-auto flex-grow"
style="max-height: 1200px">
<!-- List of previous inference requests will be dynamically populated here -->
</div>
<button id="exportRequestsButton" class="btn success outline mt-4 flex items-center self-start">
💾 Export all Saved Inference Requests
</button>
</div>
<div id="requestPreview" class="lg:col-span-2 bg-gray-50 p-4 rounded-lg">
<!-- Preview of selected inference request will be shown here -->
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8 p-4 has-border rounded-xl bg-white shadow-md">
<div>
<h2 class="text-2xl mb-4 text-bw-800">
Send and Receive Messages using PastelIDs
</h2>
<form id="sendMessageForm" class="grid grid-cols-1 gap-4">
<div>
<label class="block text-bw-700 font-bold mb-2" for="toPastelID">Recipient Pastel ID</label>
<input class="input w-full" id="toPastelID" type="text" placeholder="Enter recipient Pastel ID"
value="jXXiVgtFzLto4eYziePHjjb1hj3c6eXdABej5ndnQ62B8ouv1GYveJaD5QUMfainQM3b4MTieQuzFEmJexw8Cr" required />
</div>
<div>
<label class="block text-bw-700 font-bold mb-2" for="messageBody">Message Body</label>
<textarea class="input w-full" id="messageBody" rows="5" placeholder="Enter your message" required>
Hello, this is a brand 🍉 NEW test message from a regular user!</textarea>
</div>