From 027d7107160f280f74ed580d57eb6940ee554fd8 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Thu, 17 Oct 2024 23:47:47 +0300 Subject: [PATCH 1/4] NovelAI: Increase tier token limits --- public/scripts/nai-settings.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/public/scripts/nai-settings.js b/public/scripts/nai-settings.js index e0b3d3748..f95e7d9f6 100644 --- a/public/scripts/nai-settings.js +++ b/public/scripts/nai-settings.js @@ -83,9 +83,9 @@ export function setNovelData(data) { export function getKayraMaxContextTokens() { switch (novel_data?.tier) { case 1: - return 3072; + return 4096; case 2: - return 6144; + return 8192; case 3: return 8192; } @@ -93,14 +93,14 @@ export function getKayraMaxContextTokens() { return null; } -export function getKayraMaxResponseTokens() { +export function getNovelMaxResponseTokens() { switch (novel_data?.tier) { case 1: - return 100; - case 2: - return 100; - case 3: return 150; + case 2: + return 150; + case 3: + return 250; } return maximum_output_length; @@ -546,7 +546,7 @@ export function getNovelGenerationData(finalPrompt, settings, maxLength, isImper finalPrompt = '<|startoftext|><|reserved_special_token81|>' + finalPrompt; } - const adjustedMaxLength = (isKayra || isErato) ? getKayraMaxResponseTokens() : maximum_output_length; + const adjustedMaxLength = (isKayra || isErato) ? getNovelMaxResponseTokens() : maximum_output_length; return { 'input': finalPrompt, From 80f91d129e0e22c5a48b6171d8dd11dc7e87ab59 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 18 Oct 2024 12:54:26 +0000 Subject: [PATCH 2/4] Firefox: fix copy from edit textarea --- public/scripts/browser-fixes.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/scripts/browser-fixes.js b/public/scripts/browser-fixes.js index 96eaa7402..b4b36f552 100644 --- a/public/scripts/browser-fixes.js +++ b/public/scripts/browser-fixes.js @@ -6,6 +6,10 @@ function sanitizeInlineQuotationOnCopy() { // STRG+C, STRG+V on firefox leads to duplicate double quotes when inline quotation elements are copied. // To work around this, take the selection and transform to before calling toString(). document.addEventListener('copy', function (event) { + if (document.activeElement instanceof HTMLInputElement || document.activeElement instanceof HTMLTextAreaElement) { + return; + } + const selection = window.getSelection(); if (!selection.anchorNode?.parentElement.closest('.mes_text')) { return; From 9c379125be001b2848048eb31a17ad642b078551 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 18 Oct 2024 19:46:37 +0300 Subject: [PATCH 3/4] [chore] Add JSDoc --- public/scripts/browser-fixes.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/scripts/browser-fixes.js b/public/scripts/browser-fixes.js index b4b36f552..01bb25d26 100644 --- a/public/scripts/browser-fixes.js +++ b/public/scripts/browser-fixes.js @@ -18,8 +18,13 @@ function sanitizeInlineQuotationOnCopy() { const range = selection.getRangeAt(0).cloneContents(); const tempDOM = document.createDocumentFragment(); + /** + * Process a node, transforming elements to elements and preserving children. + * @param {Node} node Input node + * @returns {Node} Processed node + */ function processNode(node) { - if (node.nodeType === Node.ELEMENT_NODE && node.tagName.toLowerCase() === 'q') { + if (node.nodeType === Node.ELEMENT_NODE && node.nodeName.toLowerCase() === 'q') { // Transform to , preserve children const span = document.createElement('span'); From f61c2403d66377fadcdbf5e4685ca4a4ae092651 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 18 Oct 2024 20:05:50 +0300 Subject: [PATCH 4/4] Featherless: Fix model pagination init --- public/scripts/textgen-models.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/public/scripts/textgen-models.js b/public/scripts/textgen-models.js index 32b288b39..793be430b 100644 --- a/public/scripts/textgen-models.js +++ b/public/scripts/textgen-models.js @@ -288,15 +288,19 @@ export async function loadFeatherlessModels(data) { originalModels = data; // Store the original data for search featherlessModels = data; + if (!data.find(x => x.id === textgen_settings.featherless_model)) { + textgen_settings.featherless_model = data[0]?.id || ''; + } + // Populate class select options with unique classes populateClassSelection(data); - // Retrieve the stored number of items per page or default to 5 + // Retrieve the stored number of items per page or default to 10 const perPage = Number(localStorage.getItem(storageKey)) || 10; // Initialize pagination with the full set of models - const selectedModelPage = (data.findIndex(x => x.id === textgen_settings.featherless_model) / perPage) + 1; - featherlessCurrentPage = selectedModelPage > 0 ? selectedModelPage : 1; + const currentModelIndex = data.findIndex(x => x.id === textgen_settings.featherless_model); + featherlessCurrentPage = currentModelIndex >= 0 ? (currentModelIndex / perPage) + 1 : 1; setupPagination(originalModels, perPage); // Function to set up pagination (also used for filtered results)