Merge branch 'staging' into hidden-reasoning-tracking
| @@ -3749,8 +3749,8 @@ | ||
| 3749 | 3749 | </div> |
| 3750 | 3750 | <label class="checkbox_label" for="custom_stopping_strings_macro"> |
| 3751 | 3751 | <input id="custom_stopping_strings_macro" type="checkbox" checked> |
| 3752 | 3752 | <small data-i18n="Replace Macro in Custom StoppingStop Strings"> |
| 3753 | 3753 | Replace Macro in Custom StoppingStop Strings |
| 3754 | 3754 | </small> |
| 3755 | 3755 | </label> |
| 3756 | 3756 | </div> |
| @@ -3797,24 +3797,36 @@ | ||
| 3797 | 3797 | <span data-i18n="Reasoning">Reasoning</span> |
| 3798 | 3798 | </h4> |
| 3799 | 3799 | <div> |
| 3800 | - <label class="checkbox_label" for="reasoning_auto_parse" title="Automatically parse reasoning blocks from main content between the reasoning prefix/suffix. Both fields must be defined and non-empty." data-i18n="[title]reasoning_auto_parse"> | |
| 3800 | + <div class="flex-container alignItemsBaseline"> | |
| 3801 | + <label class="checkbox_label flex1" for="reasoning_auto_parse" title="Automatically parse reasoning blocks from main content between the reasoning prefix/suffix. Both fields must be defined and non-empty." data-i18n="[title]reasoning_auto_parse"> | |
| 3801 | 3802 | <input id="reasoning_auto_parse" type="checkbox" /> |
| 3802 | 3803 | <small data-i18n="Auto-Parse Reasoning"> |
| 3803 | 3804 | Auto-Parse Reasoning |
| 3804 | 3805 | </small> |
| 3805 | 3806 | </label> |
| 3806 | 3807 | <label class="checkbox_label flex1" for="reasoning_auto_expand" title="Automatically expand reasoning blocks." data-i18n="[title]reasoning_auto_expand"> |
| 3807 | 3808 | <input id="reasoning_auto_expand" type="checkbox" /> |
| 3808 | 3809 | <small data-i18n="Auto-Expand Reasoning"> |
| 3809 | 3810 | Auto-Expand Reasoning |
| 3810 | 3811 | </small> |
| 3811 | 3812 | </label> |
| 3812 | - <label class="checkbox_label" for="reasoning_add_to_prompts" title="Add existing reasoning blocks to prompts. To add a new reasoning block, use the message edit menu." data-i18n="[title]reasoning_add_to_prompts"> | |
| 3813 | + </div> | |
| 3814 | + <div class="flex-container alignItemsBaseline"> | |
| 3815 | + <label class="checkbox_label flex1" for="reasoning_add_to_prompts" title="Add existing reasoning blocks to prompts. To add a new reasoning block, use the message edit menu." data-i18n="[title]reasoning_add_to_prompts"> | |
| 3813 | 3816 | <input id="reasoning_add_to_prompts" type="checkbox" /> |
| 3814 | 3817 | <small data-i18n="Add Reasoning to Prompts"> |
| 3815 | 3818 | Add Reasoning to Prompts |
| 3816 | 3819 | </small> |
| 3817 | 3820 | </label> |
| 3821 | + <div class="flex1 flex-container alignItemsBaseline" title="Maximum number of reasoning blocks to be added per prompt, counting from the last message." data-i18n="[title]reasoning_max_additions"> | |
| 3822 | + <input id="reasoning_max_additions" class="text_pole textarea_compact widthUnset" type="number" min="0" max="999"></textarea> | |
| 3823 | + <small data-i18n="Max">Max</small> | |
| 3824 | + </div> | |
| 3825 | + </div> | |
| 3826 | + <details> | |
| 3827 | + <summary data-i18n="Reasoning Formatting"> | |
| 3828 | + Reasoning Formatting | |
| 3829 | + </summary> | |
| 3818 | 3830 | <div class="flex-container"> |
| 3819 | 3831 | <div class="flex1" title="Inserted before the reasoning content." data-i18n="[title]reasoning_prefix"> |
| 3820 | 3832 | <small data-i18n="Prefix">Prefix</small> |
| @@ -3830,11 +3842,8 @@ | ||
| 3830 | 3842 | <small data-i18n="Separator">Separator</small> |
| 3831 | 3843 | <textarea id="reasoning_separator" class="text_pole textarea_compact autoSetHeight"></textarea> |
| 3832 | 3844 | </div> |
| 3833 | - <div class="flex1" title="Maximum number of reasoning blocks to be added per prompt, counting from the last message." data-i18n="[title]reasoning_max_additions"> | |
| 3834 | - <small data-i18n="Max Additions">Max Additions</small> | |
| 3835 | - <input id="reasoning_max_additions" class="text_pole textarea_compact" type="number" min="0" max="999"></textarea> | |
| 3836 | - </div> | |
| 3837 | 3845 | </div> |
| 3846 | + </details> | |
| 3838 | 3847 | </div> |
| 3839 | 3848 | </div> |
| 3840 | 3849 | <div> |
| @@ -482,7 +482,7 @@ | ||
| 482 | 482 | "separate with commas w/o space between": "فصل بفواصل دون مسافة بينها", |
| 483 | 483 | "Custom Stopping Strings": "سلاسل توقف مخصصة", |
| 484 | 484 | "JSON serialized array of strings": "مصفوفة سلسلة JSON متسلسلة", |
| 485 | 485 | "Replace Macro in Custom StoppingStop Strings": "استبدال الماكرو في سلاسل التوقف المخصصة", |
| 486 | 486 | "Auto-Continue": "المتابعة التلقائية", |
| 487 | 487 | "Allow for Chat Completion APIs": "السماح بواجهات برمجة التطبيقات لإكمال الدردشة", |
| 488 | 488 | "Target length (tokens)": "الطول المستهدف (رموز)", |
| @@ -482,7 +482,7 @@ | ||
| 482 | 482 | "separate with commas w/o space between": "getrennt durch Kommas ohne Leerzeichen dazwischen", |
| 483 | 483 | "Custom Stopping Strings": "Benutzerdefinierte Stoppzeichenfolgen", |
| 484 | 484 | "JSON serialized array of strings": "JSON serialisierte Reihe von Zeichenfolgen", |
| 485 | 485 | "Replace Macro in Custom StoppingStop Strings": "Makro in benutzerdefinierten Stoppzeichenfolgen ersetzen", |
| 486 | 486 | "Auto-Continue": "Automatisch fortsetzen", |
| 487 | 487 | "Allow for Chat Completion APIs": "Erlaube Chat-Vervollständigungs-APIs", |
| 488 | 488 | "Target length (tokens)": "Ziel-Länge (Tokens)", |
| @@ -482,7 +482,7 @@ | ||
| 482 | 482 | "separate with commas w/o space between": "separe con comas sin espacio entre ellas", |
| 483 | 483 | "Custom Stopping Strings": "Cadenas de Detención Personalizadas", |
| 484 | 484 | "JSON serialized array of strings": "Arreglo de cadenas serializado en JSON", |
| 485 | 485 | "Replace Macro in Custom StoppingStop Strings": "Reemplazar macro en Cadenas de Detención Personalizadas", |
| 486 | 486 | "Auto-Continue": "Autocontinuar", |
| 487 | 487 | "Allow for Chat Completion APIs": "Permitir para APIs de Completado de Chat", |
| 488 | 488 | "Target length (tokens)": "Longitud objetivo (tokens)", |
| @@ -434,7 +434,7 @@ | ||
| 434 | 434 | "Non-markdown strings": "Chaînes non Markdown", |
| 435 | 435 | "Custom Stopping Strings": "Chaînes d'arrêt personnalisées", |
| 436 | 436 | "JSON serialized array of strings": "Tableau de chaînes sérialisé JSON", |
| 437 | 437 | "Replace Macro in Custom StoppingStop Strings": "Remplacer les macro dans les chaînes d'arrêt personnalisées", |
| 438 | 438 | "Auto-Continue": "Auto-Continue", |
| 439 | 439 | "Allow for Chat Completion APIs": "Autoriser les APIs de complétion de chat", |
| 440 | 440 | "Target length (tokens)": "Longueur cible (tokens)", |
| @@ -482,7 +482,7 @@ | ||
| 482 | 482 | "separate with commas w/o space between": "aðskilið með kommum án bila milli", |
| 483 | 483 | "Custom Stopping Strings": "Eigin stopp-strengir", |
| 484 | 484 | "JSON serialized array of strings": "JSON raðað fylki af strengjum", |
| 485 | 485 | "Replace Macro in Custom StoppingStop Strings": "Skiptu út í macro í sérsniðnum stoppa strengjum", |
| 486 | 486 | "Auto-Continue": "Sjálfvirk Forná", |
| 487 | 487 | "Allow for Chat Completion APIs": "Leyfa fyrir spjall Loka APIs", |
| 488 | 488 | "Target length (tokens)": "Markaðarlengd (texti)", |
| @@ -482,7 +482,7 @@ | ||
| 482 | 482 | "separate with commas w/o space between": "separati con virgole senza spazio tra loro", |
| 483 | 483 | "Custom Stopping Strings": "Stringhe di Stop Personalizzate", |
| 484 | 484 | "JSON serialized array of strings": "Matrice serializzata JSON di stringhe", |
| 485 | 485 | "Replace Macro in Custom StoppingStop Strings": "Sostituisci Macro in Stringhe di Arresto Personalizzate", |
| 486 | 486 | "Auto-Continue": "Auto-continua", |
| 487 | 487 | "Allow for Chat Completion APIs": "Consenti per API di completamento chat", |
| 488 | 488 | "Target length (tokens)": "Lunghezza obiettivo (token)", |
| @@ -482,7 +482,7 @@ | ||
| 482 | 482 | "separate with commas w/o space between": "間にスペースのないカンマで区切ります", |
| 483 | 483 | "Custom Stopping Strings": "カスタム停止文字列", |
| 484 | 484 | "JSON serialized array of strings": "文字列のJSONシリアル化配列", |
| 485 | 485 | "Replace Macro in Custom StoppingStop Strings": "カスタム停止文字列内のマクロを置換する", |
| 486 | 486 | "Auto-Continue": "自動継続", |
| 487 | 487 | "Allow for Chat Completion APIs": "チャット補完APIを許可", |
| 488 | 488 | "Target length (tokens)": "ターゲット長さ(トークン)", |
| @@ -492,7 +492,7 @@ | ||
| 492 | 492 | "separate with commas w/o space between": "쉼표로 구분 (공백 없이)", |
| 493 | 493 | "Custom Stopping Strings": "사용자 정의 중지 문자열", |
| 494 | 494 | "JSON serialized array of strings": "문자열의 JSON 직렬화된 배열", |
| 495 | 495 | "Replace Macro in Custom StoppingStop Strings": "사용자 정의 중단 문자열에서 매크로 교체", |
| 496 | 496 | "Auto-Continue": "자동 계속하기", |
| 497 | 497 | "Allow for Chat Completion APIs": "채팅 완성 API 허용", |
| 498 | 498 | "Target length (tokens)": "대상 길이 (토큰)", |
| @@ -482,7 +482,7 @@ | ||
| 482 | 482 | "separate with commas w/o space between": "gescheiden met komma's zonder spatie ertussen", |
| 483 | 483 | "Custom Stopping Strings": "Aangepaste Stopreeksen", |
| 484 | 484 | "JSON serialized array of strings": "JSON geserialiseerde reeks van strings", |
| 485 | 485 | "Replace Macro in Custom StoppingStop Strings": "Macro vervangen in aangepaste stopreeksen", |
| 486 | 486 | "Auto-Continue": "Automatisch doorgaan", |
| 487 | 487 | "Allow for Chat Completion APIs": "Chatvervolledigings-API's toestaan", |
| 488 | 488 | "Target length (tokens)": "Doellengte (tokens)", |
| @@ -482,7 +482,7 @@ | ||
| 482 | 482 | "separate with commas w/o space between": "separe com vírgulas sem espaço entre", |
| 483 | 483 | "Custom Stopping Strings": "Cadeias de parada personalizadas", |
| 484 | 484 | "JSON serialized array of strings": "Matriz de strings serializada em JSON", |
| 485 | 485 | "Replace Macro in Custom StoppingStop Strings": "Substituir Macro em Strings de Parada Personalizadas", |
| 486 | 486 | "Auto-Continue": "Auto-Continuar", |
| 487 | 487 | "Allow for Chat Completion APIs": "Permitir APIs de Completar Chat", |
| 488 | 488 | "Target length (tokens)": "Comprimento alvo (tokens)", |
| @@ -161,7 +161,7 @@ | ||
| 161 | 161 | "View hidden API keys": "Посмотреть скрытые API-ключи", |
| 162 | 162 | "Advanced Formatting": "Расширенное форматирование", |
| 163 | 163 | "Context Template": "Шаблон контекста", |
| 164 | 164 | "Replace Macro in Custom StoppingStop Strings": "Заменять макросы в пользовательских стоп-строках", |
| 165 | 165 | "Story String": "Строка истории", |
| 166 | 166 | "Example Separator": "Разделитель примеров сообщений", |
| 167 | 167 | "Chat Start": "Начало чата", |
| @@ -482,7 +482,7 @@ | ||
| 482 | 482 | "separate with commas w/o space between": "розділяйте комами без пропусків між ними", |
| 483 | 483 | "Custom Stopping Strings": "Власні рядки зупинки", |
| 484 | 484 | "JSON serialized array of strings": "JSON-серіалізований масив рядків", |
| 485 | 485 | "Replace Macro in Custom StoppingStop Strings": "Замінювати макроси у власних рядках зупинки", |
| 486 | 486 | "Auto-Continue": "Автоматичне продовження", |
| 487 | 487 | "Allow for Chat Completion APIs": "Дозволити для Chat Completion API", |
| 488 | 488 | "Target length (tokens)": "Цільова довжина (токени)", |
| @@ -482,7 +482,7 @@ | ||
| 482 | 482 | "separate with commas w/o space between": "phân tách bằng dấu phẩy không có khoảng trắng giữa", |
| 483 | 483 | "Custom Stopping Strings": "Chuỗi dừng tùy chỉnh", |
| 484 | 484 | "JSON serialized array of strings": "Mảng chuỗi được tuần tự hóa JSON", |
| 485 | 485 | "Replace Macro in Custom StoppingStop Strings": "Thay thế Macro trong Chuỗi Dừng Tùy chỉnh", |
| 486 | 486 | "Auto-Continue": "Tự động Tiếp tục", |
| 487 | 487 | "Allow for Chat Completion APIs": "Cho phép các API hoàn thành Trò chuyện", |
| 488 | 488 | "Target length (tokens)": "Độ dài mục tiêu (token)", |
| @@ -559,7 +559,7 @@ | ||
| 559 | 559 | "Prompt Content": "提示词内容", |
| 560 | 560 | "Custom Stopping Strings": "自定义停止字符串", |
| 561 | 561 | "JSON serialized array of strings": "JSON序列化的字符串数组", |
| 562 | 562 | "Replace Macro in Custom StoppingStop Strings": "替换自定义停止字符串中的宏", |
| 563 | 563 | "Token Padding": "词符填充", |
| 564 | 564 | "Miscellaneous": "杂项", |
| 565 | 565 | "Non-markdown strings": "非 Markdown 字符串", |
| @@ -483,7 +483,7 @@ | ||
| 483 | 483 | "separate with commas w/o space between": "用逗號分隔,之間無空格", |
| 484 | 484 | "Custom Stopping Strings": "自訂停止字串", |
| 485 | 485 | "JSON serialized array of strings": "JSON 序列化字串數組", |
| 486 | 486 | "Replace Macro in Custom StoppingStop Strings": "取代自訂停止字串中的巨集", |
| 487 | 487 | "Auto-Continue": "自動繼續", |
| 488 | 488 | "Allow for Chat Completion APIs": "允許聊天補全 API", |
| 489 | 489 | "Target length (tokens)": "目標長度(符元)", |
| @@ -3451,7 +3451,7 @@ export async function generateRaw(prompt, api, instructOverride, quietToLoud, sy | ||
| 3451 | 3451 | break; |
| 3452 | 3452 | } |
| 3453 | 3453 | case 'textgenerationwebui': |
| 3454 | 3454 | generateData = await getTextGenGenerationData(prompt, amount_gen, false, false, null, 'quiet'); |
| 3455 | 3455 | TempResponseLength.restore(api); |
| 3456 | 3456 | break; |
| 3457 | 3457 | case 'openai': { |
| @@ -4588,7 +4588,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | ||
| 4588 | 4588 | break; |
| 4589 | 4589 | case 'textgenerationwebui': { |
| 4590 | 4590 | const cfgValues = useCfgPrompt ? { guidanceScale: cfgGuidanceScale, negativePrompt: await getCombinedPrompt(true) } : null; |
| 4591 | 4591 | generate_data = await getTextGenGenerationData(finalPrompt, maxLength, isImpersonate, isContinue, cfgValues, type); |
| 4592 | 4592 | break; |
| 4593 | 4593 | } |
| 4594 | 4594 | case 'novel': { |
| @@ -6928,7 +6928,7 @@ export async function getSettings() { | ||
| 6928 | 6928 | loadProxyPresets(settings); |
| 6929 | 6929 | |
| 6930 | 6930 | // Allow subscribers to mutate settings |
| 6931 | 6931 | await eventSource.emit(event_types.SETTINGS_LOADED_AFTER, settings); |
| 6932 | 6932 | |
| 6933 | 6933 | // Set context size after loading power user (may override the max value) |
| 6934 | 6934 | $('#max_context').val(max_context); |
| @@ -6988,7 +6988,7 @@ export async function getSettings() { | ||
| 6988 | 6988 | } |
| 6989 | 6989 | await validateDisabledSamplers(); |
| 6990 | 6990 | settingsReady = true; |
| 6991 | 6991 | await eventSource.emit(event_types.SETTINGS_LOADED); |
| 6992 | 6992 | } |
| 6993 | 6993 | |
| 6994 | 6994 | function selectKoboldGuiPreset() { |
| @@ -11405,7 +11405,7 @@ jQuery(async function () { | ||
| 11405 | 11405 | ); |
| 11406 | 11406 | break;*/ |
| 11407 | 11407 | default: |
| 11408 | 11408 | await eventSource.emit('charManagementDropdown', target); |
| 11409 | 11409 | } |
| 11410 | 11410 | $('#char-management-dropdown').prop('selectedIndex', 0); |
| 11411 | 11411 | }); |
| @@ -11567,7 +11567,7 @@ jQuery(async function () { | ||
| 11567 | 11567 | |
| 11568 | 11568 | $(document).on('click', '.open_characters_library', async function () { |
| 11569 | 11569 | await getCharacters(); |
| 11570 | 11570 | await eventSource.emit(event_types.OPEN_CHARACTER_LIBRARY); |
| 11571 | 11571 | }); |
| 11572 | 11572 | |
| 11573 | 11573 | // Added here to prevent execution before script.js is loaded and get rid of quirky timeouts |
| @@ -621,21 +621,56 @@ async function enlargeMessageImage() { | ||
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | async function deleteMessageImage() { |
| 624 | 624 | const value = await callGenericPopup('<h3>Delete image from message?<br>This action can\'t be undone.</h3>', POPUP_TYPE.CONFIRM);TEXT, '', { |
| 625 | + okButton: t`Delete one`, | |
| 626 | + customButtons: [ | |
| 627 | + { | |
| 628 | + text: t`Delete all`, | |
| 629 | + appendAtEnd: true, | |
| 630 | + result: POPUP_RESULT.CUSTOM1, | |
| 631 | + }, | |
| 632 | + { | |
| 633 | + text: t`Cancel`, | |
| 634 | + appendAtEnd: true, | |
| 635 | + result: POPUP_RESULT.CANCELLED, | |
| 636 | + }, | |
| 637 | + ], | |
| 638 | + }); | |
| 625 | 639 | |
| 626 | 640 | if (value !== POPUP_RESULT.AFFIRMATIVEvalue) { |
| 627 | 641 | return; |
| 628 | 642 | } |
| 629 | 643 | |
| 630 | 644 | const mesBlock = $(this).closest('.mes'); |
| 631 | 645 | const mesId = mesBlock.attr('mesid'); |
| 632 | 646 | const message = chat[mesId]; |
| 647 | + | |
| 648 | + let isLastImage = true; | |
| 649 | + | |
| 650 | + if (Array.isArray(message.extra.image_swipes)) { | |
| 651 | + const indexOf = message.extra.image_swipes.indexOf(message.extra.image); | |
| 652 | + if (indexOf > -1) { | |
| 653 | + message.extra.image_swipes.splice(indexOf, 1); | |
| 654 | + isLastImage = message.extra.image_swipes.length === 0; | |
| 655 | + if (!isLastImage) { | |
| 656 | + const newIndex = Math.min(indexOf, message.extra.image_swipes.length - 1); | |
| 657 | + message.extra.image = message.extra.image_swipes[newIndex]; | |
| 658 | + } | |
| 659 | + } | |
| 660 | + } | |
| 661 | + | |
| 662 | + if (isLastImage || value === POPUP_RESULT.CUSTOM1) { | |
| 633 | 663 | delete message.extra.image; |
| 634 | 664 | delete message.extra.inline_image; |
| 635 | 665 | delete message.extra.title; |
| 636 | 666 | delete message.extra.append_title; |
| 667 | + delete message.extra.image_swipes; | |
| 637 | 668 | mesBlock.find('.mes_img_container').removeClass('img_extra'); |
| 638 | 669 | mesBlock.find('.mes_img').attr('src', ''); |
| 670 | + } else { | |
| 671 | + appendMediaToMessage(message, mesBlock); | |
| 672 | + } | |
| 673 | + | |
| 639 | 674 | await saveChatConditional(); |
| 640 | 675 | } |
| 641 | 676 | |
| @@ -10,7 +10,7 @@ | ||
| 10 | 10 | <select id="caption_source" class="text_pole"> |
| 11 | 11 | <option value="local" data-i18n="Local">Local</option> |
| 12 | 12 | <option value="multimodal" data-i18n="Multimodal (OpenAI / Anthropic / llama / Google)">Multimodal (OpenAI / Anthropic / llama / Google)</option> |
| 13 | 13 | <option value="extras" data-i18n="Extras">Extras (deprecated)</option> |
| 14 | 14 | <option value="horde" data-i18n="Horde">Horde</option> |
| 15 | 15 | </select> |
| 16 | 16 | <div id="caption_multimodal_block" class="flex-container wide100p"> |
| @@ -23,7 +23,7 @@ | ||
| 23 | 23 | <small data-i18n="Select the API for classifying expressions.">Select the API for classifying expressions.</small> |
| 24 | 24 | <select id="expression_api" class="flex1 margin0"> |
| 25 | 25 | <option value="0" data-i18n="Local">Local</option> |
| 26 | 26 | <option value="1" data-i18n="Extras">Extras (deprecated)</option> |
| 27 | 27 | <option value="2" data-i18n="Main API">Main API</option> |
| 28 | 28 | <option value="3" data-i18n="WebLLM Extension">WebLLM Extension</option> |
| 29 | 29 | </select> |
| @@ -12,7 +12,7 @@ | ||
| 12 | 12 | <label for="summary_source" data-i18n="ext_sum_with">Summarize with:</label> |
| 13 | 13 | <select id="summary_source"> |
| 14 | 14 | <option value="main" data-i18n="ext_sum_main_api">Main API</option> |
| 15 | 15 | <option value="extras">Extras API (deprecated)</option> |
| 16 | 16 | <option value="webllm" data-i18n="ext_sum_webllm">WebLLM Extension</option> |
| 17 | 17 | </select><br> |
| 18 | 18 | |
| @@ -41,7 +41,7 @@ | ||
| 41 | 41 | <option value="blockentropy">Block Entropy</option> |
| 42 | 42 | <option value="comfy">ComfyUI</option> |
| 43 | 43 | <option value="drawthings">DrawThings HTTP API</option> |
| 44 | 44 | <option value="extras">Extras API (local / remotedeprecated)</option> |
| 45 | 45 | <option value="huggingface">HuggingFace Inference API (serverless)</option> |
| 46 | 46 | <option value="nanogpt">NanoGPT</option> |
| 47 | 47 | <option value="novel">NovelAI Diffusion</option> |
| @@ -11,7 +11,7 @@ | ||
| 11 | 11 | </label> |
| 12 | 12 | <select id="vectors_source" class="text_pole"> |
| 13 | 13 | <option value="cohere">Cohere</option> |
| 14 | 14 | <option value="extras">Extras (deprecated)</option> |
| 15 | 15 | <option value="palm">Google AI Studio</option> |
| 16 | 16 | <option value="llamacpp">llama.cpp</option> |
| 17 | 17 | <option value="transformers" data-i18n="Local (Transformers)">Local (Transformers)</option> |
| @@ -24,6 +24,15 @@ export const POPUP_RESULT = { | ||
| 24 | 24 | AFFIRMATIVE: 1, |
| 25 | 25 | NEGATIVE: 0, |
| 26 | 26 | CANCELLED: null, |
| 27 | + CUSTOM1: 1001, | |
| 28 | + CUSTOM2: 1002, | |
| 29 | + CUSTOM3: 1003, | |
| 30 | + CUSTOM4: 1004, | |
| 31 | + CUSTOM5: 1005, | |
| 32 | + CUSTOM6: 1006, | |
| 33 | + CUSTOM7: 1007, | |
| 34 | + CUSTOM8: 1008, | |
| 35 | + CUSTOM9: 1009, | |
| 27 | 36 | }; |
| 28 | 37 | |
| 29 | 38 | /** |
| @@ -2451,7 +2451,7 @@ async function resetMovablePanels(type) { | ||
| 2451 | 2451 | } |
| 2452 | 2452 | |
| 2453 | 2453 | saveSettingsDebounced(); |
| 2454 | 2454 | await eventSource.emit(event_types.MOVABLE_PANELS_RESET); |
| 2455 | 2455 | |
| 2456 | 2456 | eventSource.once(event_types.SETTINGS_UPDATED, () => { |
| 2457 | 2457 | $('.resizing').removeClass('resizing'); |
| @@ -40,6 +40,7 @@ export const SECRET_KEYS = { | ||
| 40 | 40 | BFL: 'api_key_bfl', |
| 41 | 41 | GENERIC: 'api_key_generic', |
| 42 | 42 | DEEPSEEK: 'api_key_deepseek', |
| 43 | + SERPER: 'api_key_serper', | |
| 43 | 44 | }; |
| 44 | 45 | |
| 45 | 46 | const INPUT_MAP = { |
| @@ -1221,7 +1221,7 @@ function replaceMacrosInList(str) { | ||
| 1221 | 1221 | } |
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | 1224 | export async function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, isContinue, cfgValues, type) { |
| 1225 | 1225 | const canMultiSwipe = !isContinue && !isImpersonate && type !== 'quiet'; |
| 1226 | 1226 | const dynatemp = isDynamicTemperatureSupported(); |
| 1227 | 1227 | const { banned_tokens, banned_strings } = getCustomTokenBans(); |
| @@ -1449,7 +1449,7 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, | ||
| 1449 | 1449 | } |
| 1450 | 1450 | } |
| 1451 | 1451 | |
| 1452 | 1452 | await eventSource.emitAndWaitemit(event_types.TEXT_COMPLETION_SETTINGS_READY, params); |
| 1453 | 1453 | |
| 1454 | 1454 | // Grammar conflicts with with json_schema |
| 1455 | 1455 | if (settings.type === LLAMACPP) { |
| @@ -3452,7 +3452,7 @@ async function _save(name, data) { | ||
| 3452 | 3452 | headers: getRequestHeaders(), |
| 3453 | 3453 | body: JSON.stringify({ name: name, data: data }), |
| 3454 | 3454 | }); |
| 3455 | 3455 | await eventSource.emit(event_types.WORLDINFO_UPDATED, name, data); |
| 3456 | 3456 | } |
| 3457 | 3457 | |
| 3458 | 3458 | |
| @@ -5745,11 +5745,13 @@ body:not(.movingUI) .drawer-content.maximized { | ||
| 5745 | 5745 | overflow-wrap: anywhere; |
| 5746 | 5746 | } |
| 5747 | 5747 | |
| 5748 | +#SystemPromptColumn summary, | |
| 5748 | 5749 | #InstructSequencesColumn summary { |
| 5749 | 5750 | font-size: 0.95em; |
| 5750 | 5751 | cursor: pointer; |
| 5751 | 5752 | } |
| 5752 | 5753 | |
| 5754 | +#SystemPromptColumn details, | |
| 5753 | 5755 | #InstructSequencesColumn details:not(:last-of-type) { |
| 5754 | 5756 | margin-bottom: 5px; |
| 5755 | 5757 | } |
| @@ -112,6 +112,7 @@ router.post('/serpapi', jsonParser, async (request, response) => { | ||
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | const data = await result.json(); |
| 115 | + console.debug('SerpApi response', data); | |
| 115 | 116 | return response.json(data); |
| 116 | 117 | } catch (error) { |
| 117 | 118 | console.error(error); |
| @@ -255,6 +256,7 @@ router.post('/tavily', jsonParser, async (request, response) => { | ||
| 255 | 256 | } |
| 256 | 257 | |
| 257 | 258 | const data = await result.json(); |
| 259 | + console.debug('Tavily response', data); | |
| 258 | 260 | return response.json(data); |
| 259 | 261 | } catch (error) { |
| 260 | 262 | console.error(error); |
| @@ -290,6 +292,49 @@ router.post('/koboldcpp', jsonParser, async (request, response) => { | ||
| 290 | 292 | } |
| 291 | 293 | |
| 292 | 294 | const data = await result.json(); |
| 295 | + console.debug('KoboldCpp search response', data); | |
| 296 | + return response.json(data); | |
| 297 | + } catch (error) { | |
| 298 | + console.error(error); | |
| 299 | + return response.sendStatus(500); | |
| 300 | + } | |
| 301 | +}); | |
| 302 | + | |
| 303 | +router.post('/serper', jsonParser, async (request, response) => { | |
| 304 | + try { | |
| 305 | + const key = readSecret(request.user.directories, SECRET_KEYS.SERPER); | |
| 306 | + | |
| 307 | + if (!key) { | |
| 308 | + console.error('No Serper key found'); | |
| 309 | + return response.sendStatus(400); | |
| 310 | + } | |
| 311 | + | |
| 312 | + const { query, images } = request.body; | |
| 313 | + | |
| 314 | + const url = images | |
| 315 | + ? 'https://google.serper.dev/images' | |
| 316 | + : 'https://google.serper.dev/search'; | |
| 317 | + | |
| 318 | + const result = await fetch(url, { | |
| 319 | + method: 'POST', | |
| 320 | + headers: { | |
| 321 | + 'X-API-KEY': key, | |
| 322 | + 'Content-Type': 'application/json', | |
| 323 | + }, | |
| 324 | + redirect: 'follow', | |
| 325 | + body: JSON.stringify({ q: query }), | |
| 326 | + }); | |
| 327 | + | |
| 328 | + console.debug('Serper query', query); | |
| 329 | + | |
| 330 | + if (!result.ok) { | |
| 331 | + const text = await result.text(); | |
| 332 | + console.warn('Serper request failed', result.statusText, text); | |
| 333 | + return response.status(500).send(text); | |
| 334 | + } | |
| 335 | + | |
| 336 | + const data = await result.json(); | |
| 337 | + console.debug('Serper response', data); | |
| 293 | 338 | return response.json(data); |
| 294 | 339 | } catch (error) { |
| 295 | 340 | console.error(error); |
| @@ -52,6 +52,7 @@ export const SECRET_KEYS = { | ||
| 52 | 52 | BFL: 'api_key_bfl', |
| 53 | 53 | GENERIC: 'api_key_generic', |
| 54 | 54 | DEEPSEEK: 'api_key_deepseek', |
| 55 | + SERPER: 'api_key_serper', | |
| 55 | 56 | }; |
| 56 | 57 | |
| 57 | 58 | // These are the keys that are safe to expose, even if allowKeysExposure is false |