Skip to content

Commit 8515231

Browse files
author
prima
committed
fix: Aethetic mode images with agent mode (support for multi char in progress for aethetic mode)
1 parent 39e4569 commit 8515231

File tree

1 file changed

+50
-8
lines changed

1 file changed

+50
-8
lines changed

klite.embd

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21317,6 +21317,11 @@ Current version indicated by LITEVER below.
2131721317
}
2131821318
currchatunit.msg = processed_msg;
2131921319
currchatunit.name = namepart;
21320+
currchatunit.source = currchatunit?.source;
21321+
if (currchatunit?.source === "system")
21322+
{
21323+
currchatunit.name = "System"
21324+
}
2132021325
return currchatunit;
2132121326
}
2132221327

@@ -23433,9 +23438,34 @@ Current version indicated by LITEVER below.
2343323438
document.getElementById('aesthetic_text_preview').innerHTML = render_aesthetic_ui(preview,true);
2343423439
}
2343523440

23441+
// source, name, imageData
23442+
let sourceImagesForCharacters = [
23443+
{
23444+
source: "system",
23445+
name: "System",
23446+
imageData: "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAEtQTFRFAAAA+XJ0l09PsVdXcTw842hqw2hmTi4vMCQlb2eUgWtl+tGpBAMDEw4NPCkoFw8PJBgXt5WBVkxW4Nvf7Lia3Z+MpJnAZ05HnJOTYIS/NAAAABl0Uk5TAv////v//vT9//3/Nna08qf+///////a/hkcROQAAAGUSURBVHiclZLRcoQgDEULBAKoIKjI/39pL4i7nbUPbcYZwJyES5Kvr3/YvIx1nn9zL4G4EwuTXX7xs4QFGEklOT6SBENERguhsWHFD2AVRhL8IEgawY8b5L4fYtg+TSl8+NMEu4G2P34Q67r6I+37dLyBfU/4PY/sInG2MR8vIHG01h9mHfq1hUUQtwYcLEcp+ltmwqutdy5HMwAfc8ExKtVSLEZZW13Jxb4Azq7UHFnFrtGItLliS1UDYOfctm3JhEtlEH5zzpZNDsC63AB1VysY3gqC3C2ytsNW6Q3IjCt91Qr9QK8MiFL4nUEpEyNLYmodxYo3RquVHWUmbbRu0QCbKWwNfil5zYeENrRRqtZrGEQYqdtW8FWHLl4bgZDLFLZdbS/UzP2AEGTufkt3xWSvwzJeh4GxHWD5qlgXOZ/n2ULuC/od4Pk8x9xhCekD0Bqd/DmXgbpEumRgrMPn1K6ecs4pJc/V0nE+x35KtfTJTJufpvPTD2DyNZ3e4wP3zDCHevg+yYvf09PfkHuK7/Vv9g2CjBTdqv3bFgAAAABJRU5ErkJggg==)"
23447+
},
23448+
{
23449+
source: "human",
23450+
name: "Eso",
23451+
imageData: "var(--img_worldTree)"
23452+
},
23453+
{
23454+
source: "ai",
23455+
name: "Eso",
23456+
imageData: "var(--img_worldTree)"
23457+
}
23458+
];
23459+
23460+
function getImageForSource(source, name)
23461+
{
23462+
let images = sourceImagesForCharacters.filter(imageMeta => imageMeta?.source === source && imageMeta?.name === name);
23463+
return images.length > 0 ? images[0]?.imageData : undefined;
23464+
}
23465+
2343623466
function render_aesthetic_ui(input, isPreview) //class suffix string used to prevent defined styles from leaking into global scope
2343723467
{
23438-
const avatarImage = function(for_ai) { //todo: this is still bad code, but will keep it for now
23468+
const avatarImage = function(for_ai, source = undefined, name = undefined) { //todo: this is still bad code, but will keep it for now
2343923469
if((for_ai && !as.AI_portrait) || (!for_ai && !as.you_portrait) || as.border_style == 'None')
2344023470
{
2344123471
return ''; //for no portrait
@@ -23444,16 +23474,24 @@ Current version indicated by LITEVER below.
2344423474
let radius = (as.border_style == 'Circle' ? '1000rem' : (as.border_style == 'Rounded' ? '1.6rem' : '0.1rem'));
2344523475
let width, height;
2344623476
let imgclassname = "";
23447-
if (!for_ai) {
23477+
let imageToUse = source !== undefined ? getImageForSource(source, name) : undefined;
23478+
if (imageToUse !== undefined)
23479+
{
23480+
width = as.portrait_width_AI;
23481+
height = (as.border_style == 'Circle' ? as.portrait_width_AI : as.portrait_width_AI / as.portrait_ratio_AI);
23482+
}
23483+
else if (!for_ai)
23484+
{
2344823485
width = as.portrait_width_you;
2344923486
height = (as.border_style == 'Circle' ? as.portrait_width_you : as.portrait_width_you / as.portrait_ratio_you);
2345023487
imgclassname = "you-portrait-image";
23451-
} else {
23488+
}
23489+
else {
2345223490
width = as.portrait_width_AI;
2345323491
height = (as.border_style == 'Circle' ? as.portrait_width_AI : as.portrait_width_AI / as.portrait_ratio_AI);
2345423492
imgclassname = "AI-portrait-image";
2345523493
}
23456-
return `<div class='${imgclassname}${classSuffixStr}${reinvertcolor}' style='width:${width}px; height:${height}px; border-radius: ${radius}'></div>`;
23494+
return `<div class='${imgclassname}${classSuffixStr}${reinvertcolor}' style='width:${width}px; height:${height}px; border-radius: ${radius}; ${!!imageToUse ? `background:${imageToUse}; margin: 10px 6px; background-clip: content-box; background-position: 50% 50%; background-size: 100% 100%; background-origin: content-box; background-repeat: no-repeat; border:none;` : ""}'></div>`;
2345723495
}
2345823496

2345923497
if(localsettings.separate_end_tags) {
@@ -23613,12 +23651,12 @@ Current version indicated by LITEVER below.
2361323651
newbodystr += `<div style='display:flex; align-items:stretch; flex-direction: row;'>`;
2361423652
if(curr.myturn)
2361523653
{
23616-
newbodystr += `${(showavatar?avatarImage(false):"")}
23654+
newbodystr += `${(showavatar?avatarImage(false, curr?.source, curr?.name):"")}
2361723655
<div class='aui_myturn_block'`;
2361823656
}
2361923657
else
2362023658
{
23621-
newbodystr += `${(showavatar?avatarImage(true):"")}
23659+
newbodystr += `${(showavatar?avatarImage(true, curr?.source, curr?.name):"")}
2362223660
<div class='aui_aiturn_block'`;
2362323661
}
2362423662
newbodystr += ` style='flex: 1; display:flex; padding: ${as.padding()}; margin: ${as.margin()}; min-height:${as.background_minHeight}px;`
@@ -40738,14 +40776,17 @@ let checkFinalThoughtsPrompt = `Action: {"command":{"name":"thought","args":{"me
4073840776
if (elem.indexOf(usertag) !== -1)
4073940777
{
4074040778
out.source = "human"
40779+
out.myturn = true
4074140780
}
4074240781
else if (elem.indexOf(aitag) !== -1)
4074340782
{
4074440783
out.source = "ai"
40784+
out.myturn = false
4074540785
}
4074640786
else if (elem.indexOf(systag) !== -1)
4074740787
{
4074840788
out.source = "system"
40789+
out.myturn = false
4074940790
}
4075040791
else
4075140792
{
@@ -40826,7 +40867,8 @@ let checkFinalThoughtsPrompt = `Action: {"command":{"name":"thought","args":{"me
4082640867
if (allow_blank || elem.message.trim() != "") {
4082740868
return {
4082840869
msg: elem.message,
40829-
source: elem.source
40870+
source: elem.source,
40871+
myturn: elem.myturn
4083040872
}
4083140873
}
4083240874
return null
@@ -40836,7 +40878,7 @@ let checkFinalThoughtsPrompt = `Action: {"command":{"name":"thought","args":{"me
4083640878
{
4083740879
return originalRepackInstructTurns(input, usertag, aitag, allow_blank)
4083840880
}
40839-
}
40881+
};
4084040882

4084140883
let getLastActions = (amountOfActions = 10) => {
4084240884
let exclusions = ["Chain of thought repetition detected - ending", "Chain of thought complete", "plan_actions"]

0 commit comments

Comments
 (0)