Skip to content

Commit

Permalink
BugFix: SystemPromptPanel Max Height Correction
Browse files Browse the repository at this point in the history
  • Loading branch information
Ariansdf committed Aug 7, 2024
1 parent 095ea1c commit 9db4fd7
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
2 changes: 1 addition & 1 deletion private/pages/interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@

<p >
<span>&Prime;</span>
<span contenteditable="true" id="system-prompt"></span>
<span contenteditable="true" id="system-prompt" oninput="calculateSystemPromptMaxHeight()"></span>
<span>&rdquo;</span>
</p>
</div>
Expand Down
15 changes: 15 additions & 0 deletions public/js/interface_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,19 @@ function toggleSystemPromptEdit(){
isEditing = !isEditing;
}


function calculateSystemPromptMaxHeight(){
const inputWrapper = document.querySelector('.input-wrapper');
const inputHeight = inputWrapper.getBoundingClientRect().height;

const spPanel = document.getElementById('system-prompt-panel');

const windowHeight = window.innerHeight;
const remInPixels = parseFloat(getComputedStyle(document.documentElement).fontSize);
const margin = 8 * remInPixels;

const maxHeight = windowHeight - inputHeight - margin;
spPanel.style.maxHeight = `${maxHeight}px`;
}

//#endregion
25 changes: 24 additions & 1 deletion public/style/interface_style.css
Original file line number Diff line number Diff line change
Expand Up @@ -754,11 +754,14 @@ details svg{
}
#system-prompt-panel{
position: absolute;
bottom: 130%;
bottom: calc(100% + 2rem);
left: 0;
right: 0;
margin-bottom: 1rem;
height: max-content;
max-height: 70vh;
overflow-y: auto;

padding: 0.5rem 2rem 1rem 2rem;

/* font-size: 0.8rem; */
Expand All @@ -772,6 +775,26 @@ details svg{
opacity: 0;
transition: opacity 300ms;
}
#system-prompt-panel::-webkit-scrollbar {
width: 7px;
}

#system-prompt-panel::-webkit-scrollbar-track {
background: rgba(0, 0, 0, 0);
}

#system-prompt-panel::-webkit-scrollbar-thumb {
background: #cbcbcb;
border-radius: 5px;
}

#system-prompt-panel::-webkit-scrollbar-thumb:hover {
background: #555;
}




#system-prompt-title{
display: grid;
grid-template-columns: auto 1fr auto;
Expand Down

0 comments on commit 9db4fd7

Please sign in to comment.