raw Prompt visible from Itemizer view

This commit is contained in:
RossAscends
2023-05-15 18:00:45 +09:00
parent 54017e6777
commit 5245174f6f
3 changed files with 57 additions and 3 deletions

View File

@@ -2509,6 +2509,9 @@
<div id="avatar_zoom_popupheader" class="fa-solid fa-grip drag-grabber"></div> <div id="avatar_zoom_popupheader" class="fa-solid fa-grip drag-grabber"></div>
<img id="zoomed_avatar" src=""> <img id="zoomed_avatar" src="">
</div> </div>
<div id="rawPromptPopup" class="list-group">
<div id="rawPromptWrapper" class="tokenItemizingSubclass"></div>
</div>
</body> </body>
</html> </html>

View File

@@ -246,6 +246,9 @@ let optionsPopper = Popper.createPopper(document.getElementById('send_form'), do
let exportPopper = Popper.createPopper(document.getElementById('export_button'), document.getElementById('export_format_popup'), { let exportPopper = Popper.createPopper(document.getElementById('export_button'), document.getElementById('export_format_popup'), {
placement: 'left' placement: 'left'
}); });
let rawPromptPopper = Popper.createPopper(document.getElementById('dialogue_popup'), document.getElementById('rawPromptPopup'), {
placement: 'right'
});
let dialogueResolve = null; let dialogueResolve = null;
let chat_metadata = {}; let chat_metadata = {};
@@ -2232,6 +2235,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
} }
if (power_user.console_log_prompts) { if (power_user.console_log_prompts) {
console.log(generate_data.prompt); console.log(generate_data.prompt);
} }
@@ -2280,6 +2284,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
let currentArrayEntry = Number(thisPromptBits.length - 1); let currentArrayEntry = Number(thisPromptBits.length - 1);
let additionalPromptStuff = { let additionalPromptStuff = {
...thisPromptBits[currentArrayEntry], ...thisPromptBits[currentArrayEntry],
rawPrompt: generate_data.prompt,
mesId: Number(count_view_mes), mesId: Number(count_view_mes),
worldInfoBefore: worldInfoBefore, worldInfoBefore: worldInfoBefore,
allAnchors: allAnchors, allAnchors: allAnchors,
@@ -2580,6 +2585,7 @@ function promptItemize(itemizedPrompts, requestedMesId) {
Only the white numbers really matter. All numbers are estimates. Only the white numbers really matter. All numbers are estimates.
Grey color items may not have been included in the context due to certain prompt format settings. Grey color items may not have been included in the context due to certain prompt format settings.
</span> </span>
<div id="showRawPrompt" class="fa-solid fa-square-poll-horizontal menu_button"></div>
<hr class="sysHR"> <hr class="sysHR">
<div class="justifyLeft"> <div class="justifyLeft">
<div class="flex-container"> <div class="flex-container">
@@ -2693,6 +2699,7 @@ function promptItemize(itemizedPrompts, requestedMesId) {
Only the white numbers really matter. All numbers are estimates. Only the white numbers really matter. All numbers are estimates.
Grey color items may not have been included in the context due to certain prompt format settings. Grey color items may not have been included in the context due to certain prompt format settings.
</span> </span>
<div id="showRawPrompt" class="fa-solid fa-square-poll-horizontal menu_button"></div>
<hr class="sysHR"> <hr class="sysHR">
<div class="justifyLeft"> <div class="justifyLeft">
<div class="flex-container"> <div class="flex-container">
@@ -5763,6 +5770,18 @@ $(document).ready(function () {
} }
}) })
$(document).on("pointerup", "#showRawPrompt", function () {
//let mesIdForItemization = $(this).closest('.mes').attr('mesId');
//console.log(generate_data.prompt);
console.log(itemizedPrompts[0].rawPrompt);
$("#rawPromptWrapper").html(itemizedPrompts[0].rawPrompt.replace(/\n/g, '<br>'));
rawPromptPopper.update();
$('#rawPromptPopup').toggle();
//Popper(itemizedPrompts, mesIdForItemization);
})
//******************** //********************
//***Message Editor*** //***Message Editor***

View File

@@ -3193,11 +3193,39 @@ a {
text-decoration: none; text-decoration: none;
} }
#export_format_popup { #export_format_popup,
#rawPromptPopup {
display: none; display: none;
z-index: 9999; z-index: 9999;
} }
#rawPromptPopup {
inset: 0px auto auto 0px;
margin: 0px;
transform: translate(909px, 47px);
display: block;
overflow-wrap: break-word;
white-space: normal;
max-width: calc(((100svw - 500px) / 2) - 10px);
position: absolute;
z-index: 9999;
max-height: 90svh;
/*unsure why, but this prevents scrollbars*/
height: 49svh;
padding: 5px;
overflow-y: auto;
display: none;
}
#rawPopupWrapper {
word-wrap: break-word;
width: 100%;
text-align: start;
overflow-y: auto;
max-height: 100%;
}
.list-group { .list-group {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -4100,6 +4128,10 @@ body.waifuMode #avatar_zoom_popup {
} }
#showRawPrompt {
display: none;
}
.mes-text { .mes-text {
padding-right: 25px; padding-right: 25px;
} }