Skip to content

Commit 8883188

Browse files
ConcedoConcedo
Concedo
authored and
Concedo
committedAug 17, 2024
allow temporary change of AI nickname
1 parent 8375c0c commit 8883188

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed
 

‎index.html

+24-3
Original file line numberDiff line numberDiff line change
@@ -2293,6 +2293,7 @@
22932293
padding:4px;
22942294
margin-right:6px;
22952295
border-radius:50%;
2296+
cursor:pointer;
22962297
}
22972298
.corpostyleitemheading
22982299
{
@@ -15314,6 +15315,22 @@
1531415315
render_gametext(needsave);
1531515316
}
1531615317

15318+
var cosmetic_corpo_ai_nick = "KoboldAI";
15319+
function corpo_click_avatar()
15320+
{
15321+
inputBox("Set Cosmetic AI Nickname\n(This is purely cosmetic and does not affect responses, and is not saved).","Set Cosmetic AI Nickname",cosmetic_corpo_ai_nick,"Set Cosmetic AI Nickname", ()=>{
15322+
let userinput = getInputBoxValue();
15323+
userinput = userinput.trim();
15324+
if (userinput != null && userinput!="") {
15325+
cosmetic_corpo_ai_nick = userinput;
15326+
}else
15327+
{
15328+
cosmetic_corpo_ai_nick = "KoboldAI";
15329+
}
15330+
render_gametext(false);
15331+
},false,false,false);
15332+
}
15333+
1531715334
var corpo_editing_turn = -1;
1531815335
function render_corpo_ui(input)
1531915336
{
@@ -15368,7 +15385,7 @@
1536815385
processed_msg = processed_msg.replace(/\[<\|.+?\|>\]/g, ""); //remove normal comments too
1536915386
}
1537015387

15371-
let namepart = (curr.myturn ? "User" : "KoboldAI");
15388+
let namepart = (curr.myturn ? "User" : cosmetic_corpo_ai_nick);
1537215389
//advanced name replacement
1537315390
if(localsettings.opmode==3 && curr.name) //chat mode
1537415391
{
@@ -15432,7 +15449,7 @@
1543215449
+ `</div>`);
1543315450

1543415451
newbodystr += `<div class="corpostyleitem">
15435-
<div><img src="`+ (curr.myturn ? human_square : niko_square) + `" class="corpoavatar"/></div>
15452+
<div><img ${(curr.myturn ? "" : `onclick="corpo_click_avatar()"`)} src="${(curr.myturn ? human_square : niko_square)}" class="corpoavatar"/></div>
1543615453
<div style="width:100%">
1543715454
<div class="corpostyleitemheading">`+ namepart + `</div>
1543815455
`+ bodypart + chunkbtns + `
@@ -15441,7 +15458,7 @@
1544115458
}
1544215459
if(incomplete_resp)
1544315460
{
15444-
let namepart = "KoboldAI";
15461+
let namepart = cosmetic_corpo_ai_nick;
1544515462
let futuretext = (synchro_pending_stream!=""?(escapeHtml(pending_context_preinjection) + escapeHtml(synchro_pending_stream)):"...");
1544615463
if(localsettings.opmode==3)
1544715464
{
@@ -16862,6 +16879,10 @@
1686216879
replacedText = replacedText.replace(italics_regex, wrapperSpan(styleRole, 'action')); // Apply the actions style to *actions*.
1686316880
replacedText = replacedText.replace(/“(.*?)”/g, wrapperSpan(styleRole, 'speech')); // Apply the speech style to "speech".
1686416881
replacedText = replacedText.replace(/&quot;(.*?)&quot;/g, wrapperSpan(styleRole, 'speech')); // Apply the speech style to "speech".
16882+
if(localsettings.opmode==4)
16883+
{
16884+
replacedText = replacedText.replace(/!\[(.*?)\]\((.*?)\)/gm, '<img alt="$1" src="$2" />'); //very simple inline images
16885+
}
1686516886
return replacedText;
1686616887
});
1686716888
}

0 commit comments

Comments
 (0)