imseldrith commited on
Commit
aadecf2
·
1 Parent(s): 6802808

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +58 -656
index.html CHANGED
@@ -1,7 +1,6 @@
1
  <!DOCTYPE html>
2
  <html lang="en">
3
-
4
-
5
  <head>
6
  <meta charset="UTF-8">
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -11,616 +10,12 @@
11
 
12
  <link rel="stylesheet"
13
  href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/github-dark.css">
 
14
  <script src="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js"></script>
 
 
15
  </head>
16
 
17
- <style>
18
- @import url('https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,200;0,400;0,800;1,200;1,400;1,800&display=swap');
19
-
20
- @import url('https://fonts.googleapis.com/css2?family=Product+Sans&family=Google+Sans+Display:ital@0;1&family=Google+Sans:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&family=Google+Sans+Text:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&family=Material+Symbols+Outlined&family=Space+Mono&display=swap');
21
-
22
- @font-face {
23
- font-family: 'Material Symbols Outlined';
24
- font-style: normal;
25
- font-weight: 400;
26
- src: url(https://fonts.gstatic.com/s/materialsymbolsoutlined/v154/kJF1BvYX7BgnkSrUwT8OhrdQw4oELdPIeeII9v6oDMzByHX9rA6RzaxHMPdY43zj-jCxv3fzvRNU22ZXGJpEpjC_1v-p_4MrImHCIJIZrDCvHOej.woff2) format('woff2');
27
- }
28
-
29
- .material-symbols-outlined {
30
- font-family: 'Material Symbols Outlined';
31
- font-weight: normal;
32
- font-style: normal;
33
- font-size: 1.5rem;
34
- line-height: 1;
35
- letter-spacing: normal;
36
- text-transform: none;
37
- display: inline-block;
38
- white-space: nowrap;
39
- word-wrap: normal;
40
- direction: ltr;
41
- -webkit-font-feature-settings: 'liga';
42
- font-feature-settings: "liga";
43
- -webkit-font-smoothing: antialiased;
44
-
45
- }
46
-
47
- body {
48
- font-family: 'Noto Sans', sans-serif;
49
-
50
- margin: 0;
51
- }
52
-
53
- p {
54
- margin: 0;
55
- margin-bottom: 0.5rem;
56
- padding: 0;
57
- font-size: 1rem;
58
- }
59
-
60
- h1,
61
- h2,
62
- h3,
63
- ol,
64
- ul {
65
- margin: 0;
66
- }
67
-
68
- h1 {
69
- margin-bottom: 0.5rem;
70
- }
71
-
72
- a {
73
- color: #3b82f6;
74
- }
75
-
76
- input,
77
- textarea,
78
- select {
79
- border: 1px solid;
80
- padding: 0.5rem;
81
- border-radius: 0.5rem;
82
- border: none;
83
- font-family: noto sans, sans-serif;
84
- font-size: 1rem;
85
- }
86
-
87
- button:focus {
88
- outline: none;
89
- }
90
-
91
- .form {
92
- display: none;
93
- opacity: 0;
94
- flex-direction: column;
95
- width: 32rem;
96
- gap: 0.5rem;
97
- flex-grow: 1;
98
- justify-content: center;
99
- }
100
-
101
- .overlay {
102
- flex-direction: column;
103
- display: none;
104
- position: fixed;
105
- opacity: 0;
106
- top: 0;
107
- left: 0;
108
- width: 100dvw;
109
- height: 100dvh;
110
- backdrop-filter: blur(2rem);
111
- z-index: 2;
112
- justify-content: flex-start;
113
- align-items: center;
114
- }
115
-
116
- .backButton {
117
- position: absolute;
118
- top: 1rem;
119
- left: 1rem;
120
- border: none;
121
- background-color: transparent;
122
- font-size: 1.5rem;
123
- font-weight: 600;
124
- transition: all 0.2s;
125
-
126
- }
127
-
128
- #btn-hide-sidebar {
129
- display: none;
130
- }
131
-
132
- .message-container {
133
- display: flex;
134
- flex-direction: column-reverse;
135
- overflow-y: auto;
136
- gap: 1rem;
137
- padding-bottom: 2rem;
138
- flex-grow: 1;
139
- }
140
-
141
- .message-box {
142
- display: flex;
143
- position: relative;
144
- }
145
-
146
- .message {
147
-
148
- padding: 1rem;
149
- }
150
-
151
- .message-model {
152
- border-radius: 1rem;
153
- }
154
-
155
- #messageInput {
156
- height: 2.5rem;
157
- box-sizing: border-box;
158
- text-wrap: wrap;
159
- resize: none;
160
- width: 100%;
161
- padding-right: 2rem;
162
- }
163
-
164
- #messageInput::-webkit-scrollbar {
165
- height: 1rem;
166
- width: 0.5rem;
167
- }
168
-
169
- #messageInput::-webkit-scrollbar {
170
- height: 2.5rem !important;
171
- width: 0.5rem !important;
172
- }
173
-
174
- .btn-textual {
175
- background: transparent !important;
176
- margin: 0;
177
- padding: 0;
178
- border: none;
179
- transition: all 0.2s;
180
- cursor: pointer;
181
- font-size: inherit;
182
- }
183
-
184
-
185
-
186
- #btn-send {
187
- position: absolute;
188
- right: 0.5rem;
189
- bottom: 0.5rem;
190
- font-size: 1.5rem;
191
- }
192
-
193
- .btn-array {
194
- display: flex;
195
- flex-direction: row;
196
- gap: 0.5rem;
197
- margin-top: 0.5rem;
198
- }
199
-
200
- .btn-array button {
201
- flex-grow: 1;
202
- }
203
-
204
- .personality-prompt {
205
- display: none;
206
- }
207
-
208
- .prompt-field {
209
- resize: vertical;
210
- height: 7rem;
211
- }
212
-
213
- .container {
214
- box-sizing: border-box;
215
- display: flex;
216
- gap: 0.5rem;
217
- padding: 1rem;
218
-
219
-
220
- width: 100dvw;
221
- height: 100dvh;
222
-
223
- }
224
-
225
- .sidebar {
226
- position: sticky;
227
- top: 1rem;
228
-
229
- display: flex;
230
- flex-direction: column;
231
- overflow-y: auto;
232
- gap: 0.5rem;
233
- padding: 1rem;
234
- width: 25rem;
235
- border-radius: 1rem;
236
- scrollbar-width: thin;
237
- height: calc(100dvh - 4rem);
238
- z-index: 1;
239
- }
240
-
241
- .sidebar-section {
242
- margin-bottom: 1rem;
243
- display: flex;
244
- flex-direction: column;
245
- gap: 0.5rem;
246
- }
247
-
248
- #btn-show-sidebar {
249
- display: none;
250
- }
251
-
252
- .header {
253
- display: flex;
254
-
255
- box-sizing: border-box;
256
- align-items: center;
257
- font-size: 2rem;
258
- font-weight: 800;
259
- gap: 0.5rem;
260
- width: 100%;
261
- }
262
-
263
- .navbar {
264
- position: relative;
265
- display: flex;
266
- flex-direction: row;
267
- border-radius: 0.5rem;
268
- justify-content: space-evenly;
269
- margin-bottom: 1rem;
270
- z-index: 0;
271
- }
272
-
273
- .navbar-tab {
274
- width: 100%;
275
- padding: 0.5rem;
276
- text-align: center;
277
-
278
- z-index: 2;
279
- -webkit-tap-highlight-color: transparent;
280
- cursor: pointer;
281
-
282
- }
283
-
284
-
285
-
286
- .navbar-tab-highlight {
287
- padding: 0;
288
- margin: 0;
289
- position: absolute;
290
- border-radius: 0.5rem;
291
- transition: all 0.2s;
292
- height: 100%;
293
- z-index: 1;
294
- /* glow */
295
- box-shadow: 0 0 1rem 0.05rem #29292a3f;
296
- }
297
-
298
- #gemini-pro-branding {
299
- font-family: Google Sans Display, sans-serif;
300
- color: #7c8a9c;
301
- font-size: 1rem;
302
- font-weight: 400;
303
- }
304
-
305
- #gemin-pro-logo {
306
- width: 2rem;
307
- height: 2rem;
308
- }
309
-
310
- .credits {
311
- margin-top: auto;
312
- display: flex;
313
- padding: 0rem 1rem 0 1rem;
314
-
315
- font-size: 0.75rem;
316
- color: #7c8a9c;
317
-
318
- justify-content: space-between;
319
- align-items: center;
320
- }
321
-
322
- button {
323
- border: none;
324
- background-color: #3b82f6;
325
- color: white;
326
- padding: 0.5rem;
327
- border-radius: 0.5rem;
328
- transition: all 0.2s;
329
- }
330
-
331
- #mainContent {
332
- display: flex;
333
- flex-direction: column;
334
- padding: 2rem;
335
- margin-left: auto;
336
- margin-right: auto;
337
- width: 32rem;
338
- text-align: justify;
339
- }
340
-
341
- .card-personality {
342
- box-sizing: border-box;
343
- -moz-box-sizing: border-box;
344
- -webkit-box-sizing: border-box;
345
- color: #e4e4e4;
346
- background-color: black;
347
- background-size: cover;
348
- background-position: center;
349
- position: relative;
350
-
351
- display: flex;
352
- flex-direction: column;
353
- justify-content: end;
354
- padding: 1rem;
355
- border-radius: 1rem;
356
- height: 10rem;
357
- -webkit-tap-highlight-color: transparent;
358
- cursor: pointer;
359
- text-shadow: 0 0 10px #000000, 0 0 5px #181818;
360
- }
361
-
362
- .edit:hover {
363
- text-shadow: 0 0 10px #e4e4e4, 0 0 5px #dfdfdf;
364
- }
365
-
366
-
367
- .card-personality * {
368
- /* unselectable */
369
- -webkit-user-select: none;
370
- /* Safari */
371
- -moz-user-select: none;
372
- /* Firefox */
373
- -ms-user-select: none;
374
- /* IE10+/Edge */
375
- user-select: none;
376
- /* Standard */
377
-
378
- }
379
-
380
- .card-personality input {
381
- display: none;
382
- }
383
-
384
- .btn-edit-card {
385
- /* top right corner */
386
- position: absolute;
387
- top: 1rem;
388
- right: 1rem;
389
- color: #e4e4e4;
390
- }
391
-
392
- .btn-share-card {
393
- /* bottom right corner */
394
- position: absolute;
395
- top: 1rem;
396
- right: 2.5rem;
397
- font-size: 1rem;
398
- color: #e4e4e4;
399
- }
400
-
401
- #btn-hide-overlay {
402
- padding: 2rem;
403
- }
404
-
405
-
406
-
407
-
408
- @media (max-width: 768px) {
409
- body {
410
- margin: 0;
411
- padding: 0;
412
- }
413
-
414
-
415
- .container {
416
- padding: 0;
417
-
418
- }
419
-
420
- .message-container {
421
- padding-left: 1rem;
422
- padding-right: 1rem;
423
- }
424
-
425
- .sidebar {
426
- top: 0;
427
- height: calc(100dvh - 2rem);
428
- margin: 0;
429
- width: calc(100dvw - 2rem);
430
- position: fixed;
431
- border-radius: 0;
432
- display: none;
433
- }
434
-
435
- .navbar {
436
- position: relative;
437
- }
438
-
439
-
440
- #btn-hide-sidebar {
441
- display: block;
442
- }
443
-
444
- #mainContent {
445
- padding: 0;
446
- margin: 0;
447
- width: 100%;
448
- }
449
-
450
- #mainContent .header {
451
- padding: 2rem;
452
- }
453
-
454
- #messageInput {
455
- border-radius: 0;
456
- }
457
-
458
- #btn-show-sidebar {
459
- display: block;
460
- }
461
- }
462
-
463
-
464
- /* Light theme styles */
465
- @media (prefers-color-scheme: light) {
466
- :focus {
467
- outline: 1px solid #8f9eb3;
468
- }
469
-
470
- body {
471
- background-color: #f0f6ff;
472
- color: #0a0a0a;
473
- }
474
-
475
- a {
476
- color: #444ed6;
477
- }
478
-
479
- .sidebar {
480
- background-color: #d2e2f7;
481
- }
482
-
483
- .navbar {
484
- background-color: rgb(176 205 246);
485
- }
486
-
487
- .navbar-tab {
488
- color: #0a0a0a;
489
- }
490
-
491
- .navbar-tab-highlight {
492
- background-color: #87b0ed;
493
- }
494
-
495
- .btn-textual:hover {
496
- text-shadow: 0 0 10px #000000;
497
- }
498
-
499
- button {
500
- background-color: #83b5f7;
501
-
502
- color: #2b3d59;
503
- }
504
-
505
- button:hover {
506
- background-color: rgb(63, 191, 255);
507
- }
508
-
509
-
510
- input,
511
- textarea,
512
- select {
513
- background-color: #f0f6ff;
514
- outline: 1px solid #8f9eb3;
515
- }
516
-
517
- input::placeholder,
518
- textarea::placeholder {
519
- color: #7c8a9c;
520
- }
521
-
522
- .message-model {
523
- background-color: #d2e2f7;
524
- }
525
- }
526
-
527
- /* Dark theme styles */
528
- @media (prefers-color-scheme: dark) {
529
- :root {
530
- color-scheme: dark;
531
- }
532
-
533
- :focus {
534
- outline: 1px solid #73859e;
535
- }
536
-
537
-
538
-
539
- body {
540
- background-color: #151e24;
541
- color: #e4e4e4;
542
- }
543
-
544
- a {
545
- color: #92d9eb;
546
- }
547
-
548
-
549
-
550
- .sidebar {
551
- background-color: #1a2733;
552
- }
553
-
554
- .navbar {
555
- background-color: #00000047;
556
- }
557
-
558
- .navbar-tab {
559
- color: #e4e4e4;
560
- }
561
-
562
- .navbar-tab-highlight {
563
- background-color: #22486b;
564
-
565
- box-shadow: 0 0 1rem 0.05rem #29292aac;
566
- }
567
-
568
- button {
569
- background-color: #22486b;
570
- color: #c9d3ee;
571
- }
572
-
573
- button:hover {
574
- background-color: #31689c;
575
- }
576
-
577
- .btn-textual {
578
- color: #e4e4e4;
579
- }
580
-
581
- .btn-textual:hover {
582
- text-shadow: 0 0 10px #ffffff, 0 0 5px #dfdfdf;
583
- }
584
-
585
- .edit:hover {
586
- text-shadow: 0 0 10px #ffffff, 0 0 5px #dfdfdf;
587
- /* Change #00ff00 to the color you want */
588
- }
589
-
590
- input,
591
- textarea,
592
- select {
593
- background-color: #283542;
594
-
595
- color: #e4e4e4;
596
- border: none;
597
- }
598
-
599
- input::placeholder,
600
- textarea::placeholder {
601
- color: #849caf;
602
- }
603
-
604
-
605
- .message-model {
606
- background-color: #1a2733;
607
- }
608
- }
609
-
610
- #btn-reset-chat {
611
- background-color: #1a2733;
612
- color: #e4e4e4;
613
- right: 4rem;
614
- margin-right: 5px;
615
- transition: all 0.2s;
616
- cursor: pointer;
617
- }
618
-
619
- #btn-reset-chat:hover {
620
- background-color: #313131;
621
- }
622
- </style>
623
-
624
  <body>
