Merge branch 'staging' into feature/comfyGgufModels
| @@ -3019,9 +3019,9 @@ | |||
| 3019 | } | 3019 | } |
| 3020 | }, | 3020 | }, |
| 3021 | "node_modules/cross-spawn": { | 3021 | "node_modules/cross-spawn": { |
| 3022 | "version": "7.0.3", | 3022 | "version": "7.0.5", |
| 3023 | "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", | 3023 | "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.5.tgz", |
| 3024 | "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", | 3024 | "integrity": "sha512-ZVJrKKYunU38/76t0RMOulHOnUcbU9GbpWKAOZ0mhjr7CX6FVrH+4FrAapSOekrgFQ3f/8gwMEuIft0aKq6Hug==", |
| 3025 | "license": "MIT", | 3025 | "license": "MIT", |
| 3026 | "dependencies": { | 3026 | "dependencies": { |
| 3027 | "path-key": "^3.1.0", | 3027 | "path-key": "^3.1.0", |
| @@ -0,0 +1,19 @@ | |||
| 1 | .scrollable-buttons-container { | ||
| 2 | max-height: 50vh; /* Use viewport height instead of fixed pixels */ | ||
| 3 | overflow-y: auto; | ||
| 4 | -webkit-overflow-scrolling: touch; /* Momentum scrolling on iOS */ | ||
| 5 | margin-top: 1rem; /* m-t-1 is equivalent to margin-top: 1rem; */ | ||
| 6 | flex-shrink: 1; | ||
| 7 | min-height: 0; | ||
| 8 | scrollbar-width: thin; | ||
| 9 | scrollbar-color: rgba(255, 255, 255, 0.3) transparent; | ||
| 10 | } | ||
| 11 | |||
| 12 | .scrollable-buttons-container::-webkit-scrollbar { | ||
| 13 | width: 6px; | ||
| 14 | } | ||
| 15 | |||
| 16 | .scrollable-buttons-container::-webkit-scrollbar-thumb { | ||
| 17 | background-color: rgba(255, 255, 255, 0.3); | ||
| 18 | border-radius: 3px; | ||
| 19 | } | ||
| @@ -3026,6 +3026,7 @@ | |||
| 3026 | <option value="codestral-latest">codestral-latest</option> | 3026 | <option value="codestral-latest">codestral-latest</option> |
| 3027 | <option value="codestral-mamba-latest">codestral-mamba-latest</option> | 3027 | <option value="codestral-mamba-latest">codestral-mamba-latest</option> |
| 3028 | <option value="pixtral-12b-latest">pixtral-12b-latest</option> | 3028 | <option value="pixtral-12b-latest">pixtral-12b-latest</option> |
| 3029 | <option value="pixtral-large-latest">pixtral-large-latest</option> | ||
| 3029 | </optgroup> | 3030 | </optgroup> |
| 3030 | <optgroup label="Sub-versions"> | 3031 | <optgroup label="Sub-versions"> |
| 3031 | <option value="open-mistral-nemo-2407">open-mistral-nemo-2407</option> | 3032 | <option value="open-mistral-nemo-2407">open-mistral-nemo-2407</option> |
| @@ -3040,10 +3041,12 @@ | |||
| 3040 | <option value="mistral-medium-2312">mistral-medium-2312</option> | 3041 | <option value="mistral-medium-2312">mistral-medium-2312</option> |
| 3041 | <option value="mistral-large-2402">mistral-large-2402</option> | 3042 | <option value="mistral-large-2402">mistral-large-2402</option> |
| 3042 | <option value="mistral-large-2407">mistral-large-2407</option> | 3043 | <option value="mistral-large-2407">mistral-large-2407</option> |
| 3044 | <option value="mistral-large-2411">mistral-large-2411</option> | ||
| 3043 | <option value="codestral-2405">codestral-2405</option> | 3045 | <option value="codestral-2405">codestral-2405</option> |
| 3044 | <option value="codestral-2405-blue">codestral-2405-blue</option> | 3046 | <option value="codestral-2405-blue">codestral-2405-blue</option> |
| 3045 | <option value="codestral-mamba-2407">codestral-mamba-2407</option> | 3047 | <option value="codestral-mamba-2407">codestral-mamba-2407</option> |
| 3046 | <option value="pixtral-12b-2409">pixtral-12b-2409</option> | 3048 | <option value="pixtral-12b-2409">pixtral-12b-2409</option> |
| 3049 | <option value="pixtral-large-2411">pixtral-large-2411</option> | ||
| 3047 | </optgroup> | 3050 | </optgroup> |
| 3048 | <optgroup id="mistralai_other_models" label="Other"></optgroup> | 3051 | <optgroup id="mistralai_other_models" label="Other"></optgroup> |
| 3049 | </select> | 3052 | </select> |
| @@ -6631,9 +6634,9 @@ | |||
| 6631 | </div> | 6634 | </div> |
| 6632 | </div> | 6635 | </div> |
| 6633 | <div class="logprobs_panel_content inline-drawer-content flex-container flexFlowColumn"> | 6636 | <div class="logprobs_panel_content inline-drawer-content flex-container flexFlowColumn"> |
| 6634 | <small class="flex-container alignItemsCenter justifySpaceBetween"> | 6637 | <small class="flex-container alignItemsCenter justifySpaceBetween flexNoWrap"> |
| 6635 | <b data-i18n="Select a token to see alternatives considered by the AI.">Select a token to see alternatives considered by the AI.</b> | 6638 | <b data-i18n="Select a token to see alternatives considered by the AI.">Select a token to see alternatives considered by the AI.</b> |
| 6636 | <button id="logprobsReroll" class="menu_button" title="Reroll with the entire prefix" data-i18n="[title]Reroll with the entire prefix"> | 6639 | <button id="logprobsReroll" class="menu_button margin0" title="Reroll with the entire prefix" data-i18n="[title]Reroll with the entire prefix"> |
| 6637 | <span class="fa-solid fa-redo logprobs_reroll"></span> | 6640 | <span class="fa-solid fa-redo logprobs_reroll"></span> |
| 6638 | </button> | 6641 | </button> |
| 6639 | </small> | 6642 | </small> |
| @@ -703,16 +703,13 @@ const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1; | |||
| 703 | */ | 703 | */ |
| 704 | function autoFitSendTextArea() { | 704 | function autoFitSendTextArea() { |
| 705 | const originalScrollBottom = chatBlock.scrollHeight - (chatBlock.scrollTop + chatBlock.offsetHeight); | 705 | const originalScrollBottom = chatBlock.scrollHeight - (chatBlock.scrollTop + chatBlock.offsetHeight); |
| 706 | if (Math.ceil(sendTextArea.scrollHeight + 3) >= Math.floor(sendTextArea.offsetHeight)) { | 706 | |
| 707 | const sendTextAreaMinHeight = '0px'; | 707 | sendTextArea.style.height = '1px'; // Reset height to 1px to force recalculation of scrollHeight |
| 708 | sendTextArea.style.height = sendTextAreaMinHeight; | 708 | const newHeight = sendTextArea.scrollHeight; |
| 709 | } | ||
| 710 | const newHeight = sendTextArea.scrollHeight + 3; | ||
| 711 | sendTextArea.style.height = `${newHeight}px`; | 709 | sendTextArea.style.height = `${newHeight}px`; |
| 712 | 710 | ||
| 713 | if (!isFirefox) { | 711 | if (!isFirefox) { |
| 714 | const newScrollTop = Math.round(chatBlock.scrollHeight - (chatBlock.offsetHeight + originalScrollBottom)); | 712 | chatBlock.scrollTop = chatBlock.scrollHeight - (chatBlock.offsetHeight + originalScrollBottom); |
| 715 | chatBlock.scrollTop = newScrollTop; | ||
| 716 | } | 713 | } |
| 717 | } | 714 | } |
| 718 | export const autoFitSendTextAreaDebounced = debounce(autoFitSendTextArea, debounce_timeout.short); | 715 | export const autoFitSendTextAreaDebounced = debounce(autoFitSendTextArea, debounce_timeout.short); |
| @@ -37,6 +37,8 @@ | |||
| 37 | <select id="caption_multimodal_model" class="flex1 text_pole"> | 37 | <select id="caption_multimodal_model" class="flex1 text_pole"> |
| 38 | <option data-type="mistral" value="pixtral-12b-latest">pixtral-12b-latest</option> | 38 | <option data-type="mistral" value="pixtral-12b-latest">pixtral-12b-latest</option> |
| 39 | <option data-type="mistral" value="pixtral-12b-2409">pixtral-12b-2409</option> | 39 | <option data-type="mistral" value="pixtral-12b-2409">pixtral-12b-2409</option> |
| 40 | <option data-type="mistral" value="pixtral-large-latest">pixtral-large-latest</option> | ||
| 41 | <option data-type="mistral" value="pixtral-large-2411">pixtral-large-2411</option> | ||
| 40 | <option data-type="zerooneai" value="yi-vision">yi-vision</option> | 42 | <option data-type="zerooneai" value="yi-vision">yi-vision</option> |
| 41 | <option data-type="openai" value="gpt-4-vision-preview">gpt-4-vision-preview</option> | 43 | <option data-type="openai" value="gpt-4-vision-preview">gpt-4-vision-preview</option> |
| 42 | <option data-type="openai" value="gpt-4-turbo">gpt-4-turbo</option> | 44 | <option data-type="openai" value="gpt-4-turbo">gpt-4-turbo</option> |
| @@ -23,7 +23,7 @@ import { | |||
| 23 | import { collapseNewlines, registerDebugFunction } from '../../power-user.js'; | 23 | import { collapseNewlines, registerDebugFunction } from '../../power-user.js'; |
| 24 | import { SECRET_KEYS, secret_state, writeSecret } from '../../secrets.js'; | 24 | import { SECRET_KEYS, secret_state, writeSecret } from '../../secrets.js'; |
| 25 | import { getDataBankAttachments, getDataBankAttachmentsForSource, getFileAttachment } from '../../chats.js'; | 25 | import { getDataBankAttachments, getDataBankAttachmentsForSource, getFileAttachment } from '../../chats.js'; |
| 26 | import { debounce, getStringHash as calculateHash, waitUntilCondition, onlyUnique, splitRecursive, trimToStartSentence, trimToEndSentence } from '../../utils.js'; | 26 | import { debounce, getStringHash as calculateHash, waitUntilCondition, onlyUnique, splitRecursive, trimToStartSentence, trimToEndSentence, escapeHtml } from '../../utils.js'; |
| 27 | import { debounce_timeout } from '../../constants.js'; | 27 | import { debounce_timeout } from '../../constants.js'; |
| 28 | import { getSortedEntries } from '../../world-info.js'; | 28 | import { getSortedEntries } from '../../world-info.js'; |
| 29 | import { textgen_types, textgenerationwebui_settings } from '../../textgen-settings.js'; | 29 | import { textgen_types, textgenerationwebui_settings } from '../../textgen-settings.js'; |
| @@ -44,6 +44,9 @@ const MODULE_NAME = 'vectors'; | |||
| 44 | export const EXTENSION_PROMPT_TAG = '3_vectors'; | 44 | export const EXTENSION_PROMPT_TAG = '3_vectors'; |
| 45 | export const EXTENSION_PROMPT_TAG_DB = '4_vectors_data_bank'; | 45 | export const EXTENSION_PROMPT_TAG_DB = '4_vectors_data_bank'; |
| 46 | 46 | ||
| 47 | // Force solo chunks for sources that don't support batching. | ||
| 48 | const getBatchSize = () => ['transformers', 'palm', 'ollama'].includes(settings.source) ? 1 : 5; | ||
| 49 | |||
| 47 | const settings = { | 50 | const settings = { |
| 48 | // For both | 51 | // For both |
| 49 | source: 'transformers', | 52 | source: 'transformers', |
| @@ -125,7 +128,7 @@ async function onVectorizeAllClick() { | |||
| 125 | // upon request of a full vectorise | 128 | // upon request of a full vectorise |
| 126 | cachedSummaries.clear(); | 129 | cachedSummaries.clear(); |
| 127 | 130 | ||
| 128 | const batchSize = 5; | 131 | const batchSize = getBatchSize(); |
| 129 | const elapsedLog = []; | 132 | const elapsedLog = []; |
| 130 | let finished = false; | 133 | let finished = false; |
| 131 | $('#vectorize_progress').show(); | 134 | $('#vectorize_progress').show(); |
| @@ -560,7 +563,9 @@ async function vectorizeFile(fileText, fileName, collectionId, chunkSize, overla | |||
| 560 | fileText = translatedText; | 563 | fileText = translatedText; |
| 561 | } | 564 | } |
| 562 | 565 | ||
| 563 | const toast = toastr.info('Vectorization may take some time, please wait...', `Ingesting file ${fileName}`); | 566 | const batchSize = getBatchSize(); |
| 567 | const toastBody = $('<span>').text('This may take a while. Please wait...'); | ||
| 568 | const toast = toastr.info(toastBody, `Ingesting file ${escapeHtml(fileName)}`, { closeButton: false, escapeHtml: false, timeOut: 0, extendedTimeOut: 0 }); | ||
| 564 | const overlapSize = Math.round(chunkSize * overlapPercent / 100); | 569 | const overlapSize = Math.round(chunkSize * overlapPercent / 100); |
| 565 | const delimiters = getChunkDelimiters(); | 570 | const delimiters = getChunkDelimiters(); |
| 566 | // Overlap should not be included in chunk size. It will be later compensated by overlapChunks | 571 | // Overlap should not be included in chunk size. It will be later compensated by overlapChunks |
| @@ -569,7 +574,12 @@ async function vectorizeFile(fileText, fileName, collectionId, chunkSize, overla | |||
| 569 | console.debug(`Vectors: Split file ${fileName} into ${chunks.length} chunks with ${overlapPercent}% overlap`, chunks); | 574 | console.debug(`Vectors: Split file ${fileName} into ${chunks.length} chunks with ${overlapPercent}% overlap`, chunks); |
| 570 | 575 | ||
| 571 | const items = chunks.map((chunk, index) => ({ hash: getStringHash(chunk), text: chunk, index: index })); | 576 | const items = chunks.map((chunk, index) => ({ hash: getStringHash(chunk), text: chunk, index: index })); |
| 572 | await insertVectorItems(collectionId, items); | 577 | |
| 578 | for (let i = 0; i < items.length; i += batchSize) { | ||
| 579 | toastBody.text(`${i}/${items.length} (${Math.round((i / items.length) * 100)}%) chunks processed`); | ||
| 580 | const chunkedBatch = items.slice(i, i + batchSize); | ||
| 581 | await insertVectorItems(collectionId, chunkedBatch); | ||
| 582 | } | ||
| 573 | 583 | ||
| 574 | toastr.clear(toast); | 584 | toastr.clear(toast); |
| 575 | console.log(`Vectors: Inserted ${chunks.length} vector items for file ${fileName} into ${collectionId}`); | 585 | console.log(`Vectors: Inserted ${chunks.length} vector items for file ${fileName} into ${collectionId}`); |
| @@ -1050,7 +1060,7 @@ async function onViewStatsClick() { | |||
| 1050 | toastr.info(`Total hashes: <b>${totalHashes}</b><br> | 1060 | toastr.info(`Total hashes: <b>${totalHashes}</b><br> |
| 1051 | Unique hashes: <b>${uniqueHashes}</b><br><br> | 1061 | Unique hashes: <b>${uniqueHashes}</b><br><br> |
| 1052 | I'll mark collected messages with a green circle.`, | 1062 | I'll mark collected messages with a green circle.`, |
| 1053 | `Stats for chat ${chatId}`, | 1063 | `Stats for chat ${escapeHtml(chatId)}`, |
| 1054 | { timeOut: 10000, escapeHtml: false }, | 1064 | { timeOut: 10000, escapeHtml: false }, |
| 1055 | ); | 1065 | ); |
| 1056 | 1066 | ||
| @@ -4165,7 +4165,7 @@ async function onModelChange() { | |||
| 4165 | $('#openai_max_context').attr('max', unlocked_max); | 4165 | $('#openai_max_context').attr('max', unlocked_max); |
| 4166 | } else if (oai_settings.mistralai_model.includes('codestral-mamba')) { | 4166 | } else if (oai_settings.mistralai_model.includes('codestral-mamba')) { |
| 4167 | $('#openai_max_context').attr('max', max_256k); | 4167 | $('#openai_max_context').attr('max', max_256k); |
| 4168 | } else if (['mistral-large-2407', 'mistral-large-latest'].includes(oai_settings.mistralai_model)) { | 4168 | } else if (['mistral-large-2407', 'mistral-large-2411', 'mistral-large-latest'].includes(oai_settings.mistralai_model)) { |
| 4169 | $('#openai_max_context').attr('max', max_128k); | 4169 | $('#openai_max_context').attr('max', max_128k); |
| 4170 | } else if (oai_settings.mistralai_model.includes('mistral-nemo')) { | 4170 | } else if (oai_settings.mistralai_model.includes('mistral-nemo')) { |
| 4171 | $('#openai_max_context').attr('max', max_128k); | 4171 | $('#openai_max_context').attr('max', max_128k); |
| @@ -4764,6 +4764,8 @@ export function isImageInliningSupported() { | |||
| 4764 | 'pixtral-12b-latest', | 4764 | 'pixtral-12b-latest', |
| 4765 | 'pixtral-12b', | 4765 | 'pixtral-12b', |
| 4766 | 'pixtral-12b-2409', | 4766 | 'pixtral-12b-2409', |
| 4767 | 'pixtral-large-latest', | ||
| 4768 | 'pixtral-large-2411', | ||
| 4767 | ]; | 4769 | ]; |
| 4768 | 4770 | ||
| 4769 | switch (oai_settings.chat_completion_source) { | 4771 | switch (oai_settings.chat_completion_source) { |
| @@ -2083,7 +2083,10 @@ async function buttonsCallback(args, text) { | |||
| 2083 | let popup; | 2083 | let popup; |
| 2084 | 2084 | ||
| 2085 | const buttonContainer = document.createElement('div'); | 2085 | const buttonContainer = document.createElement('div'); |
| 2086 | buttonContainer.classList.add('flex-container', 'flexFlowColumn', 'wide100p', 'm-t-1'); | 2086 | buttonContainer.classList.add('flex-container', 'flexFlowColumn', 'wide100p'); |
| 2087 | |||
| 2088 | const scrollableContainer = document.createElement('div'); | ||
| 2089 | scrollableContainer.classList.add('scrollable-buttons-container'); | ||
| 2087 | 2090 | ||
| 2088 | for (const [result, button] of resultToButtonMap) { | 2091 | for (const [result, button] of resultToButtonMap) { |
| 2089 | const buttonElement = document.createElement('div'); | 2092 | const buttonElement = document.createElement('div'); |
| @@ -2096,9 +2099,16 @@ async function buttonsCallback(args, text) { | |||
| 2096 | buttonContainer.appendChild(buttonElement); | 2099 | buttonContainer.appendChild(buttonElement); |
| 2097 | } | 2100 | } |
| 2098 | 2101 | ||
| 2102 | scrollableContainer.appendChild(buttonContainer); | ||
| 2103 | |||
| 2099 | const popupContainer = document.createElement('div'); | 2104 | const popupContainer = document.createElement('div'); |
| 2100 | popupContainer.innerHTML = safeValue; | 2105 | popupContainer.innerHTML = safeValue; |
| 2101 | popupContainer.appendChild(buttonContainer); | 2106 | popupContainer.appendChild(scrollableContainer); |
| 2107 | |||
| 2108 | // Ensure the popup uses flex layout | ||
| 2109 | popupContainer.style.display = 'flex'; | ||
| 2110 | popupContainer.style.flexDirection = 'column'; | ||
| 2111 | popupContainer.style.maxHeight = '80vh'; // Limit the overall height of the popup | ||
| 2102 | 2112 | ||
| 2103 | popup = new Popup(popupContainer, POPUP_TYPE.TEXT, '', { okButton: 'Cancel', allowVerticalScrolling: true }); | 2113 | popup = new Popup(popupContainer, POPUP_TYPE.TEXT, '', { okButton: 'Cancel', allowVerticalScrolling: true }); |
| 2104 | popup.show() | 2114 | popup.show() |
| @@ -23,29 +23,42 @@ export let openRouterModels = []; | |||
| 23 | const OPENROUTER_PROVIDERS = [ | 23 | const OPENROUTER_PROVIDERS = [ |
| 24 | 'OpenAI', | 24 | 'OpenAI', |
| 25 | 'Anthropic', | 25 | 'Anthropic', |
| 26 | 'HuggingFace', | ||
| 27 | 'Google', | 26 | 'Google', |
| 28 | 'Mancer', | 27 | 'Google AI Studio', |
| 29 | 'Mancer 2', | 28 | 'Groq', |
| 29 | 'SambaNova', | ||
| 30 | 'Cohere', | ||
| 31 | 'Mistral', | ||
| 30 | 'Together', | 32 | 'Together', |
| 33 | 'Together 2', | ||
| 34 | 'Fireworks', | ||
| 31 | 'DeepInfra', | 35 | 'DeepInfra', |
| 36 | 'Lepton', | ||
| 37 | 'Novita', | ||
| 38 | 'Avian', | ||
| 39 | 'Lambda', | ||
| 32 | 'Azure', | 40 | 'Azure', |
| 33 | 'Modal', | 41 | 'Modal', |
| 34 | 'AnyScale', | 42 | 'AnyScale', |
| 35 | 'Replicate', | 43 | 'Replicate', |
| 36 | 'Perplexity', | 44 | 'Perplexity', |
| 37 | 'Recursal', | 45 | 'Recursal', |
| 38 | 'Fireworks', | ||
| 39 | 'Mistral', | ||
| 40 | 'Groq', | ||
| 41 | 'Cohere', | ||
| 42 | 'Lepton', | ||
| 43 | 'OctoAI', | 46 | 'OctoAI', |
| 44 | 'Novita', | ||
| 45 | 'Lynn', | ||
| 46 | 'Lynn 2', | ||
| 47 | 'DeepSeek', | 47 | 'DeepSeek', |
| 48 | 'Infermatic', | 48 | 'Infermatic', |
| 49 | 'AI21', | ||
| 50 | 'Featherless', | ||
| 51 | 'Inflection', | ||
| 52 | 'xAI', | ||
| 53 | '01.AI', | ||
| 54 | 'HuggingFace', | ||
| 55 | 'Mancer', | ||
| 56 | 'Mancer 2', | ||
| 57 | 'Hyperbolic', | ||
| 58 | 'Hyperbolic 2', | ||
| 59 | 'Lynn 2', | ||
| 60 | 'Lynn', | ||
| 61 | 'Reflection', | ||
| 49 | ]; | 62 | ]; |
| 50 | 63 | ||
| 51 | export async function loadOllamaModels(data) { | 64 | export async function loadOllamaModels(data) { |
| @@ -9,6 +9,7 @@ | |||
| 9 | @import url(css/logprobs.css); | 9 | @import url(css/logprobs.css); |
| 10 | @import url(css/accounts.css); | 10 | @import url(css/accounts.css); |
| 11 | @import url(css/tags.css); | 11 | @import url(css/tags.css); |
| 12 | @import url(css/scrollable-button.css); | ||
| 12 | 13 | ||
| 13 | :root { | 14 | :root { |
| 14 | --doc-height: 100%; | 15 | --doc-height: 100%; |