Chat Completion: Reduce number of toggles in AI Response Configuration (#4821) * Chat Completion: Reduce number of toggles in AI Response Configuration * Consolidate migration logic * Don't enable media inlining if image inlining was disabled * Fix icons showing on media toggle off * Update i18n

0a22856faf26c399e0919b226a0cff83f0c18bcf

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

Signed
23 files changed, +99 -235Ignore whitespace
default/content/presets/openai/Default.json+2 -4
@@ -28,7 +28,6 @@
28 "repetition_penalty": 1,28 "repetition_penalty": 1,
29 "openai_max_context": 4095,29 "openai_max_context": 4095,
30 "openai_max_tokens": 300,30 "openai_max_tokens": 300,
31 "wrap_in_quotes": false,
32 "names_behavior": 0,31 "names_behavior": 0,
33 "send_if_empty": "",32 "send_if_empty": "",
34 "impersonation_prompt": "[Write your next reply from the point of view of {{user}}, using the chat history so far as a guideline for the writing style of {{user}}. Don't write as {{char}} or system. Don't describe actions of {{char}}.]",33 "impersonation_prompt": "[Write your next reply from the point of view of {{user}}, using the chat history so far as a guideline for the writing style of {{user}}. Don't write as {{char}} or system. Don't describe actions of {{char}}.]",
@@ -231,9 +230,8 @@
231 "show_external_models": false,230 "show_external_models": false,
232 "assistant_prefill": "",231 "assistant_prefill": "",
233 "assistant_impersonation": "",232 "assistant_impersonation": "",
234 "claude_use_sysprompt": false,233 "use_sysprompt": false,
235 "squash_system_messages": false,234 "media_inlining": true,
236 "image_inlining": false,
237 "bypass_status_check": false,235 "bypass_status_check": false,
238 "continue_prefill": false,236 "continue_prefill": false,
239 "continue_postfix": " ",237 "continue_postfix": " ",
default/content/settings.json+0 -1
@@ -463,7 +463,6 @@
463 "stream_openai": true,463 "stream_openai": true,
464 "openai_max_context": 4095,464 "openai_max_context": 4095,
465 "openai_max_tokens": 300,465 "openai_max_tokens": 300,
466 "wrap_in_quotes": false,
467 "prompts": [466 "prompts": [
468 {467 {
469 "name": "Main Prompt",468 "name": "Main Prompt",
public/css/toggle-dependent.css+1 -0
@@ -532,6 +532,7 @@ label[for="bind_preset_to_connection"]:has(input:checked) {
532}532}
533533
534#openai_settings input[type="checkbox"]:not(:checked)~[data-cc-toggle],534#openai_settings input[type="checkbox"]:not(:checked)~[data-cc-toggle],
535#openai_settings input[type="checkbox"]:not(:checked)~*:has([data-cc-toggle]),
535#openai_settings [data-cc-toggle="false"]>.icon-supported,536#openai_settings [data-cc-toggle="false"]>.icon-supported,
536#openai_settings [data-cc-toggle="true"]>.icon-unsupported {537#openai_settings [data-cc-toggle="true"]>.icon-unsupported {
537 display: none;538 display: none;
public/index.html+28 -79
@@ -1920,18 +1920,6 @@
1920 </div>1920 </div>
1921 </div>1921 </div>
1922 <div class="range-block">1922 <div class="range-block">
1923 <label for="wrap_in_quotes" title="Wrap user messages in quotes before sending" data-i18n="[title]Wrap user messages in quotes before sending" class="checkbox_label widthFreeExpand">
1924 <input id="wrap_in_quotes" type="checkbox" /><span data-i18n="Wrap in Quotes">
1925 Wrap in Quotes</span>
1926 </label>
1927 <div class="toggle-description justifyLeft">
1928 <span data-i18n="Wrap entire user message in quotes before sending.">Wrap
1929 entire user message in quotes before sending.</span><br>
1930 <span data-i18n="Leave off if you use quotes manually for speech.">Leave off
1931 if you use quotes manually for speech.</span>
1932 </div>
1933 </div>
1934 <div class="range-block">
1935 <label for="continue_prefill" class="checkbox_label widthFreeExpand">1923 <label for="continue_prefill" class="checkbox_label widthFreeExpand">
1936 <input id="continue_prefill" type="checkbox" />1924 <input id="continue_prefill" type="checkbox" />
1937 <span data-i18n="Continue prefill">Continue prefill</span>1925 <span data-i18n="Continue prefill">Continue prefill</span>
@@ -1942,16 +1930,16 @@
1942 </span>1930 </span>
1943 </div>1931 </div>
1944 </div>1932 </div>
1945 <div class="range-block">1933 <div class="range-block" data-source="claude,makersuite,vertexai">
1946 <label for="squash_system_messages" title="Squash system messages" data-i18n="[title]Squash system messages" class="checkbox_label widthFreeExpand">1934 <label for="use_sysprompt" class="checkbox_label widthFreeExpand">
1947 <input id="squash_system_messages" type="checkbox" />1935 <input id="use_sysprompt" type="checkbox" />
1948 <span data-i18n="Squash system messages">1936 <span>
1949 Squash system messages1937 <span data-i18n="Use system prompt">Use system prompt</span>
1950 </span>1938 </span>
1951 </label>1939 </label>
1952 <div class="toggle-description justifyLeft">1940 <div class="toggle-description justifyLeft marginBot5">
1953 <span data-i18n="Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.">1941 <span data-i18n="Send the system prompt for supported models. If disabled, the user message is added to the beginning of the prompt.">
1954 Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.1942 Send the system prompt for supported models. If disabled, the user message is added to the beginning of the prompt.
1955 </span>1943 </span>
1956 </div>1944 </div>
1957 </div>1945 </div>
@@ -1985,16 +1973,28 @@
1985 </div>1973 </div>
1986 </div>1974 </div>
1987 <div class="range-block" data-source="openai,aimlapi,openrouter,mistralai,makersuite,vertexai,claude,custom,xai,pollinations,moonshot,cohere,cometapi,nanogpt,electronhub,azure_openai,zai,siliconflow">1975 <div class="range-block" data-source="openai,aimlapi,openrouter,mistralai,makersuite,vertexai,claude,custom,xai,pollinations,moonshot,cohere,cometapi,nanogpt,electronhub,azure_openai,zai,siliconflow">
1988 <label for="openai_image_inlining" class="checkbox_label flexWrap widthFreeExpand">1976 <label for="openai_media_inlining" class="checkbox_label flexWrap widthFreeExpand">
1989 <input id="openai_image_inlining" type="checkbox" />1977 <input id="openai_media_inlining" type="checkbox" />
1990 <span data-i18n="Send inline images">Send inline images</span>1978 <span data-i18n="Send inline media">Send inline media</span>
1991 <div id="openai_image_inlining_supported" data-cc-toggle="false">1979 <div class="flex-container">
1992 <i class="icon-supported fa-solid fa-circle-check" title="Supported by the current model" data-i18n="[title]Supported by the current model"></i>1980 <div id="openai_image_inlining_supported">
1993 <i class="icon-unsupported fa-solid fa-circle-exclamation" title="Unsupported by the current model" data-i18n="[title]Unsupported by the current model"></i>1981 <i class="icon-supported fa-solid fa-image" title="Supported by the current model" data-i18n="[title]Supported by the current model"></i>
1982 <i class="icon-unsupported fa-solid fa-image" title="Unsupported by the current model" data-i18n="[title]Unsupported by the current model"></i>
1983 </div>
1984 <div id="openai_video_inlining_supported" data-source="makersuite,vertexai,openrouter">
1985 <i class="icon-supported fa-solid fa-film" title="Supported by the current model" data-i18n="[title]Supported by the current model"></i>
1986 <i class="icon-unsupported fa-solid fa-film" title="Unsupported by the current model" data-i18n="[title]Unsupported by the current model"></i>
1987 </div>
1988 <div id="openai_audio_inlining_supported" data-source="makersuite,vertexai,openrouter">
1989 <i class="icon-supported fa-solid fa-music" title="Supported by the current model" data-i18n="[title]Supported by the current model"></i>
1990 <i class="icon-unsupported fa-solid fa-music" title="Unsupported by the current model" data-i18n="[title]Unsupported by the current model"></i>
1991 </div>
1994 </div>1992 </div>
1995 </label>1993 </label>
1996 <div id="image_inlining_hint" class="flexBasis100p toggle-description justifyLeft">1994 <div id="image_inlining_hint" class="flexBasis100p toggle-description justifyLeft">
1997 <span data-i18n="image_inlining_hint_1">Sends images in prompts if the model supports it.</span>1995 <span data-i18n="image_inlining_hint_1">Sends attached media in prompts if supported by the model.</span>
1996 <strong data-source="makersuite,vertexai" data-i18n="video_inlining_hint_4">Videos must be less than 20 MB and under 1 minute long.</strong>
1997 <strong data-source="makersuite,vertexai" data-i18n="audio_inlining_hint_2">Audio must be less than 20 MB.</strong>
1998 </div>1998 </div>
1999 <div class="flex-container flexFlowColumn wide100p textAlignCenter marginTop10" data-source="openai,custom,xai,pollinations,cohere,cometapi,nanogpt,moonshot,aimlapi,openrouter,mistralai,electronhub,azure_openai,zai,siliconflow">1999 <div class="flex-container flexFlowColumn wide100p textAlignCenter marginTop10" data-source="openai,custom,xai,pollinations,cohere,cometapi,nanogpt,moonshot,aimlapi,openrouter,mistralai,electronhub,azure_openai,zai,siliconflow">
2000 <div class="flex-container oneline-dropdown">2000 <div class="flex-container oneline-dropdown">
@@ -2009,40 +2009,12 @@
2009 </div>2009 </div>
2010 </div>2010 </div>
2011 </div>2011 </div>
2012 <div class="range-block" data-source="makersuite,vertexai,openrouter">
2013 <label for="openai_video_inlining" class="checkbox_label flexWrap widthFreeExpand">
2014 <input id="openai_video_inlining" type="checkbox" />
2015 <span data-i18n="Send inline videos">Send inline videos</span>
2016 <div id="openai_video_inlining_supported" data-cc-toggle="false">
2017 <i class="icon-supported fa-solid fa-circle-check" title="Supported by the current model" data-i18n="[title]Supported by the current model"></i>
2018 <i class="icon-unsupported fa-solid fa-circle-exclamation" title="Unsupported by the current model" data-i18n="[title]Unsupported by the current model"></i>
2019 </div>
2020 </label>
2021 <div id="video_inlining_hint" class="flexBasis100p toggle-description justifyLeft">
2022 <span data-i18n="video_inlining_hint_1">Sends videos in prompts if the model supports it.</span>
2023 <strong data-source="makersuite,vertexai" data-i18n="video_inlining_hint_4">Videos must be less than 20 MB and under 1 minute long</strong>
2024 </div>
2025 </div>
2026 <div class="range-block" data-source="makersuite,vertexai,openrouter">
2027 <label for="openai_audio_inlining" class="checkbox_label flexWrap widthFreeExpand">
2028 <input id="openai_audio_inlining" type="checkbox" />
2029 <span data-i18n="Send inline audio">Send inline audio</span>
2030 <div id="openai_audio_inlining_supported" data-cc-toggle="false">
2031 <i class="icon-supported fa-solid fa-circle-check" title="Supported by the current model" data-i18n="[title]Supported by the current model"></i>
2032 <i class="icon-unsupported fa-solid fa-circle-exclamation" title="Unsupported by the current model" data-i18n="[title]Unsupported by the current model"></i>
2033 </div>
2034 </label>
2035 <div id="audio_inlining_hint" class="flexBasis100p toggle-description justifyLeft">
2036 <span data-i18n="audio_inlining_hint_1">Sends audio in prompts if the model supports it.</span>
2037 <strong data-source="makersuite,vertexai" data-i18n="audio_inlining_hint_2">Audio must be less than 20 MB</strong>
2038 </div>
2039 </div>
2040 <div class="range-block" data-source="makersuite,vertexai">2012 <div class="range-block" data-source="makersuite,vertexai">
2041 <label for="openai_request_images" class="checkbox_label widthFreeExpand">2013 <label for="openai_request_images" class="checkbox_label widthFreeExpand">
2042 <input id="openai_request_images" type="checkbox" />2014 <input id="openai_request_images" type="checkbox" />
2043 <span>2015 <span>
2044 <span data-i18n="Request inline images">Request inline images</span>2016 <span data-i18n="Request inline images">Request inline images</span>
2045 <i class="opacity50p fa-solid fa-circle-info" title="Gemini 2.0 Flash Experimental"></i>2017 <i class="opacity50p fa-solid fa-circle-info" title="Gemini 2.5 Flash Image / Gemini 3 Pro Image"></i>
2046 </span>2018 </span>
2047 </label>2019 </label>
2048 <div class="toggle-description justifyLeft marginBot5">2020 <div class="toggle-description justifyLeft marginBot5">
@@ -2054,20 +2026,6 @@
2054 </em>2026 </em>
2055 </div>2027 </div>
2056 </div>2028 </div>
2057 <div class="range-block" data-source="makersuite,vertexai">
2058 <label for="use_makersuite_sysprompt" class="checkbox_label widthFreeExpand">
2059 <input id="use_makersuite_sysprompt" type="checkbox" />
2060 <span>
2061 <span data-i18n="Use system prompt">Use system prompt</span>
2062 <i class="opacity50p fa-solid fa-circle-info" title="Gemini 1.5+, LearnLM"></i>
2063 </span>
2064 </label>
2065 <div class="toggle-description justifyLeft marginBot5">
2066 <span data-i18n="Merges_all_system_messages_desc_1">
2067 Merges all system messages up until the first message with a non-system role, and sends them in a</span> <code>system_instruction</code> <span data-i18n="Merges_all_system_messages_desc_2">field.
2068 </span>
2069 </div>
2070 </div>
2071 <div class="range-block" data-source="deepseek,aimlapi,openrouter,custom,claude,xai,makersuite,vertexai,pollinations,moonshot,mistralai,fireworks,cometapi,electronhub,azure_openai,nanogpt,zai">2029 <div class="range-block" data-source="deepseek,aimlapi,openrouter,custom,claude,xai,makersuite,vertexai,pollinations,moonshot,mistralai,fireworks,cometapi,electronhub,azure_openai,nanogpt,zai">
2072 <label for="openai_show_thoughts" class="checkbox_label widthFreeExpand">2030 <label for="openai_show_thoughts" class="checkbox_label widthFreeExpand">
2073 <input id="openai_show_thoughts" type="checkbox" />2031 <input id="openai_show_thoughts" type="checkbox" />
@@ -2124,15 +2082,6 @@
2124 <i class="fa-solid fa-circle-info"></i>2082 <i class="fa-solid fa-circle-info"></i>
2125 <span>Prefills won't work when function calling is enabled and any tools are registered.</span>2083 <span>Prefills won't work when function calling is enabled and any tools are registered.</span>
2126 </div>2084 </div>
2127 <label for="claude_use_sysprompt" class="checkbox_label widthFreeExpand">
2128 <input id="claude_use_sysprompt" type="checkbox" />
2129 <span data-i18n="Use system prompt">Use system prompt</span>
2130 </label>
2131 <div class="toggle-description justifyLeft marginBot5">
2132 <span data-i18n="Send the system prompt for supported models. If disabled, the user message is added to the beginning of the prompt.">
2133 Send the system prompt for supported models. If disabled, the user message is added to the beginning of the prompt.
2134 </span>
2135 </div>
2136 </div>2085 </div>
2137 </div>2086 </div>
2138 <div class="range-block m-t-1" data-source="openai,aimlapi,openrouter,custom,electronhub,azure_openai">2087 <div class="range-block m-t-1" data-source="openai,aimlapi,openrouter,custom,electronhub,azure_openai">
public/locales/ar-sa.json+1 -1
@@ -235,7 +235,7 @@
235 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "يجمع الرسائل المتتالية للنظام في رسالة واحدة (باستثناء الحوارات المثالية). قد يحسن التتابع لبعض النماذج.",235 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "يجمع الرسائل المتتالية للنظام في رسالة واحدة (باستثناء الحوارات المثالية). قد يحسن التتابع لبعض النماذج.",
236 "Enable function calling": "تمكين استدعاء الوظيفة",236 "Enable function calling": "تمكين استدعاء الوظيفة",
237 "Send inline images": "إرسال الصور المضمنة",237 "Send inline images": "إرسال الصور المضمنة",
238 "image_inlining_hint_1": "يرسل الصور في المطالبات إذا كان النموذج يدعمها .",238 "image_inlining_hint_1": "يرسل ملفات الوسائط في المطالبات إذا كان النموذج يدعمها .",
239 "image_inlining_hint_2": "الإجراء على أي رسالة أو",239 "image_inlining_hint_2": "الإجراء على أي رسالة أو",
240 "image_inlining_hint_3": "القائمة لإرفاق ملف صورة للدردشة.",240 "image_inlining_hint_3": "القائمة لإرفاق ملف صورة للدردشة.",
241 "Inline Image Quality": "جودة الصورة المضمنة",241 "Inline Image Quality": "جودة الصورة المضمنة",
public/locales/de-de.json+1 -1
@@ -235,7 +235,7 @@
235 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "Kombiniert aufeinanderfolgende Systemnachrichten zu einer (ausschließlich Beispiel-Dialoge ausgeschlossen). Kann die Kohärenz für einige Modelle verbessern.",235 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "Kombiniert aufeinanderfolgende Systemnachrichten zu einer (ausschließlich Beispiel-Dialoge ausgeschlossen). Kann die Kohärenz für einige Modelle verbessern.",
236 "Enable function calling": "Funktionsaufruf aktivieren",236 "Enable function calling": "Funktionsaufruf aktivieren",
237 "Send inline images": "Inline-Bilder senden",237 "Send inline images": "Inline-Bilder senden",
238 "image_inlining_hint_1": "Sendet Bilder in Eingabeaufforderungen, wenn das Modell dies unterstützt.",238 "image_inlining_hint_1": "Sendet Mediendateien in Eingabeaufforderungen, wenn das Modell dies unterstützt.",
239 "image_inlining_hint_2": "Aktion auf eine Nachricht oder die",239 "image_inlining_hint_2": "Aktion auf eine Nachricht oder die",
240 "image_inlining_hint_3": "Menü, um eine Bilddatei an den Chat anzuhängen.",240 "image_inlining_hint_3": "Menü, um eine Bilddatei an den Chat anzuhängen.",
241 "Inline Image Quality": "Inline-Bildqualität",241 "Inline Image Quality": "Inline-Bildqualität",
public/locales/es-es.json+1 -1
@@ -235,7 +235,7 @@
235 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "Combina mensajes del sistema consecutivos en uno solo (excluyendo diálogos de ejemplo). Puede mejorar la coherencia para algunos modelos.",235 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "Combina mensajes del sistema consecutivos en uno solo (excluyendo diálogos de ejemplo). Puede mejorar la coherencia para algunos modelos.",
236 "Enable function calling": "Habilitar llamada a función",236 "Enable function calling": "Habilitar llamada a función",
237 "Send inline images": "Enviar imágenes en línea",237 "Send inline images": "Enviar imágenes en línea",
238 "image_inlining_hint_1": "Envía imágenes en mensajes si el modelo lo admite.",238 "image_inlining_hint_1": "Envía archivos multimedia en mensajes si el modelo lo admite.",
239 "image_inlining_hint_2": "acción sobre cualquier mensaje o el",239 "image_inlining_hint_2": "acción sobre cualquier mensaje o el",
240 "image_inlining_hint_3": "menú para adjuntar un archivo de imagen al chat.",240 "image_inlining_hint_3": "menú para adjuntar un archivo de imagen al chat.",
241 "Inline Image Quality": "Calidad de imagen en línea",241 "Inline Image Quality": "Calidad de imagen en línea",
public/locales/fr-fr.json+1 -1
@@ -227,7 +227,7 @@
227 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "Combine les messages système consécutifs en un seul (à l'exclusion des dialogues d'exemple). Peut améliorer la cohérence pour certains modèles.",227 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "Combine les messages système consécutifs en un seul (à l'exclusion des dialogues d'exemple). Peut améliorer la cohérence pour certains modèles.",
228 "Enable function calling": "Activer l'appel de fonction",228 "Enable function calling": "Activer l'appel de fonction",
229 "Send inline images": "Envoyer des images en ligne",229 "Send inline images": "Envoyer des images en ligne",
230 "image_inlining_hint_1": "Envoie des images dans les prompts si le modèle le prend en charge.",230 "image_inlining_hint_1": "Envoie des fichiers multimédias dans les prompts si le modèle le prend en charge.",
231 "image_inlining_hint_2": "action sur n'importe quel message ou le",231 "image_inlining_hint_2": "action sur n'importe quel message ou le",
232 "image_inlining_hint_3": "menu pour joindre un fichier image au chat.",232 "image_inlining_hint_3": "menu pour joindre un fichier image au chat.",
233 "Inline Image Quality": "Qualité d'image en ligne",233 "Inline Image Quality": "Qualité d'image en ligne",
public/locales/is-is.json+1 -1
@@ -235,7 +235,7 @@
235 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "Sameinar samhliða kerfisskilaboð í eitt (sem er utan umsagna dæmum). Getur bætt samfelldni fyrir sumar módel.",235 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "Sameinar samhliða kerfisskilaboð í eitt (sem er utan umsagna dæmum). Getur bætt samfelldni fyrir sumar módel.",
236 "Enable function calling": "Virkja aðgerðarkall",236 "Enable function calling": "Virkja aðgerðarkall",
237 "Send inline images": "Senda myndir í línu",237 "Send inline images": "Senda myndir í línu",
238 "image_inlining_hint_1": "Sendir myndir í skilaboðum ef líkanið styður það.",238 "image_inlining_hint_1": "Sendir margmiðlunarskrár í skilaboðum ef líkanið styður það.",
239 "image_inlining_hint_2": "aðgerð á hvaða skilaboðum sem er eða",239 "image_inlining_hint_2": "aðgerð á hvaða skilaboðum sem er eða",
240 "image_inlining_hint_3": "valmynd til að hengja myndskrá við spjallið.",240 "image_inlining_hint_3": "valmynd til að hengja myndskrá við spjallið.",
241 "Inline Image Quality": "Innbyggð myndgæði",241 "Inline Image Quality": "Innbyggð myndgæði",
public/locales/it-it.json+1 -1
@@ -235,7 +235,7 @@
235 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "Combina i messaggi di sistema consecutivi in uno solo (escludendo i dialoghi di esempio). Potrebbe migliorare la coerenza per alcuni modelli.",235 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "Combina i messaggi di sistema consecutivi in uno solo (escludendo i dialoghi di esempio). Potrebbe migliorare la coerenza per alcuni modelli.",
236 "Enable function calling": "Abilita la chiamata alla funzione",236 "Enable function calling": "Abilita la chiamata alla funzione",
237 "Send inline images": "Invia immagini inline",237 "Send inline images": "Invia immagini inline",
238 "image_inlining_hint_1": "Invia immagini nei prompt se il modello lo supporta.",238 "image_inlining_hint_1": "Invia file multimediali nei prompt se il modello lo supporta.",
239 "image_inlining_hint_2": "azione su qualsiasi messaggio o il",239 "image_inlining_hint_2": "azione su qualsiasi messaggio o il",
240 "image_inlining_hint_3": "menu per allegare un file immagine alla chat.",240 "image_inlining_hint_3": "menu per allegare un file immagine alla chat.",
241 "Inline Image Quality": "Qualità dell'immagine in linea",241 "Inline Image Quality": "Qualità dell'immagine in linea",
public/locales/ja-jp.json+1 -1
@@ -235,7 +235,7 @@
235 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "連続するシステムメッセージを1つに結合します(例のダイアログを除く)。一部のモデルの一貫性を向上させる可能性があります。",235 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "連続するシステムメッセージを1つに結合します(例のダイアログを除く)。一部のモデルの一貫性を向上させる可能性があります。",
236 "Enable function calling": "関数呼び出しを有効にする",236 "Enable function calling": "関数呼び出しを有効にする",
237 "Send inline images": "インライン画像を送信",237 "Send inline images": "インライン画像を送信",
238 "image_inlining_hint_1": "モデルがサポートしている場合、プロンプトで画像を送信します。",238 "image_inlining_hint_1": "モデルがサポートしている場合、プロンプトでメディアファイルを送信します。",
239 "image_inlining_hint_2": "メッセージに対するアクションまたは",239 "image_inlining_hint_2": "メッセージに対するアクションまたは",
240 "image_inlining_hint_3": "チャットに画像ファイルを添付するためのメニュー。",240 "image_inlining_hint_3": "チャットに画像ファイルを添付するためのメニュー。",
241 "Inline Image Quality": "インライン画像品質",241 "Inline Image Quality": "インライン画像品質",
public/locales/ko-kr.json+1 -1
@@ -237,7 +237,7 @@
237 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "연속된 시스템 메시지를 하나로 결합합니다(예제 대화 제외). 일부 모델의 일관성을 향상시킬 수 있습니다.",237 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "연속된 시스템 메시지를 하나로 결합합니다(예제 대화 제외). 일부 모델의 일관성을 향상시킬 수 있습니다.",
238 "Enable function calling": "함수 호출 활성화",238 "Enable function calling": "함수 호출 활성화",
239 "Send inline images": "인라인 이미지 전송",239 "Send inline images": "인라인 이미지 전송",
240 "image_inlining_hint_1": "모델이 지원하는 경우 메시지로 이미지를 보냅니다.",240 "image_inlining_hint_1": "모델이 지원하는 경우 메시지로 미디어 파일을 보냅니다.",
241 "Inline Image Quality": "인라인 이미지 품질",241 "Inline Image Quality": "인라인 이미지 품질",
242 "openai_inline_image_quality_auto": "자동",242 "openai_inline_image_quality_auto": "자동",
243 "openai_inline_image_quality_low": "낮은",243 "openai_inline_image_quality_low": "낮은",
public/locales/nl-nl.json+1 -1
@@ -235,7 +235,7 @@
235 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "Combineert opeenvolgende systeemberichten tot één (exclusief voorbeeld dialogen). Kan de coherentie verbeteren voor sommige modellen.",235 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "Combineert opeenvolgende systeemberichten tot één (exclusief voorbeeld dialogen). Kan de coherentie verbeteren voor sommige modellen.",
236 "Enable function calling": "Schakel functieaanroepen in",236 "Enable function calling": "Schakel functieaanroepen in",
237 "Send inline images": "Inline afbeeldingen verzenden",237 "Send inline images": "Inline afbeeldingen verzenden",
238 "image_inlining_hint_1": "Verzendt afbeeldingen in prompts als het model dit ondersteunt.",238 "image_inlining_hint_1": "Verzendt mediabestanden in prompts als het model dit ondersteunt.",
239 "Inline Image Quality": "Inline-beeldkwaliteit",239 "Inline Image Quality": "Inline-beeldkwaliteit",
240 "openai_inline_image_quality_auto": "Auto",240 "openai_inline_image_quality_auto": "Auto",
241 "openai_inline_image_quality_low": "Laag",241 "openai_inline_image_quality_low": "Laag",
public/locales/pt-pt.json+1 -1
@@ -235,7 +235,7 @@
235 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "Combina mensagens do sistema consecutivas em uma (excluindo diálogos de exemplo). Pode melhorar a coerência para alguns modelos.",235 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "Combina mensagens do sistema consecutivas em uma (excluindo diálogos de exemplo). Pode melhorar a coerência para alguns modelos.",
236 "Enable function calling": "Habilitar chamada de função",236 "Enable function calling": "Habilitar chamada de função",
237 "Send inline images": "Enviar imagens inline",237 "Send inline images": "Enviar imagens inline",
238 "image_inlining_hint_1": "Envia imagens em prompts se o modelo suportar.",238 "image_inlining_hint_1": "Envia ficheiros multimédia em prompts se o modelo suportar.",
239 "Inline Image Quality": "Qualidade de imagem embutida",239 "Inline Image Quality": "Qualidade de imagem embutida",
240 "openai_inline_image_quality_auto": "Auto",240 "openai_inline_image_quality_auto": "Auto",
241 "openai_inline_image_quality_low": "Baixo",241 "openai_inline_image_quality_low": "Baixo",
public/locales/ru-ru.json+1 -2
@@ -1020,7 +1020,7 @@
1020 "The prompt to be sent.": "Текст промпта.",1020 "The prompt to be sent.": "Текст промпта.",
1021 "prompt_manager_forbid_overrides": "Запретить перезапись",1021 "prompt_manager_forbid_overrides": "Запретить перезапись",
1022 "This prompt cannot be overridden by character cards, even if overrides are preferred.": "Карточка персонажа не сможет перезаписать этот промпт, даже если настройки отдают приоритет именно ей.",1022 "This prompt cannot be overridden by character cards, even if overrides are preferred.": "Карточка персонажа не сможет перезаписать этот промпт, даже если настройки отдают приоритет именно ей.",
1023 "image_inlining_hint_1": "Отправлять картинки как часть промпта, если позволяет модель.",1023 "image_inlining_hint_1": "Отправлять медиафайлы как часть промпта, если позволяет модель.",
1024 "Contest Winners": "Победители конкурса",1024 "Contest Winners": "Победители конкурса",
1025 "Rename Background": "Переименовать фон",1025 "Rename Background": "Переименовать фон",
1026 "Lock": "Закрепить",1026 "Lock": "Закрепить",
@@ -2443,7 +2443,6 @@
2443 "Allocates a portion of the response length for thinking (min: 1024 tokens, low: 10%, medium: 25%, high: 50%, max: 95%), but minimum 1024 tokens. Auto does not request thinking.": "Отводит часть ответа под рассуждения (Минимальные: 10%, Обычные: 25%, Подробные: 50%, Максимальные: 95%), но минимум 1024 токена. При выборе значение Авто рассуждения не запрашиваются.",2443 "Allocates a portion of the response length for thinking (min: 1024 tokens, low: 10%, medium: 25%, high: 50%, max: 95%), but minimum 1024 tokens. Auto does not request thinking.": "Отводит часть ответа под рассуждения (Минимальные: 10%, Обычные: 25%, Подробные: 50%, Максимальные: 95%), но минимум 1024 токена. При выборе значение Авто рассуждения не запрашиваются.",
2444 "Use system prompt": "Включить системный промпт",2444 "Use system prompt": "Включить системный промпт",
2445 "Send inline videos": "Отправлять inline-видео",2445 "Send inline videos": "Отправлять inline-видео",
2446 "video_inlining_hint_1": "Отправляет модели видео, если она поддерживает такую возможность.",
2447 "video_inlining_hint_4": "Видео должно весить не более 20 Мб и длиться не дольше 1 минуты.",2446 "video_inlining_hint_4": "Видео должно весить не более 20 Мб и длиться не дольше 1 минуты.",
2448 "Allocates a portion of the response length for thinking (Flash 2.5/Pro 2.5) (min: 0/128 tokens, low: 10%, medium: 25%, high: 50%, max: 24576/32768 tokens). Auto lets the model decide.": "Отводит часть ответа под рассуждения (Flash 2.5/Pro 2.5) (Минимальные: 0/128 токенов, Поверхностные: 10%, Обычные: 25%, Подробные: 50%, Максимальные: 24576/32768 токенов). При выборе значения Авто модель определяет объём самостоятельно.",2447 "Allocates a portion of the response length for thinking (Flash 2.5/Pro 2.5) (min: 0/128 tokens, low: 10%, medium: 25%, high: 50%, max: 24576/32768 tokens). Auto lets the model decide.": "Отводит часть ответа под рассуждения (Flash 2.5/Pro 2.5) (Минимальные: 0/128 токенов, Поверхностные: 10%, Обычные: 25%, Подробные: 50%, Максимальные: 24576/32768 токенов). При выборе значения Авто модель определяет объём самостоятельно.",
2449 "Google Vertex AI Configuration": "Настройки Google Vertex AI",2448 "Google Vertex AI Configuration": "Настройки Google Vertex AI",
public/locales/th-th.json+1 -1
@@ -241,7 +241,7 @@
241 "Allows the model to return its thinking process.": "อนุญาตให้โมเดลส่งคืนกระบวนการคิดของตัวเอง",241 "Allows the model to return its thinking process.": "อนุญาตให้โมเดลส่งคืนกระบวนการคิดของตัวเอง",
242 "This setting affects visibility only.": "การตั้งค่านี้มีผลต่อการมองเห็นเท่านั้น",242 "This setting affects visibility only.": "การตั้งค่านี้มีผลต่อการมองเห็นเท่านั้น",
243 "Send inline images": "ส่งรูปภาพแบบ inline",243 "Send inline images": "ส่งรูปภาพแบบ inline",
244 "image_inlining_hint_1": "ส่งรูปภาพในพรอมต์หากโมเดลรองรับ",244 "image_inlining_hint_1": "ส่งไฟล์สื่อในพรอมต์หากโมเดลรองรับ",
245 "Inline Image Quality": "คุณภาพรูปภาพ Inline",245 "Inline Image Quality": "คุณภาพรูปภาพ Inline",
246 "openai_inline_image_quality_auto": "อัตโนมัติ",246 "openai_inline_image_quality_auto": "อัตโนมัติ",
247 "openai_inline_image_quality_low": "ต่ำ",247 "openai_inline_image_quality_low": "ต่ำ",
public/locales/uk-ua.json+1 -1
@@ -235,7 +235,7 @@
235 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "Об'єднує послідовні системні повідомлення в одне (крім прикладів діалогів). Може покращити співпрацю для деяких моделей.",235 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "Об'єднує послідовні системні повідомлення в одне (крім прикладів діалогів). Може покращити співпрацю для деяких моделей.",
236 "Enable function calling": "Увімкнути виклик функцій",236 "Enable function calling": "Увімкнути виклик функцій",
237 "Send inline images": "Надсилати вбудовані зображення",237 "Send inline images": "Надсилати вбудовані зображення",
238 "image_inlining_hint_1": "Надсилає зображення у підказках, якщо модель це підтримує.",238 "image_inlining_hint_1": "Надсилає медіафайли у підказках, якщо модель це підтримує.",
239 "Inline Image Quality": "Якість вбудованого зображення",239 "Inline Image Quality": "Якість вбудованого зображення",
240 "openai_inline_image_quality_auto": "Авто",240 "openai_inline_image_quality_auto": "Авто",
241 "openai_inline_image_quality_low": "Низький",241 "openai_inline_image_quality_low": "Низький",
public/locales/vi-vn.json+1 -1
@@ -235,7 +235,7 @@
235 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "Kết hợp các tin nhắn hệ thống liên tiếp thành một (loại bỏ các đoạn hội thoại mẫu). Có thể cải thiện tính nhất quán cho một số model.",235 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "Kết hợp các tin nhắn hệ thống liên tiếp thành một (loại bỏ các đoạn hội thoại mẫu). Có thể cải thiện tính nhất quán cho một số model.",
236 "Enable function calling": "Sử dụng tính năng gọi hàm (function calling)",236 "Enable function calling": "Sử dụng tính năng gọi hàm (function calling)",
237 "Send inline images": "Gửi hình ảnh nội bộ",237 "Send inline images": "Gửi hình ảnh nội bộ",
238 "image_inlining_hint_1": "Gửi hình ảnh theo Prompt nếu kiểu máy hỗ trợ.",238 "image_inlining_hint_1": "Gửi tệp phương tiện theo Prompt nếu kiểu máy hỗ trợ.",
239 "Inline Image Quality": "Chất lượng hình ảnh nội tuyến",239 "Inline Image Quality": "Chất lượng hình ảnh nội tuyến",
240 "openai_inline_image_quality_auto": "Tự động",240 "openai_inline_image_quality_auto": "Tự động",
241 "openai_inline_image_quality_low": "Thấp",241 "openai_inline_image_quality_low": "Thấp",
public/locales/zh-cn.json+1 -2
@@ -269,13 +269,12 @@
269 "enable_functions_desc_3": "可以被各种扩展利用来提供附加功能。",269 "enable_functions_desc_3": "可以被各种扩展利用来提供附加功能。",
270 "enable_functions_desc_4": "当提示词后处理没有选择工具时不支持。",270 "enable_functions_desc_4": "当提示词后处理没有选择工具时不支持。",
271 "Send inline images": "发送图片",271 "Send inline images": "发送图片",
272 "image_inlining_hint_1": "如果模型支持,就可以在提示词中发送图片。",272 "image_inlining_hint_1": "如果模型支持,就可以在提示词中发送媒体文件。",
273 "Inline Image Quality": "图片画质",273 "Inline Image Quality": "图片画质",
274 "openai_inline_image_quality_auto": "自动",274 "openai_inline_image_quality_auto": "自动",
275 "openai_inline_image_quality_low": "低",275 "openai_inline_image_quality_low": "低",
276 "openai_inline_image_quality_high": "高",276 "openai_inline_image_quality_high": "高",
277 "Send inline videos": "发送视频",277 "Send inline videos": "发送视频",
278 "video_inlining_hint_1": "当模型支持时,将视频发送给模型。",
279 "video_inlining_hint_4": "视频必须在 20MB 以下且时长不超过1分钟。",278 "video_inlining_hint_4": "视频必须在 20MB 以下且时长不超过1分钟。",
280 "Request inline images": "请求图片返回",279 "Request inline images": "请求图片返回",
281 "Allows the model to return image attachments.": "允许模型返回图片附件。",280 "Allows the model to return image attachments.": "允许模型返回图片附件。",
public/locales/zh-tw.json+1 -2
@@ -236,7 +236,7 @@
236 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "將連續的系統訊息合併為一個(不包括對話範例)。可能會提高某些模型的一致性。",236 "Combines consecutive system messages into one (excluding example dialogues). May improve coherence for some models.": "將連續的系統訊息合併為一個(不包括對話範例)。可能會提高某些模型的一致性。",
237 "Enable function calling": "啟用函式呼叫",237 "Enable function calling": "啟用函式呼叫",
238 "Send inline images": "傳送內嵌圖片",238 "Send inline images": "傳送內嵌圖片",
239 "image_inlining_hint_1": "如果模型支援,則在提示詞中傳送圖片。",239 "image_inlining_hint_1": "如果模型支援,則在提示詞中傳送媒體檔案。",
240 "Inline Image Quality": "內嵌圖片品質",240 "Inline Image Quality": "內嵌圖片品質",
241 "openai_inline_image_quality_auto": "自動",241 "openai_inline_image_quality_auto": "自動",
242 "openai_inline_image_quality_low": "低",242 "openai_inline_image_quality_low": "低",
@@ -2648,7 +2648,6 @@
2648 "Min Keep": "最小保留",2648 "Min Keep": "最小保留",
2649 "enable_functions_desc_4": "當使用「無工具」提示後處理時不支援!",2649 "enable_functions_desc_4": "當使用「無工具」提示後處理時不支援!",
2650 "Send inline videos": "傳送內嵌影片",2650 "Send inline videos": "傳送內嵌影片",
2651 "video_inlining_hint_1": "若模型支援,則在提示中傳送影片。",
2652 "video_inlining_hint_4": "影片大小必須小於 20 MB 且長度低於 1 分鐘",2651 "video_inlining_hint_4": "影片大小必須小於 20 MB 且長度低於 1 分鐘",
2653 "This setting affects visibility only.": "此設定僅影響可見性。",2652 "This setting affects visibility only.": "此設定僅影響可見性。",
2654 "Allocates a portion of the response length for thinking (min: 1024 tokens, low: 10%, medium: 25%, high: 50%, max: 95%), but minimum 1024 tokens. Auto does not request thinking.": "為推理部分分配回應長度(最大回應長度至少需 1024 符元,低:10%、中:25%、高:50%、最高:95%)。選擇「自動」將不請求推理。",2653 "Allocates a portion of the response length for thinking (min: 1024 tokens, low: 10%, medium: 25%, high: 50%, max: 95%), but minimum 1024 tokens. Auto does not request thinking.": "為推理部分分配回應長度(最大回應長度至少需 1024 符元,低:10%、中:25%、高:50%、最高:95%)。選擇「自動」將不請求推理。",
public/scripts/custom-request.js+1 -2
@@ -427,8 +427,7 @@ export class ChatCompletionService {
427 reverse_proxy,427 reverse_proxy,
428 proxy_password,428 proxy_password,
429 custom_prompt_post_processing,429 custom_prompt_post_processing,
430 use_makersuite_sysprompt: true,430 use_sysprompt: true,
431 claude_use_sysprompt: true,
432 ...props,431 ...props,
433 };432 };
434433
public/scripts/openai.js+49 -128
@@ -310,7 +310,6 @@ export const settingsToUpdate = {
310 zai_endpoint: ['#zai_endpoint', 'zai_endpoint', false, true],310 zai_endpoint: ['#zai_endpoint', 'zai_endpoint', false, true],
311 openai_max_context: ['#openai_max_context', 'openai_max_context', false, false],311 openai_max_context: ['#openai_max_context', 'openai_max_context', false, false],
312 openai_max_tokens: ['#openai_max_tokens', 'openai_max_tokens', false, false],312 openai_max_tokens: ['#openai_max_tokens', 'openai_max_tokens', false, false],
313 wrap_in_quotes: ['#wrap_in_quotes', 'wrap_in_quotes', true, false],
314 names_behavior: ['#names_behavior', 'names_behavior', false, false],313 names_behavior: ['#names_behavior', 'names_behavior', false, false],
315 send_if_empty: ['#send_if_empty_textarea', 'send_if_empty', false, false],314 send_if_empty: ['#send_if_empty_textarea', 'send_if_empty', false, false],
316 impersonation_prompt: ['#impersonation_prompt_textarea', 'impersonation_prompt', false, false],315 impersonation_prompt: ['#impersonation_prompt_textarea', 'impersonation_prompt', false, false],
@@ -331,16 +330,12 @@ export const settingsToUpdate = {
331 proxy_password: ['#openai_proxy_password', 'proxy_password', false, true],330 proxy_password: ['#openai_proxy_password', 'proxy_password', false, true],
332 assistant_prefill: ['#claude_assistant_prefill', 'assistant_prefill', false, false],331 assistant_prefill: ['#claude_assistant_prefill', 'assistant_prefill', false, false],
333 assistant_impersonation: ['#claude_assistant_impersonation', 'assistant_impersonation', false, false],332 assistant_impersonation: ['#claude_assistant_impersonation', 'assistant_impersonation', false, false],
334 claude_use_sysprompt: ['#claude_use_sysprompt', 'claude_use_sysprompt', true, false],333 use_sysprompt: ['#use_sysprompt', 'use_sysprompt', true, false],
335 use_makersuite_sysprompt: ['#use_makersuite_sysprompt', 'use_makersuite_sysprompt', true, false],
336 vertexai_auth_mode: ['#vertexai_auth_mode', 'vertexai_auth_mode', false, true],334 vertexai_auth_mode: ['#vertexai_auth_mode', 'vertexai_auth_mode', false, true],
337 vertexai_region: ['#vertexai_region', 'vertexai_region', false, true],335 vertexai_region: ['#vertexai_region', 'vertexai_region', false, true],
338 vertexai_express_project_id: ['#vertexai_express_project_id', 'vertexai_express_project_id', false, true],336 vertexai_express_project_id: ['#vertexai_express_project_id', 'vertexai_express_project_id', false, true],
339 squash_system_messages: ['#squash_system_messages', 'squash_system_messages', true, false],337 media_inlining: ['#openai_media_inlining', 'media_inlining', true, false],
340 image_inlining: ['#openai_image_inlining', 'image_inlining', true, false],
341 inline_image_quality: ['#openai_inline_image_quality', 'inline_image_quality', false, false],338 inline_image_quality: ['#openai_inline_image_quality', 'inline_image_quality', false, false],
342 video_inlining: ['#openai_video_inlining', 'video_inlining', true, false],
343 audio_inlining: ['#openai_audio_inlining', 'audio_inlining', true, false],
344 continue_prefill: ['#continue_prefill', 'continue_prefill', true, false],339 continue_prefill: ['#continue_prefill', 'continue_prefill', true, false],
345 continue_postfix: ['#continue_postfix', 'continue_postfix', false, false],340 continue_postfix: ['#continue_postfix', 'continue_postfix', false, false],
346 function_calling: ['#openai_function_calling', 'function_calling', true, false],341 function_calling: ['#openai_function_calling', 'function_calling', true, false],
@@ -371,7 +366,6 @@ const default_settings = {
371 stream_openai: false,366 stream_openai: false,
372 openai_max_context: max_4k,367 openai_max_context: max_4k,
373 openai_max_tokens: 300,368 openai_max_tokens: 300,
374 wrap_in_quotes: false,
375 ...chatCompletionDefaultPrompts,369 ...chatCompletionDefaultPrompts,
376 ...promptManagerDefaultPromptOrders,370 ...promptManagerDefaultPromptOrders,
377 send_if_empty: '',371 send_if_empty: '',
@@ -432,16 +426,12 @@ const default_settings = {
432 proxy_password: '',426 proxy_password: '',
433 assistant_prefill: '',427 assistant_prefill: '',
434 assistant_impersonation: '',428 assistant_impersonation: '',
435 claude_use_sysprompt: false,429 use_sysprompt: false,
436 use_makersuite_sysprompt: true,
437 vertexai_auth_mode: 'express',430 vertexai_auth_mode: 'express',
438 vertexai_region: 'us-central1',431 vertexai_region: 'us-central1',
439 vertexai_express_project_id: '',432 vertexai_express_project_id: '',
440 squash_system_messages: false,433 media_inlining: true,
441 image_inlining: true,
442 inline_image_quality: 'auto',434 inline_image_quality: 'auto',
443 video_inlining: true,
444 audio_inlining: true,
445 bypass_status_check: false,435 bypass_status_check: false,
446 continue_prefill: false,436 continue_prefill: false,
447 function_calling: false,437 function_calling: false,
@@ -552,8 +542,6 @@ function setOpenAIMessages(chat) {
552 // remove caret return (waste of tokens)542 // remove caret return (waste of tokens)
553 content = content.replace(/\r/gm, '');543 content = content.replace(/\r/gm, '');
554544
555 // Apply the "wrap in quotes" option
556 if (role == 'user' && oai_settings.wrap_in_quotes) content = `"${content}"`;
557 const name = chat[j]['name'];545 const name = chat[j]['name'];
558 const media = chat[j]?.extra?.media;546 const media = chat[j]?.extra?.media;
559 const mediaDisplay = getMediaDisplay(chat[j]);547 const mediaDisplay = getMediaDisplay(chat[j]);
@@ -1460,10 +1448,6 @@ export async function prepareOpenAIMessages({
1460 // Pass chat completion to prompt manager for inspection1448 // Pass chat completion to prompt manager for inspection
1461 promptManager.setChatCompletion(chatCompletion);1449 promptManager.setChatCompletion(chatCompletion);
14621450
1463 if (oai_settings.squash_system_messages && dryRun == false) {
1464 await chatCompletion.squashSystemMessages();
1465 }
1466
1467 // All information is up-to-date, render.1451 // All information is up-to-date, render.
1468 if (false === dryRun) promptManager.render(false);1452 if (false === dryRun) promptManager.render(false);
1469 }1453 }
@@ -2369,7 +2353,7 @@ async function sendOpenAIRequest(type, messages, signal, { jsonSchema = null } =
23692353
2370 if (isClaude) {2354 if (isClaude) {
2371 generate_data['top_k'] = Number(oai_settings.top_k_openai);2355 generate_data['top_k'] = Number(oai_settings.top_k_openai);
2372 generate_data['claude_use_sysprompt'] = oai_settings.claude_use_sysprompt;2356 generate_data['use_sysprompt'] = oai_settings.use_sysprompt;
2373 generate_data['stop'] = getCustomStoppingStrings(); // Claude shouldn't have limits on stop strings.2357 generate_data['stop'] = getCustomStoppingStrings(); // Claude shouldn't have limits on stop strings.
2374 // Don't add a prefill on quiet gens (summarization) and when using continue prefill.2358 // Don't add a prefill on quiet gens (summarization) and when using continue prefill.
2375 if (!isQuiet && !(isContinue && oai_settings.continue_prefill)) {2359 if (!isQuiet && !(isContinue && oai_settings.continue_prefill)) {
@@ -2396,7 +2380,7 @@ async function sendOpenAIRequest(type, messages, signal, { jsonSchema = null } =
2396 const stopStringsLimit = 5;2380 const stopStringsLimit = 5;
2397 generate_data['top_k'] = Number(oai_settings.top_k_openai);2381 generate_data['top_k'] = Number(oai_settings.top_k_openai);
2398 generate_data['stop'] = getCustomStoppingStrings(stopStringsLimit).slice(0, stopStringsLimit).filter(x => x.length >= 1 && x.length <= 16);2382 generate_data['stop'] = getCustomStoppingStrings(stopStringsLimit).slice(0, stopStringsLimit).filter(x => x.length >= 1 && x.length <= 16);
2399 generate_data['use_makersuite_sysprompt'] = oai_settings.use_makersuite_sysprompt;2383 generate_data['use_sysprompt'] = oai_settings.use_sysprompt;
2400 if (isVertexAI) {2384 if (isVertexAI) {
2401 generate_data['vertexai_auth_mode'] = oai_settings.vertexai_auth_mode;2385 generate_data['vertexai_auth_mode'] = oai_settings.vertexai_auth_mode;
2402 generate_data['vertexai_region'] = oai_settings.vertexai_region;2386 generate_data['vertexai_region'] = oai_settings.vertexai_region;
@@ -3290,47 +3274,6 @@ class MessageCollection {
3290 *3274 *
3291 */3275 */
3292export class ChatCompletion {3276export class ChatCompletion {
3293
3294 /**
3295 * Combines consecutive system messages into one if they have no name attached.
3296 * @returns {Promise<void>}
3297 */
3298 async squashSystemMessages() {
3299 const excludeList = ['newMainChat', 'newChat', 'groupNudge'];
3300 this.messages.collection = this.messages.flatten();
3301
3302 let lastMessage = null;
3303 let squashedMessages = [];
3304
3305 for (let message of this.messages.collection) {
3306 // Force exclude empty messages
3307 if (message.role === 'system' && !message.content) {
3308 continue;
3309 }
3310
3311 const shouldSquash = (message) => {
3312 return !excludeList.includes(message.identifier) && message.role === 'system' && !message.name;
3313 };
3314
3315 if (shouldSquash(message)) {
3316 if (lastMessage && shouldSquash(lastMessage)) {
3317 lastMessage.content += '\n' + message.content;
3318 lastMessage.tokens = await tokenHandler.countAsync({ role: lastMessage.role, content: lastMessage.content });
3319 }
3320 else {
3321 squashedMessages.push(message);
3322 lastMessage = message;
3323 }
3324 }
3325 else {
3326 squashedMessages.push(message);
3327 lastMessage = message;
3328 }
3329 }
3330
3331 this.messages.collection = squashedMessages;
3332 }
3333
3334 /**3277 /**
3335 * Initializes a new instance of ChatCompletion.3278 * Initializes a new instance of ChatCompletion.
3336 * Sets up the initial token budget and a new message collection.3279 * Sets up the initial token budget and a new message collection.
@@ -3644,6 +3587,40 @@ export class ChatCompletion {
3644}3587}
36453588
3646/**3589/**
3590 * Migrate old Chat Completion settings to new format.
3591 * @param {ChatCompletionSettings} settings Settings to migrate
3592 */
3593function migrateChatCompletionSettings(settings) {
3594 const migrateMap = [
3595 { oldKey: 'names_in_completion', oldValue: true, newKey: 'names_behavior', newValue: character_names_behavior.COMPLETION },
3596 { oldKey: 'chat_completion_source', oldValue: 'palm', newKey: 'chat_completion_source', newValue: chat_completion_sources.MAKERSUITE },
3597 { oldKey: 'custom_prompt_post_processing', oldValue: custom_prompt_post_processing_types.CLAUDE, newKey: 'custom_prompt_post_processing', newValue: custom_prompt_post_processing_types.MERGE },
3598 { oldKey: 'ai21_model', oldValue: /^j2-/, newKey: 'ai21_model', newValue: 'jamba-large' },
3599 { oldKey: 'image_inlining', oldValue: false, newKey: 'media_inlining', newValue: false },
3600 { oldKey: 'image_inlining', oldValue: true, newKey: 'media_inlining', newValue: true },
3601 { oldKey: 'video_inlining', oldValue: true, newKey: 'media_inlining', newValue: true },
3602 { oldKey: 'audio_inlining', oldValue: true, newKey: 'media_inlining', newValue: true },
3603 { oldKey: 'claude_use_sysprompt', oldValue: true, newKey: 'use_sysprompt', newValue: true },
3604 { oldKey: 'use_makersuite_sysprompt', oldValue: true, newKey: 'use_sysprompt', newValue: true },
3605 { oldKey: 'mistralai_model', oldValue: /^(mistral-medium|mistral-small)$/, newKey: 'mistralai_model', newValue: (settings.mistralai_model + '-latest') },
3606 ];
3607
3608 for (const migration of migrateMap) {
3609 if (Object.hasOwn(settings, migration.oldKey)) {
3610 const shouldMigrate = migration.oldValue instanceof RegExp
3611 ? migration.oldValue.test(settings[migration.oldKey])
3612 : settings[migration.oldKey] === migration.oldValue;
3613 if (shouldMigrate) {
3614 settings[migration.newKey] = migration.newValue;
3615 }
3616 if (migration.oldKey !== migration.newKey) {
3617 delete settings[migration.oldKey];
3618 }
3619 }
3620 }
3621}
3622
3623/**
3647 * Load OpenAI settings from backend data3624 * Load OpenAI settings from backend data
3648 * @param {any} data Settings data from backend3625 * @param {any} data Settings data from backend
3649 * @param {ChatCompletionSettings} settings Saved settings from backend3626 * @param {ChatCompletionSettings} settings Saved settings from backend
@@ -3667,23 +3644,7 @@ function loadOpenAISettings(data, settings) {
3667 });3644 });
3668 openai_setting_names = settingNames;3645 openai_setting_names = settingNames;
36693646
3670 const migrateMap = [3647 migrateChatCompletionSettings(settings);
3671 { oldKey: 'names_in_completion', oldValue: true, newKey: 'names_behavior', newValue: character_names_behavior.COMPLETION },
3672 { oldKey: 'chat_completion_source', oldValue: 'palm', newKey: 'chat_completion_source', newValue: chat_completion_sources.MAKERSUITE },
3673 { oldKey: 'custom_prompt_post_processing', oldValue: custom_prompt_post_processing_types.CLAUDE, newKey: 'custom_prompt_post_processing', newValue: custom_prompt_post_processing_types.MERGE },
3674 { oldKey: 'ai21_model', oldValue: /^j2-/, newKey: 'ai21_model', newValue: 'jamba-large' },
3675 ];
3676
3677 for (const migration of migrateMap) {
3678 if (Object.hasOwn(settings, migration.oldKey)) {
3679 const shouldMigrate = migration.oldValue instanceof RegExp
3680 ? migration.oldValue.test(settings[migration.oldKey])
3681 : settings[migration.oldKey] === migration.oldValue;
3682 if (shouldMigrate) {
3683 settings[migration.newKey] = migration.newValue;
3684 }
3685 }
3686 }
36873648
3688 for (const key of Object.keys(default_settings)) {3649 for (const key of Object.keys(default_settings)) {
3689 oai_settings[key] = settings[key] ?? default_settings[key];3650 oai_settings[key] = settings[key] ?? default_settings[key];
@@ -4319,15 +4280,7 @@ function onSettingsPresetChange() {
43194280
4320 const preset = structuredClone(openai_settings[openai_setting_names[oai_settings.preset_settings_openai]]);4281 const preset = structuredClone(openai_settings[openai_setting_names[oai_settings.preset_settings_openai]]);
43214282
4322 // Migrate old settings4283 migrateChatCompletionSettings(preset);
4323 if (preset.names_in_completion === true && preset.names_behavior === undefined) {
4324 preset.names_behavior = character_names_behavior.COMPLETION;
4325 }
4326
4327 // Claude: Assistant Impersonation Prefill = Inherit from Assistant Prefill
4328 if (preset.assistant_prefill !== undefined && preset.assistant_impersonation === undefined) {
4329 preset.assistant_impersonation = preset.assistant_prefill;
4330 }
43314284
4332 const updateInput = (selector, value) => $(selector).val(value).trigger('input', { source: 'preset' });4285 const updateInput = (selector, value) => $(selector).val(value).trigger('input', { source: 'preset' });
4333 const updateCheckbox = (selector, value) => $(selector).prop('checked', value).trigger('input', { source: 'preset' });4286 const updateCheckbox = (selector, value) => $(selector).prop('checked', value).trigger('input', { source: 'preset' });
@@ -4739,11 +4692,6 @@ async function onModelChange() {
4739 console.debug('Null MistralAI model selected. Ignoring.');4692 console.debug('Null MistralAI model selected. Ignoring.');
4740 return;4693 return;
4741 }4694 }
4742 // Upgrade old mistral models to new naming scheme
4743 // would have done this in loadOpenAISettings, but it wasn't updating on preset change?
4744 if (value === 'mistral-medium' || value === 'mistral-small') {
4745 value = value + '-latest';
4746 }
4747 console.log('MistralAI model changed to', value);4695 console.log('MistralAI model changed to', value);
4748 oai_settings.mistralai_model = value;4696 oai_settings.mistralai_model = value;
4749 $('#model_mistralai_select').val(oai_settings.mistralai_model);4697 $('#model_mistralai_select').val(oai_settings.mistralai_model);
@@ -5436,7 +5384,7 @@ export function isImageInliningSupported() {
5436 return false;5384 return false;
5437 }5385 }
54385386
5439 if (!oai_settings.image_inlining) {5387 if (!oai_settings.media_inlining) {
5440 return false;5388 return false;
5441 }5389 }
54425390
@@ -5551,7 +5499,7 @@ export function isVideoInliningSupported() {
5551 return false;5499 return false;
5552 }5500 }
55535501
5554 if (!oai_settings.video_inlining) {5502 if (!oai_settings.media_inlining) {
5555 return false;5503 return false;
5556 }5504 }
55575505
@@ -5584,7 +5532,7 @@ export function isAudioInliningSupported() {
5584 return false;5532 return false;
5585 }5533 }
55865534
5587 if (!oai_settings.audio_inlining) {5535 if (!oai_settings.media_inlining) {
5588 return false;5536 return false;
5589 }5537 }
55905538
@@ -5968,18 +5916,8 @@ export function initOpenAI() {
5968 saveSettingsDebounced();5916 saveSettingsDebounced();
5969 });5917 });
59705918
5971 $('#wrap_in_quotes').on('change', function () {5919 $('#use_sysprompt').on('change', function () {
5972 oai_settings.wrap_in_quotes = !!$('#wrap_in_quotes').prop('checked');5920 oai_settings.use_sysprompt = !!$('#use_sysprompt').prop('checked');
5973 saveSettingsDebounced();
5974 });
5975
5976 $('#claude_use_sysprompt').on('change', function () {
5977 oai_settings.claude_use_sysprompt = !!$('#claude_use_sysprompt').prop('checked');
5978 saveSettingsDebounced();
5979 });
5980
5981 $('#use_makersuite_sysprompt').on('change', function () {
5982 oai_settings.use_makersuite_sysprompt = !!$('#use_makersuite_sysprompt').prop('checked');
5983 saveSettingsDebounced();5921 saveSettingsDebounced();
5984 });5922 });
59855923
@@ -6174,13 +6112,8 @@ export function initOpenAI() {
6174 saveSettingsDebounced();6112 saveSettingsDebounced();
6175 });6113 });
61766114
6177 $('#squash_system_messages').on('input', function () {6115 $('#openai_media_inlining').on('input', function () {
6178 oai_settings.squash_system_messages = !!$(this).prop('checked');6116 oai_settings.media_inlining = !!$(this).prop('checked');
6179 saveSettingsDebounced();
6180 });
6181
6182 $('#openai_image_inlining').on('input', function () {
6183 oai_settings.image_inlining = !!$(this).prop('checked');
6184 updateFeatureSupportFlags();6117 updateFeatureSupportFlags();
6185 saveSettingsDebounced();6118 saveSettingsDebounced();
6186 });6119 });
@@ -6190,18 +6123,6 @@ export function initOpenAI() {
6190 saveSettingsDebounced();6123 saveSettingsDebounced();
6191 });6124 });
61926125
6193 $('#openai_video_inlining').on('input', function () {
6194 oai_settings.video_inlining = !!$(this).prop('checked');
6195 updateFeatureSupportFlags();
6196 saveSettingsDebounced();
6197 });
6198
6199 $('#openai_audio_inlining').on('input', function () {
6200 oai_settings.audio_inlining = !!$(this).prop('checked');
6201 updateFeatureSupportFlags();
6202 saveSettingsDebounced();
6203 });
6204
6205 $('#continue_prefill').on('input', function () {6126 $('#continue_prefill').on('input', function () {
6206 oai_settings.continue_prefill = !!$(this).prop('checked');6127 oai_settings.continue_prefill = !!$(this).prop('checked');
6207 saveSettingsDebounced();6128 saveSettingsDebounced();
src/endpoints/backends/chat-completions.js+2 -2
@@ -158,7 +158,7 @@ async function sendClaudeRequest(request, response) {
158 const additionalHeaders = {};158 const additionalHeaders = {};
159 const betaHeaders = ['output-128k-2025-02-19'];159 const betaHeaders = ['output-128k-2025-02-19'];
160 const useTools = Array.isArray(request.body.tools) && request.body.tools.length > 0;160 const useTools = Array.isArray(request.body.tools) && request.body.tools.length > 0;
161 const useSystemPrompt = Boolean(request.body.claude_use_sysprompt);161 const useSystemPrompt = Boolean(request.body.use_sysprompt);
162 const convertedPrompt = convertClaudeMessages(request.body.messages, request.body.assistant_prefill, useSystemPrompt, useTools, getPromptNames(request));162 const convertedPrompt = convertClaudeMessages(request.body.messages, request.body.assistant_prefill, useSystemPrompt, useTools, getPromptNames(request));
163 const useThinking = /^claude-(3-7|opus-4|sonnet-4|haiku-4-5|opus-4-5)/.test(request.body.model);163 const useThinking = /^claude-(3-7|opus-4|sonnet-4|haiku-4-5|opus-4-5)/.test(request.body.model);
164 const useWebSearch = /^claude-(3-5|3-7|opus-4|sonnet-4|haiku-4-5|opus-4-5)/.test(request.body.model) && Boolean(request.body.enable_web_search);164 const useWebSearch = /^claude-(3-5|3-7|opus-4|sonnet-4|haiku-4-5|opus-4-5)/.test(request.body.model) && Boolean(request.body.enable_web_search);
@@ -406,7 +406,7 @@ async function sendMakerSuiteRequest(request, response) {
406 generationConfig.responseModalities = ['text', 'image'];406 generationConfig.responseModalities = ['text', 'image'];
407 }407 }
408408
409 const useSystemPrompt = !enableImageModality && !isGemma && request.body.use_makersuite_sysprompt;409 const useSystemPrompt = !enableImageModality && !isGemma && request.body.use_sysprompt;
410410
411 const tools = [];411 const tools = [];
412 const prompt = convertGooglePrompt(request.body.messages, model, useSystemPrompt, getPromptNames(request));412 const prompt = convertGooglePrompt(request.body.messages, model, useSystemPrompt, getPromptNames(request));