625
  <div class="container">
626
  <div class="sidebar">
@@ -640,41 +35,44 @@
640
  <div class="navbar-tab-highlight"></div>
641
  </div>
642
 
643
- <div class="sidebar-section" id="personalitySection">
644
- <label class="card-personality"
645
- style="background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('https://images.fonearena.com/blog/wp-content/uploads/2023/12/Google-Gemini-AI-1024x577.jpg')">
646
- <input type="radio" name="personality" value="zodiac3" checked>
647
- <div>
648
- <h3 class="personality-title">zodiac</h3>
649
- <p class="personality-description">zodiac is a cheerful assistant, always ready to help you with
650
- your tasks.</p>
651
- <p class="personality-prompt">You are zodiac, a helpful assistant created by faetalize, built
652
- upon Google's Gemini Pro model. Gemini Pro is a new LLM (Large Language Model) release by
653
- Google on December 2023. Your purpose is being a helpful assistant to the user.</p>
 
 
 
 
 
 
 
 
 
 
654
  </div>
655
- <button class="btn-textual btn-edit-card material-symbols-outlined"
656
- id="btn-edit-personality-default">edit</button>
657
- <button class="btn-textual btn-share-card material-symbols-outlined"
658
- id="btn-share-personality-default">share</button>
659
- </label>
660
- <div class="btn-array" id="btn-array-personality-section">
661
- <button id="btn-add-personality">Add Personality</button>
662
- <button id="btn-import-personality">Import</button>
 
 
 
 
 
