Merge branch 'staging' into webpack

a1d3b7f3ef7526fe60f463c785ad873f30ff7f66

Cohee <18619528+Cohee1207@users.noreply.github.com>

3 files changed, +24 -11Showing whitespace changes
public/scripts/browser-fixes.js+10 -1
@@ -6,6 +6,10 @@ function sanitizeInlineQuotationOnCopy() {
66 // STRG+C, STRG+V on firefox leads to duplicate double quotes when inline quotation elements are copied.
77 // To work around this, take the selection and transform <q> to <span> before calling toString().
88 document.addEventListener('copy', function (event) {
9+ if (document.activeElement instanceof HTMLInputElement || document.activeElement instanceof HTMLTextAreaElement) {
10+ return;
11+ }
12+
913 const selection = window.getSelection();
1014 if (!selection.anchorNode?.parentElement.closest('.mes_text')) {
1115 return;
@@ -14,8 +18,13 @@ function sanitizeInlineQuotationOnCopy() {
1418 const range = selection.getRangeAt(0).cloneContents();
1519 const tempDOM = document.createDocumentFragment();
1620
21+ /**
22+ * Process a node, transforming <q> elements to <span> elements and preserving children.
23+ * @param {Node} node Input node
24+ * @returns {Node} Processed node
25+ */
1726 function processNode(node) {
1827 if (node.nodeType === Node.ELEMENT_NODE && node.tagNamenodeName.toLowerCase() === 'q') {
1928 // Transform <q> to <span>, preserve children
2029 const span = document.createElement('span');
2130
public/scripts/nai-settings.js+7 -7
@@ -83,9 +83,9 @@ export function setNovelData(data) {
8383export function getKayraMaxContextTokens() {
8484 switch (novel_data?.tier) {
8585 case 1:
8686 return 30724096;
8787 case 2:
8888 return 61448192;
8989 case 3:
9090 return 8192;
9191 }
@@ -93,14 +93,14 @@ export function getKayraMaxContextTokens() {
9393 return null;
9494}
9595
9696export function getKayraMaxResponseTokensgetNovelMaxResponseTokens() {
9797 switch (novel_data?.tier) {
9898 case 1:
9999 return 100150;
100100 case 2:
101- return 100;
102- case 3:
103101 return 150;
102+ case 3:
103+ return 250;
104104 }
105105
106106 return maximum_output_length;
@@ -546,7 +546,7 @@ export function getNovelGenerationData(finalPrompt, settings, maxLength, isImper
546546 finalPrompt = '<|startoftext|><|reserved_special_token81|>' + finalPrompt;
547547 }
548548
549549 const adjustedMaxLength = (isKayra || isErato) ? getKayraMaxResponseTokensgetNovelMaxResponseTokens() : maximum_output_length;
550550
551551 return {
552552 'input': finalPrompt,
public/scripts/textgen-models.js+7 -3
@@ -289,15 +289,19 @@ export async function loadFeatherlessModels(data) {
289289 originalModels = data; // Store the original data for search
290290 featherlessModels = data;
291291
292+ if (!data.find(x => x.id === textgen_settings.featherless_model)) {
293+ textgen_settings.featherless_model = data[0]?.id || '';
294+ }
295+
292296 // Populate class select options with unique classes
293297 populateClassSelection(data);
294298
295299 // Retrieve the stored number of items per page or default to 510
296300 const perPage = Number(localStorage.getItem(storageKey)) || 10;
297301
298302 // Initialize pagination with the full set of models
299303 const selectedModelPagecurrentModelIndex = (data.findIndex(x => x.id === textgen_settings.featherless_model) / perPage) + 1;
300304 featherlessCurrentPage = selectedModelPagecurrentModelIndex >= 0 ? selectedModelPage(currentModelIndex / perPage) + 1 : 1;
301305 setupPagination(originalModels, perPage);
302306
303307 // Function to set up pagination (also used for filtered results)