Merge branch 'staging' into webpack
| @@ -6,6 +6,10 @@ function sanitizeInlineQuotationOnCopy() { | ||
| 6 | 6 | // STRG+C, STRG+V on firefox leads to duplicate double quotes when inline quotation elements are copied. |
| 7 | 7 | // To work around this, take the selection and transform <q> to <span> before calling toString(). |
| 8 | 8 | document.addEventListener('copy', function (event) { |
| 9 | + if (document.activeElement instanceof HTMLInputElement || document.activeElement instanceof HTMLTextAreaElement) { | |
| 10 | + return; | |
| 11 | + } | |
| 12 | + | |
| 9 | 13 | const selection = window.getSelection(); |
| 10 | 14 | if (!selection.anchorNode?.parentElement.closest('.mes_text')) { |
| 11 | 15 | return; |
| @@ -14,8 +18,13 @@ function sanitizeInlineQuotationOnCopy() { | ||
| 14 | 18 | const range = selection.getRangeAt(0).cloneContents(); |
| 15 | 19 | const tempDOM = document.createDocumentFragment(); |
| 16 | 20 | |
| 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 | + */ | |
| 17 | 26 | function processNode(node) { |
| 18 | 27 | if (node.nodeType === Node.ELEMENT_NODE && node.tagNamenodeName.toLowerCase() === 'q') { |
| 19 | 28 | // Transform <q> to <span>, preserve children |
| 20 | 29 | const span = document.createElement('span'); |
| 21 | 30 | |
| @@ -83,9 +83,9 @@ export function setNovelData(data) { | ||
| 83 | 83 | export function getKayraMaxContextTokens() { |
| 84 | 84 | switch (novel_data?.tier) { |
| 85 | 85 | case 1: |
| 86 | 86 | return 30724096; |
| 87 | 87 | case 2: |
| 88 | 88 | return 61448192; |
| 89 | 89 | case 3: |
| 90 | 90 | return 8192; |
| 91 | 91 | } |
| @@ -93,14 +93,14 @@ export function getKayraMaxContextTokens() { | ||
| 93 | 93 | return null; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | export function getKayraMaxResponseTokensgetNovelMaxResponseTokens() { |
| 97 | 97 | switch (novel_data?.tier) { |
| 98 | 98 | case 1: |
| 99 | 99 | return 100150; |
| 100 | 100 | case 2: |
| 101 | - return 100; | |
| 102 | - case 3: | |
| 103 | 101 | return 150; |
| 102 | + case 3: | |
| 103 | + return 250; | |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | return maximum_output_length; |
| @@ -546,7 +546,7 @@ export function getNovelGenerationData(finalPrompt, settings, maxLength, isImper | ||
| 546 | 546 | finalPrompt = '<|startoftext|><|reserved_special_token81|>' + finalPrompt; |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | const adjustedMaxLength = (isKayra || isErato) ? getKayraMaxResponseTokensgetNovelMaxResponseTokens() : maximum_output_length; |
| 550 | 550 | |
| 551 | 551 | return { |
| 552 | 552 | 'input': finalPrompt, |
| @@ -289,15 +289,19 @@ export async function loadFeatherlessModels(data) { | ||
| 289 | 289 | originalModels = data; // Store the original data for search |
| 290 | 290 | featherlessModels = data; |
| 291 | 291 | |
| 292 | + if (!data.find(x => x.id === textgen_settings.featherless_model)) { | |
| 293 | + textgen_settings.featherless_model = data[0]?.id || ''; | |
| 294 | + } | |
| 295 | + | |
| 292 | 296 | // Populate class select options with unique classes |
| 293 | 297 | populateClassSelection(data); |
| 294 | 298 | |
| 295 | 299 | // Retrieve the stored number of items per page or default to 510 |
| 296 | 300 | const perPage = Number(localStorage.getItem(storageKey)) || 10; |
| 297 | 301 | |
| 298 | 302 | // Initialize pagination with the full set of models |
| 299 | 303 | const selectedModelPagecurrentModelIndex = (data.findIndex(x => x.id === textgen_settings.featherless_model) / perPage) + 1; |
| 300 | 304 | featherlessCurrentPage = selectedModelPagecurrentModelIndex >= 0 ? selectedModelPage(currentModelIndex / perPage) + 1 : 1; |
| 301 | 305 | setupPagination(originalModels, perPage); |
| 302 | 306 | |
| 303 | 307 | // Function to set up pagination (also used for filtered results) |