663
  </div>
664
  </div>
665
-
666
- <div class="sidebar-section">
667
- <input type="text" placeholder="Paste API key here" id="apiKeyInput" class="input-field"></input>
668
- <h3>Generation Settings:</h3>
669
- <label for="maxTokens">Max Output Tokens:</label>
670
- <input type="number" id="maxTokens" class="input-field" min="1" max="4000" value="1000"></input>
671
- <label for="safetySettings">Safety Settings:</label>
672
- <select id="safetySettings" class="input-field">
673
- <option value="safe">Safe</option>
674
- <option value="moderate">Moderate</option>
675
- <option value="risky">Risky</option>
676
- </select>
677
- </div>
678
 
679
  <div class="credits">
680
  Made by fætalize
@@ -805,10 +203,10 @@
805
  const tabs = document.querySelectorAll(".navbar-tab");
806
  const sidebarViews = document.querySelectorAll(".sidebar-section");
807
  const highlight = document.querySelector(".navbar-tab-highlight");
808
- highlight.style.width = `calc(100% / ${tabs.length})`;
809
-
810
 
811
 
 
812
  let currentTab = undefined;
813
  function navigateTo(tab) {
814
  if (tab == tabs[currentTab]) {
@@ -963,7 +361,7 @@
963
  }
964
 
965
 
966
- function insertPersonality(personalityJSON){
967
  const personalitySection = document.querySelector("#personalitySection");
968
  const personalitySectionActions = document.querySelector("#btn-array-personality-section");
969
 
@@ -1035,17 +433,24 @@
1035
  closeOverlay();
1036
  }
1037
 
 
 
 
 
1038
  async function run() {
1039
- document.getElementById('messageInput').style.height = "2.5rem";
1040
  const msg = document.querySelector("#messageInput");
1041
- const msgText = msg.value;
 
 
 
 
 
1042
  const maxTokens = document.querySelector("#maxTokens");
1043
  const API_KEY = document.querySelector("#apiKeyInput");
1044
  const selectedPersonalityTitle = document.querySelector("input[name='personality']:checked + div .personality-title").innerText;
1045
  const selectedPersonalityDescription = document.querySelector("input[name='personality']:checked + div .personality-description").innerText;
1046
  const selectedPersonalityPrompt = document.querySelector("input[name='personality']:checked + div .personality-prompt").innerText;
1047
 
1048
-
1049
  //chat history
1050
  let chatHistory = [];
1051
  //get chat history from message container
@@ -1091,10 +496,7 @@
1091
  ...chatHistory
1092
  ]
1093
  })
