Allow zero depth for floating prompt

This commit is contained in:
SillyLossy
2023-03-28 17:49:02 +03:00
parent ae7e21d6c5
commit cd4f699e74
2 changed files with 3 additions and 3 deletions

View File

@ -91,7 +91,7 @@ async function moduleWorker() {
const messagesTillInsertion = lastMessageNumber >= promptInsertionInterval const messagesTillInsertion = lastMessageNumber >= promptInsertionInterval
? (lastMessageNumber % promptInsertionInterval) ? (lastMessageNumber % promptInsertionInterval)
: (promptInsertionInterval - lastMessageNumber); : (promptInsertionInterval - lastMessageNumber);
const shouldAddPrompt = messagesTillInsertion == 0 && (promptInsertionPosition == 0 || promptInsertionDepth > 0); const shouldAddPrompt = messagesTillInsertion == 0;
const prompt = shouldAddPrompt ? $('#extension_floating_prompt').val() : ''; const prompt = shouldAddPrompt ? $('#extension_floating_prompt').val() : '';
context.setExtensionPrompt(MODULE_NAME, prompt, promptInsertionPosition, promptInsertionDepth); context.setExtensionPrompt(MODULE_NAME, prompt, promptInsertionPosition, promptInsertionDepth);
$('#extension_floating_counter').text(shouldAddPrompt ? 'This' : messagesTillInsertion); $('#extension_floating_counter').text(shouldAddPrompt ? 'This' : messagesTillInsertion);
@ -114,7 +114,7 @@ async function moduleWorker() {
</label> </label>
<label for="extension_floating_interval">Every N messages <b>you</b> send (set to 0 to disable):</label> <label for="extension_floating_interval">Every N messages <b>you</b> send (set to 0 to disable):</label>
<input id="extension_floating_interval" class="text_pole" type="number" value="0" min="0" max="999" /> <input id="extension_floating_interval" class="text_pole" type="number" value="0" min="0" max="999" />
<label for="extension_floating_interval">Insertion depth (for in-chat positioning, set to 0 to disable):</label> <label for="extension_floating_interval">Insertion depth (for in-chat positioning):</label>
<input id="extension_floating_depth" class="text_pole" type="number" value="0" min="0" max="99" /> <input id="extension_floating_depth" class="text_pole" type="number" value="0" min="0" max="99" />
<span>Appending the prompt in next: <span id="extension_floating_counter">No</span> message(s)</span> <span>Appending the prompt in next: <span id="extension_floating_counter">No</span> message(s)</span>
</div> </div>

View File

@ -107,7 +107,7 @@ function setOpenAIMessages(chat) {
j++; j++;
} }
for (let i = 1; i < 100; i++) { for (let i = 0; i < 100; i++) {
const anchor = getExtensionPrompt(extension_prompt_types.IN_CHAT, i); const anchor = getExtensionPrompt(extension_prompt_types.IN_CHAT, i);
if (anchor && anchor.length) { if (anchor && anchor.length) {