@@ -21296,6 +21296,16 @@ Current version indicated by LITEVER below.
2129621296 {
2129721297 currmsg = currmsg.replace(/(\[\d{1,2}\/\d{1,2}\/\d{4}, \d{1,2}:\d{2} [AP]M\])/g, "$1\n");
2129821298 }
21299+ let currentName = undefined;
21300+ if (localsettings.inject_chatnames_instruct)
21301+ {
21302+ [localsettings.chatname, ...localsettings.chatopponent.split("||$||")].forEach(op => {
21303+ if (currentName === undefined && currmsg.trim().startsWith(`${op.trim()}:`))
21304+ {
21305+ currentName = op.trim()
21306+ }
21307+ })
21308+ }
2129921309 if(localsettings.inject_chatnames_instruct && localsettings.instruct_has_markdown)
2130021310 {
2130121311 let m_name = localsettings.chatname + ": ";
@@ -21323,34 +21333,48 @@ Current version indicated by LITEVER below.
2132321333 currmsg = simpleMarkdown(currmsg,localsettings.instruct_has_latex);
2132421334 }
2132521335
21336+ let imageToUse = getImageForSource(curr?.source, currentName), isHuman = false, putRaw = false;
2132621337 if (curr?.source !== undefined) {
2132721338 switch (curr?.source) {
2132821339 case "human":
21329- fulltxt += `<hr style="margin-top: 12px; margin-bottom: 12px;"><span class="color_cyan"><img src="${human_square}" style="height:38px;width:auto;padding:3px 6px 3px 3px;border-radius: 8%;"/>${currmsg}</span>`;
21330- break
21340+ imageToUse = imageToUse || "var(--img_humansquare)";
21341+ isHuman = true;
21342+ break;
2133121343 case "ai":
21332- fulltxt += `<hr style="margin-top: 12px; margin-bottom: 12px;"><span class="color_cyan"><img src="${niko_square}" style="height:38px;width:auto;padding:3px 6px 3px 3px;border-radius: 8%;"/>${currmsg}</span>`
21333- break
21344+ imageToUse = imageToUse || "var(--img_nikosquare)";
21345+ break;
2133421346 case "system":
2133521347 default:
21336- fulltxt += `<hr style="margin-top: 12px; margin-bottom: 12px;"><span class="color_cyan"><img src="${favivon_normal}" style="height:38px;width:auto;padding:3px 6px 3px 3px;border-radius: 8%;"/>${currmsg}</span>`
21337- break
21348+ imageToUse = imageToUse || "var(--img_favicon_normal)";
21349+ break;
2133821350 }
2133921351 }
2134021352 else {
2134121353 if(curr.myturn)
2134221354 {
21343- fulltxt += `<hr style="margin-top: 12px; margin-bottom: 12px;"><span class="color_cyan"><img src="${human_square}" style="height:38px;width:auto;padding:3px 6px 3px 3px;border-radius: 8%;"/>${currmsg}</span>`;
21355+ imageToUse = imageToUse || "var(--img_humansquare)";
21356+ isHuman = true;
2134421357 }
2134521358 else
2134621359 {
2134721360 if (i == 0) {
2134821361 fulltxt += `${currmsg}`;
21349- } else {
21350- fulltxt += `<hr style="margin-top: 12px; margin-bottom: 12px;"><img src="${niko_square}" style="height:38px;width:auto;padding:3px 6px 3px 3px;border-radius: 8%;"/>${currmsg}</span>`;
21362+ putRaw = true;
21363+ }
21364+ else {
21365+ imageToUse = imageToUse || "var(--img_nikosquare)";
2135121366 }
2135221367 }
2135321368 }
21369+
21370+ if (putRaw)
21371+ {
21372+ fulltxt += `${currmsg}`;
21373+ }
21374+ else
21375+ {
21376+ fulltxt += `<hr style="margin-top: 12px; margin-bottom: 12px;">${isHuman ? `<span class="color_cyan">` : ""}<img class="containAndScaleImage" style="height:38px;width:38px;padding:3px 6px 3px 3px;border-radius: 8%; background-image: ${imageToUse};" />${currmsg}${isHuman ? `</span>` : ""}`;
21377+ }
2135421378 }
2135521379
2135621380 } else {
@@ -22340,7 +22364,12 @@ Current version indicated by LITEVER below.
2234022364 newbodystr += `<div style="width:100%">`;
2234122365 }
2234222366 else {
22343- newbodystr += `<div><img ${(curr.myturn ? "" : `onclick="corpo_click_avatar()"`)} src="${(curr.myturn ? human_square : niko_square)}" class="corpoavatar"/></div>
22367+ let imageToUse = getImageForSource(curr?.source, curr.name);
22368+ if (imageToUse === undefined)
22369+ {
22370+ imageToUse = curr.myturn ? "var(--img_humansquare)" : "var(--img_nikosquare)"
22371+ }
22372+ newbodystr += `<div><img ${(curr.myturn ? "" : `onclick="corpo_click_avatar()"`)} style="background-image:${imageToUse};" class="corpoavatar containAndScaleImage"/></div>
2234422373 <div style="width:100%">
2234522374 <div class="corpostyleitemheading">`+ curr.name + `</div>`;
2234622375 }
@@ -24069,11 +24098,23 @@ Current version indicated by LITEVER below.
2406924098
2407024099 function getImageForSource(source, name)
2407124100 {
24101+ if (name === undefined)
24102+ {
24103+ return undefined;
24104+ }
2407224105 let imageFromIndexDB = getImageUrlFromCharacter(name)
2407324106 if (imageFromIndexDB !== undefined)
2407424107 {
2407524108 return imageFromIndexDB;
2407624109 }
24110+ if (name === localsettings.chatname && !!aestheticInstructUISettings?.you_portrait)
24111+ {
24112+ return `url(${aestheticInstructUISettings.you_portrait})`
24113+ }
24114+ if (localsettings?.chatopponent?.split("||$||").includes(name) && !!aestheticInstructUISettings?.AI_portrait)
24115+ {
24116+ return `url(${aestheticInstructUISettings.AI_portrait})`
24117+ }
2407724118 if (source !== undefined)
2407824119 {
2407924120 let images = sourceImagesForCharacters.filter(imageMeta => imageMeta?.source === source && imageMeta?.name === name);
@@ -24110,7 +24151,7 @@ Current version indicated by LITEVER below.
2411024151 height = (as.border_style == 'Circle' ? as.portrait_width_AI : as.portrait_width_AI / as.portrait_ratio_AI);
2411124152 imgclassname = "AI-portrait-image";
2411224153 }
24113- 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>`;
24154+ return `<div class='${imgclassname}${classSuffixStr}${reinvertcolor} containAndScaleImage ' style='width:${width}px; height:${height}px; border-radius: ${radius}; ${!!imageToUse ? `background-image :${imageToUse}; margin: 10px 6px; border:none;` : ""}'></div>`;
2411424155 }
2411524156
2411624157 if(localsettings.separate_end_tags) {
@@ -37051,4 +37092,15 @@ flowchart TD\n${treeToViewOutput.outputText.trim()}`
3705137092 setInterval(updateExecScriptButtons, 15*1000);
3705237093 setTimeout(updateExecScriptButtons, 5*1000);
3705337094</script>
37095+ <style>
37096+ .containAndScaleImage
37097+ {
37098+ aspect-ratio: 1;
37099+ background-clip: content-box;
37100+ background-position: 50% 50%;
37101+ background-size: 100% 100%;
37102+ background-origin: content-box;
37103+ background-repeat: no-repeat;
37104+ }
37105+ </style>
3705437106</html>
0 commit comments