1094
-
1095
-
1096
-
1097
- msg.value = "";
1098
  //create new message div for the user's message then append to message container's top
1099
  const newMessage = document.createElement("div");
1100
  newMessage.classList.add("message");
@@ -1124,23 +526,23 @@
1124
 
1125
  let rawText = "";
1126
  for await (const chunk of result.stream) {
1127
- console.log("hello");
1128
  rawText += chunk.text();
1129
- replyText.innerHTML = marked(rawText);
 
1130
  void replyText.offsetHeight; // Force reflow
1131
  hljs.highlightAll();
1132
  }
1133
 
1134
  //save api key to local storage
1135
  localStorage.setItem("API_KEY", API_KEY.value);
1136
- localStorage.setItem("maxTokens",maxTokens.value);
1137
 
1138
  }
1139
 
1140
  //reset chat button (async)
1141
  resetChatButton.addEventListener("click", () => {
1142
- //remove all messages
1143
- messageContainer.innerHTML = "";
1144
  });
1145
 
1146
 
 
1
  <!DOCTYPE html>
2
  <html lang="en">
3
+
 
4
  <head>
5
  <meta charset="UTF-8">
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
 
10
 
11
  <link rel="stylesheet"
12
  href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/github-dark.css">
13
+ <link rel="stylesheet" href="style.css">
14
  <script src="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js"></script>
