CC: Add model support indicators for function calling, image, and video inlining
| @@ -530,3 +530,17 @@ label[for="trim_spaces"]:not(:has(input:checked)) small { | ||
| 530 | 530 | label[for="bind_preset_to_connection"]:has(input:checked) { |
| 531 | 531 | color: var(--active); |
| 532 | 532 | } |
| 533 | + | |
| 534 | +#openai_settings input[type="checkbox"]:not(:checked)~[data-cc-toggle], | |
| 535 | +#openai_settings [data-cc-toggle="false"]>.icon-supported, | |
| 536 | +#openai_settings [data-cc-toggle="true"]>.icon-unsupported { | |
| 537 | + display: none; | |
| 538 | +} | |
| 539 | + | |
| 540 | +#openai_settings [data-cc-toggle="true"]>.icon-supported { | |
| 541 | + color: var(--active); | |
| 542 | +} | |
| 543 | + | |
| 544 | +#openai_settings [data-cc-toggle="false"]>.icon-unsupported { | |
| 545 | + color: var(--golden); | |
| 546 | +} | |
| @@ -1988,6 +1988,10 @@ | ||
| 1988 | 1988 | <label for="openai_function_calling" class="checkbox_label flexWrap widthFreeExpand"> |
| 1989 | 1989 | <input id="openai_function_calling" type="checkbox" /> |
| 1990 | 1990 | <span data-i18n="Enable function calling">Enable function calling</span> |
| 1991 | + <div id="openai_function_calling_supported" data-cc-toggle="false"> | |
| 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> | |
| 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> | |
| 1994 | + </div> | |
| 1991 | 1995 | </label> |
| 1992 | 1996 | <div class="flexBasis100p toggle-description justifyLeft"> |
| 1993 | 1997 | <span data-i18n="enable_functions_desc_1">Allows using </span><a href="https://platform.openai.com/docs/guides/function-calling" target="_blank" data-i18n="enable_functions_desc_2">function tools</a>. |
| @@ -1999,6 +2003,10 @@ | ||
| 1999 | 2003 | <label for="openai_image_inlining" class="checkbox_label flexWrap widthFreeExpand"> |
| 2000 | 2004 | <input id="openai_image_inlining" type="checkbox" /> |
| 2001 | 2005 | <span data-i18n="Send inline images">Send inline images</span> |
| 2006 | + <div id="openai_image_inlining_supported" data-cc-toggle="false"> | |
| 2007 | + <i class="icon-supported fa-solid fa-circle-check" title="Supported by the current model" data-i18n="[title]Supported by the current model"></i> | |
| 2008 | + <i class="icon-unsupported fa-solid fa-circle-exclamation" title="Unsupported by the current model" data-i18n="[title]Unsupported by the current model"></i> | |
| 2009 | + </div> | |
| 2002 | 2010 | </label> |
| 2003 | 2011 | <div id="image_inlining_hint" class="flexBasis100p toggle-description justifyLeft"> |
| 2004 | 2012 | <span data-i18n="image_inlining_hint_1">Sends images in prompts if the model supports it. Use the</span> |
| @@ -2024,6 +2032,10 @@ | ||
| 2024 | 2032 | <label for="openai_video_inlining" class="checkbox_label flexWrap widthFreeExpand"> |
| 2025 | 2033 | <input id="openai_video_inlining" type="checkbox" /> |
| 2026 | 2034 | <span data-i18n="Send inline videos">Send inline videos</span> |
| 2035 | + <div id="openai_video_inlining_supported" data-cc-toggle="false"> | |
| 2036 | + <i class="icon-supported fa-solid fa-circle-check" title="Supported by the current model" data-i18n="[title]Supported by the current model"></i> | |
| 2037 | + <i class="icon-unsupported fa-solid fa-circle-exclamation" title="Unsupported by the current model" data-i18n="[title]Unsupported by the current model"></i> | |
| 2038 | + </div> | |
| 2027 | 2039 | </label> |
| 2028 | 2040 | <div id="video_inlining_hint" class="flexBasis100p toggle-description justifyLeft"> |
| 2029 | 2041 | <span data-i18n="video_inlining_hint_1">Sends videos in prompts if the model supports it. Use the</span> |
| @@ -4970,6 +4970,7 @@ async function onModelChange() { | ||
| 4970 | 4970 | $('#openai_max_context_counter').attr('max', Number($('#openai_max_context').attr('max'))); |
| 4971 | 4971 | |
| 4972 | 4972 | saveSettingsDebounced(); |
| 4973 | + updateFeatureSupportFlags(); | |
| 4973 | 4974 | eventSource.emit(event_types.CHATCOMPLETION_MODEL_CHANGED, value); |
| 4974 | 4975 | } |
| 4975 | 4976 | |
| @@ -5726,7 +5727,20 @@ function updateVertexAIServiceAccountStatus(isValid = false, message = '') { | ||
| 5726 | 5727 | } |
| 5727 | 5728 | } |
| 5728 | 5729 | |
| 5730 | +function updateFeatureSupportFlags() { | |
| 5731 | + const featureFlags = { | |
| 5732 | + openai_function_calling_supported: ToolManager.isToolCallingSupported(), | |
| 5733 | + openai_image_inlining_supported: isImageInliningSupported(), | |
| 5734 | + openai_video_inlining_supported: isVideoInliningSupported(), | |
| 5735 | + }; | |
| 5729 | 5736 | |
| 5737 | + for (const [key, value] of Object.entries(featureFlags)) { | |
| 5738 | + const element = document.getElementById(key); | |
| 5739 | + if (element) { | |
| 5740 | + element.dataset.ccToggle = String(value); | |
| 5741 | + } | |
| 5742 | + } | |
| 5743 | +} | |
| 5730 | 5744 | |
| 5731 | 5745 | export function initOpenAI() { |
| 5732 | 5746 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ |
| @@ -5950,6 +5964,7 @@ export function initOpenAI() { | ||
| 5950 | 5964 | saveSettingsDebounced(); |
| 5951 | 5965 | reconnectOpenAi(); |
| 5952 | 5966 | forceCharacterEditorTokenize(); |
| 5967 | + updateFeatureSupportFlags(); | |
| 5953 | 5968 | eventSource.emit(event_types.CHATCOMPLETION_SOURCE_CHANGED, oai_settings.chat_completion_source); |
| 5954 | 5969 | }); |
| 5955 | 5970 | |