Merge branch 'staging' into fix-pipe-types
| @@ -5,7 +5,7 @@ | ||
| 5 | 5 | <title>SillyTavern</title> |
| 6 | 6 | <base href="/"> |
| 7 | 7 | <meta charset="utf-8"> |
| 8 | 8 | <meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1, maximum-scale=1.0, user-scalable=no, interactive-widget=resizes-content"> |
| 9 | 9 | <meta name="apple-mobile-web-app-capable" content="yes"> |
| 10 | 10 | <meta name="darkreader-lock"> |
| 11 | 11 | <meta name="robots" content="noindex, nofollow" /> |
| @@ -1278,6 +1278,28 @@ | ||
| 1278 | 1278 | </div> |
| 1279 | 1279 | </div> |
| 1280 | 1280 | </div> |
| 1281 | + | |
| 1282 | + <div data-newbie-hidden data-tg-type="koboldcpp" id="xtc_block" class="wide100p"> | |
| 1283 | + <h4 class="wide100p textAlignCenter"> | |
| 1284 | + <label data-i18n="Exclude Top Choices (XTC)">Exclude Top Choices (XTC)</label> | |
| 1285 | + <a href="https://github.com/oobabooga/text-generation-webui/pull/6335" target="_blank"> | |
| 1286 | + <div class=" fa-solid fa-circle-info opacity50p"></div> | |
| 1287 | + </a> | |
| 1288 | + </h4> | |
| 1289 | + <div class="flex-container flexFlowRow gap10px flexShrink"> | |
| 1290 | + <div class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0"> | |
| 1291 | + <small data-i18n="Threshold">Threshold</small> | |
| 1292 | + <input class="neo-range-slider" type="range" id="xtc_threshold_textgenerationwebui" name="volume" min="0" max="0.5" step="0.01" /> | |
| 1293 | + <input class="neo-range-input" type="number" min="0" max="0.5" step="0.01" data-for="xtc_threshold_textgenerationwebui" id="xtc_threshold_counter_textgenerationwebui"> | |
| 1294 | + </div> | |
| 1295 | + <div class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0"> | |
| 1296 | + <small data-i18n="Probability">Probability</small> | |
| 1297 | + <input class="neo-range-slider" type="range" id="xtc_probability_textgenerationwebui" name="volume" min="0" max="1" step="0.01" /> | |
| 1298 | + <input class="neo-range-input" type="number" min="0" max="1" step="0.01" data-for="xtc_probability_textgenerationwebui" id="xtc_probability_counter_textgenerationwebui"> | |
| 1299 | + </div> | |
| 1300 | + </div> | |
| 1301 | + </div> | |
| 1302 | + | |
| 1281 | 1303 | <!-- Enable for llama.cpp when the PR is merged: https://github.com/ggerganov/llama.cpp/pull/6839 --> |
| 1282 | 1304 | <div data-newbie-hidden data-tg-type="ooba, koboldcpp" id="dryBlock" class="wide100p"> |
| 1283 | 1305 | <h4 class="wide100p textAlignCenter" title="DRY penalizes tokens that would extend the end of the input into a sequence that has previously occurred in the input. Set multiplier to 0 to disable." data-i18n="[title]DRY_Repetition_Penalty_desc"> |
| @@ -1471,11 +1493,11 @@ | ||
| 1471 | 1493 | <div id="banned_tokens_block_ooba" data-newbie-hidden class="wide100p"> |
| 1472 | 1494 | <hr data-newbie-hidden class="width100p"> |
| 1473 | 1495 | <h4 class="range-block-title justifyCenter"> |
| 1474 | 1496 | <span data-i18n="Banned Tokens">Banned Tokens/Strings</span> |
| 1475 | 1497 | <div class="margin5 fa-solid fa-circle-info opacity50p " data-i18n="[title]LLaMA / Mistral / Yi models only" title="LLaMA / Mistral / Yi models only. Make sure to select an appropriate tokenizerEnter first. Sequencessequences you don't want to appear in the output. OneUnquoted pertext line.will Textbe ortokenized in the back end and banned as tokens. [token ids] will be banned as-is. Most tokens have a leading space. Use token counter (with the correct tokenizer selected first!) if you are unsure. Enclose text in double quotes to ban the entire string as a set. Quoted Strings and [Token ids] must be on their own line."></div> |
| 1476 | 1498 | </h4> |
| 1477 | 1499 | <div class="wide100p"> |
| 1478 | 1500 | <textarea id="banned_tokens_textgenerationwebui" class="text_pole textarea_compact" name="banned_tokens_textgenerationwebui" rows="3" data-i18n="[placeholder]Example: some text [42, 69, 1337]" placeholder="Example: 'some text as tokens [42420, 69, 1337] "Some verbatim string"'></textarea> |
| 1479 | 1501 | </div> |
| 1480 | 1502 | </div> |
| 1481 | 1503 | <div class="range-block wide100p"> |
| @@ -1823,7 +1845,7 @@ | ||
| 1823 | 1845 | <div class="fa-solid fa-clock-rotate-left"></div> |
| 1824 | 1846 | </div> |
| 1825 | 1847 | </div> |
| 1826 | 1848 | <textarea id="claude_human_sysprompt_textarea" class="text_pole textarea_compact" rows="4" maxlength="10000" data-i18n="[placeholder]Human message" placeholder="Human message, instruction, etc. Adds nothing when empty, i.e. requires a new prompt with the role 'user'."></textarea> |
| 1827 | 1849 | </div> |
| 1828 | 1850 | </div> |
| 1829 | 1851 | </div> |
| @@ -2931,6 +2953,8 @@ | ||
| 2931 | 2953 | <option value="command">command</option> |
| 2932 | 2954 | <option value="command-r">command-r</option> |
| 2933 | 2955 | <option value="command-r-plus">command-r-plus</option> |
| 2956 | + <option value="command-r-08-2024">command-r-08-2024</option> | |
| 2957 | + <option value="command-r-plus-08-2024">command-r-plus-08-2024</option> | |
| 2934 | 2958 | </optgroup> |
| 2935 | 2959 | <optgroup label="Nightly"> |
| 2936 | 2960 | <option value="command-light-nightly">command-light-nightly</option> |
| @@ -488,14 +488,6 @@ let default_user_name = 'User'; | ||
| 488 | 488 | export let name1 = default_user_name; |
| 489 | 489 | export let name2 = 'SillyTavern System'; |
| 490 | 490 | export let chat = []; |
| 491 | -let safetychat = [ | |
| 492 | - { | |
| 493 | - name: systemUserName, | |
| 494 | - is_user: false, | |
| 495 | - create_date: 0, | |
| 496 | - mes: 'You deleted a character/chat and arrived back here for safety reasons! Pick another character!', | |
| 497 | - }, | |
| 498 | -]; | |
| 499 | 491 | let chatSaveTimeout; |
| 500 | 492 | let importFlashTimeout; |
| 501 | 493 | export let isChatSaving = false; |
| @@ -594,6 +586,17 @@ export const extension_prompt_roles = { | ||
| 594 | 586 | |
| 595 | 587 | export const MAX_INJECTION_DEPTH = 1000; |
| 596 | 588 | |
| 589 | +const SAFETY_CHAT = [ | |
| 590 | + { | |
| 591 | + name: systemUserName, | |
| 592 | + force_avatar: system_avatar, | |
| 593 | + is_system: true, | |
| 594 | + is_user: false, | |
| 595 | + create_date: 0, | |
| 596 | + mes: 'You deleted a character/chat and arrived back here for safety reasons! Pick another character!', | |
| 597 | + }, | |
| 598 | +]; | |
| 599 | + | |
| 597 | 600 | export let system_messages = {}; |
| 598 | 601 | |
| 599 | 602 | async function getSystemMessages() { |
| @@ -3760,7 +3763,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | ||
| 3760 | 3763 | } |
| 3761 | 3764 | |
| 3762 | 3765 | let examplesString = ''; |
| 3763 | 3766 | let chatString = addChatsPreamble(addChatsSeparator('')); |
| 3764 | 3767 | let cyclePrompt = ''; |
| 3765 | 3768 | |
| 3766 | 3769 | async function getMessagesTokenCount() { |
| @@ -3769,10 +3772,10 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | ||
| 3769 | 3772 | storyString, |
| 3770 | 3773 | afterScenarioAnchor, |
| 3771 | 3774 | examplesString, |
| 3775 | + userAlignmentMessage, | |
| 3772 | 3776 | chatString, |
| 3773 | - quiet_prompt, | |
| 3777 | + modifyLastPromptLine(''), | |
| 3774 | 3778 | cyclePrompt, |
| 3775 | - userAlignmentMessage, | |
| 3776 | 3779 | ].join('').replace(/\r/gm, ''); |
| 3777 | 3780 | return getTokenCountAsync(encodeString, power_user.token_padding); |
| 3778 | 3781 | } |
| @@ -3803,8 +3806,8 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | ||
| 3803 | 3806 | } |
| 3804 | 3807 | |
| 3805 | 3808 | tokenCount += await getTokenCountAsync(item.replace(/\r/gm, '')); |
| 3806 | - chatString = item + chatString; | |
| 3807 | 3809 | if (tokenCount < this_max_context) { |
| 3810 | + chatString = chatString + item; | |
| 3808 | 3811 | arrMes[index] = item; |
| 3809 | 3812 | lastAddedIndex = Math.max(lastAddedIndex, index); |
| 3810 | 3813 | } else { |
| @@ -3830,8 +3833,8 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | ||
| 3830 | 3833 | } |
| 3831 | 3834 | |
| 3832 | 3835 | tokenCount += await getTokenCountAsync(item.replace(/\r/gm, '')); |
| 3833 | - chatString = item + chatString; | |
| 3834 | 3836 | if (tokenCount < this_max_context) { |
| 3837 | + chatString = chatString + item; | |
| 3835 | 3838 | arrMes[i] = item; |
| 3836 | 3839 | lastAddedIndex = Math.max(lastAddedIndex, i); |
| 3837 | 3840 | } else { |
| @@ -4028,15 +4031,16 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | ||
| 4028 | 4031 | async function checkPromptSize() { |
| 4029 | 4032 | console.debug('---checking Prompt size'); |
| 4030 | 4033 | setPromptString(); |
| 4034 | + const jointMessages = mesSend.map((e) => `${e.extensionPrompts.join('')}${e.message}`).join(''); | |
| 4031 | 4035 | const prompt = [ |
| 4032 | 4036 | beforeScenarioAnchor, |
| 4033 | 4037 | storyString, |
| 4034 | 4038 | afterScenarioAnchor, |
| 4035 | 4039 | mesExmString, |
| 4036 | - mesSend.map((e) => `${e.extensionPrompts.join('')}${e.message}`).join(''), | |
| 4040 | + addChatsPreamble(addChatsSeparator(jointMessages)), | |
| 4037 | 4041 | '\n', |
| 4042 | + modifyLastPromptLine(''), | |
| 4038 | 4043 | generatedPromptCache, |
| 4039 | - quiet_prompt, | |
| 4040 | 4044 | ].join('').replace(/\r/gm, ''); |
| 4041 | 4045 | let thisPromptContextSize = await getTokenCountAsync(prompt, power_user.token_padding); |
| 4042 | 4046 | |
| @@ -5679,7 +5683,7 @@ export function resetChatState() { | ||
| 5679 | 5683 | // replaces deleted charcter name with system user since it will be displayed next. |
| 5680 | 5684 | name2 = systemUserName; |
| 5681 | 5685 | // sets up system user to tell user about having deleted a character |
| 5682 | 5686 | chat.splice(0, =chat.length, [...safetychat]SAFETY_CHAT); |
| 5683 | 5687 | // resets chat metadata |
| 5684 | 5688 | chat_metadata = {}; |
| 5685 | 5689 | // resets the characters array, forcing getcharacters to reset |
| @@ -8840,16 +8844,21 @@ export async function handleDeleteCharacter(this_chid, delete_chats) { | ||
| 8840 | 8844 | /** |
| 8841 | 8845 | * Deletes a character completely, including associated chats if specified |
| 8842 | 8846 | * |
| 8843 | 8847 | * @param {string|string[]} characterKey - The key (avatar) of the character to be deleted |
| 8844 | 8848 | * @param {Object} [options] - Optional parameters for the deletion |
| 8845 | 8849 | * @param {boolean} [options.deleteChats=true] - Whether to delete associated chats or not |
| 8846 | 8850 | * @return {Promise<void>} - A promise that resolves when the character is successfully deleted |
| 8847 | 8851 | */ |
| 8848 | 8852 | export async function deleteCharacter(characterKey, { deleteChats = true } = {}) { |
| 8849 | - const character = characters.find(x => x.avatar == characterKey); | |
| 8853 | + if (!Array.isArray(characterKey)) { | |
| 8854 | + characterKey = [characterKey]; | |
| 8855 | + } | |
| 8856 | + | |
| 8857 | + for (const key of characterKey) { | |
| 8858 | + const character = characters.find(x => x.avatar == key); | |
| 8850 | 8859 | if (!character) { |
| 8851 | 8860 | toastr.warning(`Character ${characterKeykey} not found. Cannot beSkipping deleteddeletion.`); |
| 8852 | - return; | |
| 8861 | + continue; | |
| 8853 | 8862 | } |
| 8854 | 8863 | |
| 8855 | 8864 | const chid = characters.indexOf(character); |
| @@ -8865,10 +8874,12 @@ export async function deleteCharacter(characterKey, { deleteChats = true } = {}) | ||
| 8865 | 8874 | }); |
| 8866 | 8875 | |
| 8867 | 8876 | if (!response.ok) { |
| 8868 | 8877 | throw new Error toastr.error(`Failed to delete character: ${response.status} ${response.statusText}`, 'Failed to delete character'); |
| 8878 | + continue; | |
| 8869 | 8879 | } |
| 8870 | 8880 | |
| 8871 | - await removeCharacterFromUI(character.name, character.avatar); | |
| 8881 | + delete tag_map[character.avatar]; | |
| 8882 | + select_rm_info('char_delete', character.name); | |
| 8872 | 8883 | |
| 8873 | 8884 | if (deleteChats) { |
| 8874 | 8885 | for (const chat of pastChats) { |
| @@ -8877,35 +8888,30 @@ export async function deleteCharacter(characterKey, { deleteChats = true } = {}) | ||
| 8877 | 8888 | } |
| 8878 | 8889 | } |
| 8879 | 8890 | |
| 8880 | 8891 | await eventSource.emit(event_types.CHARACTER_DELETED, { id: this_chidchid, character: characters[this_chid]character }); |
| 8892 | + } | |
| 8893 | + | |
| 8894 | + await removeCharacterFromUI(); | |
| 8881 | 8895 | } |
| 8882 | 8896 | |
| 8883 | 8897 | /** |
| 8884 | 8898 | * Function to delete a character from UI after character deletion API success. |
| 8885 | 8899 | * It manages necessary UI changes such as closing advanced editing popup, unsetting |
| 8886 | 8900 | * character ID, resetting characters array and chat metadata, deselecting character's tab |
| 8887 | 8901 | * panel, removing character name from navigation tabs, clearing chat, removingfetching character'supdated list of characters. |
| 8888 | - * avatar from tag_map, fetching updated list of characters and updating the 'deleted | |
| 8889 | - * character' message. | |
| 8890 | 8902 | * It also ensures to save the settings after all the operations. |
| 8891 | - * | |
| 8892 | - * @param {string} name - The name of the character to be deleted. | |
| 8893 | - * @param {string} avatar - The avatar URL of the character to be deleted. | |
| 8894 | - * @param {boolean} reloadCharacters - Whether the character list should be refreshed after deletion. | |
| 8895 | 8903 | */ |
| 8896 | 8904 | async function removeCharacterFromUI(name, avatar, reloadCharacters = true) { |
| 8897 | 8905 | await clearChat(); |
| 8898 | 8906 | $('#character_cross').click(); |
| 8899 | 8907 | this_chid = undefined; |
| 8900 | 8908 | characters.length = 0; |
| 8901 | 8909 | name2 = systemUserName; |
| 8902 | 8910 | chat.splice(0, =chat.length, [...safetychat]SAFETY_CHAT); |
| 8903 | 8911 | chat_metadata = {}; |
| 8904 | 8912 | $(document.getElementById('rm_button_selected_ch')).children('h2').text(''); |
| 8905 | 8913 | this_chid = undefined; |
| 8906 | - delete tag_map[avatar]; | |
| 8914 | + await getCharacters(); | |
| 8907 | - if (reloadCharacters) await getCharacters(); | |
| 8908 | - select_rm_info('char_delete', name); | |
| 8909 | 8915 | await printMessages(); |
| 8910 | 8916 | saveSettingsDebounced(); |
| 8911 | 8917 | } |
| @@ -108,14 +108,12 @@ class CharacterContextMenu { | ||
| 108 | 108 | * Delete one or more characters, |
| 109 | 109 | * opens a popup. |
| 110 | 110 | * |
| 111 | 111 | * @param {numberstring|string[]} characterIdcharacterKey |
| 112 | 112 | * @param {boolean} [deleteChats] |
| 113 | 113 | * @returns {Promise<void>} |
| 114 | 114 | */ |
| 115 | 115 | static delete = async (characterIdcharacterKey, deleteChats = false) => { |
| 116 | - const character = CharacterContextMenu.#getCharacter(characterId); | |
| 116 | + await deleteCharacter(characterKey, { deleteChats: deleteChats }); | |
| 117 | - | |
| 118 | - await deleteCharacter(character.avatar, { deleteChats: deleteChats }); | |
| 119 | 117 | }; |
| 120 | 118 | |
| 121 | 119 | static #getCharacter = (characterId) => characters[characterId] ?? null; |
| @@ -599,8 +597,7 @@ class BulkEditOverlay { | ||
| 599 | 597 | |
| 600 | 598 | this.container.removeEventListener('mouseup', cancelHold); |
| 601 | 599 | this.container.removeEventListener('touchend', cancelHold); |
| 602 | 600 | }, BulkEditOverlay.longPressDelay); |
| 603 | - BulkEditOverlay.longPressDelay); | |
| 604 | 601 | }; |
| 605 | 602 | |
| 606 | 603 | handleLongPressEnd = (event) => { |
| @@ -847,11 +844,14 @@ class BulkEditOverlay { | ||
| 847 | 844 | const deleteChats = document.getElementById('del_char_checkbox').checked ?? false; |
| 848 | 845 | |
| 849 | 846 | showLoader(); |
| 850 | 847 | const toast = toastr.info('We\'re deleting your characters, please wait...', 'Working on it'); |
| 851 | - return Promise.allSettled(characterIds.map(async characterId => CharacterContextMenu.delete(characterId, deleteChats))) | |
| 848 | + const avatarList = characterIds.map(id => characters[id]?.avatar).filter(a => a); | |
| 852 | - .then(() => getCharacters()) | |
| 849 | + return CharacterContextMenu.delete(avatarList, deleteChats) | |
| 853 | 850 | .then(() => this.browseState()) |
| 854 | 851 | .finally(() => hideLoader());{ |
| 852 | + toastr.clear(toast); | |
| 853 | + hideLoader(); | |
| 854 | + }); | |
| 855 | 855 | }); |
| 856 | 856 | |
| 857 | 857 | // At this moment the popup is already changed in the dom, but not yet closed/resolved. We build the avatar list here |
| @@ -78,6 +78,19 @@ export function getKayraMaxContextTokens() { | ||
| 78 | 78 | return null; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | +export function getKayraMaxResponseTokens() { | |
| 82 | + switch (novel_data?.tier) { | |
| 83 | + case 1: | |
| 84 | + return 100; | |
| 85 | + case 2: | |
| 86 | + return 100; | |
| 87 | + case 3: | |
| 88 | + return 150; | |
| 89 | + } | |
| 90 | + | |
| 91 | + return maximum_output_length; | |
| 92 | +} | |
| 93 | + | |
| 81 | 94 | export function getNovelTier() { |
| 82 | 95 | return nai_tiers[novel_data?.tier] ?? 'no_connection'; |
| 83 | 96 | } |
| @@ -438,12 +451,14 @@ export function getNovelGenerationData(finalPrompt, settings, maxLength, isImper | ||
| 438 | 451 | console.log(finalPrompt); |
| 439 | 452 | } |
| 440 | 453 | |
| 454 | + const adjustedMaxLength = nai_settings.model_novel.includes('kayra') ? getKayraMaxResponseTokens() : maximum_output_length; | |
| 455 | + | |
| 441 | 456 | return { |
| 442 | 457 | 'input': finalPrompt, |
| 443 | 458 | 'model': nai_settings.model_novel, |
| 444 | 459 | 'use_string': true, |
| 445 | 460 | 'temperature': Number(nai_settings.temperature), |
| 446 | 461 | 'max_length': maxLength < maximum_output_lengthadjustedMaxLength ? maxLength : maximum_output_lengthadjustedMaxLength, |
| 447 | 462 | 'min_length': Number(nai_settings.min_length), |
| 448 | 463 | 'tail_free_sampling': Number(nai_settings.tail_free_sampling), |
| 449 | 464 | 'repetition_penalty': Number(nai_settings.repetition_penalty), |
| @@ -133,7 +133,7 @@ const max_2mil = 2000 * 1000; | ||
| 133 | 133 | const scale_max = 8191; |
| 134 | 134 | const claude_max = 9000; // We have a proper tokenizer, so theoretically could be larger (up to 9k) |
| 135 | 135 | const claude_100k_max = 99000; |
| 136 | 136 | const unlocked_max = max_200kmax_2mil; |
| 137 | 137 | const oai_max_temp = 2.0; |
| 138 | 138 | const claude_max_temp = 1.0; |
| 139 | 139 | const openrouter_website_model = 'OR_Website'; |
| @@ -4191,7 +4191,7 @@ async function onModelChange() { | ||
| 4191 | 4191 | else if (['command-light-nightly', 'command-nightly'].includes(oai_settings.cohere_model)) { |
| 4192 | 4192 | $('#openai_max_context').attr('max', max_8k); |
| 4193 | 4193 | } |
| 4194 | 4194 | else if (['command-r', oai_settings.cohere_model.includes('command-r-plus'].includes(oai_settings.cohere_model)) { |
| 4195 | 4195 | $('#openai_max_context').attr('max', max_128k); |
| 4196 | 4196 | } |
| 4197 | 4197 | else if (['c4ai-aya-23'].includes(oai_settings.cohere_model)) { |
| @@ -188,6 +188,8 @@ const settings = { | ||
| 188 | 188 | custom_model: '', |
| 189 | 189 | bypass_status_check: false, |
| 190 | 190 | openrouter_allow_fallbacks: true, |
| 191 | + xtc_threshold: 0.1, | |
| 192 | + xtc_probability: 0, | |
| 191 | 193 | }; |
| 192 | 194 | |
| 193 | 195 | export let textgenerationwebui_banned_in_macros = []; |
| @@ -263,6 +265,8 @@ export const setting_names = [ | ||
| 263 | 265 | 'custom_model', |
| 264 | 266 | 'bypass_status_check', |
| 265 | 267 | 'openrouter_allow_fallbacks', |
| 268 | + 'xtc_threshold', | |
| 269 | + 'xtc_probability', | |
| 266 | 270 | ]; |
| 267 | 271 | |
| 268 | 272 | const DYNATEMP_BLOCK = document.getElementById('dynatemp_block_ooba'); |
| @@ -718,6 +722,8 @@ jQuery(function () { | ||
| 718 | 722 | 'dry_multiplier_textgenerationwebui': 0, |
| 719 | 723 | 'dry_base_textgenerationwebui': 1.75, |
| 720 | 724 | 'dry_penalty_last_n_textgenerationwebui': 0, |
| 725 | + 'xtc_threshold_textgenerationwebui': 0.1, | |
| 726 | + 'xtc_probability_textgenerationwebui': 0, | |
| 721 | 727 | }; |
| 722 | 728 | |
| 723 | 729 | for (const [id, value] of Object.entries(inputs)) { |
| @@ -1156,6 +1162,8 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, | ||
| 1156 | 1162 | 'api_server': getTextGenServer(), |
| 1157 | 1163 | 'legacy_api': settings.legacy_api && (settings.type === OOBA || settings.type === APHRODITE), |
| 1158 | 1164 | 'sampler_order': settings.type === textgen_types.KOBOLDCPP ? settings.sampler_order : undefined, |
| 1165 | + 'xtc_threshold': settings.xtc_threshold, | |
| 1166 | + 'xtc_probability': settings.xtc_probability, | |
| 1159 | 1167 | }; |
| 1160 | 1168 | const nonAphroditeParams = { |
| 1161 | 1169 | 'rep_pen': settings.rep_pen, |
| @@ -4777,8 +4777,10 @@ jQuery(() => { | ||
| 4777 | 4777 | world_info_min_activations = Number($(this).val()); |
| 4778 | 4778 | $('#world_info_min_activations_counter').val(world_info_min_activations); |
| 4779 | 4779 | |
| 4780 | 4780 | if (world_info_min_activations !== 0 && world_info_max_recursion_steps !== 0) { |
| 4781 | 4781 | $('#world_info_max_recursion_steps').val(0).trigger('input'); |
| 4782 | + flashHighlight($('#world_info_max_recursion_steps').parent()); // flash the other control to show it has changed | |
| 4783 | + console.info('[WI] Max recursion steps set to 0, as min activations is set to', world_info_min_activations); | |
| 4782 | 4784 | } else { |
| 4783 | 4785 | saveSettings(); |
| 4784 | 4786 | } |
| @@ -4840,8 +4842,10 @@ jQuery(() => { | ||
| 4840 | 4842 | $('#world_info_max_recursion_steps').on('input', function () { |
| 4841 | 4843 | world_info_max_recursion_steps = Number($(this).val()); |
| 4842 | 4844 | $('#world_info_max_recursion_steps_counter').val(world_info_max_recursion_steps); |
| 4843 | 4845 | if (world_info_max_recursion_steps !== 0 && world_info_min_activations !== 0) { |
| 4844 | 4846 | $('#world_info_min_activations').val(0).trigger('input'); |
| 4847 | + flashHighlight($('#world_info_min_activations').parent()); // flash the other control to show it has changed | |
| 4848 | + console.info('[WI] Min activations set to 0, as max recursion steps is set to', world_info_max_recursion_steps); | |
| 4845 | 4849 | } else { |
| 4846 | 4850 | saveSettings(); |
| 4847 | 4851 | } |
| @@ -2412,7 +2412,6 @@ input[type="file"] { | ||
| 2412 | 2412 | } |
| 2413 | 2413 | |
| 2414 | 2414 | #rm_print_characters_block .text_block { |
| 2415 | - height: 100%; | |
| 2416 | 2415 | width: 100%; |
| 2417 | 2416 | opacity: 0.5; |
| 2418 | 2417 | margin: 0 auto 1px auto; |
| @@ -572,6 +572,11 @@ async function sendCohereRequest(request, response) { | ||
| 572 | 572 | search_queries_only: false, |
| 573 | 573 | }; |
| 574 | 574 | |
| 575 | + const canDoSafetyMode = String(request.body.model).endsWith('08-2024'); | |
| 576 | + if (canDoSafetyMode) { | |
| 577 | + requestBody.safety_mode = 'NONE'; | |
| 578 | + } | |
| 579 | + | |
| 575 | 580 | console.log('Cohere request:', requestBody); |
| 576 | 581 | |
| 577 | 582 | const config = { |
| @@ -6,6 +6,7 @@ const { readAllChunks, extractFileFromZipBuffer, forwardFetchResponse } = requir | ||
| 6 | 6 | const { jsonParser } = require('../express-common'); |
| 7 | 7 | |
| 8 | 8 | const API_NOVELAI = 'https://api.novelai.net'; |
| 9 | +const TEXT_NOVELAI = 'https://text.novelai.net'; | |
| 9 | 10 | const IMAGE_NOVELAI = 'https://image.novelai.net'; |
| 10 | 11 | |
| 11 | 12 | // Ban bracket generation, plus defaults |
| @@ -155,7 +156,7 @@ router.post('/generate', jsonParser, async function (req, res) { | ||
| 155 | 156 | 'repetition_penalty_slope': req.body.repetition_penalty_slope, |
| 156 | 157 | 'repetition_penalty_frequency': req.body.repetition_penalty_frequency, |
| 157 | 158 | 'repetition_penalty_presence': req.body.repetition_penalty_presence, |
| 158 | 159 | 'repetition_penalty_whitelist': isNewModel ? repPenaltyAllowList.flat() : null, |
| 159 | 160 | 'top_a': req.body.top_a, |
| 160 | 161 | 'top_p': req.body.top_p, |
| 161 | 162 | 'top_k': req.body.top_k, |
| @@ -178,9 +179,7 @@ router.post('/generate', jsonParser, async function (req, res) { | ||
| 178 | 179 | }; |
| 179 | 180 | |
| 180 | 181 | // Tells the model to stop generation at '>' |
| 181 | 182 | if ('theme_textadventure' === req.body.prefix && isNewModel) { |
| 182 | - (true === req.body.model.includes('clio') || | |
| 183 | - true === req.body.model.includes('kayra'))) { | |
| 184 | 183 | data.parameters.eos_token_id = 49405; |
| 185 | 184 | } |
| 186 | 185 | |
| @@ -193,7 +192,8 @@ router.post('/generate', jsonParser, async function (req, res) { | ||
| 193 | 192 | }; |
| 194 | 193 | |
| 195 | 194 | try { |
| 196 | 195 | const urlbaseURL = req.body.streamingmodel.includes('kayra') ? `${API_NOVELAI}/ai/generate-stream`TEXT_NOVELAI : `${API_NOVELAI}/ai/generate`; |
| 196 | + const url = req.body.streaming ? `${baseURL}/ai/generate-stream` : `${baseURL}/ai/generate`; | |
| 197 | 197 | const response = await fetch(url, { method: 'POST', timeout: 0, ...args }); |
| 198 | 198 | |
| 199 | 199 | if (req.body.streaming) { |