15
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/dompurify/3.0.6/purify.min.js"></script>
16
+
17
  </head>
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  <body>
20
  <div class="container">
21
  <div class="sidebar">
 
35
  <div class="navbar-tab-highlight"></div>
36
  </div>
37
 
38
+ <div id="sidebar-content">
39
+ <div class="sidebar-section" id="personalitySection">
40
+ <label class="card-personality"
41
+ style="background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('https://images.fonearena.com/blog/wp-content/uploads/2023/12/Google-Gemini-AI-1024x577.jpg')">
42
+ <input type="radio" name="personality" value="zodiac3" checked>
43
+ <div>
44
+ <h3 class="personality-title">zodiac</h3>
45
+ <p class="personality-description">zodiac is a cheerful assistant, always ready to help you with
46
+ your tasks.</p>
47
+ <p class="personality-prompt">You are zodiac, a helpful assistant created by faetalize, built
48
+ upon Google's Gemini Pro model. Gemini Pro is a new LLM (Large Language Model) release by
49
+ Google on December 2023. Your purpose is being a helpful assistant to the user.</p>
50
+ </div>
51
+ <button class="btn-textual btn-edit-card material-symbols-outlined"
52
+ id="btn-edit-personality-default">edit</button>
53
+ <button class="btn-textual btn-share-card material-symbols-outlined"
54
+ id="btn-share-personality-default">share</button>
55
+ </label>
56
+ <div class="btn-array" id="btn-array-personality-section">
57
+ <button id="btn-add-personality">Add Personality</button>
58
+ <button id="btn-import-personality">Import</button>
59
  </div>
