-
Notifications
You must be signed in to change notification settings - Fork 17
/
index.html
executable file
·8027 lines (7694 loc) · 442 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
<!-- It's totally free for personal non-commercial use. Please enjoy. -->
<!-- It's not allowed to use this commercially and/or by/for any business or corporation. -->
<!-- It's not allowed to use this in your product or project without my agreement. -->
<!-- Read more at github page mentioned above -->
<html id='html'>
<head>
<!-- "vue": "https://unpkg.com/vue@3/dist/vue.esm-browser.prod.js"-->
<!-- "vue": "/vue.prod.js" -->
<script type="importmap">
{
"imports": {
"vue": "https://unpkg.com/vue@3/dist/vue.esm-browser.prod.js"
}
}
</script>
</head>
<body style="background: black" id='body'>
<div id="app" ><chat /></div>
<div class='tmpl' style='display:none'>
<div id='tmplChat'>
<div id='chatC'><!--:style='{backgroundImage: `url(${this.config.bgImg.v})`}'-->
<table id='chat' border=1 height='100%'>
<tr>
<td colspan='3' id='heading'><a href='https://www.github.com/drazdra/ollama-chats' target='new' class='nobg'>Ollama-chats (v{{config.version.v}})</a></td>
</tr>
<template v-if='inited==2'>
<tr>
<td class='center'>
<div class='nobg'>
Loading..<br><br>
<template v-if='this.modelsLoading.inited==2'>
Models loaded {{ this.modelsLoading.done }} / {{ this.modelsLoading.total }}
</template>
</div>
</td>
</tr>
</template>
<template v-else-if='cardSave.loading'>
<tr>
<td class='center'>
<div class='nobg'>
Loading card..<br><br>
</div>
</td>
</tr>
</template>
<template v-else-if='this.connection==1'>
<tr>
<td colspan='3' id='nicks'>
<table width='100%' cellspacing=0 cellpadding=0>
<tr v-if='config.storiesUI.v'>
<td class='' colspan='2' title="These are presets of users. They are here simply to let you save and quickly access groups of users that talk together. For example, characters in 2 different rooms. Or character talking on a phone to somebody when others do not hear it, etc.">
<span class='nobgt'>
<template v-for='(g,gi) in groups'>
<span @click='groupCh(gi)' :class='"groups "+(gi==group&&"groupSel")'>{{g.n}}</span> <template v-if='gi!=0'>(<span @click='groupDel(gi)' class='del'>x</span>)</template> :
</template>
<input placeholder='add new' v-model='groupAddN'/> <span class='lnk' @click='groupAdd(this.groupAddN,[]);groupAddN=""'>add</span>
</span>
<br><br>
</td>
</tr>
<tr>
<td class='nicksListTitle'>
<div class='understroke nobgt right nobreak'>Users ({{groups[this.group].an['u']}}):</div>
</td>
<td width='100%'>
<user-list :t='"u"' :group='group' :groups='groups' :nicks='nicks'></users-list>
</td>
<td><nickadd t='u' :group='group' :groups='groups' :nicks='nicks' :amount-nicks='amountNicks'/></td>
</tr>
<tr>
<td class='right nicksListTitle'>
<span class='understroke nobgt rightf nobreak'>AIs ({{groups[this.group].an['a']}}):</span>
</td>
<td>
<user-list :t='"a"' :group='group' :groups='groups' :nicks='nicks'></users-list>
</td>
<td>
<nickadd t='a' :group='group' :groups='groups' :nicks='nicks' :amount-nicks='amountNicks'/><br>
</td>
</tr>
</table>
</td>
</tr>
<tr id='chatLog'>
<td colspan='3'>
<table width='100%'>
<tbody id='chatLogC' :style='{display:(this.config.chatHeight.v!=""?"block":"table"),maxHeight: this.config.chatHeight.v+"px"}'>
<template v-for="(i,index) in turns">
<chat-row
v-if='this.turn>0&&index<=turn&&i.branch>=0&&!hideMsg(...tbma(index))'
:turn ='index'
:turn-end ='turn'
:branch ='i.branch'
:fontSize ='this.config.msgFontSize.v'
:trinity ='this.config.trinity.v'
:u ='userS("u")'
:ai ='this.userS("a")'
:stories ='this.config.storiesUI.v'
:nicks ='this.nicks'
:group ='this.group'
:tokens ='this.config.tokensCount.v'
:ctx ='this.settings.options["num_ctx"].v'
:branch-moving='this.branchMoving'
></chat-row>
</template>
<tr><td id='chatLogEnd'></td></tr>
</tbody>
</table>
</td>
</tr>
<tr v-if='this.turnNotLast(turn)'>
<td class='nobg'></td>
<td class='lnk nobg'>
<div class='center' @click='this.turnDown(0)'>
There is more in the chat below, totally: {{turnLast(turn)-turn}} message(s), press down or click here to see.
</div>
<div class='center' @click='this.turnDown(1)'>
Press shift+down or click here to show all the messages below
</div>
</td>
<td class='nobg'></td>
</tr>
<tr v-if='config.storiesUI.v&&turns.length>1' id='contextFilterRow'>
<td></td>
<td id='contextFilter' colspan='2' title='Filters the messages of context history by who was meant to read them. You can do it to see either what Ai will see or just the history. "Every1" shows all the messages ever sent to chat. If you have both characters selected, you get one more checkbox that can be "AND" / "OR". "And" means you see only messages visible for BOTH selected characters - that is you see everything they BOTH meant to see. If one of them did not see something, you do not see it in this mode. "OR", on other hand, means you see ALL of the messages visible by any of these characters (in that some message of yours you see might not not be visible Ai, and some of the messages sent by Ai might not be meant for you to see)'>
<span class='nobg'>
<template v-if='!context[0]'>
<span v-if="userS('u')!=null"><input type='checkbox' v-model='context[2]'><nick :id='userS("u")' :name='nicks[userS("u")].n'></nick></span>
<template v-if='context[2]&&context[1]'>
<span><input type='checkbox' v-model='context[3]'>{{context[3]?"and":"or"}}</span>
</template>
<span v-if="userS('a')!=null"><input type='checkbox' v-model='context[1]'><nick :id='userS("a")' :name='nicks[userS("a")].n'></nick></span>
</template>
<span><input type='checkbox' v-model='context[0]'>Every1</span>
</span>
</td>
<td></td>
</tr>
<tr v-show='pState["control"]'>
<td colspan=3 class='center'>
<br>
<talkers t='u' :config='config' :group='group' :groups='groups' :nicks='nicks'></talkers>
<textarea rows='5' tabindex='5300' id='prompt' placeholder='Prompt'
:disabled='userS("u")==null||userS("a")==null'
v-model="prompt"
@keydown.enter='send($event,1,null)'
:style='"font-size:"+config.taFontSize.v'
></textarea>
<table id='talkersB'>
<tr>
<td class='nobgb' width='50'>
<div class='left leftf' id='imgAdd'>
<fields n='+Image' id='img' :i='{name:"+Image",f:"file",d:"Upload an image to the prompt"}' :n-show='false'></fields>
</div>
</td>
<td>
<talkers t='a' :config='config' :group='group' :groups='groups' :nicks='nicks'></talkers>
</td>
</tr>
</table>
<div class='left' id='imgAddList'>
<template v-for='(img,ind) in this.imgs'>
<span class='chatLogImg nobg'>
<img title='An image to attach to the prompt, click to remove.' @click='this.imgs.splice(ind,1)' class='imgPrompt nobg' :src='`data:image/gif;base64,${img}`'>
</span>
</template>
</div>
<br>
<br><br>
<table id='sysinstr'>
<tbody>
<tr>
<td :width='(pState["sys"]?(pState["instr"]?"50%":"100%"):"0%")'>
<transition name="ta" mode="out-in">
<div :key='pState["sys"]' v-if='userS("a")!=null'>
<div v-show='pState["sys"]' id='sysTitle'>
<span class='nobgt'>System Prompt of <nick :id='userS("a")' :name='nicks[userS("a")].n'/></span>
</div>
<textarea
v-show='pState["sys"]'
id='sys'
rows=10
v-model='this.nicks[userS("a")].system'
:placeholder='`Edit this to override the system prompt of (${userS("a")}) ${nicks[userS("a")].n} with this text. Empty means the system uses default system prompt (from modelfile)`'
:style='"font-size:"+config.taFontSize.v'
></textarea>
</div>
</transition>
</td>
<td :width='(pState["instr"]?(pState["sys"]?"50%":"100%"):"0%")'>
<transition name="ta" mode="out-in">
<div :key='pState["instr"]' v-if='userS("a")!=null'>
<div v-show='pState["instr"]' id='instTitle'>
<span class='nobgt'>Instruction of <nick :id='userS("a")' :name='nicks[userS("a")].n'/></span>
</div><br>
<textarea
v-show='pState["instr"]'
id='instr'
rows=10
v-model='this.nicks[userS("a")].instr'
:placeholder='`You can specify special reminder here for (${userS("a")}) ${nicks[userS("a")].n} on the situation. It will be injected as a last message belonging to the AI, but will not stay in the chat log. I use things like: "I am thinking about doing .., as i am .., i see that.. i feel that.. etc`'
:style='"font-size:"+config.taFontSize.v'
></textarea>
</div>
</transition>
</td>
</tr>
</tbody>
</table>
<div id='ragC' v-show='pState["ragG"]||pState["ragU"]'>
<br><br>
<template v-if='this.config.rag.v'>
<template v-if='rag.err!=null'>
<div class='center red'><span class='nobg'><rag-err :rag='rag'></rag-err></span></div><br>
</template>
<table v-if='userS("a")!=null'>
<tr>
<td>
<div class='nobg' id='remembered'>
<template v-if='rag[userS("a")].last.length||rag["g"].last.length'>
<p class='green understroke'>Things {{nicks[userS("a")].n}} remembers at last reply:</p>
<template v-for='(r,id) in rag["g"].last'>
<p class='justify'>Knowledge {{id+1}}: {{r.t}} (<span :title='r.cos'>Similarity: {{this.rnd(r.cos,3)}}</span>)</p>
</template>
<template v-for='(r,id) in rag[userS("a")].last'>
<p class='justify'>Memories {{id+1}}: {{r.t}} (<span :title='r.cos'>Similarity: {{this.rnd(r.cos,3)}}</span>)</p>
</template>
</template>
<template v-else>
<span class='small'>Nothing was remembered last time</span>
</template>
</div>
</td>
</tr>
</table>
<br>
<transition name="ta" mode="out-in">
<table id='ragU' v-show='pState["ragU"]' v-if='userS("a")!=null'>
<tr>
<td>
<div id='ragTitle'>
<span class='nobgt'>Memories (rag) of <nick :id='userS("a")' :name='nicks[userS("a")].n'/>:</span>
</div>
<textarea
id='rag'
rows=7
:disabled='this.workingRag||this.working'
v-model='this.rag[userS("a")].t'
@blur='ragU(userS("a"))'
:placeholder='"Edit this to store ("+userS("a")+") "+nicks[userS("a")].n+" memories (rag). Only "+nicks[userS("a")].n+" can access these. You can use any format but i recommend to split it into small paragraphs, every separate paragraph should explicitly mention all the relevant subjects it speaks of, because every paragraph is searched separately. For example:\nMari has the following preferences in reading: Mari reads only sci-fi and hates manga. Favorite authors of Mari are Bubu Dada nad Dudu Baba.\nWhen Mari sees a mouse Mari screams and jumps on any man next her.\nSame about the world, environment, anything. Data in this field is searched by semantic similarity to the prompt."'
:style='"font-size:"+config.taFontSize.v'
></textarea><br>
<div @click='pToggle("ragMemGen")' class='nobgb lnk rightf'>Memories generator</div>
<div class='left small'>
<rag-status :rag='rag' :id='userS("a")'></rag-status>
</div>
<div id='memGen'>
<br>
<transition name="ta" mode="out-in" >
<div class='nobg' v-if='pState["ragMemGen"]' :key='pState["ragMemGen"]'>
<char-new-mem-sets :char-new='memNew'></char-new-mem-sets>
<template v-if='memNew.parts.m.length==0'>
<span class='lnk' @click='memGen4rag(userS("a"))'>Generate</span>
</template>
<template v-else>
<span class='lnk' @click='memGen4rag(userS("a"))'>Re-generate</span>
:
<span class='lnk' @click='memGen2rag(memNew,userS("a"))'>Move to memories</span>
: <span class='lnk' @click='memGenParsedReset(memNew,0)'>Clear</span>
</template>
<div class='rightf' title="When this marked, model will get not just system prompt of the character but also all of the character's 'memories' in its context for new memories generation. This may give a hope to have new memories more consistent with the existing ones.">w. ex. memories: <input type='checkbox' v-model='memNew.parts.wMemories'></div>
<char-new-mem-parsed :char-new='memNew'></char-new-mem-parsed>
<template v-if='memNew.working'>
<template v-if='memNew.parts.tmp.waiting'>..loading..</template>
<template v-else-if='memNew.working'>..working..</template>
<textarea disabled=1 v-model='memNew.parts.tmp.content' rows='7'></textarea>
</template>
<table class='memparsed'>
<tr>
<td>
<char-new-system-edit :char-new='memNew' :p-state='pState' id='0'></char-new-system-edit>
</td>
</tr>
</table>
</div>
</transition>
</div>
</td>
</tr>
</table>
</transition>
<br>
<transition name="ta" mode="out-in">
<table id='ragG' v-show='pState["ragG"]'>
<tr>
<td>
<div class='rightf' id='ragTitle'>
<span class='nobgt'>Public knowledge (rag) of all characters</span>
</div>
<textarea
id='rag'
rows=7
:disabled='this.workingRag||this.working'
v-model='this.rag["g"].t'
@blur='ragU("g")'
:placeholder='"Edit this to store global knowledge (rag) of all characters. You can use any format but i recommend to split it into small paragraphs, every separate paragraph should have explicitly mention all the relevant subjects it speaks of, because every paragraph is searched separately. For example:\nCafe where they meet first time for in the city of Kikuku, it was evening and the dragons were dancing in the air.\nTransportation, moving, driving is possible only on donkeys as cars do not exist, cars are just faity tales. If you need to get somewhere, get a donkey.\nSame about the world, environment, anything. Data in this field is searched by semantic similarity to the prompt."'
:style='"font-size:"+config.taFontSize.v'
></textarea><br>
<div class='left small'>
<span class='nobgb'>
<rag-status :rag='rag' id='g'></rag-status>
</span>
</div>
<br>
</td>
</tr>
</table>
</transition>
</template>
<template v-else>
<p class='small nobg center'>Memories (rag) are disabled, please enable in configuration if you wish to use it.</p>
</template>
<br>
</div>
<div id='setsQ' v-if='config.setsQ.v'>
<br>
<template v-for='(g,gind) in configGroups'>
<template v-for='j of [config,settings.options,settings.req]'>
<template v-for='(i,ind) of j'>
<template v-if='i!=null&&i.q===true&&i.g==gind&&!i.hidden'>
<div style='display:inline-block;'><fields :n='ind' :id='ind' :i='i' n-show='1'/></div>
</template>
</template>
</template>
</template>
</div>
<div v-show='pState["sets"]' align='center'>
<br>
<table id='sets' class='nobg'>
<tr>
<td colspan='3' class='green heading understroke center'>
Configuration
</td>
</tr>
<tr>
<td class='header center'>
<p class='green right'>Name</p>
</td>
<td class='header center'>
<p class='green'>Value</p>
</td>
<td class='header center'><p title='Quick access' class='green'>Quick</p></td>
</tr>
<!-- hardcoded settings that are personalized/outside of main ones, too lazy to write templating that would support everything needed. i suppose if needed i can make this "nicks" settings and then it's easy enough.-->
<tr v-if='userS("a")!=null' class='setsRow'>
<td class='title' title="Enable this to make the currently active AI to have personal set of settings and configuration. It makes it possible to assign different models per characters, to have different settings like temperature, etc and even different interface style (the latter is totaly useless).">
<div :class='config.setsDescrShow.v&&"understroke green"'>
Personal settings for <nick :id='userS("a")' :name='nicks[userS("a")].n'></nick>
</div>
<div v-if='config.setsDescrShow.v' class='justify txt'>
Enable this to make <nick :id='userS("a")' :name='nicks[userS("a")].n'></nick> have personal set of settings and configuration. It makes it possible to assign different models per characters, to have different settings like temperature, etc and even different interface style (the latter is totaly useless).
Default: false
</div>
</td>
<td class='val'><input type='checkbox' @change='userSetsPerAi(userS("a"))' v-model='nicks[userS("a")].setsDo'></td>
<td class='setsQ'></td>
<td v-if='!config.setsDescrShow.v' class='def left'>def: false</td>
</tr>
<template v-for='(g,gind) in configGroups'>
<tr>
<td class='left headerC' colspan='3'>
<p class='lnk green header' @click='pToggleDo("sets_"+gind)'>{{g.name}}</p>
</td>
</tr>
<template v-for='j in [config,settings["req"],settings["options"]]'>
<template v-for='(i,ind) in j'>
<template v-if='i!=null&&i.g==gind&&!i.hidden'>
<transition name='ta'>
<template v-if='pState["sets_"+gind]'>
<tr :id='"sets_"+gind' class='setsRow'>
<td class='title' :title='i.d'>
<div :class='config.setsDescrShow.v&&"green"'>
{{i.name?i.name:ind}}
</div>
<div v-if='config.setsDescrShow.v' class='justify txt pre descr'>
{{i.d}}<br>
Default: <span>{{i.def===''?"empty":i.def}}</span>
</div>
</td>
<td class='val'><fields :n='i.name?i.name:ind' :id='ind' :i='i'/></td>
<td class='setsQ'><input v-if='i.q!==null' type='checkbox' v-model='i.q'/></td>
<td v-if='!config.setsDescrShow.v' class='def left'><span v-show='(i.def+"")!=""'>def: {{i.def}}</span></td>
</tr>
</template>
</transition>
</template>
</template>
</template>
</template>
</table>
</div>
<div id='howto' class='nobg' v-if='pState["howto"]'><help></help></div>
<div v-if='pState["cardSave"]' id='cardSave'>
<br>
<div class='nobg'>
<table class='center'>
<tr>
<td colspan='2'><span class='green header center understroke'>Character card saving</span></td>
</tr>
<tr>
<td colspan='2' class='justify'>
Here you can choose the characters you wish to save to a file. Later you can import them into existing conversation or just share with somebody else if they use my UI.
</td>
</tr>
<tr>
<td class='right green'>Character</td>
<td class='green'>Save</td>
</tr>
<template v-for='n in this.nicks'>
<template v-if='!n.del&&n.t!="s"'>
<tr>
<td class='right' width='50%'>
<nick :id='n.id' :name='nicks[n.id].n'/>
</td>
<td width='50%'>
<input class='understroke' type='checkbox' v-model='cardSave.nicks[n.id]'>
</td>
</tr>
</template>
</template>
</table><br>
<div class='center' style='width:90%'>
<div class='justify'>
You also may add several messages to start the story.<br><br>
Select lists in the left column let you choose the message author
(from the ones you've selected for saving).
Text area is the message that will be added on behalf of that user.
Please specify both for every message or these will not be saved.<br><br>
On loading these messages will be added as first ones, if the chat log is empty.
In case if card is loaded when there is some chat log, it will create
a new branch at the first turn, keeping the existing chat log branch untouched.
This doesn't support features like trinity and stories and is just plain
messages that will be converted into the settings of the person who imports it.
The reason for that is that using whole features list would pose a lot of
question on what to do with the existing settings of the user who loads and
also it would require a lot of changes to the code while too few would use it.
Maybe i will do it in the future, tho.
<br><br>
</div>
</div>
<table class='center' id='msgs'>
<tr>
<td class='green center'>Character</td>
<td class='green center'>Message</td>
<td class='green center'>Del</td>
</tr>
<template v-for='(m,mey) in cardSave.msgs'>
<tr>
<td class='nick'>
<select v-model="m.u">
<template v-for="(u,uind) in this.nicks">
<template v-if='!u.del&&cardSave.nicks[u.id]'>
<option :value='u.id'><nick :id='u.id' :name='u.n'/></option>
</template>
</template>
</select>
</td>
<td class='content'>
<textarea width='100%' rows=7 v-model='m.content'></textarea>
</td>
<td class='del'>
(<span @click='cardSave.msgs.splice(mey,1)' class='del'>x</span>)
</td>
</tr>
</template>
</table>
<span class='lnk center' @click='this.cardSaveDo()'>Save</span>
<br><br>
</div>
</div>
<div v-if='pState["pull"]' id='pull'>
<br>
<div class='nobg'>
<p class='heading understroke green center'>Pull a model</p>
<br>
<template v-if='!this.working'>
<div v-if='!this.models.length'>
There are no models installed, please install the models in the console
or install it through this interface.
</div>
To install a model enter your preferred model's name, as it is at
<a href='https://ollama.com/library' target='new'>https://ollama.com/library</a>
and click "pull".<br><br>
<input @keydown.enter.prevent='this.pull()' v-model='modelPull'/> <span class='lnk' @click='this.pull()'>pull</span>
<br><br>
<div v-if='this.connectionErr.length'>
Error: {{this.connectionErr}}
</div>
</template>
<template v-else>
Pulling model: {{this.modelPull}}<br><br>
<template v-for='i in this.mpull'>
<div>
{{i.status}}
<span v-if='i.total'>
{{i.done}} / {{i.total}} = {{i.prcnt}}%
</span>
</div><br>
</template>
</template>
</div>
</div>
</td>
</tr>
<tr v-if='pState["charNew"]' id='charNew'>
<td colspan='3' class='center nobg'>
<transition name="ta" mode="out-in" :key='pState["charNew"]'>
<div>
<div>
<div class='header understroke green center'>
Generation of a new character
<template v-if='charNew.parts.auto.working'>
{{charNew.parts.auto.at}} of {{charNew.parts.auto.amount}}
(<span class='del' @click='this.charNew.cancel=this.cancel=0'>cancel</span>)
</template>
</div>
</div>
<transition name="ta" mode="out-in" :key='charNew.stepShow'>
<table width='100%'>
<tr>
<td colspan='2'>
<template v-if='charNew.step>0'>
<table id='charNewStep'>
<tr>
<td>
<div class='lnk header' v-if='charNew.stepShow>0' @click='charNew.stepShow--'>Back to step {{charNew.stepShow}}</div>
</td>
<td>
<div v-if='charNew.stepShow>0' class='header understroke green center'>Step {{charNew.stepShow+1}}</div>
</td>
<td>
<div class='lnk header rightf' v-if='charNew.step>charNew.stepShow' @click='charNew.stepShow++'>Back to step {{charNew.stepShow+2}}</div>
</td>
</tr>
</table>
</template>
</td>
</tr>
<tr>
<td colspan='2'>
</td>
</tr>
<template v-if='charNew.stepShow==0'>
<tr>
<td colspan='2' style='width:100%' class='center'>
<div>
<span class='lnk' @click='charCreate(0)'>Click to create step by step</span> or
<span class='lnk' @click='charCreateAuto()'>Click to create in 1 click</span> <input class='understroke' characters style='width: 21px' v-model='charNew.parts.auto.amount'> characters
<div class='del rightf' @click='charCreateReset(charNew,1)'>Click to reset</div>
</div>
<p>
Here you can generate a new character. Refer to help section at the bottom for instruction.
To start you can predefine any of the parameters below or leave all empty and just start.
The input to the right from parameters is the amount of character memories to generate about
that "topic". You can leave it empty.<br>
Btw, you can even remove any of these parameters if they don't fit your idea and
add any custom parameters.
</p>
</td>
</tr>
<tr>
<td colspan='2' class='center'>
<div style='max-width:90%;' class='center'>
<char-new-parsed-params :char-new='charNew'></char-new-parsed-params>
<br>
<char-new-mem-sets :char-new='charNew'></char-new-mem-sets>
<br><br>
<char-new-system-edit :char-new='charNew' :p-state='pState' id='0'></char-new-system-edit>
</div>
</td>
</tr>
</template>
<template v-if='charNew.stepShow==1'>
<tr>
<td class='center'>
Below are values recognized in the content generated by the model.
You can edit it before doing next step or just re-create these.
</td>
<td class='center'>
<template v-if='charNew.step==1'>
<div class='center green'>
<template v-if='charNew.parts.tmp.waiting'>..loading..</template>
<template v-else-if='this.charNew.working'>..working..</template>
</div>
</template>
<template v-if='!charNew.working'>
<template v-if='charNew.step>charNew.stepShow'>
<div class='center lnk bold' @click='charNew.stepShow++'>Move to next step</div>
<br>
</template>
<div class='center lnk' @click='charCreate(0)'>Click here to re-create</div>
</template>
</td>
</tr>
<tr>
<td>
<char-new-parsed-params :char-new='charNew'></char-new-parsed-params>
<br><br>
<char-new-system-edit :char-new='charNew' :p-state='pState' id='0'></char-new-system-edit>
</td>
<td>
<textarea v-show='charNew.working&&charNew.step==1' :disabled="1" style='width: 100%;height:100%;' v-model='charNew.parts.tmp.content'></textarea>
</td>
</tr>
</template>
<template v-if='charNew.stepShow==2'>
<tr>
<td class='center green'>
Below are values recognized in the content generated by the model. To edit these move to the previous step.
</td>
<td class='center'>
<template v-if='charNew.step==2'>
<div class='center green'>
<template v-if='charNew.parts.tmp.waiting'>..loading..</template>
<template v-else-if='this.charNew.working'>..working..</template>
</div>
</template>
<template v-if='!charNew.working'>
<template v-if='charNew.parts.sys.length'>
<div class='lnk center middle bold' @click='charNew.stepShow++'>Move to next step</div>
<br>
</template>
<div class='lnk center middle' @click='charCreate(1)'>Click here to do rephrasing of generating content.</div>
<br>
You can edit it manually too, of course.
</template>
</td>
</tr>
<tr>
<td>
<char-new-parsed-params :char-new='charNew'></char-new-parsed-params>
<br><br>
<char-new-system-edit :char-new='charNew' :p-state='pState' id='1'></char-new-system-edit>
</td>
<td>
<template v-if='charNew.working==1'>
<textarea :disabled='charNew.working' style='width:100%;height:100%' v-model='charNew.parts.tmp.content'></textarea>
</template>
<template v-else>
<textarea style='width:100%;height:100%' v-model='charNew.parts.sys'></textarea>
</template
</td>
</tr>
</template>
<template v-if='charNew.stepShow==3'>
<tr>
<td class='center green'>
You can edit the memories below after the generation.
</td>
<td>
<template v-if='charNew.step==3'>
<div class='center green'>
<template v-if='charNew.parts.tmp.waiting'>..loading..</template>
<template v-else-if='charNew.working'>..working..</template>
</div>
</template>
<template v-if='!charNew.working'>
<template v-if='charNew.parts.m.length'>
<div class='lnk center middle bold' @click='charNew.stepShow++'>Move to next step</div>
<br>
</template>
<div class='center middle'>
<span class='lnk' @click='charCreate(2)'>Click here to start (re)generating memories</span>
or
<span class='lnk' @click='charNew.stepShow=4'>Skip this step</span>
</div>
</template>
</td>
</tr>
<tr>
<td class='center'>
<div><char-new-mem-sets :char-new='charNew'></char-new-mem-sets></div>
<char-new-mem-parsed :char-new='charNew'></char-new-mem-parsed>
<br><br>
<char-new-system-edit :char-new='charNew' :p-state='pState' id='2'></char-new-system-edit>
</td>
<td>
<textarea v-show='charNew.working&&charNew.step==3' :disabled='charNew.working==1' style='width:100%; height:100%' v-model='charNew.parts.tmp.content'></textarea>
</td>
</tr>
</template>
<template v-if='charNew.stepShow==4'>
<tr>
<td class='center green'>
Remaining steps to complete:
</td>
<td>
<div class='center'><span class='lnk bold' @click='charCreate(3)'>Click here</span> to make new character with the generated data</div>
</td>
</tr>
<tr>
<td>
<table width='100%'>
<tr>
<td class='green'>Name <span class='small'>(if you change this, update the system prompt manually)</span>:<br>
<textarea rows=1 v-model='charNew.parts.name.c'></textarea>
</td>
</tr>
<tr>
<td class='green center'>System prompt, these 3 parts will be united:<br>
<textarea v-model='charNew.parts.sysPre' rows='4'></textarea>
+
<textarea v-model='charNew.parts.sysKq' rows='4'></textarea>
+
<textarea v-model='charNew.parts.sys' rows='7'></textarea>
</td>
</tr>
<tr>
<td>
<char-new-mem-parsed :char-new='charNew'></char-new-mem-parsed>
</td>
</tr>
</table>
</td>
<td>
<br>
<table width='100%'>
<tr>
<td style='width:90%'>Creating new character:</td>
<td style='width:10%'>{{charNew.parts.copy.userAdd?("done, user: "+charNew.parts.copy.userAdd):".."}}</td>
</tr>
<tr>
<td>Adding system prompt:</td>
<td>{{charNew.parts.copy.sysPrompt?"done":".."}}</td>
</tr>
<tr>
<td>Adding character to the group:</td>
<td>{{charNew.parts.copy.add2group?"done":".."}}</td>
</tr>
<tr>
<td>Selecting character as active:</td>
<td>{{charNew.parts.copy.select?"done":".."}}</td>
</tr>
<tr>
<td>Adding memories and converting these to embeddings:</td>
<td>
<template v-if='!charNew.parts.copy.embedding'>
..
</template>
<template v-else>
<rag-status :rag='rag' :id='charNew.parts.u'></rag-status>
</template>
</td>
</tr>
</table>
</td>
</tr>
</template>
<template v-if='charNew.stepShow==5'>
<tr>
<td colspan='2'>
<div class='center green'>
You have finished creating a new character.
</div>
<br><br>
<div class='center'>
<span class='lnk' @click='pToggle("charNew")'>You can close this</span>
<br><br>or<br><br>
<span class='lnk' @click='charNew.stepShow=0'>Create one more character with the same presets</span>.
<br><br>or<br><br>
<span class='lnk' @click='charCreateReset(charNew,1)'>Create one more character from scratch</span>.
</div>
</td>
</tr>
</template>
</table>
</transition>
<br><br>
<div id='charNewHelp'>
<div class='green understroke right header'>Help</div>
<ol>
<template v-if='charNew.stepShow==0'>
<li>Set all the desired predefined characteristics above or just leave them empty</li>
<li>
Input field to the right from each characteristic is the amount of memories
you wish to be generated about it at a later stage. In other words,
if you put 3 here, you will
get 3 autogenerated memories about this parameter later. Just as
it goes with predefined topics for memories at the bottom.
</li>
<li>
You can proceed by steps, controlling everything, or just click
an automatic creation in 1-click of any amount of new characters.
The choice is yours.
</li>
<li>
If you wish to control every step, click on "click to create by steps"
at the top, it will use your predefined
parameters to start generating the rest.
</li>
<li>
If you choose to create everything in one click, it will
use the predefined values and create as many characters as
you have requested. The predefined values will be used for all of the
generations, everything else is re-generated.
</li>
<li>
Please note, if you move back and forth between the steps,
data is retained. But if you re-generate things, at, say, step 2,
then everything in the next steps is erased to keep things
consistent. If you just edit things, data in the next
steps is not erased, because i believe you know what you do
with manual editing.
</li>
</template>
<template v-if='charNew.stepShow==1'>
<li>
Here you see the values generated for your new character,
if you wish, you can correct any of these. It's a good idea to check
them for consistency.
</li>
<li>
If the reply was
bad and generated parameters were not recognized,
it will try to repeat the process multiple times,
regenerating only the absent parameters.
You can cancel it with "Esc" button on your keyboard.
</li>
<li>
If you don't like the values, you can click on a link to re-create these.
</li>
<li>
When done, click on the link to move to the next step.
</li>
</template>
<template v-if='charNew.stepShow==2'>
<li>
Click on a link in the upper right column to proceed
with rephrasing of the generated character parameters into a more human/llm readable form.
It adds more life to the system prompt.
</li>
<li>
It may automatically try to do it several times if the model doesn't generate it properly. You can cancel the process with "Esc" button on the keyboard.
</li>
<li>
Once ready, you can edit the resulting system prompt right where it is. The edits
you make are used in the final character settings.
</li>
<li>
Once you are satisfied click to proceed to the next step.
</li>
</template>
<template v-if='charNew.stepShow==3'>
<li>
This step is for creating various memories of the new character.
</li>
<li>
If you don't use RAG and don't want to generate memories,
you can skip this step by clicking the appropriate link at the
top of the right column.
</li>
<li>
If you wish to generate specific memories, just
add the desired topics in the left column. You can
define any amount of topics for model to hallucinate about and
set any desired amount of these to generate (0-9999).
Please note that all of the generated memories remain
in the context of a model, to make them consistent, so
requesting a lot of these may overfill your context window
size (num_ctx).
</li>
<li>
It's a good idea to generate memories with desired
reactions to the situations you expect. For example: "i feel irritated and i scream",
"i saw a flower and i cried", "talking to the walls is a sign of a clever person", etc.
If you have only a few memories, these will almost always emerge,
thus somewhat limiting the variativity of character's replies.
It means that in general, having a few memories might be a bad idea.
However, i often use it as i may just turn rag on and off when needed.
</li>
<li>
Once generated, check the results to ensure everything is consistent.
You can edit the memories in place.
</li>
<li>
Please note, a click on generation will delete all existing memories.
</li>
<li>
When ready, proceed to the next step.
</li>
</template>
<template v-if='charNew.stepShow==4'>
<li>
This uses all the generated data
and creates a new character.
</li>
<li>
If you didn't have a field with the "name" data, then
system doesn't know how to call your character. You might
want to enter the name manually then. Also, be sure to
edit the system prompt manually after that.
</li>
<li>Enjoy!</li>
</template>
</ol>
</div>
</div>
</transition>
</td>
</tr>
<tr v-if='pState["opt"]' id='opt'>
<td colspan='3' class='center nobg'>
<opt :branch='branchac':config='config' :settings='settings' :opt='opt' :p-state='pState'></opt>
</td>
</tr>
<tr>
<td colspan=3 class='center' id='menu'>
<br>
<table v-if='pState["menu"]'>
<tr>
<td></td>
<td><span class='lnk nobgt' @click='pToggle("howto")' title='Help'><menun k='F1' t='Help'/></span></td>
<td></td>
<td><span class='lnk nobgt' @click='save()' title='Save state'><menun k='F2' t='Save'/></span></td>
<td></td>
<td><span class='nobgt' title='Load old state'><input id='load' type='file' @change='load()'/><label class='lnk' for="load" id="loadlabel"><menun k='F3' t='Load'></label></span></td>
<td></td>
<td><span class='lnk nobgt' @click='pToggle("sys")' title='System prompt'><menun k='F4' t='Sys.pr.'/></span></td>
<td></td>
<td><span class='lnk nobgt' @click='pToggle("instr")' title='Instruction'><menun k='F5' t='Instr'/></span></td>
<td></td>
<td><span class='lnk nobgt' @click='list()' title='Reload models'><menun k='F6' t='Rld.mdls'/> </span></td>
<td></td>
<td><span class='lnk nobgt' @click='pToggle("pull")' title='Pull a model'><menun k='F7' t='Pull'/></span></td>
<td></td>
<td><span class='lnk nobgt' @click='this.prune()' title='Prune'><menun k='F8' t='Prune'/></span></td>
<td></td>
<td><span class='lnk nobgt' @click='pToggle("sets")' title='Configuration and settings'><menun k='F9' t='Config'/></span></td>
<td></td>
<td><span class='lnk nobgt' @click='quit()' title='Quit'><menun k='F10' t='Quit'/></span></td>
</tr>
<tr>
<td><span class='nobgt'>Shift+</span> </td>
<td><span class='gray nobgt'><menun k='F1' t='None'/></span></td>
<td></td>
<td><span class='lnk nobgt' @click='cardSaveToggle()' title='Save characters card'><menun k='F2' t='Sv ch.'/></span></td>
<td></td>
<td><span class='nobgt' title='Load characters card'><input id='loadcard' type='file' @change='loadFile("card")'/><label class='lnk' for="loadcard" id="loadLabelCard"><menun k='F3' t='Ld.ch.'/></label></span></td>
<td></td>
<td><span class='lnk nobgt' @click='pToggle("ragG")' title='Public knowledge'><menun k='F4' t='P.knlg'/></span></td>
<td></td>
<td><span class='lnk nobgt' @click='pToggle("ragU")' title="Character's memory"><menun k='F5' t='Mem'/></span></td>
<td></td>
<td><span class='gray nobgt'><menun k='F6' t='None'/></span></td>
<td></td>
<td><span class='lnk nobgt' @click='pToggle("charNew")' title="Generate a new character"><menun k='F7' t='Gen.ch.'/></span></td>
<td></td>
<td><span class='lnk nobgt' @click='clear()' title='Clear'><menun k='F8' t='Clear'/></span></td>
<td></td>
<td><span class='lnk nobgt' @click='optToggle()' title='Try different combinations of parameters automatically'><menun k='F9' t='Tune'/></span></td>
<td></td>
<td><span class='gray nobgt'><menun k='F10' t='None'/></span></td>
</tr>
</table>
</td>
</tr>
</template>
<template v-else>
<tr>
<td class='center nobg'>
Ollama url<br>
<input v-model='this.config.url.v' class='understroke'/>
<span class='lnk' @click='this.config.url.v=this.def.configGlobal.url.v'>reset</span>
<br><br>
<template v-if='this.connectionErr.length'>
<br>
<span class='lnk' @click='this.urlTest()'>Re-try</span><br><br>
{{this.connectionErr}}
</template>
<br><br><br><br>
<table>
<tr>
<td colspan=2>
<p class='header center green'>Installation</p>
<p>There is not much to install, it's a single index.html file.
However, the file needs to connect to your local Ollama server and you have 2 choices for that:
<ul>
<li>You can install a local web-server as a reverse proxy.
<li>If Ollama runs on your own computer, you can use a bad way to configure Ollama to
allow a specific Origin header. As it still runs only on your local 127.0.0.1 address, others still
won't be able to connect to it directly. However, sites you visit may use malicious code
to connect to your local network, as you run their code in your browser on your local