60
+ </div>
61
+
62
+ <div class="sidebar-section">
63
+ <input type="text" placeholder="Paste API key here" id="apiKeyInput" class="input-field"></input>
64
+ <h3>Generation Settings:</h3>
65
+ <label for="maxTokens">Max Output Tokens:</label>
66
+ <input type="number" id="maxTokens" class="input-field" min="1" max="4000" value="1000"></input>
67
+ <label for="safetySettings">Safety Settings:</label>
68
+ <select id="safetySettings" class="input-field">
69
+ <option value="safe">Safe</option>
70
+ <option value="moderate">Moderate</option>
71
+ <option value="risky">Risky</option>
72
+ </select>
73
  </div>
74
  </div>
75
+
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
  <div class="credits">
78
  Made by fætalize
 
203
  const tabs = document.querySelectorAll(".navbar-tab");
204
  const sidebarViews = document.querySelectorAll(".sidebar-section");
205
  const highlight = document.querySelector(".navbar-tab-highlight");
206
+ highlight.style.width = `calc(100% / ${tabs.length})`;
 
207
 
208
 
209
+
210
  let currentTab = undefined;
211
  function navigateTo(tab) {
212
  if (tab == tabs[currentTab]) {
 
361
  }
362
 
363
 
364
+ function insertPersonality(personalityJSON) {
365
  const personalitySection = document.querySelector("#personalitySection");
366
  const personalitySectionActions = document.querySelector("#btn-array-personality-section");
367
 
 
433
  closeOverlay();
434
  }
435
 
436
+ function getSanitized(string){
437
+ return DOMPurify.sanitize(string.replace(/</g, "&lt;").replace(/>/g, "&gt;").trim());
438
+ }
439
+
440
  async function run() {
 
441
  const msg = document.querySelector("#messageInput");
442
+ let msgText = getSanitized(msg.value);
443
+ msg.value = "";
444
+ document.getElementById('messageInput').style.height = "2.5rem"; //This will reset messageInput box to its normal size.
445
+ if (msgText == "") {
446
+ return;
447
+ }
448
  const maxTokens = document.querySelector("#maxTokens");
449
  const API_KEY = document.querySelector("#apiKeyInput");
450
  const selectedPersonalityTitle = document.querySelector("input[name='personality']:checked + div .personality-title").innerText;
451
  const selectedPersonalityDescription = document.querySelector("input[name='personality']:checked + div .personality-description").innerText;
452
  const selectedPersonalityPrompt = document.querySelector("input[name='personality']:checked + div .personality-prompt").innerText;
453
 
 
454
  //chat history
455
  let chatHistory = [];
456
  //get chat history from message container
 
496
  ...chatHistory
497
  ]
498
  })
499
+
 
 
 
500
  //create new message div for the user's message then append to message container's top
501
  const newMessage = document.createElement("div");
502
  newMessage.classList.add("message");
 
526
 
527
  let rawText = "";
528
  for await (const chunk of result.stream) {
 
529
  rawText += chunk.text();
530
+
531
+ replyText.innerHTML = DOMPurify.sanitize(marked.parse(rawText));
532
  void replyText.offsetHeight; // Force reflow
533
  hljs.highlightAll();
534
  }
535
 
536
  //save api key to local storage
537
  localStorage.setItem("API_KEY", API_KEY.value);
538
+ localStorage.setItem("maxTokens", maxTokens.value);
539
 
540
  }
541
 
542
  //reset chat button (async)
543
  resetChatButton.addEventListener("click", () => {
544
+ //remove all messages
545
+ messageContainer.innerHTML = "";
546
  });
547
 
548